From daab72e229db522d4169a512b22d29c9b487a6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 5 Oct 2019 09:25:21 +0000 Subject: [PATCH] Bug 1585882 - Fix needs_frame() check to account for the case where an ancestor of us has been reconstructed regularly, not via lazy frame construction. r=heycam This is a pre-existing bug, and this would be enough to fix the website, but this is still not 100% correct. More on that in a second. Differential Revision: https://phabricator.services.mozilla.com/D48134 --HG-- extra : moz-landing-system : lando --- servo/ports/geckolib/glue.rs | 11 +++++- ...yle-animations-replaced-into-ib-split.html | 34 +++++++++++++++++++ ...yout-dependent-replaced-into-ib-split.html | 30 ++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 testing/web-platform/tests/css/cssom/getComputedStyle-animations-replaced-into-ib-split.html create mode 100644 testing/web-platform/tests/css/cssom/getComputedStyle-layout-dependent-replaced-into-ib-split.html diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index 63ada34e1f66..c7c1217f5d77 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -6137,6 +6137,7 @@ pub extern "C" fn Servo_ProcessInvalidations( #[no_mangle] pub extern "C" fn Servo_HasPendingRestyleAncestor(element: &RawGeckoElement) -> bool { + let mut has_yet_to_be_styled = false; let mut element = Some(GeckoElement(element)); while let Some(e) = element { if e.has_animations() { @@ -6146,15 +6147,23 @@ pub extern "C" fn Servo_HasPendingRestyleAncestor(element: &RawGeckoElement) -> // If the element needs a frame, it means that we haven't styled it yet // after it got inserted in the document, and thus we may need to do // that for transitions and animations to trigger. + // + // This is a fast path in the common case, but `has_yet_to_be_styled` is + // the real check for this. if e.needs_frame() { return true; } - if let Some(data) = e.borrow_data() { + let data = e.borrow_data(); + if let Some(ref data) = data { if !data.hint.is_empty() { return true; } + if has_yet_to_be_styled && !data.styles.is_display_none() { + return true; + } } + has_yet_to_be_styled = data.is_none(); element = e.traversal_parent(); } diff --git a/testing/web-platform/tests/css/cssom/getComputedStyle-animations-replaced-into-ib-split.html b/testing/web-platform/tests/css/cssom/getComputedStyle-animations-replaced-into-ib-split.html new file mode 100644 index 000000000000..47198803a0d2 --- /dev/null +++ b/testing/web-platform/tests/css/cssom/getComputedStyle-animations-replaced-into-ib-split.html @@ -0,0 +1,34 @@ + +getComputedStyle() returns the right style for animating nodes that have been just inserted into the document, and that have an ancestor whose layout tree was recreated (like an IB-split) + + + + + + + + +
+
+ diff --git a/testing/web-platform/tests/css/cssom/getComputedStyle-layout-dependent-replaced-into-ib-split.html b/testing/web-platform/tests/css/cssom/getComputedStyle-layout-dependent-replaced-into-ib-split.html new file mode 100644 index 000000000000..98771cebc732 --- /dev/null +++ b/testing/web-platform/tests/css/cssom/getComputedStyle-layout-dependent-replaced-into-ib-split.html @@ -0,0 +1,30 @@ + +getComputedStyle() returns the right style for layout-dependent properties for nodes that have been just inserted into the document, and that have an ancestor whose layout tree was recreated (like an IB-split) + + + + + + + + +
+
+