aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
authorCameron McCormack <cam@mcc.id.au>2017-11-24 15:51:43 +0800
committerCameron McCormack <cam@mcc.id.au>2017-12-04 08:57:46 +0800
commitc00944046cb1e687ef29bda56865dfb6e16fe1bc (patch)
treecdd47cd81121ced57eff0ed970f9aa21e1c5dba4 /ports
parente4dba3abef2a4941c5a4d95d58ae0b864ad10961 (diff)
downloadservo-c00944046cb1e687ef29bda56865dfb6e16fe1bc.tar.gz
servo-c00944046cb1e687ef29bda56865dfb6e16fe1bc.zip
geckolib: Add FFI function to parse a @counter-style name.
Diffstat (limited to 'ports')
-rw-r--r--ports/geckolib/glue.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs
index 3a1af21f726..ad3e32f2458 100644
--- a/ports/geckolib/glue.rs
+++ b/ports/geckolib/glue.rs
@@ -18,6 +18,7 @@ use std::ptr;
use style::applicable_declarations::ApplicableDeclarationBlock;
use style::context::{CascadeInputs, QuirksMode, SharedStyleContext, StyleContext};
use style::context::ThreadLocalStyleContext;
+use style::counter_style;
use style::data::{ElementStyles, self};
use style::dom::{ShowSubtreeData, TDocument, TElement, TNode};
use style::driver;
@@ -4735,3 +4736,15 @@ pub unsafe extern "C" fn Servo_SourceSizeList_Evaluate(
pub unsafe extern "C" fn Servo_SourceSizeList_Drop(list: RawServoSourceSizeListOwned) {
let _ = list.into_box::<SourceSizeList>();
}
+
+#[no_mangle]
+pub extern "C" fn Servo_ParseCounterStyleName(
+ value: *const nsACString,
+) -> *mut nsAtom {
+ let value = unsafe { value.as_ref().unwrap().as_str_unchecked() };
+ let mut input = ParserInput::new(&value);
+ match Parser::new(&mut input).parse_entirely(counter_style::parse_counter_style_name) {
+ Ok(name) => name.0.into_addrefed(),
+ Err(_) => ptr::null_mut(),
+ }
+}