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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 // directives must occur, in which case, RenderCounter::destroyCounterNodes(
) | 568 // directives must occur, in which case, RenderCounter::destroyCounterNodes(
) |
569 // must be called. | 569 // must be called. |
570 // The destruction of the Renderer (possibly caused by the removal of its | 570 // The destruction of the Renderer (possibly caused by the removal of its |
571 // associated DOM node) is the other case that leads to the permanent | 571 // associated DOM node) is the other case that leads to the permanent |
572 // destruction of all counters attached to a Renderer. In this case | 572 // destruction of all counters attached to a Renderer. In this case |
573 // RenderCounter::destroyCounterNodes() must be and is now called, too. | 573 // RenderCounter::destroyCounterNodes() must be and is now called, too. |
574 // RenderCounter::destroyCounterNodes() handles destruction of the counter | 574 // RenderCounter::destroyCounterNodes() handles destruction of the counter |
575 // map associated with a renderer, so there is no risk in leaking the map. | 575 // map associated with a renderer, so there is no risk in leaking the map. |
576 } | 576 } |
577 | 577 |
| 578 void RenderCounter::rendererRemovedFromTree(RenderObject* removedRenderer) |
| 579 { |
| 580 RenderObject* currentRenderer = removedRenderer->lastLeafChild(); |
| 581 if (!currentRenderer) |
| 582 currentRenderer = removedRenderer; |
| 583 while (true) { |
| 584 destroyCounterNodes(currentRenderer); |
| 585 if (currentRenderer == removedRenderer) |
| 586 break; |
| 587 currentRenderer = currentRenderer->previousInPreOrder(); |
| 588 } |
| 589 } |
| 590 |
578 static void updateCounters(RenderObject* renderer) | 591 static void updateCounters(RenderObject* renderer) |
579 { | 592 { |
580 ASSERT(renderer->style()); | 593 ASSERT(renderer->style()); |
581 const CounterDirectiveMap* directiveMap = renderer->style()->counterDirectiv
es(); | 594 const CounterDirectiveMap* directiveMap = renderer->style()->counterDirectiv
es(); |
582 if (!directiveMap) | 595 if (!directiveMap) |
583 return; | 596 return; |
584 CounterDirectiveMap::const_iterator end = directiveMap->end(); | 597 CounterDirectiveMap::const_iterator end = directiveMap->end(); |
585 if (!renderer->m_hasCounterNodeMap) { | 598 if (!renderer->m_hasCounterNodeMap) { |
586 for (CounterDirectiveMap::const_iterator it = directiveMap->begin(); it
!= end; ++it) | 599 for (CounterDirectiveMap::const_iterator it = directiveMap->begin(); it
!= end; ++it) |
587 makeCounterNode(renderer, AtomicString(it->first.get()), false); | 600 makeCounterNode(renderer, AtomicString(it->first.get()), false); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 fprintf(stderr, " "); | 699 fprintf(stderr, " "); |
687 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", | 700 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", |
688 current, current->node(), current->parent(), current->previousSiblin
g(), | 701 current, current->node(), current->parent(), current->previousSiblin
g(), |
689 current->nextSibling(), current->m_hasCounterNodeMap? | 702 current->nextSibling(), current->m_hasCounterNodeMap? |
690 counterName ? WebCore::counterMaps().get(current)->get(identifier.im
pl()).get() : (WebCore::CounterNode*)1 : (WebCore::CounterNode*)0); | 703 counterName ? WebCore::counterMaps().get(current)->get(identifier.im
pl()).get() : (WebCore::CounterNode*)1 : (WebCore::CounterNode*)0); |
691 } | 704 } |
692 fflush(stderr); | 705 fflush(stderr); |
693 } | 706 } |
694 | 707 |
695 #endif // NDEBUG | 708 #endif // NDEBUG |
OLD | NEW |