From 7174bd25c7f84facda295af87ecf13679fc0b114 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 22 Aug 2017 18:13:57 -0700 Subject: [PATCH] Bug 1392863 - Clean up DoProcessPendingRestyles. r=emilio MozReview-Commit-ID: 4JhWFNPVvGn --- layout/base/ServoRestyleManager.cpp | 13 +++---------- layout/style/ServoStyleSet.cpp | 6 +++++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/layout/base/ServoRestyleManager.cpp b/layout/base/ServoRestyleManager.cpp index e063fa37f188..0bff39ee221b 100644 --- a/layout/base/ServoRestyleManager.cpp +++ b/layout/base/ServoRestyleManager.cpp @@ -1012,16 +1012,7 @@ ServoRestyleManager::DoProcessPendingRestyles(ServoTraversalFlags aFlags) aFlags |= ServoTraversalFlags::ForCSSRuleChanges; } - while (doc->GetServoRestyleRoot()) { - // Do the servo traversal. - bool needsPostTraversal = styleSet->StyleDocument(aFlags); - - // If we don't need a post-traversal, we're done. - if (!needsPostTraversal) { - doc->ClearServoRestyleRoot(); - break; - } - + while (styleSet->StyleDocument(aFlags)) { ClearSnapshots(); nsStyleChangeList currentChanges(StyleBackendType::Servo); @@ -1086,6 +1077,8 @@ ServoRestyleManager::DoProcessPendingRestyles(ServoTraversalFlags aFlags) } } + doc->ClearServoRestyleRoot(); + FlushOverflowChangedTracker(); ClearSnapshots(); diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index 0f78a805a63d..7f65609ad4a4 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -858,6 +858,11 @@ ServoStyleSet::HasStateDependentStyle(dom::Element* aElement, bool ServoStyleSet::StyleDocument(ServoTraversalFlags aBaseFlags) { + nsIDocument* doc = mPresContext->Document(); + if (!doc->GetServoRestyleRoot()) { + return false; + } + PreTraverse(aBaseFlags); AutoPrepareTraversal guard(this); const SnapshotTable& snapshots = Snapshots(); @@ -866,7 +871,6 @@ ServoStyleSet::StyleDocument(ServoTraversalFlags aBaseFlags) // NAC subtree roots. bool postTraversalRequired = false; - nsIDocument* doc = mPresContext->Document(); Element* rootElement = doc->GetRootElement(); // NB: We distinguish between the main document and document-level NAC here. const bool isInitialForMainDoc = rootElement && !rootElement->HasServoData();