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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 AtomicString identifier(it->first.get()); | 287 AtomicString identifier(it->first.get()); |
288 destroyCounterNodeChildren(identifier, node); | 288 destroyCounterNodeChildren(identifier, node); |
289 if (CounterNode* parent = node->parent()) | 289 if (CounterNode* parent = node->parent()) |
290 parent->removeChild(node, identifier); | 290 parent->removeChild(node, identifier); |
291 delete node; | 291 delete node; |
292 } | 292 } |
293 | 293 |
294 delete map; | 294 delete map; |
295 } | 295 } |
296 | 296 |
| 297 void RenderCounter::rendererStyleChanged(RenderObject* renderer, const RenderSty
le* oldStyle, const RenderStyle* newStyle) |
| 298 { |
| 299 const CounterDirectiveMap* newCounterDirectives; |
| 300 const CounterDirectiveMap* oldCounterDirectives; |
| 301 if (oldStyle && (oldCounterDirectives = oldStyle->counterDirectives())) { |
| 302 if (newStyle && (newCounterDirectives = newStyle->counterDirectives()))
{ |
| 303 CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives
->end(); |
| 304 CounterDirectiveMap::const_iterator oldMapEnd = oldCounterDirectives
->end(); |
| 305 for (CounterDirectiveMap::const_iterator it = newCounterDirectives->
begin(); it != newMapEnd; ++it) { |
| 306 CounterDirectiveMap::const_iterator oldMapIt = oldCounterDirecti
ves->find(it->first); |
| 307 if (oldMapIt != oldMapEnd) { |
| 308 if (oldMapIt->second == it->second) |
| 309 continue; |
| 310 RenderCounter::destroyCounterNode(renderer, it->first.get())
; |
| 311 } |
| 312 // We must create this node here, because the changed node may b
e a node with no display such as |
| 313 // as those created by the increment or reset directives and the
re-layout that will happen will |
| 314 // not catch the change if the node had no children. |
| 315 makeCounterNode(renderer, it->first.get(), false); |
| 316 } |
| 317 // Destroying old counters that do not exist in the new counterDirec
tive map. |
| 318 for (CounterDirectiveMap::const_iterator it = oldCounterDirectives->
begin(); it !=oldMapEnd; ++it) { |
| 319 if (!newCounterDirectives->contains(it->first)) |
| 320 RenderCounter::destroyCounterNode(renderer, it->first.get())
; |
| 321 } |
| 322 } else { |
| 323 if (renderer->m_hasCounterNodeMap) |
| 324 RenderCounter::destroyCounterNodes(renderer); |
| 325 } |
| 326 } else if (newStyle && (newCounterDirectives = newStyle->counterDirectives()
)) { |
| 327 CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives->en
d(); |
| 328 for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begi
n(); it != newMapEnd; ++it) { |
| 329 // We must create this node here, because the added node may be a no
de with no display such as |
| 330 // as those created by the increment or reset directives and the re-
layout that will happen will |
| 331 // not catch the change if the node had no children. |
| 332 makeCounterNode(renderer, it->first.get(), false); |
| 333 } |
| 334 } |
| 335 } |
| 336 |
297 } // namespace WebCore | 337 } // namespace WebCore |
OLD | NEW |