Changeset 52450 in webkit
- Timestamp:
- Dec 21, 2009 12:11:47 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r52449 r52450 1 2009-12-21 Carol Szabo <carol.szabo@nokia.com> 2 3 Reviewed by Darin Adler. 4 5 Inconsistent use of counterName and identifier in CSS counter code and loss of information about the counter type. 6 https://bugs.webkit.org/show_bug.cgi?id=31814 7 8 No new tests because there are no functional changes in this patch. 9 10 * rendering/CounterNode.cpp: 11 (WebCore::CounterNode::CounterNode): 12 (WebCore::CounterNode::computeCountInParent): 13 (WebCore::showTreeAndMark): 14 * rendering/RenderCounter.cpp: 15 (WebCore::planCounter): 16 (WebCore::findPlaceForCounter): 17 (WebCore::makeCounterNode): 18 (WebCore::RenderCounter::originalText): 19 Changed to use identifier instead of counterName and actsAsReset or hasResetType, as appropriate instead of isReset. 20 * rendering/CounterNode.h: 21 (WebCore::CounterNode::actsAsReset): 22 (WebCore::CounterNode::hasResetType): 23 1 24 2009-12-21 Dirk Schulze <krit@webkit.org> 2 25 -
trunk/WebCore/rendering/CounterNode.cpp
r50966 r52450 35 35 namespace WebCore { 36 36 37 CounterNode::CounterNode(RenderObject* o, bool isReset, int value)38 : m_ isReset(isReset)37 CounterNode::CounterNode(RenderObject* o, bool hasResetType, int value) 38 : m_hasResetType(hasResetType) 39 39 , m_value(value) 40 40 , m_countInParent(0) … … 101 101 int CounterNode::computeCountInParent() const 102 102 { 103 int increment = m_isReset? 0 : m_value;103 int increment = actsAsReset() ? 0 : m_value; 104 104 if (m_previousSibling) 105 105 return m_previousSibling->m_countInParent + increment; … … 107 107 return m_parent->m_value + increment; 108 108 } 109 110 109 111 110 void CounterNode::resetRenderer(const AtomicString& identifier) const … … 217 216 fwrite(" ", 1, 2, stderr); 218 217 fprintf(stderr, "%p %s: %d %d P:%p PS:%p NS:%p R:%p\n", 219 current, current-> isReset() ? "reset____" : "increment", current->value(),218 current, current->actsAsReset() ? "reset____" : "increment", current->value(), 220 219 current->countInParent(), current->parent(), current->previousSibling(), 221 220 current->nextSibling(), current->renderer()); -
trunk/WebCore/rendering/CounterNode.h
r50960 r52450 43 43 CounterNode(RenderObject*, bool isReset, int value); 44 44 45 bool isReset() const { return m_isReset; } 45 bool actsAsReset() const { return m_hasResetType || !m_parent; } 46 bool hasResetType() const { return m_hasResetType; } 46 47 int value() const { return m_value; } 47 48 int countInParent() const { return m_countInParent; } … … 59 60 60 61 void insertAfter(CounterNode* newChild, CounterNode* beforeChild, const AtomicString& identifier); 62 63 // identifier must match the identifier of this counter. 61 64 void removeChild(CounterNode*, const AtomicString& identifier); 62 65 … … 64 67 int computeCountInParent() const; 65 68 void recount(const AtomicString& identifier); 69 70 // Invalidates the text in the renderer of this counter, if any. 71 // identifier must match the identifier of this counter. 66 72 void resetRenderer(const AtomicString& identifier) const; 73 74 // Invalidates the text in the renderer of this counter, if any, 75 // and in the renderers of all descendants of this counter, if any. 76 // identifier must match the identifier of this counter. 67 77 void resetRenderers(const AtomicString& identifier) const; 68 78 69 bool m_ isReset;79 bool m_hasResetType; 70 80 int m_value; 71 81 int m_countInParent; -
trunk/WebCore/rendering/RenderCounter.cpp
r51851 r52450 39 39 typedef HashMap<const RenderObject*, CounterMap*> CounterMaps; 40 40 41 static CounterNode* makeCounterNode(RenderObject*, const AtomicString& counterName, bool alwaysCreateCounter);41 static CounterNode* makeCounterNode(RenderObject*, const AtomicString& identifier, bool alwaysCreateCounter); 42 42 43 43 static CounterMaps& counterMaps() … … 54 54 } 55 55 56 static bool planCounter(RenderObject* object, const AtomicString& counterName, bool& isReset, int& value)56 static bool planCounter(RenderObject* object, const AtomicString& identifier, bool& isReset, int& value) 57 57 { 58 58 ASSERT(object); … … 67 67 68 68 if (const CounterDirectiveMap* directivesMap = style->counterDirectives()) { 69 CounterDirectives directives = directivesMap->get( counterName.impl());69 CounterDirectives directives = directivesMap->get(identifier.impl()); 70 70 if (directives.m_reset) { 71 71 value = directives.m_resetValue; … … 82 82 } 83 83 84 if ( counterName== "list-item") {84 if (identifier == "list-item") { 85 85 if (object->isListItem()) { 86 86 if (toRenderListItem(object)->hasExplicitValue()) { … … 143 143 // We have a suitable counter on the EndSearchRenderer. 144 144 if (previousSibling) { // But we already found another counter that we come after. 145 if (currentCounter-> isReset()) {145 if (currentCounter->actsAsReset()) { 146 146 // We found a reset counter that is on a renderer that is a sibling of ours or a parent. 147 147 if (isReset && currentRenderer->parent() == counterOwner->parent()) { … … 172 172 // previousSibling, and when we are a sibling of the end counter we must set previousSibling 173 173 // to currentCounter. 174 if (currentCounter-> isReset()) {174 if (currentCounter->actsAsReset()) { 175 175 if (isReset && currentRenderer->parent() == counterOwner->parent()) { 176 176 parent = currentCounter->parent(); … … 202 202 // Since we had a suitable previous counter before, we should only consider this one as our 203 203 // previousSibling if it is a reset counter and hence the current previousSibling is its child. 204 if (currentCounter-> isReset()) {204 if (currentCounter->actsAsReset()) { 205 205 previousSibling = currentCounter; 206 206 // We are no longer interested in previous siblings of the currentRenderer or their children … … 227 227 } 228 228 229 static CounterNode* makeCounterNode(RenderObject* object, const AtomicString& counterName, bool alwaysCreateCounter)229 static CounterNode* makeCounterNode(RenderObject* object, const AtomicString& identifier, bool alwaysCreateCounter) 230 230 { 231 231 ASSERT(object); … … 233 233 if (object->m_hasCounterNodeMap) 234 234 if (CounterMap* nodeMap = counterMaps().get(object)) 235 if (CounterNode* node = nodeMap->get( counterName.impl()))235 if (CounterNode* node = nodeMap->get(identifier.impl())) 236 236 return node; 237 237 238 238 bool isReset = false; 239 239 int value = 0; 240 if (!planCounter(object, counterName, isReset, value) && !alwaysCreateCounter)240 if (!planCounter(object, identifier, isReset, value) && !alwaysCreateCounter) 241 241 return 0; 242 242 243 243 CounterNode* newParent = 0; 244 244 CounterNode* newPreviousSibling = 0; 245 CounterNode* newNode; 246 if (findPlaceForCounter(object, counterName, isReset, newParent, newPreviousSibling)) { 247 newNode = new CounterNode(object, isReset, value); 248 newParent->insertAfter(newNode, newPreviousSibling, counterName); 249 } else { 250 // Make a reset node for counters that aren't inside an existing reset node. 251 newNode = new CounterNode(object, true, value); 252 } 253 245 CounterNode* newNode = new CounterNode(object, isReset, value); 246 if (findPlaceForCounter(object, identifier, isReset, newParent, newPreviousSibling)) 247 newParent->insertAfter(newNode, newPreviousSibling, identifier); 254 248 CounterMap* nodeMap; 255 249 if (object->m_hasCounterNodeMap) … … 260 254 object->m_hasCounterNodeMap = true; 261 255 } 262 nodeMap->set(counterName.impl(), newNode); 263 256 nodeMap->set(identifier.impl(), newNode); 264 257 return newNode; 265 258 } … … 291 284 292 285 CounterNode* child = m_counterNode; 293 int value = child-> isReset() ? child->value() : child->countInParent();286 int value = child->actsAsReset() ? child->value() : child->countInParent(); 294 287 295 288 String text = listMarkerText(m_counter.listStyle(), value); 296 289 297 290 if (!m_counter.separator().isNull()) { 298 if (!child-> isReset())291 if (!child->actsAsReset()) 299 292 child = child->parent(); 300 293 while (CounterNode* parent = child->parent()) {
Note: See TracChangeset
for help on using the changeset viewer.