Fix up Servo_StyleSheet_GetOrigin for Linux 32-bit ABI

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
This commit is contained in:
J. Ryan Stinnett 2017-08-21 18:42:40 -05:00
parent eb80e8f20a
commit 214c59b25e

View file

@ -1059,12 +1059,16 @@ pub extern "C" fn Servo_StyleSheet_SizeOfIncludingThis(
#[no_mangle]
pub extern "C" fn Servo_StyleSheet_GetOrigin(
sheet: RawServoStyleSheetContentsBorrowed
) -> OriginFlags {
match StylesheetContents::as_arc(&sheet).origin {
) -> u8 {
let origin = match StylesheetContents::as_arc(&sheet).origin {
Origin::UserAgent => OriginFlags_UserAgent,
Origin::User => OriginFlags_User,
Origin::Author => OriginFlags_Author,
}
};
// 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, so for now just unwrap it.
origin.0
}
#[no_mangle]