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

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

Issue 329703002: Merge appendChildToContainer into ContainerNode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: try again Created 6 years, 6 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
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/ContainerNodeAlgorithms.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index fed648dbb0002f7a4a4f906e439df3f33500c162..837a135f602df0890efc15cd5b3961e536ee53b3 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -271,6 +271,20 @@ void ContainerNode::insertBeforeCommon(Node& nextChild, Node& newChild)
newChild.setNextSibling(&nextChild);
}
+void ContainerNode::appendChildCommon(Node& child)
+{
+ child.setParentOrShadowHostNode(this);
+
+ if (m_lastChild) {
+ child.setPreviousSibling(m_lastChild);
+ m_lastChild->setNextSibling(&child);
+ } else {
+ setFirstChild(&child);
+ }
+
+ setLastChild(&child);
+}
+
void ContainerNode::parserInsertBefore(PassRefPtrWillBeRawPtr<Node> newChild, Node& nextChild)
{
ASSERT(newChild);
@@ -374,7 +388,7 @@ void ContainerNode::replaceChild(PassRefPtrWillBeRawPtr<Node> newChild, Node* ol
if (next)
insertBeforeCommon(*next, child);
else
- appendChildToContainer(child, *this);
+ appendChildCommon(child);
}
updateTreeAfterInsertion(child);
@@ -622,7 +636,7 @@ void ContainerNode::appendChild(PassRefPtrWillBeRawPtr<Node> newChild, Exception
ScriptForbiddenScope forbidScript;
treeScope().adoptIfNeeded(child);
- appendChildToContainer(child, *this);
+ appendChildCommon(child);
}
updateTreeAfterInsertion(child);
@@ -648,8 +662,7 @@ void ContainerNode::parserAppendChild(PassRefPtrWillBeRawPtr<Node> newChild)
ScriptForbiddenScope forbidScript;
treeScope().adoptIfNeeded(*newChild);
- // FIXME: This method should take a PassRefPtr.
- appendChildToContainer(*newChild, *this);
+ appendChildCommon(*newChild);
newChild->updateAncestorConnectedSubframeCountForInsertion();
ChildListMutationScope(*this).childAdded(*newChild);
}
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/ContainerNodeAlgorithms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698