aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXidorn Quan <me@upsuper.org>2016-11-23 10:34:25 +1100
committerXidorn Quan <me@upsuper.org>2016-11-24 10:28:38 +1100
commit9ee2ec5a35784bc90415212f21253de396f661a6 (patch)
treed0c80406177150bd32268214398e1244b9a15720
parent66669e48effa1e3d099c7a94fbf6a98f07c0de21 (diff)
downloadservo-9ee2ec5a35784bc90415212f21253de396f661a6.tar.gz
servo-9ee2ec5a35784bc90415212f21253de396f661a6.zip
Add stylo FFI for CSSStyleRule.style
-rw-r--r--components/style/gecko_bindings/bindings.rs9
-rw-r--r--ports/geckolib/glue.rs14
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();