Bug 1390691 - Fix up Gecko_CalcStyleDifference for Linux 32-bit ABI. r=Manishearth draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 14 Aug 2017 20:02:01 -0500
changeset 647207 20d382b752f3ab36fe650eac0f9eddb4c472f27b
parent 647206 47ffe9199789fcebdb4237f44be89ee035ca811f
child 647208 da153f89548af00b3151909cfd4f2d55ae6fec8b
push id74321
push userbmo:jryans@gmail.com
push dateWed, 16 Aug 2017 03:16:57 +0000
reviewersManishearth
bugs1390691
milestone57.0a1
Bug 1390691 - Fix up Gecko_CalcStyleDifference for Linux 32-bit ABI. r=Manishearth Bindgen bitfield enums don't work as return values with the Linux 32-bit ABI at the moment because they wrap the value in a struct. This causes the Rust side to believe the callee expects space for the struct return value, while C++ believes it's just an integer value. MozReview-Commit-ID: FRBqlZuMiAR
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -449,17 +449,17 @@ Gecko_GetStyleContext(RawGeckoElementBor
 }
 
 CSSPseudoElementType
 Gecko_GetImplementedPseudo(RawGeckoElementBorrowed aElement)
 {
   return aElement->GetPseudoElementType();
 }
 
-nsChangeHint
+uint32_t
 Gecko_CalcStyleDifference(ServoStyleContextBorrowed aOldStyle,
                           ServoStyleContextBorrowed aNewStyle,
                           uint64_t aOldStyleBits,
                           bool* aAnyStyleChanged)
 {
   MOZ_ASSERT(aOldStyle);
   MOZ_ASSERT(aNewStyle);
 
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -390,20 +390,23 @@ void Gecko_NoteDirtyElement(RawGeckoElem
 void Gecko_NoteAnimationOnlyDirtyElement(RawGeckoElementBorrowed element);
 
 // Incremental restyle.
 // Also, we might want a ComputedValues to ComputedValues API for animations?
 // Not if we do them in Gecko...
 nsStyleContext* Gecko_GetStyleContext(RawGeckoElementBorrowed element,
                                       nsIAtom* aPseudoTagOrNull);
 mozilla::CSSPseudoElementType Gecko_GetImplementedPseudo(RawGeckoElementBorrowed element);
-nsChangeHint Gecko_CalcStyleDifference(ServoStyleContextBorrowed old_style,
-                                       ServoStyleContextBorrowed new_style,
-                                       uint64_t old_style_bits,
-                                       bool* any_style_changed);
+// We'd like to return `nsChangeHint` here, but bindgen bitfield enums don't
+// work as return values with the Linux 32-bit ABI at the moment because
+// they wrap the value in a struct.
+uint32_t Gecko_CalcStyleDifference(ServoStyleContextBorrowed old_style,
+                                   ServoStyleContextBorrowed new_style,
+                                   uint64_t old_style_bits,
+                                   bool* any_style_changed);
 nsChangeHint Gecko_HintsHandledForDescendants(nsChangeHint aHint);
 
 // Get an element snapshot for a given element from the table.
 const ServoElementSnapshot*
 Gecko_GetElementSnapshot(const mozilla::ServoElementSnapshotTable* table,
                          RawGeckoElementBorrowed element);
 
 void Gecko_DropElementSnapshot(ServoElementSnapshotOwned snapshot);