From 3947e2f698f73c529790935a20f9e954ac60519f Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 3 Aug 2017 14:01:33 -0700 Subject: [PATCH] Update stylo code to work on nightly --- components/style/gecko/generated/bindings.rs | 12 +++++++++--- components/style/gecko/wrapper.rs | 7 ++++++- ports/geckolib/glue.rs | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index e46bdfe1e1e..b6703ab95bf 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -8,6 +8,7 @@ type nsAString_internal = nsAString; pub type ServoStyleContextBorrowed<'a> = &'a ::properties::ComputedValues; pub type ServoStyleContextBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>; pub type ServoComputedDataBorrowed<'a> = &'a ServoComputedData; +pub type RawServoAnimationValueTableBorrowed<'a> = &'a (); use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue; use gecko_bindings::structs::mozilla::css::ErrorReporter; use gecko_bindings::structs::mozilla::css::ImageValue; @@ -37,7 +38,7 @@ use gecko_bindings::structs::RawServoStyleRule; use gecko_bindings::structs::RawGeckoPresContext; use gecko_bindings::structs::RawGeckoPresContextOwned; use gecko_bindings::structs::RawGeckoStyleAnimationList; -use gecko_bindings::structs::RawGeckoStyleChildrenIteratorBorrowedMut; +use gecko_bindings::structs::RawGeckoStyleChildrenIterator; use gecko_bindings::structs::RawGeckoServoStyleRuleList; use gecko_bindings::structs::RawGeckoURLExtraData; use gecko_bindings::structs::RawGeckoXBLBinding; @@ -320,6 +321,10 @@ pub type RawGeckoServoAnimationValueListBorrowed<'a> = &'a RawGeckoServoAnimatio pub type RawGeckoServoAnimationValueListBorrowedOrNull<'a> = Option<&'a RawGeckoServoAnimationValueList>; pub type RawGeckoServoAnimationValueListBorrowedMut<'a> = &'a mut RawGeckoServoAnimationValueList; pub type RawGeckoServoAnimationValueListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoServoAnimationValueList>; +pub type RawGeckoStyleChildrenIteratorBorrowed<'a> = &'a RawGeckoStyleChildrenIterator; +pub type RawGeckoStyleChildrenIteratorBorrowedOrNull<'a> = Option<&'a RawGeckoStyleChildrenIterator>; +pub type RawGeckoStyleChildrenIteratorBorrowedMut<'a> = &'a mut RawGeckoStyleChildrenIterator; +pub type RawGeckoStyleChildrenIteratorBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoStyleChildrenIterator>; pub type ServoCssRulesStrong = ::gecko_bindings::sugar::ownership::Strong; pub type ServoCssRulesBorrowed<'a> = &'a ServoCssRules; pub type ServoCssRulesBorrowedOrNull<'a> = Option<&'a ServoCssRules>; @@ -840,7 +845,7 @@ extern "C" { } extern "C" { pub fn Gecko_AnimationGetBaseStyle(aBaseStyles: - *mut ::std::os::raw::c_void, + RawServoAnimationValueTableBorrowed, aProperty: nsCSSPropertyID) -> RawServoAnimationValueBorrowedOrNull; } @@ -2602,7 +2607,8 @@ extern "C" { extern "C" { pub fn Servo_AnimationCompose(animation_values: RawServoAnimationValueMapBorrowedMut, - base_values: *mut ::std::os::raw::c_void, + base_values: + RawServoAnimationValueTableBorrowed, property: nsCSSPropertyID, animation_segment: RawGeckoAnimationPropertySegmentBorrowed, diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index dae89869231..6d62f54951c 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -387,7 +387,12 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> { curr }, GeckoChildrenIterator::GeckoIterator(ref mut it) => unsafe { - Gecko_GetNextStyleChild(it).map(GeckoNode) + // We do this unsafe lengthening of the lifetime here because + // structs::StyleChildrenIterator is actually StyleChildrenIterator<'a>, + // however we can't express this easily with bindgen, and it would + // introduce functions with two input lifetimes into bindgen, + // which would be out of scope for elision. + Gecko_GetNextStyleChild(&mut * (it as *mut _)).map(GeckoNode) } } } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 367d24ff87b..e69959f3710 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -59,6 +59,7 @@ use style::gecko_bindings::bindings::RawGeckoServoStyleRuleListBorrowedMut; use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed; use style::gecko_bindings::bindings::RawServoAnimationValueMapBorrowedMut; use style::gecko_bindings::bindings::RawServoAnimationValueStrong; +use style::gecko_bindings::bindings::RawServoAnimationValueTableBorrowed; use style::gecko_bindings::bindings::RawServoStyleRuleBorrowed; use style::gecko_bindings::bindings::ServoStyleContextBorrowedOrNull; use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t; @@ -374,7 +375,7 @@ pub extern "C" fn Servo_AnimationValues_ComputeDistance(from: RawServoAnimationV #[no_mangle] pub extern "C" fn Servo_AnimationCompose(raw_value_map: RawServoAnimationValueMapBorrowedMut, - base_values: *mut ::std::os::raw::c_void, + base_values: RawServoAnimationValueTableBorrowed, css_property: nsCSSPropertyID, segment: RawGeckoAnimationPropertySegmentBorrowed, last_segment: RawGeckoAnimationPropertySegmentBorrowed,