mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add basic integration of @counter-style.
This commit is contained in:
parent
161dc666b0
commit
11ac1e894e
6 changed files with 74 additions and 22 deletions
|
@ -61,7 +61,8 @@ use style::gecko_bindings::structs;
|
|||
use style::gecko_bindings::structs::{CSSPseudoElementType, CompositeOperation};
|
||||
use style::gecko_bindings::structs::{RawServoStyleRule, ServoStyleSheet};
|
||||
use style::gecko_bindings::structs::{SheetParsingMode, nsIAtom, nsCSSPropertyID};
|
||||
use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, nsCSSFontFaceRule};
|
||||
use style::gecko_bindings::structs::{nsCSSFontFaceRule, nsCSSCounterStyleRule};
|
||||
use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint};
|
||||
use style::gecko_bindings::structs::Loader;
|
||||
use style::gecko_bindings::structs::RawGeckoPresContextOwned;
|
||||
use style::gecko_bindings::structs::ServoElementSnapshotTable;
|
||||
|
@ -871,19 +872,28 @@ impl_group_rule_funcs! { (Document, DocumentRule, RawServoDocumentRule),
|
|||
to_css: Servo_DocumentRule_GetCssText,
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_CssRules_GetFontFaceRuleAt(rules: ServoCssRulesBorrowed, index: u32)
|
||||
-> *mut nsCSSFontFaceRule
|
||||
{
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
let rules = Locked::<CssRules>::as_arc(&rules).read_with(&guard);
|
||||
match rules.0[index as usize] {
|
||||
CssRule::FontFace(ref rule) => rule.read_with(&guard).get(),
|
||||
_ => unreachable!("Servo_CssRules_GetFontFaceRuleAt should only be called on a FontFace rule"),
|
||||
macro_rules! impl_getter_for_embedded_rule {
|
||||
($getter:ident: $name:ident -> $ty:ty) => {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn $getter(rules: ServoCssRulesBorrowed, index: u32) -> *mut $ty
|
||||
{
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
let rules = Locked::<CssRules>::as_arc(&rules).read_with(&guard);
|
||||
match rules.0[index as usize] {
|
||||
CssRule::$name(ref rule) => rule.read_with(&guard).get(),
|
||||
_ => unreachable!(concat!(stringify!($getter), " should only be called on a ",
|
||||
stringify!($name), " rule")),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl_getter_for_embedded_rule!(Servo_CssRules_GetFontFaceRuleAt:
|
||||
FontFace -> nsCSSFontFaceRule);
|
||||
impl_getter_for_embedded_rule!(Servo_CssRules_GetCounterStyleRuleAt:
|
||||
CounterStyle -> nsCSSCounterStyleRule);
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleRule_GetStyle(rule: RawServoStyleRuleBorrowed) -> RawServoDeclarationBlockStrong {
|
||||
read_locked_arc(rule, |rule: &StyleRule| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue