Bug 1288873: stylo: Stop calling Servo_RestyleSubtree if we know it's not effective. draft
authorEmilio Cobos Álvarez <ecoal95@gmail.com>
Fri, 22 Jul 2016 16:45:50 -0700
changeset 392097 b90ba6d89a2864f9c66899afa4b4445313eae5b5
parent 392096 531e8ca1aaf4e52ce768cabd49c2af30656aece9
child 526248 15e9d136649c5849a9c6d489bcd3cb7e6dded3ad
push id23935
push userbmo:ealvarez@mozilla.com
push dateSat, 23 Jul 2016 00:15:20 +0000
bugs1288873
milestone50.0a1
Bug 1288873: stylo: Stop calling Servo_RestyleSubtree if we know it's not effective. This allows preventing the creation of the StyleContext in the Servo side, which is a non-trivial amount of work. MozReview-Commit-ID: E6NupdPru9A
layout/style/ServoStyleSet.cpp
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -391,10 +391,12 @@ ServoStyleSet::ComputeRestyleHint(dom::E
 void
 ServoStyleSet::RestyleSubtree(nsINode* aNode, bool aForce)
 {
   if (aForce) {
     MOZ_ASSERT(aNode->IsContent());
     ServoRestyleManager::DirtyTree(aNode->AsContent());
   }
 
-  Servo_RestyleSubtree(aNode, mRawSet.get());
+  if (aNode->IsDirtyForServo() || aNode->HasDirtyDescendantsForServo()) {
+    Servo_RestyleSubtree(aNode, mRawSet.get());
+  }
 }