| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 { | 129 { |
| 130 // We cannot stop searching for counters with the same identifier before we
also | 130 // We cannot stop searching for counters with the same identifier before we
also |
| 131 // check this renderer, because it may affect the positioning in the tree of
our counter. | 131 // check this renderer, because it may affect the positioning in the tree of
our counter. |
| 132 RenderObject* searchEndRenderer = previousSiblingOrParent(counterOwner); | 132 RenderObject* searchEndRenderer = previousSiblingOrParent(counterOwner); |
| 133 // We check renderers in preOrder from the renderer that our counter is atta
ched to | 133 // We check renderers in preOrder from the renderer that our counter is atta
ched to |
| 134 // towards the begining of the document for counters with the same identifie
r as the one | 134 // towards the begining of the document for counters with the same identifie
r as the one |
| 135 // we are trying to find a place for. This is the next renderer to be checke
d. | 135 // we are trying to find a place for. This is the next renderer to be checke
d. |
| 136 RenderObject* currentRenderer = counterOwner->previousInPreOrder(); | 136 RenderObject* currentRenderer = counterOwner->previousInPreOrder(); |
| 137 previousSibling = 0; | 137 previousSibling = 0; |
| 138 while (currentRenderer) { | 138 while (currentRenderer) { |
| 139 // A sibling without a parent means that the counter node tree was not c
onstructed correctly so we stop | |
| 140 // traversing. In the future RenderCounter should handle RenderObjects t
hat are not connected to the | |
| 141 // render tree at counter node creation. See bug 43812. | |
| 142 if (previousSibling && !previousSibling->parent()) | |
| 143 return false; | |
| 144 CounterNode* currentCounter = makeCounterNode(currentRenderer, identifie
r, false); | 139 CounterNode* currentCounter = makeCounterNode(currentRenderer, identifie
r, false); |
| 145 if (searchEndRenderer == currentRenderer) { | 140 if (searchEndRenderer == currentRenderer) { |
| 146 // We may be at the end of our search. | 141 // We may be at the end of our search. |
| 147 if (currentCounter) { | 142 if (currentCounter) { |
| 148 // We have a suitable counter on the EndSearchRenderer. | 143 // We have a suitable counter on the EndSearchRenderer. |
| 149 if (previousSibling) { // But we already found another counter t
hat we come after. | 144 if (previousSibling) { // But we already found another counter t
hat we come after. |
| 150 if (currentCounter->actsAsReset()) { | 145 if (currentCounter->actsAsReset()) { |
| 151 // We found a reset counter that is on a renderer that i
s a sibling of ours or a parent. | 146 // We found a reset counter that is on a renderer that i
s a sibling of ours or a parent. |
| 152 if (isReset && currentRenderer->parent() == counterOwner
->parent()) { | 147 if (isReset && currentRenderer->parent() == counterOwner
->parent()) { |
| 153 // We are also a reset counter and the previous rese
t was on a sibling renderer | 148 // We are also a reset counter and the previous rese
t was on a sibling renderer |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begi
n(); it != newMapEnd; ++it) { | 482 for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begi
n(); it != newMapEnd; ++it) { |
| 488 // We must create this node here, because the added node may be a no
de with no display such as | 483 // We must create this node here, because the added node may be a no
de with no display such as |
| 489 // as those created by the increment or reset directives and the re-
layout that will happen will | 484 // as those created by the increment or reset directives and the re-
layout that will happen will |
| 490 // not catch the change if the node had no children. | 485 // not catch the change if the node had no children. |
| 491 makeCounterNode(renderer, it->first.get(), false); | 486 makeCounterNode(renderer, it->first.get(), false); |
| 492 } | 487 } |
| 493 } | 488 } |
| 494 } | 489 } |
| 495 | 490 |
| 496 } // namespace WebCore | 491 } // namespace WebCore |
| OLD | NEW |