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 @@ -1010,6 +1010,15 @@ extern "C" { index: u32) -> 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 @@ -324,6 +324,20 @@ pub extern "C" fn Servo_StyleRule_Release(rule: RawServoStyleRuleBorrowed) -> () unsafe { RwLock::::release(rule) }; } +#[no_mangle] +pub extern "C" fn Servo_StyleRule_GetStyle(rule: RawServoStyleRuleBorrowed) -> RawServoDeclarationBlockStrong { + let rule = RwLock::::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::::as_arc(&rule); + let declarations = RwLock::::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::::as_arc(&rule);