OLD | NEW |
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 Loading... |
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(); | 130 void attachChildren(const AttachContext& = AttachContext()); |
131 void attachChildrenLazily(); | 131 void attachChildrenLazily(); |
132 void detachChildren(); | 132 void detachChildren(const AttachContext& = AttachContext()); |
133 void detachChildrenIfNeeded(); | 133 void detachChildrenIfNeeded(const AttachContext& = AttachContext()); |
134 | 134 |
135 void disconnectDescendantFrames(); | 135 void disconnectDescendantFrames(); |
136 | 136 |
137 virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const {
return true; } | 137 virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const {
return true; } |
138 | 138 |
139 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 139 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |
140 | 140 |
141 protected: | 141 protected: |
142 ContainerNode(TreeScope*, ConstructionType = CreateContainer); | 142 ContainerNode(TreeScope*, ConstructionType = CreateContainer); |
143 | 143 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // This will catch anyone doing an unnecessary cast. | 189 // This will catch anyone doing an unnecessary cast. |
190 void toContainerNode(const ContainerNode*); | 190 void toContainerNode(const ContainerNode*); |
191 | 191 |
192 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) | 192 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) |
193 : Node(treeScope, type) | 193 : Node(treeScope, type) |
194 , m_firstChild(0) | 194 , m_firstChild(0) |
195 , m_lastChild(0) | 195 , m_lastChild(0) |
196 { | 196 { |
197 } | 197 } |
198 | 198 |
199 inline void ContainerNode::attachChildren() | 199 inline void ContainerNode::attachChildren(const AttachContext& context) |
200 { | 200 { |
| 201 AttachContext childrenContext(context); |
| 202 childrenContext.resolvedStyle = 0; |
| 203 |
201 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 204 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
202 ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(t
his)); | 205 ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(t
his)); |
203 if (!child->attached()) | 206 if (!child->attached()) |
204 child->attach(); | 207 child->attach(childrenContext); |
205 } | 208 } |
206 } | 209 } |
207 | 210 |
208 inline void ContainerNode::attachChildrenLazily() | 211 inline void ContainerNode::attachChildrenLazily() |
209 { | 212 { |
210 for (Node* child = firstChild(); child; child = child->nextSibling()) | 213 for (Node* child = firstChild(); child; child = child->nextSibling()) |
211 if (!child->attached()) | 214 if (!child->attached()) |
212 child->lazyAttach(); | 215 child->lazyAttach(); |
213 } | 216 } |
214 | 217 |
215 inline void ContainerNode::detachChildrenIfNeeded() | 218 inline void ContainerNode::detachChildrenIfNeeded(const AttachContext& context) |
216 { | 219 { |
| 220 AttachContext childrenContext(context); |
| 221 childrenContext.resolvedStyle = 0; |
| 222 |
217 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 223 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
218 if (child->attached()) | 224 if (child->attached()) |
219 child->detach(); | 225 child->detach(childrenContext); |
220 } | 226 } |
221 } | 227 } |
222 | 228 |
223 inline void ContainerNode::detachChildren() | 229 inline void ContainerNode::detachChildren(const AttachContext& context) |
224 { | 230 { |
| 231 AttachContext childrenContext(context); |
| 232 childrenContext.resolvedStyle = 0; |
| 233 |
225 for (Node* child = firstChild(); child; child = child->nextSibling()) | 234 for (Node* child = firstChild(); child; child = child->nextSibling()) |
226 child->detach(); | 235 child->detach(childrenContext); |
227 } | 236 } |
228 | 237 |
229 inline unsigned Node::childNodeCount() const | 238 inline unsigned Node::childNodeCount() const |
230 { | 239 { |
231 if (!isContainerNode()) | 240 if (!isContainerNode()) |
232 return 0; | 241 return 0; |
233 return toContainerNode(this)->childNodeCount(); | 242 return toContainerNode(this)->childNodeCount(); |
234 } | 243 } |
235 | 244 |
236 inline Node* Node::childNode(unsigned index) const | 245 inline Node* Node::childNode(unsigned index) const |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 m_node->resumePostAttachCallbacks(); | 364 m_node->resumePostAttachCallbacks(); |
356 } | 365 } |
357 | 366 |
358 private: | 367 private: |
359 ContainerNode* m_node; | 368 ContainerNode* m_node; |
360 }; | 369 }; |
361 | 370 |
362 } // namespace WebCore | 371 } // namespace WebCore |
363 | 372 |
364 #endif // ContainerNode_h | 373 #endif // ContainerNode_h |
OLD | NEW |