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

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

Issue 24430002: Rename attach and detach to createRenderTree/destroyRenderTree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/Node.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 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // However, arbitrary code may be run by beforeload handlers. 106 // However, arbitrary code may be run by beforeload handlers.
107 void parserAppendChild(PassRefPtr<Node>); 107 void parserAppendChild(PassRefPtr<Node>);
108 void parserRemoveChild(Node*); 108 void parserRemoveChild(Node*);
109 void parserInsertBefore(PassRefPtr<Node> newChild, Node* refChild); 109 void parserInsertBefore(PassRefPtr<Node> newChild, Node* refChild);
110 110
111 void removeChildren(); 111 void removeChildren();
112 void takeAllChildrenFrom(ContainerNode*); 112 void takeAllChildrenFrom(ContainerNode*);
113 113
114 void cloneChildNodes(ContainerNode* clone); 114 void cloneChildNodes(ContainerNode* clone);
115 115
116 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; 116 virtual void createRenderTree(const AttachContext& = AttachContext()) OVERRI DE;
117 virtual void detach(const AttachContext& = AttachContext()) OVERRIDE; 117 virtual void destroyRenderTree(const AttachContext& = AttachContext()) OVERR IDE;
118 virtual LayoutRect boundingBox() const OVERRIDE; 118 virtual LayoutRect boundingBox() const OVERRIDE;
119 virtual void setFocus(bool) OVERRIDE; 119 virtual void setFocus(bool) OVERRIDE;
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.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // This will catch anyone doing an unnecessary cast. 177 // This will catch anyone doing an unnecessary cast.
178 void toContainerNode(const ContainerNode*); 178 void toContainerNode(const ContainerNode*);
179 179
180 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) 180 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type)
181 : Node(treeScope, type) 181 : Node(treeScope, type)
182 , m_firstChild(0) 182 , m_firstChild(0)
183 , m_lastChild(0) 183 , m_lastChild(0)
184 { 184 {
185 } 185 }
186 186
187 inline void ContainerNode::attachChildren(const AttachContext& context)
188 {
189 AttachContext childrenContext(context);
190 childrenContext.resolvedStyle = 0;
191
192 for (Node* child = firstChild(); child; child = child->nextSibling()) {
193 ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(t his));
194 if (!child->attached())
195 child->attach(childrenContext);
196 }
197 }
198
199 inline void ContainerNode::detachChildren(const AttachContext& context)
200 {
201 AttachContext childrenContext(context);
202 childrenContext.resolvedStyle = 0;
203
204 for (Node* child = firstChild(); child; child = child->nextSibling())
205 child->detach(childrenContext);
206 }
207
208 inline unsigned Node::childNodeCount() const 187 inline unsigned Node::childNodeCount() const
209 { 188 {
210 if (!isContainerNode()) 189 if (!isContainerNode())
211 return 0; 190 return 0;
212 return toContainerNode(this)->childNodeCount(); 191 return toContainerNode(this)->childNodeCount();
213 } 192 }
214 193
215 inline Node* Node::childNode(unsigned index) const 194 inline Node* Node::childNode(unsigned index) const
216 { 195 {
217 if (!isContainerNode()) 196 if (!isContainerNode())
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 295
317 RefPtr<Node> m_currentNode; 296 RefPtr<Node> m_currentNode;
318 unsigned m_currentIndex; 297 unsigned m_currentIndex;
319 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. 298 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated.
320 ChildNodesLazySnapshot* m_nextSnapshot; 299 ChildNodesLazySnapshot* m_nextSnapshot;
321 }; 300 };
322 301
323 } // namespace WebCore 302 } // namespace WebCore
324 303
325 #endif // ContainerNode_h 304 #endif // ContainerNode_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/ContainerNode.cpp » ('j') | Source/core/dom/Node.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698