Commit b374fd5f authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

AssertLayoutTreeUpdated for pseudo elements.

We were not checking dirty flags for pseudo elements in
AssertLayoutTreeUpdated.

Change-Id: Icad8f8fabd45bdb973258c4da9ada440b6952e14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2073878Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744606}
parent 82bba406
...@@ -2419,25 +2419,43 @@ void Document::PropagateStyleToViewport() { ...@@ -2419,25 +2419,43 @@ void Document::PropagateStyleToViewport() {
#undef PROPAGATE_FROM #undef PROPAGATE_FROM
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
static void AssertNodeClean(const Node& node) {
DCHECK(!node.NeedsStyleRecalc());
DCHECK(!node.ChildNeedsStyleRecalc());
DCHECK(!node.NeedsReattachLayoutTree());
DCHECK(!node.ChildNeedsReattachLayoutTree());
DCHECK(!node.ChildNeedsDistributionRecalc());
DCHECK(!node.NeedsStyleInvalidation());
DCHECK(!node.ChildNeedsStyleInvalidation());
DCHECK(!node.GetForceReattachLayoutTree());
}
static void AssertLayoutTreeUpdatedForPseudoElements(const Element& element) {
WTF::Vector<PseudoId> pseudo_ids = {kPseudoIdFirstLetter, kPseudoIdBefore,
kPseudoIdAfter, kPseudoIdMarker,
kPseudoIdBackdrop};
for (auto pseudo_id : pseudo_ids) {
if (auto* pseudo_element = element.GetPseudoElement(pseudo_id))
AssertNodeClean(*pseudo_element);
}
}
static void AssertLayoutTreeUpdated(Node& root) { static void AssertLayoutTreeUpdated(Node& root) {
Node* node = &root; Node* node = &root;
while (node) { while (node) {
auto* element = DynamicTo<Element>(node); if (auto* element = DynamicTo<Element>(node)) {
if (element && RuntimeEnabledFeatures::CSSRenderSubtreeEnabled() && if (RuntimeEnabledFeatures::CSSRenderSubtreeEnabled() &&
element->StyleRecalcBlockedByDisplayLock( element->StyleRecalcBlockedByDisplayLock(
DisplayLockLifecycleTarget::kChildren)) { DisplayLockLifecycleTarget::kChildren)) {
node = FlatTreeTraversal::NextSkippingChildren(*node); node = FlatTreeTraversal::NextSkippingChildren(*node);
continue; continue;
}
// Check pseudo elements.
AssertLayoutTreeUpdatedForPseudoElements(*element);
} }
DCHECK(!node->NeedsStyleRecalc()); AssertNodeClean(*node);
DCHECK(!node->ChildNeedsStyleRecalc());
DCHECK(!node->NeedsReattachLayoutTree());
DCHECK(!node->ChildNeedsReattachLayoutTree());
DCHECK(!node->ChildNeedsDistributionRecalc());
DCHECK(!node->NeedsStyleInvalidation());
DCHECK(!node->ChildNeedsStyleInvalidation());
DCHECK(!node->GetForceReattachLayoutTree());
// Make sure there is no node which has a LayoutObject, but doesn't have a // Make sure there is no node which has a LayoutObject, but doesn't have a
// parent in a flat tree. If there is such a node, we forgot to detach the // parent in a flat tree. If there is such a node, we forgot to detach the
// node. DocumentNode is only an exception. // node. DocumentNode is only an exception.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment