Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Unified Diff: Source/core/dom/ContainerNodeAlgorithms.cpp

Issue 49153006: Have ContainerNodeAlgorithms deal with references instead of pointers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/ContainerNodeAlgorithms.cpp
diff --git a/Source/core/dom/ContainerNodeAlgorithms.cpp b/Source/core/dom/ContainerNodeAlgorithms.cpp
index ab67eefcd5e218c05f0d49a1a4ff93326cbdba6d..afcb4ca9aa9b0f41505411d3c9fb20d0d2487b57 100644
--- a/Source/core/dom/ContainerNodeAlgorithms.cpp
+++ b/Source/core/dom/ContainerNodeAlgorithms.cpp
@@ -42,80 +42,80 @@ public:
}
};
-void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument(ContainerNode* node)
+void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument(ContainerNode& node)
{
ChildNodesLazySnapshot snapshot(node);
while (RefPtr<Node> child = snapshot.nextNode()) {
// If we have been removed from the document during this loop, then
// we don't want to tell the rest of our children that they've been
// inserted into the document because they haven't.
- if (node->inDocument() && child->parentNode() == node)
- notifyNodeInsertedIntoDocument(child.get());
+ if (node.inDocument() && child->parentNode() == node)
+ notifyNodeInsertedIntoDocument(*child);
}
- if (!node->isElementNode())
+ if (!node.isElementNode())
return;
- if (ElementShadow* shadow = toElement(node)->shadow()) {
+ if (ElementShadow* shadow = toElement(node).shadow()) {
ShadowRootVector roots(shadow);
for (size_t i = 0; i < roots.size(); ++i) {
- if (node->inDocument() && roots[i]->host() == node)
- notifyNodeInsertedIntoDocument(roots[i].get());
+ if (node.inDocument() && roots[i]->host() == node)
+ notifyNodeInsertedIntoDocument(*roots[i]);
}
}
}
-void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree(ContainerNode* node)
+void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree(ContainerNode& node)
{
- for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
+ for (Node* child = node.firstChild(); child; child = child->nextSibling()) {
if (child->isContainerNode())
- notifyNodeInsertedIntoTree(toContainerNode(child));
+ notifyNodeInsertedIntoTree(toContainerNode(*child));
}
- for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->olderShadowRoot())
- notifyNodeInsertedIntoTree(root);
+ for (ShadowRoot* root = node.youngestShadowRoot(); root; root = root->olderShadowRoot())
+ notifyNodeInsertedIntoTree(*root);
}
-void ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument(ContainerNode* node)
+void ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument(ContainerNode& node)
{
ChildNodesLazySnapshot snapshot(node);
while (RefPtr<Node> child = snapshot.nextNode()) {
// If we have been added to the document during this loop, then we
// don't want to tell the rest of our children that they've been
// removed from the document because they haven't.
- if (!node->inDocument() && child->parentNode() == node)
- notifyNodeRemovedFromDocument(child.get());
+ if (!node.inDocument() && child->parentNode() == node)
+ notifyNodeRemovedFromDocument(*child);
}
- if (!node->isElementNode())
+ if (!node.isElementNode())
return;
- if (node->document().cssTarget() == node)
- node->document().setCSSTarget(0);
+ if (node.document().cssTarget() == node)
+ node.document().setCSSTarget(0);
- if (ElementShadow* shadow = toElement(node)->shadow()) {
+ if (ElementShadow* shadow = toElement(node).shadow()) {
ShadowRootVector roots(shadow);
for (size_t i = 0; i < roots.size(); ++i) {
- if (!node->inDocument() && roots[i]->host() == node)
- notifyNodeRemovedFromDocument(roots[i].get());
+ if (!node.inDocument() && roots[i]->host() == node)
+ notifyNodeRemovedFromDocument(*roots[i]);
}
}
}
-void ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree(ContainerNode* node)
+void ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree(ContainerNode& node)
{
- for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
+ for (Node* child = node.firstChild(); child; child = child->nextSibling()) {
if (child->isContainerNode())
- notifyNodeRemovedFromTree(toContainerNode(child));
+ notifyNodeRemovedFromTree(toContainerNode(*child));
}
- if (!node->isElementNode())
+ if (!node.isElementNode())
return;
- if (ElementShadow* shadow = toElement(node)->shadow()) {
+ if (ElementShadow* shadow = toElement(node).shadow()) {
ShadowRootVector roots(shadow);
for (size_t i = 0; i < roots.size(); ++i)
- notifyNodeRemovedFromTree(roots[i].get());
+ notifyNodeRemovedFromTree(*roots[i]);
}
}

Powered by Google App Engine
This is Rietveld 408576698