Enable querying counter-style rule on Servo backend.

This commit is contained in:
Xidorn Quan 2017-05-16 09:47:26 +10:00
parent 0667287bf6
commit 3e00a91e20
3 changed files with 52 additions and 12 deletions

View file

@ -2384,6 +2384,19 @@ pub extern "C" fn Servo_StyleSet_GetFontFaceRules(raw_data: RawServoStyleSetBorr
}
}
#[no_mangle]
pub extern "C" fn Servo_StyleSet_GetCounterStyleRule(raw_data: RawServoStyleSetBorrowed,
name: *mut nsIAtom) -> *mut nsCSSCounterStyleRule {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
unsafe {
Atom::with(name, |name| data.counter_styles.get(name))
}.map(|rule| {
let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read();
rule.read_with(&guard).get()
}).unwrap_or(ptr::null_mut())
}
#[no_mangle]
pub extern "C" fn Servo_StyleSet_ResolveForDeclarations(raw_data: RawServoStyleSetBorrowed,
parent_style_or_null: ServoComputedValuesBorrowedOrNull,