Changeset 155116 in webkit
- Timestamp:
- Sep 5, 2013, 7:45:58 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r155113 r155116 1 2013-09-05 Antti Koivisto <antti@apple.com> 2 3 Call createTextRenderersForSiblingsAfterAttachIfNeeded only for the attach root 4 https://bugs.webkit.org/show_bug.cgi?id=120770 5 6 Reviewed by Andreas Kling. 7 8 There is no need to call this during recursive attach as siblings are going to be attached normally anyway. 9 Move call sites to attach roots only. 10 11 * style/StyleResolveTree.cpp: 12 (WebCore::Style::createTextRenderersForSiblingsAfterAttachIfNeeded): 13 14 Factor to take reference and do the inital tests itself. 15 16 (WebCore::Style::createTextRendererIfNeeded): 17 (WebCore::Style::updateTextRendererAfterContentChange): 18 (WebCore::Style::attachChildren): 19 20 Also tightened the condition where previously attached children may be encountered. 21 22 (WebCore::Style::attachRenderTree): 23 (WebCore::Style::resolveLocal): 24 (WebCore::Style::updateTextStyle): 25 (WebCore::Style::reattachRenderTree): 26 1 27 2013-09-05 Enrique Ocaña González <eocanha@igalia.com> 2 28 -
trunk/Source/WebCore/style/StyleResolveTree.cpp
r155074 r155116 281 281 } 282 282 283 static void createTextRenderersForSiblingsAfterAttachIfNeeded(Node* sibling) 284 { 285 ASSERT(sibling->previousSibling()); 286 ASSERT(sibling->previousSibling()->renderer()); 287 ASSERT(!sibling->renderer()); 288 ASSERT(sibling->attached()); 283 static void createTextRenderersForSiblingsAfterAttachIfNeeded(Node& node) 284 { 285 if (!node.renderer()) 286 return; 289 287 // If this node got a renderer it may be the previousRenderer() of sibling text nodes and thus affect the 290 288 // result of Text::textRendererIsNeeded() for those nodes. 291 for ( ; sibling; sibling = sibling->nextSibling()) {289 for (Node* sibling = node.nextSibling(); sibling; sibling = sibling->nextSibling()) { 292 290 if (sibling->renderer()) 293 291 break; … … 296 294 if (!sibling->isTextNode()) 297 295 continue; 298 ASSERT(!sibling->renderer());299 296 attachTextRenderer(*toText(sibling)); 300 297 // If we again decided not to create a renderer for next, we can bail out the loop, … … 386 383 newRenderer->setStyle(style.release()); 387 384 parentRenderer->addChild(newRenderer, nextRenderer); 388 389 Node* sibling = textNode.nextSibling();390 if (sibling && !sibling->renderer() && sibling->attached())391 createTextRenderersForSiblingsAfterAttachIfNeeded(sibling);392 385 } 393 386 … … 415 408 if (!textRenderer) { 416 409 attachTextRenderer(textNode); 410 createTextRenderersForSiblingsAfterAttachIfNeeded(textNode); 417 411 return; 418 412 } … … 426 420 } 427 421 428 #ifndef NDEBUG429 static bool childAttachedAllowedWhenAttachingChildren(ContainerNode& node)430 {431 if (node.isShadowRoot())432 return true;433 if (node.isInsertionPoint())434 return true;435 if (node.isElementNode() && toElement(&node)->shadowRoot())436 return true;437 return false;438 }439 #endif440 441 422 static void attachChildren(ContainerNode& current) 442 423 { 443 424 for (Node* child = current.firstChild(); child; child = child->nextSibling()) { 444 ASSERT(!child->attached() || c hildAttachedAllowedWhenAttachingChildren(current));425 ASSERT(!child->attached() || current.shadowRoot()); 445 426 if (child->attached()) 446 427 continue; … … 494 475 495 476 attachChildren(current); 496 497 Node* sibling = current.nextSibling();498 if (current.renderer() && sibling && !sibling->renderer() && sibling->attached())499 createTextRenderersForSiblingsAfterAttachIfNeeded(sibling);500 477 501 478 current.setAttached(true); … … 613 590 detachRenderTree(current, ReattachDetach); 614 591 attachRenderTree(current, newStyle.get()); 592 createTextRenderersForSiblingsAfterAttachIfNeeded(current); 593 615 594 return Detach; 616 595 } … … 653 632 if (renderer) 654 633 renderer->setText(text.dataImpl()); 655 else 634 else { 656 635 attachTextRenderer(text); 636 createTextRenderersForSiblingsAfterAttachIfNeeded(text); 637 } 657 638 text.clearNeedsStyleRecalc(); 658 639 } … … 837 818 { 838 819 attachRenderTree(element, nullptr); 820 createTextRenderersForSiblingsAfterAttachIfNeeded(element); 839 821 } 840 822 … … 853 835 if (current.attached()) 854 836 detachRenderTree(current, ReattachDetach); 855 attachRenderTree(current , nullptr);856 } 857 858 } 859 } 837 attachRenderTree(current); 838 } 839 840 } 841 }
Note:
See TracChangeset
for help on using the changeset viewer.