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

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

Issue 342283005: Make collection caching code more consistent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Stop including NodeListsNodeData.h in ContainerNode.h Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/ContainerNode.cpp » ('j') | Source/core/dom/NodeListsNodeData.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 * 21 *
22 */ 22 */
23 23
24 #ifndef ContainerNode_h 24 #ifndef ContainerNode_h
25 #define ContainerNode_h 25 #define ContainerNode_h
26 26
27 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 27 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
28 #include "core/dom/Node.h" 28 #include "core/dom/Node.h"
29 #include "core/html/CollectionType.h"
29 #include "wtf/OwnPtr.h" 30 #include "wtf/OwnPtr.h"
30 #include "wtf/Vector.h" 31 #include "wtf/Vector.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 class ClassCollection; 35 class ClassCollection;
35 class ExceptionState; 36 class ExceptionState;
36 class FloatPoint; 37 class FloatPoint;
37 class HTMLCollection; 38 class HTMLCollection;
38 class StaticNodeList; 39 class StaticNodeList;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 protected: 179 protected:
179 ContainerNode(TreeScope*, ConstructionType = CreateContainer); 180 ContainerNode(TreeScope*, ConstructionType = CreateContainer);
180 181
181 #if !ENABLE(OILPAN) 182 #if !ENABLE(OILPAN)
182 void removeDetachedChildren(); 183 void removeDetachedChildren();
183 #endif 184 #endif
184 185
185 void setFirstChild(Node* child) { m_firstChild = child; } 186 void setFirstChild(Node* child) { m_firstChild = child; }
186 void setLastChild(Node* child) { m_lastChild = child; } 187 void setLastChild(Node* child) { m_lastChild = child; }
187 188
189 // Utility functions for NodeListsNodeData API.
190 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType);
191 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType, const AtomicString& name);
192 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType, const AtomicString& namespaceURI, const AtomicStrin g& localName);
193 template <typename Collection> Collection* cachedCollection(CollectionType);
194
188 private: 195 private:
196 NodeListsNodeData& ensureNodeLists();
189 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild); 197 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild);
190 void insertBeforeCommon(Node& nextChild, Node& oldChild); 198 void insertBeforeCommon(Node& nextChild, Node& oldChild);
191 void appendChildCommon(Node& child); 199 void appendChildCommon(Node& child);
192 void updateTreeAfterInsertion(Node& child); 200 void updateTreeAfterInsertion(Node& child);
193 void willRemoveChildren(); 201 void willRemoveChildren();
194 void willRemoveChild(Node& child); 202 void willRemoveChild(Node& child);
195 void removeDetachedChildrenInContainer(ContainerNode&); 203 void removeDetachedChildrenInContainer(ContainerNode&);
196 void addChildNodesToDeletionQueue(Node*&, Node*&, ContainerNode&); 204 void addChildNodesToDeletionQueue(Node*&, Node*&, ContainerNode&);
197 205
198 void notifyNodeInsertedInternal(Node&, NodeVector& postInsertionNotification Targets); 206 void notifyNodeInsertedInternal(Node&, NodeVector& postInsertionNotification Targets);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 inline void getChildNodes(Node& node, NodeVector& nodes) 327 inline void getChildNodes(Node& node, NodeVector& nodes)
320 { 328 {
321 ASSERT(!nodes.size()); 329 ASSERT(!nodes.size());
322 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 330 for (Node* child = node.firstChild(); child; child = child->nextSibling())
323 nodes.append(child); 331 nodes.append(child);
324 } 332 }
325 333
326 } // namespace blink 334 } // namespace blink
327 335
328 #endif // ContainerNode_h 336 #endif // ContainerNode_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/ContainerNode.cpp » ('j') | Source/core/dom/NodeListsNodeData.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698