From e2f91f0889ea3886f23af9e9183f1edc48f6df3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 14 Oct 2017 13:37:15 +0200 Subject: [PATCH 1/3] stylo: Reformat a few function signatures. --- ports/geckolib/glue.rs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 9b94a391ce2..0ef6059d96f 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -332,11 +332,11 @@ pub extern "C" fn Servo_MaybeGCRuleTree(raw_data: RawServoStyleSetBorrowed) { } #[no_mangle] -pub extern "C" fn Servo_AnimationValues_Interpolate(from: RawServoAnimationValueBorrowed, - to: RawServoAnimationValueBorrowed, - progress: f64) - -> RawServoAnimationValueStrong -{ +pub extern "C" fn Servo_AnimationValues_Interpolate( + from: RawServoAnimationValueBorrowed, + to: RawServoAnimationValueBorrowed, + progress: f64, +) -> RawServoAnimationValueStrong { let from_value = AnimationValue::as_arc(&from); let to_value = AnimationValue::as_arc(&to); if let Ok(value) = from_value.animate(to_value, Procedure::Interpolate { progress }) { @@ -356,10 +356,10 @@ pub extern "C" fn Servo_AnimationValues_IsInterpolable(from: RawServoAnimationVa } #[no_mangle] -pub extern "C" fn Servo_AnimationValues_Add(a: RawServoAnimationValueBorrowed, - b: RawServoAnimationValueBorrowed) - -> RawServoAnimationValueStrong -{ +pub extern "C" fn Servo_AnimationValues_Add( + a: RawServoAnimationValueBorrowed, + b: RawServoAnimationValueBorrowed, +) -> RawServoAnimationValueStrong { let a_value = AnimationValue::as_arc(&a); let b_value = AnimationValue::as_arc(&b); if let Ok(value) = a_value.animate(b_value, Procedure::Add) { @@ -370,11 +370,11 @@ pub extern "C" fn Servo_AnimationValues_Add(a: RawServoAnimationValueBorrowed, } #[no_mangle] -pub extern "C" fn Servo_AnimationValues_Accumulate(a: RawServoAnimationValueBorrowed, - b: RawServoAnimationValueBorrowed, - count: u64) - -> RawServoAnimationValueStrong -{ +pub extern "C" fn Servo_AnimationValues_Accumulate( + a: RawServoAnimationValueBorrowed, + b: RawServoAnimationValueBorrowed, + count: u64, +) -> RawServoAnimationValueStrong { let a_value = AnimationValue::as_arc(&a); let b_value = AnimationValue::as_arc(&b); if let Ok(value) = a_value.animate(b_value, Procedure::Accumulate { count }) { @@ -673,8 +673,9 @@ pub extern "C" fn Servo_AnimationValue_DeepEqual(this: RawServoAnimationValueBor } #[no_mangle] -pub extern "C" fn Servo_AnimationValue_Uncompute(value: RawServoAnimationValueBorrowed) - -> RawServoDeclarationBlockStrong { +pub extern "C" fn Servo_AnimationValue_Uncompute( + value: RawServoAnimationValueBorrowed, +) -> RawServoDeclarationBlockStrong { let value = AnimationValue::as_arc(&value); let global_style_data = &*GLOBAL_STYLE_DATA; Arc::new(global_style_data.shared_lock.wrap( From 94d84737af118ce4cba46db9cb0549a804cd87a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 14 Oct 2017 13:44:58 +0200 Subject: [PATCH 2/3] stylo: Dumb down the return value of SelectorList_Closest. --- ports/geckolib/glue.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 0ef6059d96f..f0bb226c7e0 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1522,10 +1522,10 @@ pub extern "C" fn Servo_StyleRule_SelectorMatchesElement(rule: RawServoStyleRule } #[no_mangle] -pub unsafe extern "C" fn Servo_SelectorList_Closest<'a>( - element: RawGeckoElementBorrowed<'a>, +pub unsafe extern "C" fn Servo_SelectorList_Closest( + element: RawGeckoElementBorrowed, selectors: RawServoSelectorListBorrowed, -) -> RawGeckoElementBorrowedOrNull<'a> { +) -> *const structs::RawGeckoElement { use std::borrow::Borrow; use style::dom_apis; @@ -1533,7 +1533,7 @@ pub unsafe extern "C" fn Servo_SelectorList_Closest<'a>( let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow(); dom_apis::element_closest(element, &selectors, element.owner_document_quirks_mode()) - .map(|e| e.0) + .map_or(ptr::null(), |e| e.0) } #[no_mangle] From e9a26f3a897011cac42d3269e0b4ab9108e08b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 14 Oct 2017 13:55:46 +0200 Subject: [PATCH 3/3] style: Update bindings. --- components/style/gecko/generated/bindings.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index b880c0e1abf..404e072b04e 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -1921,6 +1921,11 @@ extern "C" { pub fn Gecko_AddBufferToCrashReport(addr: *const ::std::os::raw::c_void, len: usize); } +extern "C" { + pub fn Gecko_AnnotateCrashReport(key_str: *const ::std::os::raw::c_char, + value_str: + *const ::std::os::raw::c_char); +} extern "C" { pub fn Servo_Element_ClearData(node: RawGeckoElementBorrowed); } @@ -2118,6 +2123,11 @@ extern "C" { arg2: RawServoSelectorListBorrowed) -> bool; } +extern "C" { + pub fn Servo_SelectorList_Closest(arg1: RawGeckoElementBorrowed, + arg2: RawServoSelectorListBorrowed) + -> *const RawGeckoElement; +} extern "C" { pub fn Servo_StyleSet_AddSizeOfExcludingThis(malloc_size_of: MallocSizeOf, malloc_enclosing_size_of: