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

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

Issue 2317573003: Introduce ContainerNode::insertNodeVector() to share code in insertBefore(), appendChild(), and rep… (Closed)
Patch Set: Created 4 years, 3 months 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, 2009, 2010, 2011, 2013 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All r ights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 template <typename Collection> Collection* ensureCachedCollection(Collection Type, const AtomicString& name); 235 template <typename Collection> Collection* ensureCachedCollection(Collection Type, const AtomicString& name);
236 template <typename Collection> Collection* ensureCachedCollection(Collection Type, const AtomicString& namespaceURI, const AtomicString& localName); 236 template <typename Collection> Collection* ensureCachedCollection(Collection Type, const AtomicString& namespaceURI, const AtomicString& localName);
237 template <typename Collection> Collection* cachedCollection(CollectionType); 237 template <typename Collection> Collection* cachedCollection(CollectionType);
238 238
239 private: 239 private:
240 bool isContainerNode() const = delete; // This will catch anyone doing an un necessary check. 240 bool isContainerNode() const = delete; // This will catch anyone doing an un necessary check.
241 bool isTextNode() const = delete; // This will catch anyone doing an unneces sary check. 241 bool isTextNode() const = delete; // This will catch anyone doing an unneces sary check.
242 242
243 NodeListsNodeData& ensureNodeLists(); 243 NodeListsNodeData& ensureNodeLists();
244 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild); 244 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild);
245 void insertBeforeCommon(Node& nextChild, Node& oldChild); 245 void insertNodeVector(const NodeVector&, Node* next, bool (ContainerNode::*m utator)(Node& child, Node* next));
246 bool insertBeforeCommonWithAdoption(Node& newChild, Node* nextChild);
247 bool appendChildCommonWithAdoption(Node& newChild, Node* ignored);
248 void insertBeforeCommon(Node& nextChild, Node& newChild);
246 void appendChildCommon(Node& child); 249 void appendChildCommon(Node& child);
247 void updateTreeAfterInsertion(Node& child); 250 void updateTreeAfterInsertion(Node& child);
248 void willRemoveChildren(); 251 void willRemoveChildren();
249 void willRemoveChild(Node& child); 252 void willRemoveChild(Node& child);
250 void removeDetachedChildrenInContainer(ContainerNode&); 253 void removeDetachedChildrenInContainer(ContainerNode&);
251 void addChildNodesToDeletionQueue(Node*&, Node*&, ContainerNode&); 254 void addChildNodesToDeletionQueue(Node*&, Node*&, ContainerNode&);
252 255
253 void notifyNodeInserted(Node&, ChildrenChangeSource = ChildrenChangeSourceAP I); 256 void notifyNodeInserted(Node&, ChildrenChangeSource = ChildrenChangeSourceAP I);
254 void notifyNodeInsertedInternal(Node&, NodeVector& postInsertionNotification Targets); 257 void notifyNodeInsertedInternal(Node&, NodeVector& postInsertionNotification Targets);
255 void notifyNodeRemoved(Node&); 258 void notifyNodeRemoved(Node&);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) 349 inline void getChildNodes(ContainerNode& node, NodeVector& nodes)
347 { 350 {
348 DCHECK(!nodes.size()); 351 DCHECK(!nodes.size());
349 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 352 for (Node* child = node.firstChild(); child; child = child->nextSibling())
350 nodes.append(child); 353 nodes.append(child);
351 } 354 }
352 355
353 } // namespace blink 356 } // namespace blink
354 357
355 #endif // ContainerNode_h 358 #endif // ContainerNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698