From 8d069d127a49ef43962362c91d81ad046a7d757c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 4 Jun 2018 19:14:20 +0200 Subject: [PATCH] style: Work around a bindgen bug on Android. Bug: 1466406 Reviewed-by: xidorn MozReview-Commit-ID: 2lltjH7IoZu --- components/style/gecko/wrapper.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 96f20fd90ab..5475be1e3fc 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1118,7 +1118,23 @@ impl<'le> TElement for GeckoElement<'le> { assert_eq!(base as *const _, self.0 as *const _, "Bad cast"); } - let assigned_nodes: &[structs::RefPtr] = &*slot.mAssignedNodes; + // FIXME(emilio): Workaround a bindgen bug on Android that causes + // mAssignedNodes to be at the wrong offset. See bug 1466406. + // + // Bug 1466580 tracks running the Android layout tests on automation. + // + // The actual bindgen bug still needs reduction. + let assigned_nodes: &[structs::RefPtr] = + if !cfg!(target_os = "android") { + debug_assert_eq!( + unsafe { bindings::Gecko_GetAssignedNodes(self.0) }, + &slot.mAssignedNodes as *const _, + ); + + &*slot.mAssignedNodes + } else { + unsafe { &**bindings::Gecko_GetAssignedNodes(self.0) } + }; debug_assert_eq!( mem::size_of::>(),