Bug 1390691 - Fix up Servo_TakeChangeHint for Linux 32-bit ABI. r=Manishearth draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 14 Aug 2017 22:11:53 -0500
changeset 647208 da153f89548af00b3151909cfd4f2d55ae6fec8b
parent 647207 20d382b752f3ab36fe650eac0f9eddb4c472f27b
child 647209 370fda11d7f9e3b5c81ed2f17174e1bc394eb6da
push id74321
push userbmo:jryans@gmail.com
push dateWed, 16 Aug 2017 03:16:57 +0000
reviewersManishearth
bugs1390691
milestone57.0a1
Bug 1390691 - Fix up Servo_TakeChangeHint 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 caller will pass along space for the struct return value, while C++ believes it's just an integer value. MozReview-Commit-ID: 6qqVVfU8Mb2
layout/base/ServoRestyleManager.cpp
layout/style/ServoBindingList.h
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -698,17 +698,18 @@ ServoRestyleManager::ProcessPostTraversa
   // NOTE(emilio): This is needed because for table frames the bit is set on the
   // table wrapper (which is the primary frame), not on the table itself.
   const bool isOutOfFlow =
     primaryFrame &&
     primaryFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW);
 
   // Grab the change hint from Servo.
   bool wasRestyled;
-  nsChangeHint changeHint = Servo_TakeChangeHint(aElement, &wasRestyled);
+  nsChangeHint changeHint =
+    static_cast<nsChangeHint>(Servo_TakeChangeHint(aElement, &wasRestyled));
 
   // We should really fix the weird primary frame mapping for image maps
   // (bug 135040)...
   if (styleFrame && styleFrame->GetContent() != aElement) {
     MOZ_ASSERT(styleFrame->IsImageFrame());
     styleFrame = nullptr;
   }
 
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -512,18 +512,21 @@ SERVO_BINDING_FUNC(Servo_ComputedValues_
 SERVO_BINDING_FUNC(Servo_Initialize, void,
                    RawGeckoURLExtraData* dummy_url_data)
 // Shut down Servo components. Should be called exactly once at shutdown.
 SERVO_BINDING_FUNC(Servo_Shutdown, void)
 
 // Restyle and change hints.
 SERVO_BINDING_FUNC(Servo_NoteExplicitHints, void, RawGeckoElementBorrowed element,
                    nsRestyleHint restyle_hint, nsChangeHint change_hint)
+// 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.
 SERVO_BINDING_FUNC(Servo_TakeChangeHint,
-                   nsChangeHint,
+                   uint32_t,
                    RawGeckoElementBorrowed element,
                    bool* was_restyled)
 SERVO_BINDING_FUNC(Servo_ResolveStyle, ServoStyleContextStrong,
                    RawGeckoElementBorrowed element,
                    RawServoStyleSetBorrowed set)
 SERVO_BINDING_FUNC(Servo_ResolveStyleAllowStale, ServoStyleContextStrong,
                    RawGeckoElementBorrowed element)
 SERVO_BINDING_FUNC(Servo_ResolvePseudoStyle, ServoStyleContextStrong,