| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 2 * Copyright (C) 2004 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } | 271 } |
| 272 | 272 |
| 273 static void destroyCounterNodeChildren(AtomicStringImpl* identifier, CounterNode
* node) | 273 static void destroyCounterNodeChildren(AtomicStringImpl* identifier, CounterNode
* node) |
| 274 { | 274 { |
| 275 CounterNode* previous; | 275 CounterNode* previous; |
| 276 for (CounterNode* child = lastDescendant(node); child && child != node; chil
d = previous) { | 276 for (CounterNode* child = lastDescendant(node); child && child != node; chil
d = previous) { |
| 277 previous = previousInPreOrder(child); | 277 previous = previousInPreOrder(child); |
| 278 child->parent()->removeChild(child); | 278 child->parent()->removeChild(child); |
| 279 ASSERT(counterMaps().get(child->renderer())->get(identifier) == child); | 279 ASSERT(counterMaps().get(child->renderer())->get(identifier) == child); |
| 280 counterMaps().get(child->renderer())->remove(identifier); | 280 counterMaps().get(child->renderer())->remove(identifier); |
| 281 child->renderer()->invalidateCounters(); | 281 if (!child->renderer()->documentBeingDestroyed()) { |
| 282 RenderObjectChildList* children = child->renderer()->virtualChildren
(); |
| 283 if (children) |
| 284 children->invalidateCounters(child->renderer()); |
| 285 } |
| 282 delete child; | 286 delete child; |
| 283 } | 287 } |
| 284 } | 288 } |
| 285 | 289 |
| 286 void RenderCounter::destroyCounterNodes(RenderObject* object) | 290 void RenderCounter::destroyCounterNodes(RenderObject* object) |
| 287 { | 291 { |
| 288 CounterMaps& maps = counterMaps(); | 292 CounterMaps& maps = counterMaps(); |
| 289 CounterMap* map = maps.get(object); | 293 CounterMap* map = maps.get(object); |
| 290 if (!map) | 294 if (!map) |
| 291 return; | 295 return; |
| 292 maps.remove(object); | 296 maps.remove(object); |
| 293 | 297 |
| 294 CounterMap::const_iterator end = map->end(); | 298 CounterMap::const_iterator end = map->end(); |
| 295 for (CounterMap::const_iterator it = map->begin(); it != end; ++it) { | 299 for (CounterMap::const_iterator it = map->begin(); it != end; ++it) { |
| 296 CounterNode* node = it->second; | 300 CounterNode* node = it->second; |
| 297 destroyCounterNodeChildren(it->first.get(), node); | 301 destroyCounterNodeChildren(it->first.get(), node); |
| 298 if (CounterNode* parent = node->parent()) | 302 if (CounterNode* parent = node->parent()) |
| 299 parent->removeChild(node); | 303 parent->removeChild(node); |
| 300 delete node; | 304 delete node; |
| 301 } | 305 } |
| 302 | 306 |
| 303 delete map; | 307 delete map; |
| 304 } | 308 } |
| 305 | 309 |
| 306 } // namespace WebCore | 310 } // namespace WebCore |
| 307 | 311 |
| OLD | NEW |