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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 void LayoutCounter::destroyCounterNodes(LayoutObject& owner) { | 516 void LayoutCounter::destroyCounterNodes(LayoutObject& owner) { |
517 CounterMaps& maps = counterMaps(); | 517 CounterMaps& maps = counterMaps(); |
518 CounterMaps::iterator mapsIterator = maps.find(&owner); | 518 CounterMaps::iterator mapsIterator = maps.find(&owner); |
519 if (mapsIterator == maps.end()) | 519 if (mapsIterator == maps.end()) |
520 return; | 520 return; |
521 CounterMap* map = mapsIterator->value.get(); | 521 CounterMap* map = mapsIterator->value.get(); |
522 CounterMap::const_iterator end = map->end(); | 522 CounterMap::const_iterator end = map->end(); |
523 for (CounterMap::const_iterator it = map->begin(); it != end; ++it) { | 523 for (CounterMap::const_iterator it = map->begin(); it != end; ++it) { |
524 destroyCounterNodeWithoutMapRemoval(it->key, it->value.get()); | 524 destroyCounterNodeWithoutMapRemoval(it->key, it->value.get()); |
525 } | 525 } |
526 maps.remove(mapsIterator); | 526 maps.erase(mapsIterator); |
527 owner.setHasCounterNodeMap(false); | 527 owner.setHasCounterNodeMap(false); |
528 } | 528 } |
529 | 529 |
530 void LayoutCounter::destroyCounterNode(LayoutObject& owner, | 530 void LayoutCounter::destroyCounterNode(LayoutObject& owner, |
531 const AtomicString& identifier) { | 531 const AtomicString& identifier) { |
532 CounterMap* map = counterMaps().at(&owner); | 532 CounterMap* map = counterMaps().at(&owner); |
533 if (!map) | 533 if (!map) |
534 return; | 534 return; |
535 CounterMap::iterator mapIterator = map->find(identifier); | 535 CounterMap::iterator mapIterator = map->find(identifier); |
536 if (mapIterator == map->end()) | 536 if (mapIterator == map->end()) |
537 return; | 537 return; |
538 destroyCounterNodeWithoutMapRemoval(identifier, mapIterator->value.get()); | 538 destroyCounterNodeWithoutMapRemoval(identifier, mapIterator->value.get()); |
539 map->remove(mapIterator); | 539 map->erase(mapIterator); |
540 // We do not delete "map" here even if empty because we expect to reuse | 540 // We do not delete "map" here even if empty because we expect to reuse |
541 // it soon. In order for a layoutObject to lose all its counters permanently, | 541 // it soon. In order for a layoutObject to lose all its counters permanently, |
542 // a style change for the layoutObject involving removal of all counter | 542 // a style change for the layoutObject involving removal of all counter |
543 // directives must occur, in which case, LayoutCounter::destroyCounterNodes() | 543 // directives must occur, in which case, LayoutCounter::destroyCounterNodes() |
544 // must be called. | 544 // must be called. |
545 // The destruction of the LayoutObject (possibly caused by the removal of its | 545 // The destruction of the LayoutObject (possibly caused by the removal of its |
546 // associated DOM node) is the other case that leads to the permanent | 546 // associated DOM node) is the other case that leads to the permanent |
547 // destruction of all counters attached to a LayoutObject. In this case | 547 // destruction of all counters attached to a LayoutObject. In this case |
548 // LayoutCounter::destroyCounterNodes() must be and is now called, too. | 548 // LayoutCounter::destroyCounterNodes() must be and is now called, too. |
549 // LayoutCounter::destroyCounterNodes() handles destruction of the counter | 549 // LayoutCounter::destroyCounterNodes() handles destruction of the counter |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 current->nextSibling(), | 707 current->nextSibling(), |
708 current->hasCounterNodeMap() | 708 current->hasCounterNodeMap() |
709 ? counterName ? blink::counterMaps().at(current)->at(identifier) | 709 ? counterName ? blink::counterMaps().at(current)->at(identifier) |
710 : (blink::CounterNode*)1 | 710 : (blink::CounterNode*)1 |
711 : (blink::CounterNode*)0); | 711 : (blink::CounterNode*)0); |
712 } | 712 } |
713 fflush(stderr); | 713 fflush(stderr); |
714 } | 714 } |
715 | 715 |
716 #endif // NDEBUG | 716 #endif // NDEBUG |
OLD | NEW |