1 /** 2 * Copyright (C) 2004 Allan Sandfeld Jensen (kde (at) carewolf.com) 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 * 20 */ 21 22 #include "config.h" 23 #include "core/rendering/RenderCounter.h" 24 25 #include "HTMLNames.h" 26 #include "core/dom/Document.h" 27 #include "core/dom/Element.h" 28 #include "core/dom/ElementTraversal.h" 29 #include "core/html/HTMLOListElement.h" 30 #include "core/rendering/CounterNode.h" 31 #include "core/rendering/RenderListItem.h" 32 #include "core/rendering/RenderListMarker.h" 33 #include "core/rendering/RenderView.h" 34 #include "core/rendering/style/RenderStyle.h" 35 #include "wtf/StdLibExtras.h" 36 37 #ifndef NDEBUG 38 #include <stdio.h> 39 #endif 40 41 namespace WebCore { 42 43 using namespace HTMLNames; 44 45 typedef HashMap<AtomicString, RefPtr<CounterNode> > CounterMap; 46 typedef HashMap<const RenderObject*, OwnPtr<CounterMap> > CounterMaps; 47 48 static CounterNode* makeCounterNode(RenderObject&, const AtomicString& identifier, bool alwaysCreateCounter); 49 50 static CounterMaps& counterMaps() 51 { 52 DEFINE_STATIC_LOCAL(CounterMaps, staticCounterMaps, ()); 53 return staticCounterMaps; 54 } 55 56 // This function processes the renderer tree in the order of the DOM tree 57 // including pseudo elements as defined in CSS 2.1. 58 static RenderObject* previousInPreOrder(const RenderObject& object) 59 { 60 Element* self = toElement(object.node()); 61 ASSERT(self); 62 Element* previous = ElementTraversal::previousIncludingPseudo(*self); 63 while (previous && !previous->renderer()) 64 previous = ElementTraversal::previousIncludingPseudo(*previous); 65 return previous ? previous->renderer() : 0; 66 } 67 68 // This function processes the renderer tree in the order of the DOM tree 69 // including pseudo elements as defined in CSS 2.1. 70 static RenderObject* previousSiblingOrParent(const RenderObject& object) 71 { 72 Element* self = toElement(object.node()); 73 ASSERT(self); 74 Element* previous = ElementTraversal::pseudoAwarePreviousSibling(*self); 75 while (previous && !previous->renderer()) 76 previous = ElementTraversal::pseudoAwarePreviousSibling(*previous); 77 if (previous) 78 return previous->renderer(); 79 previous = self->parentElement(); 80 return previous ? previous->renderer() : 0; 81 } 82 83 static inline Element* parentElement(RenderObject& object) 84 { 85 return toElement(object.node())->parentElement(); 86 } 87 88 static inline bool areRenderersElementsSiblings(RenderObject& first, RenderObject& second) 89 { 90 return parentElement(first) == parentElement(second); 91 } 92 93 // This function processes the renderer tree in the order of the DOM tree 94 // including pseudo elements as defined in CSS 2.1. 95 static RenderObject* nextInPreOrder(const RenderObject& object, const Element* stayWithin, bool skipDescendants = false) 96 { 97 Element* self = toElement(object.node()); 98 ASSERT(self); 99 Element* next = skipDescendants ? ElementTraversal::nextIncludingPseudoSkippingChildren(*self, stayWithin) : ElementTraversal::nextIncludingPseudo(*self, stayWithin); 100 while (next && !next->renderer()) 101 next = skipDescendants ? ElementTraversal::nextIncludingPseudoSkippingChildren(*next, stayWithin) : ElementTraversal::nextIncludingPseudo(*next, stayWithin); 102 return next ? next->renderer() : 0; 103 } 104 105 static bool planCounter(RenderObject& object, const AtomicString& identifier, bool& isReset, int& value) 106 { 107 // Real text nodes don't have their own style so they can't have counters. 108 // We can't even look at their styles or we'll see extra resets and increments! 109 if (object.isText() && !object.isBR()) 110 return false; 111 Node* generatingNode = object.generatingNode(); 112 // We must have a generating node or else we cannot have a counter. 113 if (!generatingNode) 114 return false; 115 RenderStyle* style = object.style(); 116 ASSERT(style); 117 118 switch (style->styleType()) { 119 case NOPSEUDO: 120 // Sometimes nodes have more then one renderer. Only the first one gets the counter 121 // LayoutTests/http/tests/css/counter-crash.html 122 if (generatingNode->renderer() != &object) 123 return false; 124 break; 125 case BEFORE: 126 case AFTER: 127 break; 128 default: 129 return false; // Counters are forbidden from all other pseudo elements. 130 } 131 132 const CounterDirectives directives = style->getCounterDirectives(identifier); 133 if (directives.isDefined()) { 134 value = directives.combinedValue(); 135 isReset = directives.isReset(); 136 return true; 137 } 138 139 if (identifier == "list-item") { 140 if (object.isListItem()) { 141 if (toRenderListItem(object).hasExplicitValue()) { 142 value = toRenderListItem(object).explicitValue(); 143 isReset = true; 144 return true; 145 } 146 value = 1; 147 isReset = false; 148 return true; 149 } 150 if (Node* e = object.node()) { 151 if (e->hasTagName(olTag)) { 152 value = toHTMLOListElement(e)->start(); 153 isReset = true; 154 return true; 155 } 156 if (e->hasTagName(ulTag) || e->hasTagName(menuTag) || e->hasTagName(dirTag)) { 157 value = 0; 158 isReset = true; 159 return true; 160 } 161 } 162 } 163 164 return false; 165 } 166 167 // - Finds the insertion point for the counter described by counterOwner, isReset and 168 // identifier in the CounterNode tree for identifier and sets parent and 169 // previousSibling accordingly. 170 // - The function returns true if the counter whose insertion point is searched is NOT 171 // the root of the tree. 172 // - The root of the tree is a counter reference that is not in the scope of any other 173 // counter with the same identifier. 174 // - All the counter references with the same identifier as this one that are in 175 // children or subsequent siblings of the renderer that owns the root of the tree 176 // form the rest of of the nodes of the tree. 177 // - The root of the tree is always a reset type reference. 178 // - A subtree rooted at any reset node in the tree is equivalent to all counter 179 // references that are in the scope of the counter or nested counter defined by that 180 // reset node. 181 // - Non-reset CounterNodes cannot have descendants. 182 183 static bool findPlaceForCounter(RenderObject& counterOwner, const AtomicString& identifier, bool isReset, RefPtr<CounterNode>& parent, RefPtr<CounterNode>& previousSibling) 184 { 185 // We cannot stop searching for counters with the same identifier before we also 186 // check this renderer, because it may affect the positioning in the tree of our counter. 187 RenderObject* searchEndRenderer = previousSiblingOrParent(counterOwner); 188 // We check renderers in preOrder from the renderer that our counter is attached to 189 // towards the begining of the document for counters with the same identifier as the one 190 // we are trying to find a place for. This is the next renderer to be checked. 191 RenderObject* currentRenderer = previousInPreOrder(counterOwner); 192 previousSibling = 0; 193 RefPtr<CounterNode> previousSiblingProtector = 0; 194 195 while (currentRenderer) { 196 CounterNode* currentCounter = makeCounterNode(*currentRenderer, identifier, false); 197 if (searchEndRenderer == currentRenderer) { 198 // We may be at the end of our search. 199 if (currentCounter) { 200 // We have a suitable counter on the EndSearchRenderer. 201 if (previousSiblingProtector) { // But we already found another counter that we come after. 202 if (currentCounter->actsAsReset()) { 203 // We found a reset counter that is on a renderer that is a sibling of ours or a parent. 204 if (isReset && areRenderersElementsSiblings(*currentRenderer, counterOwner)) { 205 // We are also a reset counter and the previous reset was on a sibling renderer 206 // hence we are the next sibling of that counter if that reset is not a root or 207 // we are a root node if that reset is a root. 208 parent = currentCounter->parent(); 209 previousSibling = parent ? currentCounter : 0; 210 return parent; 211 } 212 // We are not a reset node or the previous reset must be on an ancestor of our owner renderer 213 // hence we must be a child of that reset counter. 214 parent = currentCounter; 215 // In some cases renders can be reparented (ex. nodes inside a table but not in a column or row). 216 // In these cases the identified previousSibling will be invalid as its parent is different from 217 // our identified parent. 218 if (previousSiblingProtector->parent() != currentCounter) 219 previousSiblingProtector = 0; 220 221 previousSibling = previousSiblingProtector.get(); 222 return true; 223 } 224 // CurrentCounter, the counter at the EndSearchRenderer, is not reset. 225 if (!isReset || !areRenderersElementsSiblings(*currentRenderer, counterOwner)) { 226 // If the node we are placing is not reset or we have found a counter that is attached 227 // to an ancestor of the placed counter's owner renderer we know we are a sibling of that node. 228 if (currentCounter->parent() != previousSiblingProtector->parent()) 229 return false; 230 231 parent = currentCounter->parent(); 232 previousSibling = previousSiblingProtector.get(); 233 return true; 234 } 235 } else { 236 // We are at the potential end of the search, but we had no previous sibling candidate 237 // In this case we follow pretty much the same logic as above but no ASSERTs about 238 // previousSibling, and when we are a sibling of the end counter we must set previousSibling 239 // to currentCounter. 240 if (currentCounter->actsAsReset()) { 241 if (isReset && areRenderersElementsSiblings(*currentRenderer, counterOwner)) { 242 parent = currentCounter->parent(); 243 previousSibling = currentCounter; 244 return parent; 245 } 246 parent = currentCounter; 247 previousSibling = previousSiblingProtector.get(); 248 return true; 249 } 250 if (!isReset || !areRenderersElementsSiblings(*currentRenderer, counterOwner)) { 251 parent = currentCounter->parent(); 252 previousSibling = currentCounter; 253 return true; 254 } 255 previousSiblingProtector = currentCounter; 256 } 257 } 258 // We come here if the previous sibling or parent of our owner renderer had no 259 // good counter, or we are a reset node and the counter on the previous sibling 260 // of our owner renderer was not a reset counter. 261 // Set a new goal for the end of the search. 262 searchEndRenderer = previousSiblingOrParent(*currentRenderer); 263 } else { 264 // We are searching descendants of a previous sibling of the renderer that the 265 // counter being placed is attached to. 266 if (currentCounter) { 267 // We found a suitable counter. 268 if (previousSiblingProtector) { 269 // Since we had a suitable previous counter before, we should only consider this one as our 270 // previousSibling if it is a reset counter and hence the current previousSibling is its child. 271 if (currentCounter->actsAsReset()) { 272 previousSiblingProtector = currentCounter; 273 // We are no longer interested in previous siblings of the currentRenderer or their children 274 // as counters they may have attached cannot be the previous sibling of the counter we are placing. 275 currentRenderer = parentElement(*currentRenderer)->renderer(); 276 continue; 277 } 278 } else 279 previousSiblingProtector = currentCounter; 280 currentRenderer = previousSiblingOrParent(*currentRenderer); 281 continue; 282 } 283 } 284 // This function is designed so that the same test is not done twice in an iteration, except for this one 285 // which may be done twice in some cases. Rearranging the decision points though, to accommodate this 286 // performance improvement would create more code duplication than is worthwhile in my oppinion and may further 287 // impede the readability of this already complex algorithm. 288 if (previousSiblingProtector) 289 currentRenderer = previousSiblingOrParent(*currentRenderer); 290 else 291 currentRenderer = previousInPreOrder(*currentRenderer); 292 } 293 return false; 294 } 295 296 static CounterNode* makeCounterNode(RenderObject& object, const AtomicString& identifier, bool alwaysCreateCounter) 297 { 298 if (object.hasCounterNodeMap()) { 299 if (CounterMap* nodeMap = counterMaps().get(&object)) { 300 if (CounterNode* node = nodeMap->get(identifier)) 301 return node; 302 } 303 } 304 305 bool isReset = false; 306 int value = 0; 307 if (!planCounter(object, identifier, isReset, value) && !alwaysCreateCounter) 308 return 0; 309 310 RefPtr<CounterNode> newParent = 0; 311 RefPtr<CounterNode> newPreviousSibling = 0; 312 RefPtr<CounterNode> newNode = CounterNode::create(object, isReset, value); 313 if (findPlaceForCounter(object, identifier, isReset, newParent, newPreviousSibling)) 314 newParent->insertAfter(newNode.get(), newPreviousSibling.get(), identifier); 315 CounterMap* nodeMap; 316 if (object.hasCounterNodeMap()) 317 nodeMap = counterMaps().get(&object); 318 else { 319 nodeMap = new CounterMap; 320 counterMaps().set(&object, adoptPtr(nodeMap)); 321 object.setHasCounterNodeMap(true); 322 } 323 nodeMap->set(identifier, newNode); 324 if (newNode->parent()) 325 return newNode.get(); 326 // Checking if some nodes that were previously counter tree root nodes 327 // should become children of this node now. 328 CounterMaps& maps = counterMaps(); 329 Element* stayWithin = parentElement(object); 330 bool skipDescendants; 331 for (RenderObject* currentRenderer = nextInPreOrder(object, stayWithin); currentRenderer; currentRenderer = nextInPreOrder(*currentRenderer, stayWithin, skipDescendants)) { 332 skipDescendants = false; 333 if (!currentRenderer->hasCounterNodeMap()) 334 continue; 335 CounterNode* currentCounter = maps.get(currentRenderer)->get(identifier); 336 if (!currentCounter) 337 continue; 338 skipDescendants = true; 339 if (currentCounter->parent()) 340 continue; 341 if (stayWithin == parentElement(*currentRenderer) && currentCounter->hasResetType()) 342 break; 343 newNode->insertAfter(currentCounter, newNode->lastChild(), identifier); 344 } 345 return newNode.get(); 346 } 347 348 RenderCounter::RenderCounter(Document* node, const CounterContent& counter) 349 : RenderText(node, StringImpl::empty()) 350 , m_counter(counter) 351 , m_counterNode(0) 352 , m_nextForSameCounter(0) 353 { 354 view()->addRenderCounter(); 355 } 356 357 RenderCounter::~RenderCounter() 358 { 359 if (m_counterNode) { 360 m_counterNode->removeRenderer(this); 361 ASSERT(!m_counterNode); 362 } 363 } 364 365 void RenderCounter::willBeDestroyed() 366 { 367 if (view()) 368 view()->removeRenderCounter(); 369 RenderText::willBeDestroyed(); 370 } 371 372 const char* RenderCounter::renderName() const 373 { 374 return "RenderCounter"; 375 } 376 377 bool RenderCounter::isCounter() const 378 { 379 return true; 380 } 381 382 PassRefPtr<StringImpl> RenderCounter::originalText() const 383 { 384 if (!m_counterNode) { 385 RenderObject* beforeAfterContainer = parent(); 386 while (true) { 387 if (!beforeAfterContainer) 388 return 0; 389 if (!beforeAfterContainer->isAnonymous() && !beforeAfterContainer->isPseudoElement()) 390 return 0; // RenderCounters are restricted to before and after pseudo elements 391 PseudoId containerStyle = beforeAfterContainer->style()->styleType(); 392 if ((containerStyle == BEFORE) || (containerStyle == AFTER)) 393 break; 394 beforeAfterContainer = beforeAfterContainer->parent(); 395 } 396 makeCounterNode(*beforeAfterContainer, m_counter.identifier(), true)->addRenderer(const_cast<RenderCounter*>(this)); 397 ASSERT(m_counterNode); 398 } 399 CounterNode* child = m_counterNode; 400 int value = child->actsAsReset() ? child->value() : child->countInParent(); 401 402 String text = listMarkerText(m_counter.listStyle(), value); 403 404 if (!m_counter.separator().isNull()) { 405 if (!child->actsAsReset()) 406 child = child->parent(); 407 while (CounterNode* parent = child->parent()) { 408 text = listMarkerText(m_counter.listStyle(), child->countInParent()) 409 + m_counter.separator() + text; 410 child = parent; 411 } 412 } 413 414 return text.impl(); 415 } 416 417 void RenderCounter::updateCounter() 418 { 419 setTextInternal(originalText()); 420 } 421 422 void RenderCounter::invalidate() 423 { 424 m_counterNode->removeRenderer(this); 425 ASSERT(!m_counterNode); 426 if (documentBeingDestroyed()) 427 return; 428 setNeedsLayoutAndPrefWidthsRecalc(); 429 } 430 431 static void destroyCounterNodeWithoutMapRemoval(const AtomicString& identifier, CounterNode* node) 432 { 433 CounterNode* previous; 434 for (RefPtr<CounterNode> child = node->lastDescendant(); child && child != node; child = previous) { 435 previous = child->previousInPreOrder(); 436 child->parent()->removeChild(child.get()); 437 ASSERT(counterMaps().get(&child->owner())->get(identifier) == child); 438 counterMaps().get(&child->owner())->remove(identifier); 439 } 440 if (CounterNode* parent = node->parent()) 441 parent->removeChild(node); 442 } 443 444 void RenderCounter::destroyCounterNodes(RenderObject& owner) 445 { 446 CounterMaps& maps = counterMaps(); 447 CounterMaps::iterator mapsIterator = maps.find(&owner); 448 if (mapsIterator == maps.end()) 449 return; 450 CounterMap* map = mapsIterator->value.get(); 451 CounterMap::const_iterator end = map->end(); 452 for (CounterMap::const_iterator it = map->begin(); it != end; ++it) { 453 destroyCounterNodeWithoutMapRemoval(it->key, it->value.get()); 454 } 455 maps.remove(mapsIterator); 456 owner.setHasCounterNodeMap(false); 457 } 458 459 void RenderCounter::destroyCounterNode(RenderObject& owner, const AtomicString& identifier) 460 { 461 CounterMap* map = counterMaps().get(&owner); 462 if (!map) 463 return; 464 CounterMap::iterator mapIterator = map->find(identifier); 465 if (mapIterator == map->end()) 466 return; 467 destroyCounterNodeWithoutMapRemoval(identifier, mapIterator->value.get()); 468 map->remove(mapIterator); 469 // We do not delete "map" here even if empty because we expect to reuse 470 // it soon. In order for a renderer to lose all its counters permanently, 471 // a style change for the renderer involving removal of all counter 472 // directives must occur, in which case, RenderCounter::destroyCounterNodes() 473 // must be called. 474 // The destruction of the Renderer (possibly caused by the removal of its 475 // associated DOM node) is the other case that leads to the permanent 476 // destruction of all counters attached to a Renderer. In this case 477 // RenderCounter::destroyCounterNodes() must be and is now called, too. 478 // RenderCounter::destroyCounterNodes() handles destruction of the counter 479 // map associated with a renderer, so there is no risk in leaking the map. 480 } 481 482 void RenderCounter::rendererRemovedFromTree(RenderObject* renderer) 483 { 484 ASSERT(renderer->view()); 485 if (!renderer->view()->hasRenderCounters()) 486 return; 487 RenderObject* currentRenderer = renderer->lastLeafChild(); 488 if (!currentRenderer) 489 currentRenderer = renderer; 490 while (true) { 491 destroyCounterNodes(*currentRenderer); 492 if (currentRenderer == renderer) 493 break; 494 currentRenderer = currentRenderer->previousInPreOrder(); 495 } 496 } 497 498 static void updateCounters(RenderObject& renderer) 499 { 500 ASSERT(renderer.style()); 501 const CounterDirectiveMap* directiveMap = renderer.style()->counterDirectives(); 502 if (!directiveMap) 503 return; 504 CounterDirectiveMap::const_iterator end = directiveMap->end(); 505 if (!renderer.hasCounterNodeMap()) { 506 for (CounterDirectiveMap::const_iterator it = directiveMap->begin(); it != end; ++it) 507 makeCounterNode(renderer, it->key, false); 508 return; 509 } 510 CounterMap* counterMap = counterMaps().get(&renderer); 511 ASSERT(counterMap); 512 for (CounterDirectiveMap::const_iterator it = directiveMap->begin(); it != end; ++it) { 513 RefPtr<CounterNode> node = counterMap->get(it->key); 514 if (!node) { 515 makeCounterNode(renderer, it->key, false); 516 continue; 517 } 518 RefPtr<CounterNode> newParent = 0; 519 RefPtr<CounterNode> newPreviousSibling = 0; 520 521 findPlaceForCounter(renderer, it->key, node->hasResetType(), newParent, newPreviousSibling); 522 if (node != counterMap->get(it->key)) 523 continue; 524 CounterNode* parent = node->parent(); 525 if (newParent == parent && newPreviousSibling == node->previousSibling()) 526 continue; 527 if (parent) 528 parent->removeChild(node.get()); 529 if (newParent) 530 newParent->insertAfter(node.get(), newPreviousSibling.get(), it->key); 531 } 532 } 533 534 void RenderCounter::rendererSubtreeAttached(RenderObject* renderer) 535 { 536 ASSERT(renderer->view()); 537 if (!renderer->view()->hasRenderCounters()) 538 return; 539 Node* node = renderer->node(); 540 if (node) 541 node = node->parentNode(); 542 else 543 node = renderer->generatingNode(); 544 if (node && node->needsAttach()) 545 return; // No need to update if the parent is not attached yet 546 for (RenderObject* descendant = renderer; descendant; descendant = descendant->nextInPreOrder(renderer)) 547 updateCounters(*descendant); 548 } 549 550 void RenderCounter::rendererStyleChanged(RenderObject& renderer, const RenderStyle* oldStyle, const RenderStyle* newStyle) 551 { 552 Node* node = renderer.generatingNode(); 553 if (!node || node->needsAttach()) 554 return; // cannot have generated content or if it can have, it will be handled during attaching 555 const CounterDirectiveMap* newCounterDirectives; 556 const CounterDirectiveMap* oldCounterDirectives; 557 if (oldStyle && (oldCounterDirectives = oldStyle->counterDirectives())) { 558 if (newStyle && (newCounterDirectives = newStyle->counterDirectives())) { 559 CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives->end(); 560 CounterDirectiveMap::const_iterator oldMapEnd = oldCounterDirectives->end(); 561 for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begin(); it != newMapEnd; ++it) { 562 CounterDirectiveMap::const_iterator oldMapIt = oldCounterDirectives->find(it->key); 563 if (oldMapIt != oldMapEnd) { 564 if (oldMapIt->value == it->value) 565 continue; 566 RenderCounter::destroyCounterNode(renderer, it->key); 567 } 568 // We must create this node here, because the changed node may be a node with no display such as 569 // as those created by the increment or reset directives and the re-layout that will happen will 570 // not catch the change if the node had no children. 571 makeCounterNode(renderer, it->key, false); 572 } 573 // Destroying old counters that do not exist in the new counterDirective map. 574 for (CounterDirectiveMap::const_iterator it = oldCounterDirectives->begin(); it !=oldMapEnd; ++it) { 575 if (!newCounterDirectives->contains(it->key)) 576 RenderCounter::destroyCounterNode(renderer, it->key); 577 } 578 } else { 579 if (renderer.hasCounterNodeMap()) 580 RenderCounter::destroyCounterNodes(renderer); 581 } 582 } else if (newStyle && (newCounterDirectives = newStyle->counterDirectives())) { 583 CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives->end(); 584 for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begin(); it != newMapEnd; ++it) { 585 // We must create this node here, because the added node may be a node with no display such as 586 // as those created by the increment or reset directives and the re-layout that will happen will 587 // not catch the change if the node had no children. 588 makeCounterNode(renderer, it->key, false); 589 } 590 } 591 } 592 593 } // namespace WebCore 594 595 #ifndef NDEBUG 596 597 void showCounterRendererTree(const WebCore::RenderObject* renderer, const char* counterName) 598 { 599 if (!renderer) 600 return; 601 const WebCore::RenderObject* root = renderer; 602 while (root->parent()) 603 root = root->parent(); 604 605 AtomicString identifier(counterName); 606 for (const WebCore::RenderObject* current = root; current; current = current->nextInPreOrder()) { 607 fprintf(stderr, "%c", (current == renderer) ? '*' : ' '); 608 for (const WebCore::RenderObject* parent = current; parent && parent != root; parent = parent->parent()) 609 fprintf(stderr, " "); 610 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", 611 current, current->node(), current->parent(), current->previousSibling(), 612 current->nextSibling(), current->hasCounterNodeMap() ? 613 counterName ? WebCore::counterMaps().get(current)->get(identifier) : (WebCore::CounterNode*)1 : (WebCore::CounterNode*)0); 614 } 615 fflush(stderr); 616 } 617 618 #endif // NDEBUG 619