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

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

Issue 17512006: Remove unused attachChildrenLazily method and make attach/detachChildren private (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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/Element.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 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 virtual void setActive(bool active = true, bool pause = false) OVERRIDE; 120 virtual void setActive(bool active = true, bool pause = false) OVERRIDE;
121 virtual void setHovered(bool = true) OVERRIDE; 121 virtual void setHovered(bool = true) OVERRIDE;
122 122
123 // ------------------------------------------------------------------------- ---- 123 // ------------------------------------------------------------------------- ----
124 // Notification of document structure changes (see core/dom/Node.h for more notification methods) 124 // Notification of document structure changes (see core/dom/Node.h for more notification methods)
125 125
126 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child 126 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child
127 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value. 127 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value.
128 virtual void childrenChanged(bool createdByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0); 128 virtual void childrenChanged(bool createdByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0);
129 129
130 void attachChildren(const AttachContext& = AttachContext());
131 void attachChildrenLazily();
132 void detachChildren(const AttachContext& = AttachContext());
133 void detachChildrenIfNeeded(const AttachContext& = AttachContext());
134
135 void disconnectDescendantFrames(); 130 void disconnectDescendantFrames();
136 131
137 virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const { return true; } 132 virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const { return true; }
138 133
139 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; 134 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
140 135
141 protected: 136 protected:
142 ContainerNode(TreeScope*, ConstructionType = CreateContainer); 137 ContainerNode(TreeScope*, ConstructionType = CreateContainer);
143 138
144 static void queuePostAttachCallback(NodeCallback, Node*); 139 static void queuePostAttachCallback(NodeCallback, Node*);
145 static bool postAttachCallbacksAreSuspended(); 140 static bool postAttachCallbacksAreSuspended();
146 141
147 template<class GenericNode, class GenericNodeContainer> 142 template<class GenericNode, class GenericNodeContainer>
148 friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* ); 143 friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* );
149 144
150 template<class GenericNode, class GenericNodeContainer> 145 template<class GenericNode, class GenericNodeContainer>
151 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi cNode*& tail, GenericNodeContainer*); 146 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi cNode*& tail, GenericNodeContainer*);
152 147
153 void removeDetachedChildren(); 148 void removeDetachedChildren();
154 void setFirstChild(Node* child) { m_firstChild = child; } 149 void setFirstChild(Node* child) { m_firstChild = child; }
155 void setLastChild(Node* child) { m_lastChild = child; } 150 void setLastChild(Node* child) { m_lastChild = child; }
156 151
157 private: 152 private:
158 void removeBetween(Node* previousChild, Node* nextChild, Node* oldChild); 153 void removeBetween(Node* previousChild, Node* nextChild, Node* oldChild);
159 void insertBeforeCommon(Node* nextChild, Node* oldChild); 154 void insertBeforeCommon(Node* nextChild, Node* oldChild);
160 155
156 void attachChildren(const AttachContext& = AttachContext());
157 void detachChildren(const AttachContext& = AttachContext());
158
161 static void dispatchPostAttachCallbacks(); 159 static void dispatchPostAttachCallbacks();
162 160
163 void suspendPostAttachCallbacks(); 161 void suspendPostAttachCallbacks();
164 void resumePostAttachCallbacks(); 162 void resumePostAttachCallbacks();
165 163
166 bool getUpperLeftCorner(FloatPoint&) const; 164 bool getUpperLeftCorner(FloatPoint&) const;
167 bool getLowerRightCorner(FloatPoint&) const; 165 bool getLowerRightCorner(FloatPoint&) const;
168 166
169 Node* m_firstChild; 167 Node* m_firstChild;
170 Node* m_lastChild; 168 Node* m_lastChild;
(...skipping 30 matching lines...) Expand all
201 AttachContext childrenContext(context); 199 AttachContext childrenContext(context);
202 childrenContext.resolvedStyle = 0; 200 childrenContext.resolvedStyle = 0;
203 201
204 for (Node* child = firstChild(); child; child = child->nextSibling()) { 202 for (Node* child = firstChild(); child; child = child->nextSibling()) {
205 ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(t his)); 203 ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(t his));
206 if (!child->attached()) 204 if (!child->attached())
207 child->attach(childrenContext); 205 child->attach(childrenContext);
208 } 206 }
209 } 207 }
210 208
211 inline void ContainerNode::attachChildrenLazily()
212 {
213 for (Node* child = firstChild(); child; child = child->nextSibling())
214 if (!child->attached())
215 child->lazyAttach();
216 }
217
218 inline void ContainerNode::detachChildrenIfNeeded(const AttachContext& context)
219 {
220 AttachContext childrenContext(context);
221 childrenContext.resolvedStyle = 0;
222
223 for (Node* child = firstChild(); child; child = child->nextSibling()) {
224 if (child->attached())
225 child->detach(childrenContext);
226 }
227 }
228
229 inline void ContainerNode::detachChildren(const AttachContext& context) 209 inline void ContainerNode::detachChildren(const AttachContext& context)
230 { 210 {
231 AttachContext childrenContext(context); 211 AttachContext childrenContext(context);
232 childrenContext.resolvedStyle = 0; 212 childrenContext.resolvedStyle = 0;
233 213
234 for (Node* child = firstChild(); child; child = child->nextSibling()) 214 for (Node* child = firstChild(); child; child = child->nextSibling())
235 child->detach(childrenContext); 215 child->detach(childrenContext);
236 } 216 }
237 217
238 inline unsigned Node::childNodeCount() const 218 inline unsigned Node::childNodeCount() const
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 m_node->resumePostAttachCallbacks(); 344 m_node->resumePostAttachCallbacks();
365 } 345 }
366 346
367 private: 347 private:
368 ContainerNode* m_node; 348 ContainerNode* m_node;
369 }; 349 };
370 350
371 } // namespace WebCore 351 } // namespace WebCore
372 352
373 #endif // ContainerNode_h 353 #endif // ContainerNode_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698