mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Support CSSOM access to @font-face rules.
This commit is contained in:
parent
f68e2948d5
commit
0d96c7997f
1 changed files with 14 additions and 1 deletions
|
@ -54,7 +54,7 @@ use style::gecko_bindings::bindings::nsTimingFunctionBorrowedMut;
|
||||||
use style::gecko_bindings::structs;
|
use style::gecko_bindings::structs;
|
||||||
use style::gecko_bindings::structs::{SheetParsingMode, nsIAtom, nsCSSPropertyID};
|
use style::gecko_bindings::structs::{SheetParsingMode, nsIAtom, nsCSSPropertyID};
|
||||||
use style::gecko_bindings::structs::{ThreadSafePrincipalHolder, ThreadSafeURIHolder};
|
use style::gecko_bindings::structs::{ThreadSafePrincipalHolder, ThreadSafeURIHolder};
|
||||||
use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint};
|
use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, nsCSSFontFaceRule};
|
||||||
use style::gecko_bindings::structs::Loader;
|
use style::gecko_bindings::structs::Loader;
|
||||||
use style::gecko_bindings::structs::RawGeckoPresContextOwned;
|
use style::gecko_bindings::structs::RawGeckoPresContextOwned;
|
||||||
use style::gecko_bindings::structs::ServoStyleSheet;
|
use style::gecko_bindings::structs::ServoStyleSheet;
|
||||||
|
@ -602,6 +602,19 @@ impl_basic_rule_funcs! { (Namespace, NamespaceRule, RawServoNamespaceRule),
|
||||||
to_css: Servo_NamespaceRule_GetCssText,
|
to_css: Servo_NamespaceRule_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"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleRule_GetStyle(rule: RawServoStyleRuleBorrowed) -> RawServoDeclarationBlockStrong {
|
pub extern "C" fn Servo_StyleRule_GetStyle(rule: RawServoStyleRuleBorrowed) -> RawServoDeclarationBlockStrong {
|
||||||
read_locked_arc(rule, |rule: &StyleRule| {
|
read_locked_arc(rule, |rule: &StyleRule| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue