From 22e794bbd85ebf0fe53fdaca08ff2f3825118f44 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 14 Aug 2017 22:11:53 -0500 Subject: [PATCH] Fix up Servo_TakeChangeHint 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: 6qqVVfU8Mb2 --- ports/geckolib/glue.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index fe6eef50626..68742d004a7 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -2831,7 +2831,7 @@ pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed, #[no_mangle] pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed, - was_restyled: *mut bool) -> nsChangeHint + was_restyled: *mut bool) -> u32 { let mut was_restyled = unsafe { was_restyled.as_mut().unwrap() }; let element = GeckoElement(element); @@ -2852,7 +2852,10 @@ pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed, }; debug!("Servo_TakeChangeHint: {:?}, damage={:?}", element, damage); - damage.as_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, so for now just unwrap it. + damage.as_change_hint().0 } #[no_mangle]