Bug 1289916 - Check tree dirtiness in ProcessPendingRestyles before triggering traversal. r=emilio
authorBobby Holley <bobbyholley@gmail.com>
Wed, 27 Jul 2016 14:00:29 -0700
changeset 349075 f8669df3b3de4d707278012f3a45bf6c75678aca
parent 349074 3531847a7419ec572bce11d97dfb8de81b7a0177
child 349076 003da22902a615be6b8f48d00f36331cbae17f5c
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1289916
milestone50.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
Bug 1289916 - Check tree dirtiness in ProcessPendingRestyles before triggering traversal. r=emilio It's possible (and in fact, desirable) for the restyle hints to all evaluate to 0, which means the tree stays clean even though the map was non-empty.
layout/base/ServoRestyleManager.cpp
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -198,18 +198,20 @@ ServoRestyleManager::ProcessPendingResty
       nsRestyleHint hint = styleSet->ComputeRestyleHint(element, snapshot);
       hint |= snapshot->ExplicitRestyleHint();
 
       if (hint) {
         NoteRestyleHint(element, hint);
       }
     }
 
-    styleSet->RestyleSubtree(root);
-    RecreateStyleContexts(root, nullptr, styleSet);
+    if (root->IsDirtyForServo() || root->HasDirtyDescendantsForServo()) {
+      styleSet->RestyleSubtree(root);
+      RecreateStyleContexts(root, nullptr, styleSet);
+    }
   }
 
   mModifiedElements.Clear();
 
   // NB: we restyle from the root element, but the document also gets the
   // HAS_DIRTY_DESCENDANTS flag as part of the loop on PostRestyleEvent, and we
   // use that to check we have pending restyles.
   //