diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/dom/ContainerNode.cpp | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/dom/ContainerNode.cpp')
-rw-r--r-- | Source/WebCore/dom/ContainerNode.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp index bc881c6..7424875 100644 --- a/Source/WebCore/dom/ContainerNode.cpp +++ b/Source/WebCore/dom/ContainerNode.cpp @@ -158,6 +158,7 @@ bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce InspectorInstrumentation::willInsertDOMNode(document(), child, this); #endif + child->setDocumentRecursively(document()); insertBeforeCommon(next.get(), child); // Send notification about the children change. @@ -306,6 +307,8 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce InspectorInstrumentation::willInsertDOMNode(document(), child.get(), this); #endif + child->setDocumentRecursively(document()); + // Add child after "prev". forbidEventDispatch(); Node* next; @@ -355,7 +358,8 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce void ContainerNode::willRemove() { - NodeVector nodes; + Vector<RefPtr<Node>, 10> nodes; + nodes.reserveInitialCapacity(childNodeCount()); for (Node* n = m_lastChild; n; n = n->previousSibling()) nodes.append(n); for (; nodes.size(); nodes.removeLast()) @@ -512,10 +516,11 @@ void ContainerNode::removeChildren() document()->removeFocusedNodeOfSubtree(this, true); forbidEventDispatch(); - Vector<RefPtr<Node> > removedChildren; + Vector<RefPtr<Node>, 10> removedChildren; + removedChildren.reserveInitialCapacity(childNodeCount()); while (RefPtr<Node> n = m_firstChild) { Node* next = n->nextSibling(); - + // Remove the node from the tree before calling detach or removedFromDocument (4427024, 4129744). // removeChild() does this after calling detach(). There is no explanation for // this discrepancy between removeChild() and its optimized version removeChildren(). @@ -592,6 +597,8 @@ bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bo InspectorInstrumentation::willInsertDOMNode(document(), child, this); #endif + child->setDocumentRecursively(document()); + // Append child to the end of the list forbidEventDispatch(); child->setParent(this); |