diff --git a/layout/base/ServoRestyleManager.cpp b/layout/base/ServoRestyleManager.cpp index 682464114544..6ca7463795d9 100644 --- a/layout/base/ServoRestyleManager.cpp +++ b/layout/base/ServoRestyleManager.cpp @@ -203,8 +203,10 @@ ServoRestyleManager::ProcessPendingRestyles() } } - styleSet->RestyleSubtree(root); - RecreateStyleContexts(root, nullptr, styleSet); + if (root->IsDirtyForServo() || root->HasDirtyDescendantsForServo()) { + styleSet->RestyleSubtree(root); + RecreateStyleContexts(root, nullptr, styleSet); + } } mModifiedElements.Clear();