Bug 1405544 - Propagate existing bits to the parent element as well when switch the restyle root for invalidation siblings in post-traversal. r?emilio draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 10 Oct 2017 10:05:54 +0900
changeset 677091 4a8a27c1a943614fbad3e29eac23fc13e53a780c
parent 676775 1db601511bf3022b991420ebc1fffb4867a37f69
child 735111 a74de28175ab6e0ff4f0188d46c3c1812cfa6357
push id83687
push userhikezoe@mozilla.com
push dateTue, 10 Oct 2017 01:06:25 +0000
reviewersemilio
bugs1405544
milestone58.0a1
Bug 1405544 - Propagate existing bits to the parent element as well when switch the restyle root for invalidation siblings in post-traversal. r?emilio MozReview-Commit-ID: 8Rmg2FSytlp
layout/style/ServoStyleSet.cpp
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -981,20 +981,22 @@ ServoStyleSet::StyleDocument(ServoTraver
       root->HasAnyOfFlags(Element::kAllServoDescendantBits | NODE_NEEDS_FRAME);
 
     if (parent) {
       MOZ_ASSERT(root == doc->GetServoRestyleRoot());
       if (parent->HasDirtyDescendantsForServo()) {
         // If any style invalidation was triggered in our siblings, then we may
         // need to post-traverse them, even if the root wasn't restyled after
         // all.
+        uint32_t existingBits = doc->GetServoRestyleRootDirtyBits();
+        // We need to propagate the existing bits to the parent.
+        parent->SetFlags(existingBits);
         doc->SetServoRestyleRoot(
             parent,
-            doc->GetServoRestyleRootDirtyBits() |
-            ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
+            existingBits | ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
         postTraversalRequired = true;
       }
     }
   }
 
   // If there are still animation restyles needed, trigger a second traversal to
   // update CSS animations or transitions' styles.
   //