Commit 5fabee49 authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

DOM: Rename HadAtMostOneDOMMutation->NeedsRecheck

The name was appropriate at the start but not it checks much more than
this.

Change-Id: Id9b01ae5f62cc2fbc834559e80f75dc6305e7d21
Reviewed-on: https://chromium-review.googlesource.com/1109670Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569208}
parent f6e559e0
...@@ -88,7 +88,7 @@ class DOMTreeMutationDetector { ...@@ -88,7 +88,7 @@ class DOMTreeMutationDetector {
original_node_document_version_(node_document_->DomTreeVersion()), original_node_document_version_(node_document_->DomTreeVersion()),
original_parent_document_version_(parent_document_->DomTreeVersion()) {} original_parent_document_version_(parent_document_->DomTreeVersion()) {}
bool HadAtMostOneDOMMutation() { bool NeedsRecheck() {
if (node_document_->DomTreeVersion() > original_node_document_version_ + 1) if (node_document_->DomTreeVersion() > original_node_document_version_ + 1)
return false; return false;
if (parent_document_ != parent_->GetDocument()) if (parent_document_ != parent_->GetDocument())
...@@ -397,7 +397,7 @@ Node* ContainerNode::InsertBefore(Node* new_child, ...@@ -397,7 +397,7 @@ Node* ContainerNode::InsertBefore(Node* new_child,
if (!CollectChildrenAndRemoveFromOldParent(*new_child, targets, if (!CollectChildrenAndRemoveFromOldParent(*new_child, targets,
exception_state)) exception_state))
return new_child; return new_child;
if (!detector.HadAtMostOneDOMMutation()) { if (!detector.NeedsRecheck()) {
if (!RecheckNodeInsertionStructuralPrereq(targets, ref_child, if (!RecheckNodeInsertionStructuralPrereq(targets, ref_child,
exception_state)) exception_state))
return new_child; return new_child;
...@@ -548,7 +548,7 @@ Node* ContainerNode::ReplaceChild(Node* new_child, ...@@ -548,7 +548,7 @@ Node* ContainerNode::ReplaceChild(Node* new_child,
new_child_parent->RemoveChild(new_child, exception_state); new_child_parent->RemoveChild(new_child, exception_state);
if (exception_state.HadException()) if (exception_state.HadException())
return nullptr; return nullptr;
if (!detector.HadAtMostOneDOMMutation()) if (!detector.NeedsRecheck())
needs_recheck = true; needs_recheck = true;
} }
...@@ -570,7 +570,7 @@ Node* ContainerNode::ReplaceChild(Node* new_child, ...@@ -570,7 +570,7 @@ Node* ContainerNode::ReplaceChild(Node* new_child,
old_child_parent->RemoveChild(old_child, exception_state); old_child_parent->RemoveChild(old_child, exception_state);
if (exception_state.HadException()) if (exception_state.HadException())
return nullptr; return nullptr;
if (!detector.HadAtMostOneDOMMutation()) if (!detector.NeedsRecheck())
needs_recheck = true; needs_recheck = true;
} }
...@@ -585,7 +585,7 @@ Node* ContainerNode::ReplaceChild(Node* new_child, ...@@ -585,7 +585,7 @@ Node* ContainerNode::ReplaceChild(Node* new_child,
if (!CollectChildrenAndRemoveFromOldParent(*new_child, targets, if (!CollectChildrenAndRemoveFromOldParent(*new_child, targets,
exception_state)) exception_state))
return old_child; return old_child;
if (!detector.HadAtMostOneDOMMutation() || needs_recheck) { if (!detector.NeedsRecheck() || needs_recheck) {
if (!RecheckNodeInsertionStructuralPrereq(targets, next, exception_state)) if (!RecheckNodeInsertionStructuralPrereq(targets, next, exception_state))
return old_child; return old_child;
} }
...@@ -837,7 +837,7 @@ Node* ContainerNode::AppendChild(Node* new_child, ...@@ -837,7 +837,7 @@ Node* ContainerNode::AppendChild(Node* new_child,
if (!CollectChildrenAndRemoveFromOldParent(*new_child, targets, if (!CollectChildrenAndRemoveFromOldParent(*new_child, targets,
exception_state)) exception_state))
return new_child; return new_child;
if (!detector.HadAtMostOneDOMMutation()) { if (!detector.NeedsRecheck()) {
if (!RecheckNodeInsertionStructuralPrereq(targets, nullptr, if (!RecheckNodeInsertionStructuralPrereq(targets, nullptr,
exception_state)) exception_state))
return new_child; return new_child;
......
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