OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 template<class GenericNode, class GenericNodeContainer> | 156 template<class GenericNode, class GenericNodeContainer> |
157 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, Ge
nericNodeContainer* container) | 157 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, Ge
nericNodeContainer* container) |
158 { | 158 { |
159 // We have to tell all children that their parent has died. | 159 // We have to tell all children that their parent has died. |
160 GenericNode* next = 0; | 160 GenericNode* next = 0; |
161 for (GenericNode* n = container->firstChild(); n != 0; n = next) { | 161 for (GenericNode* n = container->firstChild(); n != 0; n = next) { |
162 ASSERT(!n->m_deletionHasBegun); | 162 ASSERT(!n->m_deletionHasBegun); |
163 | 163 |
164 next = n->nextSibling(); | 164 next = n->nextSibling(); |
165 n->setPreviousSibling(0); | |
166 n->setNextSibling(0); | 165 n->setNextSibling(0); |
167 n->setParentOrShadowHostNode(0); | 166 n->setParentOrShadowHostNode(0); |
| 167 container->setFirstChild(next); |
| 168 if (next) |
| 169 next->setPreviousSibling(0); |
168 | 170 |
169 if (!n->refCount()) { | 171 if (!n->refCount()) { |
170 #ifndef NDEBUG | 172 #ifndef NDEBUG |
171 n->m_deletionHasBegun = true; | 173 n->m_deletionHasBegun = true; |
172 #endif | 174 #endif |
173 // Add the node to the list of nodes to be deleted. | 175 // Add the node to the list of nodes to be deleted. |
174 // Reuse the nextSibling pointer for this purpose. | 176 // Reuse the nextSibling pointer for this purpose. |
175 if (tail) | 177 if (tail) |
176 tail->setNextSibling(n); | 178 tail->setNextSibling(n); |
177 else | 179 else |
178 head = n; | 180 head = n; |
179 | 181 |
180 tail = n; | 182 tail = n; |
181 } else { | 183 } else { |
182 RefPtr<GenericNode> protect(n); // removedFromDocument may remov
e remove all references to this node. | 184 RefPtr<GenericNode> protect(n); // removedFromDocument may remov
e remove all references to this node. |
183 NodeRemovalDispatcher<GenericNode, GenericNodeContainer, ShouldD
ispatchRemovalNotification<GenericNode>::value>::dispatch(n, container); | 185 NodeRemovalDispatcher<GenericNode, GenericNodeContainer, ShouldD
ispatchRemovalNotification<GenericNode>::value>::dispatch(n, container); |
184 } | 186 } |
185 } | 187 } |
186 | 188 |
187 container->setFirstChild(0); | |
188 container->setLastChild(0); | 189 container->setLastChild(0); |
189 } | 190 } |
190 | 191 |
191 } // namespace Private | 192 } // namespace Private |
192 | 193 |
193 inline void ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument(Node* nod
e) | 194 inline void ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument(Node* nod
e) |
194 { | 195 { |
195 ASSERT(m_insertionPoint->inDocument()); | 196 ASSERT(m_insertionPoint->inDocument()); |
196 RefPtr<Node> protect(node); | 197 RefPtr<Node> protect(node); |
197 if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node->insertedInt
o(m_insertionPoint)) | 198 if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node->insertedInt
o(m_insertionPoint)) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 for (Node* child = m_root->firstChild(); child; child = child->nextSibli
ng()) | 334 for (Node* child = m_root->firstChild(); child; child = child->nextSibli
ng()) |
334 collectFrameOwners(child); | 335 collectFrameOwners(child); |
335 } | 336 } |
336 | 337 |
337 disconnectCollectedFrameOwners(); | 338 disconnectCollectedFrameOwners(); |
338 } | 339 } |
339 | 340 |
340 } // namespace WebCore | 341 } // namespace WebCore |
341 | 342 |
342 #endif // ContainerNodeAlgorithms_h | 343 #endif // ContainerNodeAlgorithms_h |
OLD | NEW |