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

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: Fix nits Created 6 years, 4 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') | no next file with comments »
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 181
181 void invalidateNodeListCachesInAncestors(const QualifiedName* attrName = 0, Element* attributeOwnerElement = 0); 182 void invalidateNodeListCachesInAncestors(const QualifiedName* attrName = 0, Element* attributeOwnerElement = 0);
182 183
183 #if !ENABLE(OILPAN) 184 #if !ENABLE(OILPAN)
184 void removeDetachedChildren(); 185 void removeDetachedChildren();
185 #endif 186 #endif
186 187
187 void setFirstChild(Node* child) { m_firstChild = child; } 188 void setFirstChild(Node* child) { m_firstChild = child; }
188 void setLastChild(Node* child) { m_lastChild = child; } 189 void setLastChild(Node* child) { m_lastChild = child; }
189 190
191 // Utility functions for NodeListsNodeData API.
192 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType);
193 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType, const AtomicString& name);
194 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType, const AtomicString& namespaceURI, const AtomicStrin g& localName);
195 template <typename Collection> Collection* cachedCollection(CollectionType);
196
190 private: 197 private:
191 bool isContainerNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. 198 bool isContainerNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check.
192 bool isTextNode() const WTF_DELETED_FUNCTION; // This will catch anyone doin g an unnecessary check. 199 bool isTextNode() const WTF_DELETED_FUNCTION; // This will catch anyone doin g an unnecessary check.
193 200
201 NodeListsNodeData& ensureNodeLists();
194 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild); 202 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild);
195 void insertBeforeCommon(Node& nextChild, Node& oldChild); 203 void insertBeforeCommon(Node& nextChild, Node& oldChild);
196 void appendChildCommon(Node& child); 204 void appendChildCommon(Node& child);
197 void updateTreeAfterInsertion(Node& child); 205 void updateTreeAfterInsertion(Node& child);
198 void willRemoveChildren(); 206 void willRemoveChildren();
199 void willRemoveChild(Node& child); 207 void willRemoveChild(Node& child);
200 void removeDetachedChildrenInContainer(ContainerNode&); 208 void removeDetachedChildrenInContainer(ContainerNode&);
201 void addChildNodesToDeletionQueue(Node*&, Node*&, ContainerNode&); 209 void addChildNodesToDeletionQueue(Node*&, Node*&, ContainerNode&);
202 210
203 void notifyNodeInsertedInternal(Node&, NodeVector& postInsertionNotification Targets); 211 void notifyNodeInsertedInternal(Node&, NodeVector& postInsertionNotification Targets);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 inline void getChildNodes(Node& node, NodeVector& nodes) 332 inline void getChildNodes(Node& node, NodeVector& nodes)
325 { 333 {
326 ASSERT(!nodes.size()); 334 ASSERT(!nodes.size());
327 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 335 for (Node* child = node.firstChild(); child; child = child->nextSibling())
328 nodes.append(child); 336 nodes.append(child);
329 } 337 }
330 338
331 } // namespace blink 339 } // namespace blink
332 340
333 #endif // ContainerNode_h 341 #endif // ContainerNode_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698