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
--- 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());
+ }
}