From ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Thu, 8 Jul 2010 12:51:48 +0100 Subject: Merge WebKit at r62496: Initial merge by git Change-Id: Ie3da0770eca22a70a632e3571f31cfabc80facb2 --- WebCore/dom/ContainerNode.cpp | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'WebCore/dom/ContainerNode.cpp') diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp index fddccdd..6539e5b 100644 --- a/WebCore/dom/ContainerNode.cpp +++ b/WebCore/dom/ContainerNode.cpp @@ -537,7 +537,31 @@ bool ContainerNode::appendChild(PassRefPtr newChild, ExceptionCode& ec, bo return true; } -ContainerNode* ContainerNode::addChild(PassRefPtr newChild) +void ContainerNode::addChildCommon(Node* newChild) +{ + ASSERT(!newChild->parent()); // Use appendChild if you need to handle reparenting. + forbidEventDispatch(); + Node* last = m_lastChild; + // FIXME: This method should take a PassRefPtr. + appendChildToContainer(newChild, this); + allowEventDispatch(); + + document()->incDOMTreeVersion(); + if (inDocument()) + newChild->insertedIntoDocument(); + childrenChanged(true, last, 0, 1); +} + +void ContainerNode::parserAddChild(PassRefPtr newChild) +{ + ASSERT(newChild); + // This function is only used during parsing. + // It does not send any DOM mutation events or handle reparenting. + + addChildCommon(newChild.get()); +} + +ContainerNode* ContainerNode::legacyParserAddChild(PassRefPtr newChild) { ASSERT(newChild); // This function is only used during parsing. @@ -547,16 +571,8 @@ ContainerNode* ContainerNode::addChild(PassRefPtr newChild) if (document()->isHTMLDocument() && !childAllowed(newChild.get())) return 0; - forbidEventDispatch(); - Node* last = m_lastChild; - appendChildToContainer(newChild.get(), this); - allowEventDispatch(); + addChildCommon(newChild.get()); - document()->incDOMTreeVersion(); - if (inDocument()) - newChild->insertedIntoDocument(); - childrenChanged(true, last, 0, 1); - if (newChild->isElementNode()) return static_cast(newChild.get()); return this; -- cgit v1.1