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
--- 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,