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

Clear flat tree node data before early return.

Caused a fuzzer crash because ancestor marking of
ChildNeedsStyleRecalc happened with out-of-date FlatTreeNodeData.

Bug: 1034265
Change-Id: If36225997187bd1a3dcfb6ea4b9519ce44172711
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986800Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728497}
parent 45044c64
...@@ -1008,13 +1008,15 @@ void ContainerNode::ChildrenChanged(const ChildrenChange& change) { ...@@ -1008,13 +1008,15 @@ void ContainerNode::ChildrenChanged(const ChildrenChange& change) {
GetDocument().IncDOMTreeVersion(); GetDocument().IncDOMTreeVersion();
GetDocument().NotifyChangeChildren(*this); GetDocument().NotifyChangeChildren(*this);
InvalidateNodeListCachesInAncestors(nullptr, nullptr, &change); InvalidateNodeListCachesInAncestors(nullptr, nullptr, &change);
if (change.IsChildRemoval() || change.type == kAllChildrenRemoved) { if (change.IsChildRemoval() || change.type == kAllChildrenRemoved) {
GetDocument().GetStyleEngine().ChildrenRemoved(*this); GetDocument().GetStyleEngine().ChildrenRemoved(*this);
return; return;
} }
if (!change.IsChildInsertion()) if (!change.IsChildInsertion())
return; return;
Node* inserted_node = change.sibling_changed;
if (inserted_node->IsContainerNode() || inserted_node->IsTextNode())
inserted_node->ClearFlatTreeNodeDataIfHostChanged(*this);
if (!InActiveDocument()) if (!InActiveDocument())
return; return;
if (IsElementNode() && !GetComputedStyle()) { if (IsElementNode() && !GetComputedStyle()) {
...@@ -1025,11 +1027,8 @@ void ContainerNode::ChildrenChanged(const ChildrenChange& change) { ...@@ -1025,11 +1027,8 @@ void ContainerNode::ChildrenChanged(const ChildrenChange& change) {
// the ComputedStyle goes from null to non-null. // the ComputedStyle goes from null to non-null.
return; return;
} }
Node* inserted_node = change.sibling_changed; if (inserted_node->IsContainerNode() || inserted_node->IsTextNode())
if (inserted_node->IsContainerNode() || inserted_node->IsTextNode()) {
inserted_node->ClearFlatTreeNodeDataIfHostChanged(*this);
inserted_node->SetStyleChangeOnInsertion(); inserted_node->SetStyleChangeOnInsertion();
}
} }
void ContainerNode::CloneChildNodesFrom(const ContainerNode& node) { void ContainerNode::CloneChildNodesFrom(const ContainerNode& node) {
......
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