Bug 1392447 - Fix up Servo_StyleSheet_GetOrigin for Linux 32-bit ABI. r=emilio draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 21 Aug 2017 18:42:40 -0500
changeset 650561 b608086c1741c142e6f48ac0acf2986849a681af
parent 650560 08c538a185408e3f79fc7a0a08fba042ebebc689
child 650562 6e54c7b11677f97b1306deab05c577aabae5dd0a
push id75438
push userbmo:jryans@gmail.com
push dateTue, 22 Aug 2017 16:27:03 +0000
reviewersemilio
bugs1392447
milestone57.0a1
Bug 1392447 - Fix up Servo_StyleSheet_GetOrigin for Linux 32-bit ABI. r=emilio 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: JHDp0XAmQCG
layout/style/ServoBindingList.h
layout/style/ServoStyleSheet.cpp
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -50,18 +50,20 @@ SERVO_BINDING_FUNC(Servo_StyleSheet_HasR
 SERVO_BINDING_FUNC(Servo_StyleSheet_GetRules, ServoCssRulesStrong,
                    RawServoStyleSheetContentsBorrowed sheet)
 SERVO_BINDING_FUNC(Servo_StyleSheet_Clone, RawServoStyleSheetContentsStrong,
                    RawServoStyleSheetContentsBorrowed sheet,
                    const mozilla::ServoStyleSheet* reference_sheet);
 SERVO_BINDING_FUNC(Servo_StyleSheet_SizeOfIncludingThis, size_t,
                    mozilla::MallocSizeOf malloc_size_of,
                    RawServoStyleSheetContentsBorrowed sheet)
-SERVO_BINDING_FUNC(Servo_StyleSheet_GetOrigin,
-                   mozilla::OriginFlags,
+// We'd like to return `OriginFlags` 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_StyleSheet_GetOrigin, uint8_t,
                    RawServoStyleSheetContentsBorrowed sheet)
 SERVO_BINDING_FUNC(Servo_StyleSet_Init, RawServoStyleSet*, RawGeckoPresContextOwned pres_context)
 SERVO_BINDING_FUNC(Servo_StyleSet_RebuildCachedData, void,
                    RawServoStyleSetBorrowed set)
 // We'd like to return `OriginFlags` 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_StyleSet_MediumFeaturesChanged, uint8_t,
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -461,12 +461,13 @@ ServoStyleSheet::SizeOfIncludingThis(Mal
     s = s->mNext ? s->mNext->AsServo() : nullptr;
   }
   return n;
 }
 
 OriginFlags
 ServoStyleSheet::GetOrigin()
 {
-  return Servo_StyleSheet_GetOrigin(Inner()->mContents);
+  return static_cast<OriginFlags>(
+    Servo_StyleSheet_GetOrigin(Inner()->mContents));
 }
 
 } // namespace mozilla