diff options
-rw-r--r-- | components/style/gecko_bindings/bindings.rs | 9 | ||||
-rw-r--r-- | ports/geckolib/glue.rs | 14 |
2 files changed, 23 insertions, 0 deletions
diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 0513cc695ac..348f27fc878 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -1011,6 +1011,15 @@ extern "C" { -> RawServoStyleRuleStrong; } extern "C" { + pub fn Servo_StyleRule_GetStyle(rule: RawServoStyleRuleBorrowed) + -> RawServoDeclarationBlockStrong; +} +extern "C" { + pub fn Servo_StyleRule_SetStyle(rule: RawServoStyleRuleBorrowed, + declarations: + RawServoDeclarationBlockBorrowed); +} +extern "C" { pub fn Servo_StyleRule_GetCssText(rule: RawServoStyleRuleBorrowed, result: *mut nsAString_internal); } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 8fed9eb8a66..103f680507c 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -325,6 +325,20 @@ pub extern "C" fn Servo_StyleRule_Release(rule: RawServoStyleRuleBorrowed) -> () } #[no_mangle] +pub extern "C" fn Servo_StyleRule_GetStyle(rule: RawServoStyleRuleBorrowed) -> RawServoDeclarationBlockStrong { + let rule = RwLock::<StyleRule>::as_arc(&rule); + rule.read().block.clone().into_strong() +} + +#[no_mangle] +pub extern "C" fn Servo_StyleRule_SetStyle(rule: RawServoStyleRuleBorrowed, + declarations: RawServoDeclarationBlockBorrowed) -> () { + let rule = RwLock::<StyleRule>::as_arc(&rule); + let declarations = RwLock::<PropertyDeclarationBlock>::as_arc(&declarations); + rule.write().block = declarations.clone(); +} + +#[no_mangle] pub extern "C" fn Servo_StyleRule_GetCssText(rule: RawServoStyleRuleBorrowed, result: *mut nsAString) -> () { let rule = RwLock::<StyleRule>::as_arc(&rule); rule.read().to_css(unsafe { result.as_mut().unwrap() }).unwrap(); |