Bug 1286445: stylo: Unset restyle frames appropriately after regenerating style contexts. r=heycam

MozReview-Commit-ID: IgG4KOESJUY
This commit is contained in:
Emilio Cobos Álvarez 2016-07-15 11:48:45 -07:00
Родитель f526a25d70
Коммит ec307d8059
1 изменённых файлов: 23 добавлений и 19 удалений

Просмотреть файл

@ -98,10 +98,6 @@ ServoRestyleManager::RecreateStyleContexts(nsIContent* aContent,
nsStyleContext* aParentContext, nsStyleContext* aParentContext,
ServoStyleSet* aStyleSet) ServoStyleSet* aStyleSet)
{ {
if (!(aContent->IsDirtyForServo() || aContent->HasDirtyDescendantsForServo())) {
return;
}
nsIFrame* primaryFrame = aContent->GetPrimaryFrame(); nsIFrame* primaryFrame = aContent->GetPrimaryFrame();
// TODO: AFAIK this can happen when we have, let's say, display: none. Here we // TODO: AFAIK this can happen when we have, let's say, display: none. Here we
@ -109,27 +105,35 @@ ServoRestyleManager::RecreateStyleContexts(nsIContent* aContent,
// guess), but we'd better do that once we have all the restyle hints thing // guess), but we'd better do that once we have all the restyle hints thing
// figured out. // figured out.
if (!primaryFrame) { if (!primaryFrame) {
aContent->UnsetFlags(NODE_IS_DIRTY_FOR_SERVO | NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
return; return;
} }
RefPtr<ServoComputedValues> computedValues = if (aContent->IsDirtyForServo()) {
dont_AddRef(Servo_GetComputedValues(aContent)); RefPtr<ServoComputedValues> computedValues =
dont_AddRef(Servo_GetComputedValues(aContent));
// TODO: Figure out what pseudos does this content have, and do the proper // TODO: Figure out what pseudos does this content have, and do the proper
// thing with them. // thing with them.
RefPtr<nsStyleContext> context = RefPtr<nsStyleContext> context =
aStyleSet->GetContext(computedValues.forget(), aStyleSet->GetContext(computedValues.forget(),
aParentContext, aParentContext,
nullptr, nullptr,
CSSPseudoElementType::NotPseudo); CSSPseudoElementType::NotPseudo);
// TODO: Compare old and new styles to generate restyle change hints, and // TODO: Compare old and new styles to generate restyle change hints, and
// process them. // process them.
primaryFrame->SetStyleContext(context.get()); primaryFrame->SetStyleContext(context.get());
FlattenedChildIterator it(aContent); aContent->UnsetFlags(NODE_IS_DIRTY_FOR_SERVO);
for (nsIContent* n = it.GetNextChild(); n; n = it.GetNextChild()) { }
RecreateStyleContexts(n, context.get(), aStyleSet);
if (aContent->HasDirtyDescendantsForServo()) {
FlattenedChildIterator it(aContent);
for (nsIContent* n = it.GetNextChild(); n; n = it.GetNextChild()) {
RecreateStyleContexts(n, primaryFrame->StyleContext(), aStyleSet);
}
aContent->UnsetFlags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
} }
} }