From 3c5871f83a66df709ae8f583f6f4fdb30e8cd911 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 23 Nov 2016 10:35:00 +1100 Subject: [PATCH] Add FFI for debug info of CSSStyleRule --- components/style/gecko_bindings/bindings.rs | 4 ++++ ports/geckolib/glue.rs | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 348f27fc878..c00e7149da6 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -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; diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 103f680507c..e65c8cbd5bd 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -324,6 +324,13 @@ pub extern "C" fn Servo_StyleRule_Release(rule: RawServoStyleRuleBorrowed) -> () unsafe { RwLock::::release(rule) }; } +#[no_mangle] +pub extern "C" fn Servo_StyleRule_Debug(rule: RawServoStyleRuleBorrowed, result: *mut nsACString) -> () { + let rule = RwLock::::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::::as_arc(&rule);