Bug 1286445: stylo: Unset restyle frames appropriately after regenerating style contexts. r=heycam
MozReview-Commit-ID: IgG4KOESJUY
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -97,16 +97,17 @@ ServoRestyleManager::PostRebuildAllStyle
ServoRestyleManager::RecreateStyleContexts(nsIContent* aContent,
nsStyleContext* aParentContext,
ServoStyleSet* aStyleSet)
{
if (!(aContent->IsDirtyForServo() || aContent->HasDirtyDescendantsForServo())) {
return;
}
+ aContent->UnsetFlags(NODE_IS_DIRTY_FOR_SERVO);
nsIFrame* primaryFrame = aContent->GetPrimaryFrame();
// TODO: AFAIK this can happen when we have, let's say, display: none. Here we
// should trigger frame construction if the element is actually dirty (I
// guess), but we'd better do that once we have all the restyle hints thing
// figured out.
if (!primaryFrame) {
return;
@@ -122,20 +123,25 @@ ServoRestyleManager::RecreateStyleContex
aParentContext,
nullptr,
CSSPseudoElementType::NotPseudo);
// TODO: Compare old and new styles to generate restyle change hints, and
// process them.
primaryFrame->SetStyleContext(context.get());
+ if (!aContent->HasDirtyDescendantsForServo()) {
+ return; // We're done
+ }
+
FlattenedChildIterator it(aContent);
for (nsIContent* n = it.GetNextChild(); n; n = it.GetNextChild()) {
RecreateStyleContexts(n, context.get(), aStyleSet);
}
+ aContent->UnsetFlags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
void
ServoRestyleManager::ProcessPendingRestyles()
{
ServoStyleSet* styleSet = StyleSet();
nsIDocument* doc = PresContext()->Document();