OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 2 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 next = refChild->m_nextSibling; | 254 next = refChild->m_nextSibling; |
255 refChild->m_nextSibling = newChild; | 255 refChild->m_nextSibling = newChild; |
256 } else { | 256 } else { |
257 next = m_firstChild; | 257 next = m_firstChild; |
258 m_firstChild = newChild; | 258 m_firstChild = newChild; |
259 } | 259 } |
260 | 260 |
261 newChild->m_parent = this; | 261 newChild->m_parent = this; |
262 newChild->m_previousSibling = refChild; | 262 newChild->m_previousSibling = refChild; |
263 | 263 |
| 264 if (next) { |
| 265 ASSERT(next->m_previousSibling == refChild); |
| 266 next->m_previousSibling = newChild; |
| 267 newChild->m_nextSibling = next; |
| 268 } else { |
| 269 ASSERT(m_lastChild == refChild); |
| 270 m_lastChild = newChild; |
| 271 } |
| 272 |
264 if (!newChild->m_firstChild || newChild->m_hasResetType) { | 273 if (!newChild->m_firstChild || newChild->m_hasResetType) { |
265 newChild->m_nextSibling = next; | |
266 if (next) { | |
267 ASSERT(next->m_previousSibling == refChild); | |
268 next->m_previousSibling = newChild; | |
269 } else { | |
270 ASSERT(m_lastChild == refChild); | |
271 m_lastChild = newChild; | |
272 } | |
273 | |
274 newChild->m_countInParent = newChild->computeCountInParent(); | 274 newChild->m_countInParent = newChild->computeCountInParent(); |
275 newChild->resetThisAndDescendantsRenderers(); | 275 newChild->resetThisAndDescendantsRenderers(); |
276 if (next) | 276 if (next) |
277 next->recount(); | 277 next->recount(); |
278 return; | 278 return; |
279 } | 279 } |
280 // If the new child is the last in the sibling list we must set the parent's
lastChild. | |
281 if (!newChild->m_nextSibling) | |
282 m_lastChild = newChild; | |
283 | 280 |
284 // The code below handles the case when a formerly root increment counter is
loosing its root position | 281 // The code below handles the case when a formerly root increment counter is
loosing its root position |
285 // and therefore its children become next siblings. | 282 // and therefore its children become next siblings. |
286 CounterNode* last = newChild->m_lastChild; | 283 CounterNode* last = newChild->m_lastChild; |
287 CounterNode* first = newChild->m_firstChild; | 284 CounterNode* first = newChild->m_firstChild; |
288 | 285 |
289 if (first) { | 286 if (first) { |
290 ASSERT(last); | 287 ASSERT(last); |
291 newChild->m_nextSibling = first; | 288 newChild->m_nextSibling = first; |
292 if (m_lastChild == newChild) | 289 if (m_lastChild == newChild) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 376 |
380 #ifndef NDEBUG | 377 #ifndef NDEBUG |
381 | 378 |
382 void showCounterTree(const WebCore::CounterNode* counter) | 379 void showCounterTree(const WebCore::CounterNode* counter) |
383 { | 380 { |
384 if (counter) | 381 if (counter) |
385 showTreeAndMark(counter); | 382 showTreeAndMark(counter); |
386 } | 383 } |
387 | 384 |
388 #endif | 385 #endif |
OLD | NEW |