Bug 1403028: Ensure the parent is in the composed doc before marking it as dirty. r=heycam

We could do the check earlier, but the end result is effectively the same, and
this makes it easier to remove.

MozReview-Commit-ID: 5c8TFHK1ciD
This commit is contained in:
Emilio Cobos Álvarez 2017-09-26 09:38:18 +02:00
Родитель 135f2e07c7
Коммит 4b5023d5d3
1 изменённых файлов: 8 добавлений и 2 удалений

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

@ -1053,8 +1053,14 @@ ServoRestyleManager::SnapshotFor(Element* aElement)
if (aElement->GetNextElementSibling()) {
Element* parent = aElement->GetFlattenedTreeParentElementForStyle();
MOZ_ASSERT(parent);
parent->NoteDirtyForServo();
parent->SetHasDirtyDescendantsForServo();
// The parent will only be outside of the composed doc if we're mid-unbind.
//
// FIXME(emilio): Make the traversal lazily mark the parent as dirty if
// needed to avoid this problem altogether, plus being better perf-wise.
if (parent->IsInComposedDoc()) {
parent->NoteDirtyForServo();
parent->SetHasDirtyDescendantsForServo();
}
} else {
aElement->NoteDirtyForServo();
}