servo: Merge #17837 - style: Avoid looking at descendant hints to check whether the element needs a restyle (from emilio:assert-fix); r=hiikezoe
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 24 Jul 2017 04:49:08 -0700
changeset 421673 7e21499a9eb443a7492c722930e7b0c21f8ce433
parent 421672 54deee11a7c5711db2233653a7ce899d0dca5b64
child 421674 80b3b7fa1e23f3c504a9013a219218238a20ce63
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiikezoe
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17837 - style: Avoid looking at descendant hints to check whether the element needs a restyle (from emilio:assert-fix); r=hiikezoe This makes us hit some assertions in Gecko. Source-Repo: https://github.com/servo/servo Source-Revision: 9f412caab21ae407173187cdb5d0250fb1ae6b37
servo/components/style/data.rs
servo/components/style/dom.rs
servo/components/style/invalidation/element/restyle_hints.rs
--- a/servo/components/style/data.rs
+++ b/servo/components/style/data.rs
@@ -319,17 +319,17 @@ impl ElementData {
 
         if hint.has_replacements() {
             debug_assert!(!hint.has_animation_hint(),
                           "Animation only restyle hint should have already processed");
             return RestyleKind::CascadeWithReplacements(hint & RestyleHint::replacements());
         }
 
         debug_assert!(hint.has_recascade_self(),
-                      "We definitely need to do something!");
+                      "We definitely need to do something: {:?}!", hint);
         return RestyleKind::CascadeOnly;
     }
 
     /// Returns the kind of restyling for animation-only restyle.
     fn restyle_kind_for_animation(
         &self,
         shared_context: &SharedStyleContext,
     ) -> RestyleKind {
--- a/servo/components/style/dom.rs
+++ b/servo/components/style/dom.rs
@@ -487,17 +487,17 @@ pub trait TElement : Eq + PartialEq + De
             return data.has_styles() &&
                    !data.restyle.hint.has_animation_hint_or_recascade();
         }
 
         if self.has_snapshot() && !self.handled_snapshot() {
             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`.
     ///
     /// TODO(emilio): We call this conservatively from restyle_element_internal
     /// because we never flag unstyled stuff. A different setup for this may be
     /// a bit cleaner, but it's probably not worth to invest on it right now
     /// unless necessary.
--- a/servo/components/style/invalidation/element/restyle_hints.rs
+++ b/servo/components/style/invalidation/element/restyle_hints.rs
@@ -60,18 +60,22 @@ impl RestyleHint {
 
     /// Returns whether this hint invalidates the element and all its
     /// descendants.
     pub fn contains_subtree(&self) -> bool {
         self.contains(RESTYLE_SELF | RESTYLE_DESCENDANTS)
     }
 
     /// 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.
     pub fn propagate(&mut self, traversal_flags: &TraversalFlags) -> Self {
         use std::mem;
 
         // In the middle of an animation only restyle, we don't need to
         // propagate any restyle hints, and we need to remove ourselves.