From 05371b56eb4ac19889c744b96263c9a58e305796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 4 Sep 2017 22:04:18 +0200 Subject: [PATCH] style: Fix recascading when child blockification depends on our display value. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All other browsers get it right because they basically throw away all the styles in a subtree after a display change. We do better, but need to do this check. MozReview-Commit-ID: BODx0gnSzwI Signed-off-by: Emilio Cobos Álvarez --- components/style/matching.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/style/matching.rs b/components/style/matching.rs index b15594f29ef..cb9295c47af 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -395,6 +395,15 @@ trait PrivateMatchMethods: TElement { StyleChange::Unchanged => ChildCascadeRequirement::CanSkipCascade, StyleChange::Changed { reset_only } => { if reset_only { + let old_display = old_values.get_box().clone_display(); + let new_display = new_values.get_box().clone_display(); + + if old_display.is_item_container() != new_display.is_item_container() { + // Blockification of children may depend on our display + // value, so we need to actually do the recascade. + return ChildCascadeRequirement::MustCascadeChildren + } + #[cfg(feature = "gecko")] { use values::specified::align;