From af2b429557b13723d6a82bc49aa47d8b61c58891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 24 Jul 2017 12:12:08 +0200 Subject: [PATCH 1/2] style: Avoid looking at descendant hints to check whether the element needs a restyle. --- components/style/dom.rs | 2 +- components/style/invalidation/element/restyle_hints.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/style/dom.rs b/components/style/dom.rs index 4b69a8e2c8a..58050757b30 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -492,7 +492,7 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone + return false; } - data.has_styles() && !data.restyle.hint.has_non_animation_hint() + data.has_styles() && !data.restyle.hint.has_non_animation_invalidations() } /// Flags an element and its ancestors with a given `DescendantsBit`. diff --git a/components/style/invalidation/element/restyle_hints.rs b/components/style/invalidation/element/restyle_hints.rs index c9171d368cc..d846afa5e51 100644 --- a/components/style/invalidation/element/restyle_hints.rs +++ b/components/style/invalidation/element/restyle_hints.rs @@ -65,8 +65,12 @@ impl RestyleHint { } /// Returns whether we need to restyle this element. - pub fn has_self_invalidations(&self) -> bool { - self.intersects(RESTYLE_SELF | RECASCADE_SELF | Self::replacements()) + pub fn has_non_animation_invalidations(&self) -> bool { + self.intersects( + RESTYLE_SELF | + RECASCADE_SELF | + (Self::replacements() & !Self::for_animations()) + ) } /// Propagates this restyle hint to a child element. From b4d26619d38e3f8b9fbcdf2f83daf0da240f2a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 24 Jul 2017 12:13:19 +0200 Subject: [PATCH 2/2] style: Improve the assertion message in restyle_kind(). --- components/style/data.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/style/data.rs b/components/style/data.rs index 21d35252304..c835593fed2 100644 --- a/components/style/data.rs +++ b/components/style/data.rs @@ -324,7 +324,7 @@ impl ElementData { } debug_assert!(hint.has_recascade_self(), - "We definitely need to do something!"); + "We definitely need to do something: {:?}!", hint); return RestyleKind::CascadeOnly; }