| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 return false; | 292 return false; |
| 293 } | 293 } |
| 294 | 294 |
| 295 static CounterNode* makeCounterNode(RenderObject* object, const AtomicString& id
entifier, bool alwaysCreateCounter) | 295 static CounterNode* makeCounterNode(RenderObject* object, const AtomicString& id
entifier, bool alwaysCreateCounter) |
| 296 { | 296 { |
| 297 ASSERT(object); | 297 ASSERT(object); |
| 298 | 298 |
| 299 if (object->hasCounterNodeMap()) { | 299 if (object->hasCounterNodeMap()) { |
| 300 if (CounterMap* nodeMap = counterMaps().get(object)) { | 300 if (CounterMap* nodeMap = counterMaps().get(object)) { |
| 301 if (CounterNode* node = nodeMap->get(identifier).get()) | 301 if (CounterNode* node = nodeMap->get(identifier)) |
| 302 return node; | 302 return node; |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 bool isReset = false; | 306 bool isReset = false; |
| 307 int value = 0; | 307 int value = 0; |
| 308 if (!planCounter(object, identifier, isReset, value) && !alwaysCreateCounter
) | 308 if (!planCounter(object, identifier, isReset, value) && !alwaysCreateCounter
) |
| 309 return 0; | 309 return 0; |
| 310 | 310 |
| 311 RefPtr<CounterNode> newParent = 0; | 311 RefPtr<CounterNode> newParent = 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 326 return newNode.get(); | 326 return newNode.get(); |
| 327 // Checking if some nodes that were previously counter tree root nodes | 327 // Checking if some nodes that were previously counter tree root nodes |
| 328 // should become children of this node now. | 328 // should become children of this node now. |
| 329 CounterMaps& maps = counterMaps(); | 329 CounterMaps& maps = counterMaps(); |
| 330 Element* stayWithin = parentElement(object); | 330 Element* stayWithin = parentElement(object); |
| 331 bool skipDescendants; | 331 bool skipDescendants; |
| 332 for (RenderObject* currentRenderer = nextInPreOrder(object, stayWithin); cur
rentRenderer; currentRenderer = nextInPreOrder(currentRenderer, stayWithin, skip
Descendants)) { | 332 for (RenderObject* currentRenderer = nextInPreOrder(object, stayWithin); cur
rentRenderer; currentRenderer = nextInPreOrder(currentRenderer, stayWithin, skip
Descendants)) { |
| 333 skipDescendants = false; | 333 skipDescendants = false; |
| 334 if (!currentRenderer->hasCounterNodeMap()) | 334 if (!currentRenderer->hasCounterNodeMap()) |
| 335 continue; | 335 continue; |
| 336 CounterNode* currentCounter = maps.get(currentRenderer)->get(identifier)
.get(); | 336 CounterNode* currentCounter = maps.get(currentRenderer)->get(identifier)
; |
| 337 if (!currentCounter) | 337 if (!currentCounter) |
| 338 continue; | 338 continue; |
| 339 skipDescendants = true; | 339 skipDescendants = true; |
| 340 if (currentCounter->parent()) | 340 if (currentCounter->parent()) |
| 341 continue; | 341 continue; |
| 342 if (stayWithin == parentElement(currentRenderer) && currentCounter->hasR
esetType()) | 342 if (stayWithin == parentElement(currentRenderer) && currentCounter->hasR
esetType()) |
| 343 break; | 343 break; |
| 344 newNode->insertAfter(currentCounter, newNode->lastChild(), identifier); | 344 newNode->insertAfter(currentCounter, newNode->lastChild(), identifier); |
| 345 } | 345 } |
| 346 return newNode.get(); | 346 return newNode.get(); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 root = root->parent(); | 620 root = root->parent(); |
| 621 | 621 |
| 622 AtomicString identifier(counterName); | 622 AtomicString identifier(counterName); |
| 623 for (const WebCore::RenderObject* current = root; current; current = current
->nextInPreOrder()) { | 623 for (const WebCore::RenderObject* current = root; current; current = current
->nextInPreOrder()) { |
| 624 fprintf(stderr, "%c", (current == renderer) ? '*' : ' '); | 624 fprintf(stderr, "%c", (current == renderer) ? '*' : ' '); |
| 625 for (const WebCore::RenderObject* parent = current; parent && parent !=
root; parent = parent->parent()) | 625 for (const WebCore::RenderObject* parent = current; parent && parent !=
root; parent = parent->parent()) |
| 626 fprintf(stderr, " "); | 626 fprintf(stderr, " "); |
| 627 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", | 627 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", |
| 628 current, current->node(), current->parent(), current->previousSiblin
g(), | 628 current, current->node(), current->parent(), current->previousSiblin
g(), |
| 629 current->nextSibling(), current->hasCounterNodeMap() ? | 629 current->nextSibling(), current->hasCounterNodeMap() ? |
| 630 counterName ? WebCore::counterMaps().get(current)->get(identifier).g
et() : (WebCore::CounterNode*)1 : (WebCore::CounterNode*)0); | 630 counterName ? WebCore::counterMaps().get(current)->get(identifier) :
(WebCore::CounterNode*)1 : (WebCore::CounterNode*)0); |
| 631 } | 631 } |
| 632 fflush(stderr); | 632 fflush(stderr); |
| 633 } | 633 } |
| 634 | 634 |
| 635 #endif // NDEBUG | 635 #endif // NDEBUG |
| OLD | NEW |