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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 2574773002: Migrate WTF::Vector::append() to ::push_back() [part 4 of N] (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 static inline void collectChildrenAndRemoveFromOldParent( 69 static inline void collectChildrenAndRemoveFromOldParent(
70 Node& node, 70 Node& node,
71 NodeVector& nodes, 71 NodeVector& nodes,
72 ExceptionState& exceptionState) { 72 ExceptionState& exceptionState) {
73 if (node.isDocumentFragment()) { 73 if (node.isDocumentFragment()) {
74 DocumentFragment& fragment = toDocumentFragment(node); 74 DocumentFragment& fragment = toDocumentFragment(node);
75 getChildNodes(fragment, nodes); 75 getChildNodes(fragment, nodes);
76 fragment.removeChildren(); 76 fragment.removeChildren();
77 return; 77 return;
78 } 78 }
79 nodes.append(&node); 79 nodes.push_back(&node);
80 if (ContainerNode* oldParent = node.parentNode()) 80 if (ContainerNode* oldParent = node.parentNode())
81 oldParent->removeChild(&node, exceptionState); 81 oldParent->removeChild(&node, exceptionState);
82 } 82 }
83 83
84 void ContainerNode::parserTakeAllChildrenFrom(ContainerNode& oldParent) { 84 void ContainerNode::parserTakeAllChildrenFrom(ContainerNode& oldParent) {
85 while (Node* child = oldParent.firstChild()) { 85 while (Node* child = oldParent.firstChild()) {
86 // Explicitly remove since appending can fail, but this loop shouldn't be 86 // Explicitly remove since appending can fail, but this loop shouldn't be
87 // infinite. 87 // infinite.
88 oldParent.parserRemoveChild(*child); 88 oldParent.parserRemoveChild(*child);
89 parserAppendChild(child); 89 parserAppendChild(child);
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 EventDispatchForbiddenScope assertNoEventDispatch; 721 EventDispatchForbiddenScope assertNoEventDispatch;
722 ScriptForbiddenScope forbidScript; 722 ScriptForbiddenScope forbidScript;
723 723
724 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { 724 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) {
725 // As an optimization we don't notify leaf nodes when when inserting 725 // As an optimization we don't notify leaf nodes when when inserting
726 // into detached subtrees that are not in a shadow tree. 726 // into detached subtrees that are not in a shadow tree.
727 if (!isConnected() && !isInShadowTree() && !node.isContainerNode()) 727 if (!isConnected() && !isInShadowTree() && !node.isContainerNode())
728 continue; 728 continue;
729 if (Node::InsertionShouldCallDidNotifySubtreeInsertions == 729 if (Node::InsertionShouldCallDidNotifySubtreeInsertions ==
730 node.insertedInto(this)) 730 node.insertedInto(this))
731 postInsertionNotificationTargets.append(&node); 731 postInsertionNotificationTargets.push_back(&node);
732 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; 732 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot;
733 shadowRoot = shadowRoot->olderShadowRoot()) 733 shadowRoot = shadowRoot->olderShadowRoot())
734 notifyNodeInsertedInternal(*shadowRoot, postInsertionNotificationTargets); 734 notifyNodeInsertedInternal(*shadowRoot, postInsertionNotificationTargets);
735 } 735 }
736 } 736 }
737 737
738 void ContainerNode::notifyNodeRemoved(Node& root) { 738 void ContainerNode::notifyNodeRemoved(Node& root) {
739 ScriptForbiddenScope forbidScript; 739 ScriptForbiddenScope forbidScript;
740 EventDispatchForbiddenScope assertNoEventDispatch; 740 EventDispatchForbiddenScope assertNoEventDispatch;
741 741
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 return true; 1469 return true;
1470 1470
1471 if (node->isElementNode() && toElement(node)->shadow()) 1471 if (node->isElementNode() && toElement(node)->shadow())
1472 return true; 1472 return true;
1473 1473
1474 return false; 1474 return false;
1475 } 1475 }
1476 #endif 1476 #endif
1477 1477
1478 } // namespace blink 1478 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/DOMStringList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698