diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-25 13:02:02 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-25 13:02:02 +0200 |
commit | 715be629d51174233403237bfc563cf150087dc8 (patch) | |
tree | 4cff72df808db977624338b0a38d8b6d1bd73c57 /Source/WebCore/dom/ContainerNode.cpp | |
parent | dc6262b587c71c14e30d93e57ed812e36a79a33e (diff) | |
download | qtwebkit-715be629d51174233403237bfc563cf150087dc8.tar.gz |
Imported WebKit commit ce614b0924ba46f78d4435e28ff93c8525fbb7cc (http://svn.webkit.org/repository/webkit/trunk@129485)
New snapshot that includes MingW build fixes
Diffstat (limited to 'Source/WebCore/dom/ContainerNode.cpp')
-rw-r--r-- | Source/WebCore/dom/ContainerNode.cpp | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp index cd118f17d..dafee6077 100644 --- a/Source/WebCore/dom/ContainerNode.cpp +++ b/Source/WebCore/dom/ContainerNode.cpp @@ -419,15 +419,15 @@ bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec) return false; } - RenderWidget::suspendWidgetHierarchyUpdates(); - - Node* prev = child->previousSibling(); - Node* next = child->nextSibling(); - removeBetween(prev, next, child.get()); - childrenChanged(false, prev, next, -1); - ChildNodeRemovalNotifier(this).notify(child.get()); - - RenderWidget::resumeWidgetHierarchyUpdates(); + { + WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; + + Node* prev = child->previousSibling(); + Node* next = child->nextSibling(); + removeBetween(prev, next, child.get()); + childrenChanged(false, prev, next, -1); + ChildNodeRemovalNotifier(this).notify(child.get()); + } dispatchSubtreeModifiedEvent(); return child; @@ -497,49 +497,50 @@ void ContainerNode::removeChildren() // and remove... e.g. stop loading frames, fire unload events. willRemoveChildren(protect.get()); - RenderWidget::suspendWidgetHierarchyUpdates(); - forbidEventDispatch(); 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(). - n->setPreviousSibling(0); - n->setNextSibling(0); - n->setParentOrHostNode(0); - document()->adoptIfNeeded(n.get()); - - m_firstChild = next; - if (n == m_lastChild) - m_lastChild = 0; - removedChildren.append(n.release()); - } + { + WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; + forbidEventDispatch(); + 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(). + n->setPreviousSibling(0); + n->setNextSibling(0); + n->setParentOrHostNode(0); + document()->adoptIfNeeded(n.get()); + + m_firstChild = next; + if (n == m_lastChild) + m_lastChild = 0; + removedChildren.append(n.release()); + } - size_t removedChildrenCount = removedChildren.size(); - size_t i; - - // Detach the nodes only after properly removed from the tree because - // a. detaching requires a proper DOM tree (for counters and quotes for - // example) and during the previous loop the next sibling still points to - // the node being removed while the node being removed does not point back - // and does not point to the same parent as its next sibling. - // b. destroying Renderers of standalone nodes is sometimes faster. - for (i = 0; i < removedChildrenCount; ++i) { - Node* removedChild = removedChildren[i].get(); - if (removedChild->attached()) - removedChild->detach(); - } + size_t removedChildrenCount = removedChildren.size(); + size_t i; + + // Detach the nodes only after properly removed from the tree because + // a. detaching requires a proper DOM tree (for counters and quotes for + // example) and during the previous loop the next sibling still points to + // the node being removed while the node being removed does not point back + // and does not point to the same parent as its next sibling. + // b. destroying Renderers of standalone nodes is sometimes faster. + for (i = 0; i < removedChildrenCount; ++i) { + Node* removedChild = removedChildren[i].get(); + if (removedChild->attached()) + removedChild->detach(); + } - childrenChanged(false, 0, 0, -static_cast<int>(removedChildrenCount)); + childrenChanged(false, 0, 0, -static_cast<int>(removedChildrenCount)); - for (i = 0; i < removedChildrenCount; ++i) - ChildNodeRemovalNotifier(this).notify(removedChildren[i].get()); + for (i = 0; i < removedChildrenCount; ++i) + ChildNodeRemovalNotifier(this).notify(removedChildren[i].get()); - allowEventDispatch(); - RenderWidget::resumeWidgetHierarchyUpdates(); + allowEventDispatch(); + } dispatchSubtreeModifiedEvent(); } |