summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/ContainerNodeAlgorithms.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
commit3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch)
tree73dc228333948738bbe02976cacca8cd382bc978 /Source/WebCore/dom/ContainerNodeAlgorithms.cpp
parentb32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff)
downloadqtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/WebCore/dom/ContainerNodeAlgorithms.cpp')
-rw-r--r--Source/WebCore/dom/ContainerNodeAlgorithms.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/Source/WebCore/dom/ContainerNodeAlgorithms.cpp b/Source/WebCore/dom/ContainerNodeAlgorithms.cpp
index c8959dfb8..2edea30e0 100644
--- a/Source/WebCore/dom/ContainerNodeAlgorithms.cpp
+++ b/Source/WebCore/dom/ContainerNodeAlgorithms.cpp
@@ -34,16 +34,15 @@ namespace WebCore {
void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument(ContainerNode* node)
{
- NodeVector children;
- getChildNodes(node, children);
- for (size_t i = 0; i < children.size(); ++i) {
+ ChildNodesLazySnapshot snapshot(node);
+ while (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() && children[i]->parentNode() == node)
- notifyNodeInsertedIntoDocument(children[i].get());
+ if (node->inDocument() && child->parentNode() == node)
+ notifyNodeInsertedIntoDocument(child);
}
-
+
if (!node->isElementNode())
return;
@@ -67,14 +66,13 @@ void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree(ContainerNode*
void ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument(ContainerNode* node)
{
- NodeVector children;
- getChildNodes(node, children);
- for (size_t i = 0; i < children.size(); ++i) {
+ ChildNodesLazySnapshot snapshot(node);
+ while (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() && children[i]->parentNode() == node)
- notifyNodeRemovedFromDocument(children[i].get());
+ if (!node->inDocument() && child->parentNode() == node)
+ notifyNodeRemovedFromDocument(child);
}
if (!node->isElementNode())