Skip to content

Commit

Permalink
Add FFI for debug info of CSSStyleRule
Browse files Browse the repository at this point in the history
  • Loading branch information
upsuper committed Nov 23, 2016
1 parent 9ee2ec5 commit 3c5871f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/style/gecko_bindings/bindings.rs
Expand Up @@ -1010,6 +1010,10 @@ extern "C" {
index: u32)
-> RawServoStyleRuleStrong;
}
extern "C" {
pub fn Servo_StyleRule_Debug(rule: RawServoStyleRuleBorrowed,
result: *mut nsACString_internal);
}
extern "C" {
pub fn Servo_StyleRule_GetStyle(rule: RawServoStyleRuleBorrowed)
-> RawServoDeclarationBlockStrong;
Expand Down
7 changes: 7 additions & 0 deletions ports/geckolib/glue.rs
Expand Up @@ -324,6 +324,13 @@ pub extern "C" fn Servo_StyleRule_Release(rule: RawServoStyleRuleBorrowed) -> ()
unsafe { RwLock::<StyleRule>::release(rule) };
}

#[no_mangle]
pub extern "C" fn Servo_StyleRule_Debug(rule: RawServoStyleRuleBorrowed, result: *mut nsACString) -> () {
let rule = RwLock::<StyleRule>::as_arc(&rule);
let result = unsafe { result.as_mut().unwrap() };
write!(result, "{:?}", *rule.read()).unwrap();
}

#[no_mangle]
pub extern "C" fn Servo_StyleRule_GetStyle(rule: RawServoStyleRuleBorrowed) -> RawServoDeclarationBlockStrong {
let rule = RwLock::<StyleRule>::as_arc(&rule);
Expand Down

0 comments on commit 3c5871f

Please sign in to comment.