Add stylo FFI for CSSStyleRule.style

This commit is contained in:
Xidorn Quan 2016-11-23 10:34:25 +11:00
parent 66669e48ef
commit 9ee2ec5a35
2 changed files with 23 additions and 0 deletions

View file

@ -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);

View file

@ -324,6 +324,20 @@ pub extern "C" fn Servo_StyleRule_Release(rule: RawServoStyleRuleBorrowed) -> ()
unsafe { RwLock::<StyleRule>::release(rule) };
}
#[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);