Changeset 154873 in webkit
- Timestamp:
- Aug 30, 2013, 5:33:15 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r154871 r154873 1 2013-08-30 Antti Koivisto <antti@apple.com> 2 3 Remove AttachContext 4 https://bugs.webkit.org/show_bug.cgi?id=120518 5 6 Reviewed by Andreas Kling. 7 8 This type is not useful anymore. Just pass the precomputed style to attachRenderTree and reattach-or-not flag to detachRenderTree. 9 10 * style/StyleResolveTree.cpp: 11 (WebCore::Style::createRendererIfNeeded): 12 (WebCore::Style::attachChildren): 13 (WebCore::Style::attachShadowRoot): 14 (WebCore::Style::attachRenderTree): 15 (WebCore::Style::detachChildren): 16 (WebCore::Style::detachShadowRoot): 17 (WebCore::Style::detachRenderTree): 18 (WebCore::Style::reattachRenderTree): 19 (WebCore::Style::resolveLocal): 20 * style/StyleResolveTree.h: 21 1 22 2013-08-30 Commit Queue <commit-queue@webkit.org> 2 23 -
TabularUnified trunk/Source/WebCore/dom/Element.cpp ¶
r154835 r154873 1376 1376 void Element::lazyReattach(ShouldSetAttached shouldSetAttached) 1377 1377 { 1378 Style::AttachContext context;1379 context.performingReattach = true;1380 1381 1378 if (attached()) 1382 Style::detachRenderTree (this, context);1379 Style::detachRenderTreeInReattachMode(this); 1383 1380 lazyAttach(shouldSetAttached); 1384 1381 } -
TabularUnified trunk/Source/WebCore/style/StyleResolveTree.cpp ¶
r154820 r154873 55 55 namespace Style { 56 56 57 enum DetachType { NormalDetach, ReattachDetach }; 58 59 static void attachRenderTree(Element*, RenderStyle* resolvedStyle); 60 static void detachRenderTree(Element*, DetachType); 61 57 62 Change determineChange(const RenderStyle* s1, const RenderStyle* s2, Settings* settings) 58 63 { … … 189 194 #endif 190 195 191 static void createRendererIfNeeded(Element& element, const AttachContext& context)196 static void createRendererIfNeeded(Element& element, RenderStyle* resolvedStyle) 192 197 { 193 198 ASSERT(!element.renderer()); … … 196 201 ContainerNode* renderingParentNode = NodeRenderingTraversal::parent(&element); 197 202 198 RefPtr<RenderStyle> style = context.resolvedStyle;203 RefPtr<RenderStyle> style = resolvedStyle; 199 204 200 205 element.setIsInsideRegion(false); … … 432 437 #endif 433 438 434 static void attachChildren(ContainerNode& current, const AttachContext& context) 435 { 436 AttachContext childrenContext(context); 437 childrenContext.resolvedStyle = 0; 438 439 static void attachChildren(ContainerNode& current) 440 { 439 441 for (Node* child = current.firstChild(); child; child = child->nextSibling()) { 440 442 ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(current)); … … 446 448 } 447 449 if (child->isElementNode()) 448 attachRenderTree(toElement(child), childrenContext);449 } 450 } 451 452 static void attachShadowRoot(ShadowRoot& shadowRoot , const AttachContext& context)450 attachRenderTree(toElement(child), nullptr); 451 } 452 } 453 454 static void attachShadowRoot(ShadowRoot& shadowRoot) 453 455 { 454 456 if (shadowRoot.attached()) … … 457 459 styleResolver.pushParentShadowRoot(&shadowRoot); 458 460 459 attachChildren(shadowRoot , context);461 attachChildren(shadowRoot); 460 462 461 463 styleResolver.popParentShadowRoot(&shadowRoot); … … 465 467 } 466 468 467 void attachRenderTree(Element* current, const AttachContext& context)469 static void attachRenderTree(Element* current, RenderStyle* resolvedStyle) 468 470 { 469 471 PostAttachCallbackDisabler callbackDisabler(current); … … 473 475 current->willAttachRenderers(); 474 476 475 createRendererIfNeeded(*current, context);477 createRendererIfNeeded(*current, resolvedStyle); 476 478 477 479 if (current->parentElement() && current->parentElement()->isInCanvasSubtree()) … … 485 487 if (ShadowRoot* shadowRoot = current->shadowRoot()) { 486 488 parentPusher.push(); 487 attachShadowRoot(*shadowRoot , context);489 attachShadowRoot(*shadowRoot); 488 490 } else if (current->firstChild()) 489 491 parentPusher.push(); 490 492 491 attachChildren(*current , context);493 attachChildren(*current); 492 494 493 495 Node* sibling = current->nextSibling(); … … 511 513 } 512 514 513 static void detachChildren(ContainerNode& current, const AttachContext& context) 514 { 515 AttachContext childrenContext(context); 516 childrenContext.resolvedStyle = 0; 517 515 static void detachChildren(ContainerNode& current, DetachType detachType) 516 { 518 517 for (Node* child = current.firstChild(); child; child = child->nextSibling()) { 519 518 if (child->isTextNode()) { … … 522 521 } 523 522 if (child->isElementNode()) 524 detachRenderTree(toElement(child), childrenContext);523 detachRenderTree(toElement(child), detachType); 525 524 } 526 525 current.clearChildNeedsStyleRecalc(); 527 526 } 528 527 529 static void detachShadowRoot(ShadowRoot& shadowRoot, const AttachContext& context)528 static void detachShadowRoot(ShadowRoot& shadowRoot, DetachType detachType) 530 529 { 531 530 if (!shadowRoot.attached()) 532 531 return; 533 detachChildren(shadowRoot, context);532 detachChildren(shadowRoot, detachType); 534 533 535 534 shadowRoot.setAttached(false); 536 535 } 537 536 538 void detachRenderTree(Element* current, const AttachContext& context)537 static void detachRenderTree(Element* current, DetachType detachType) 539 538 { 540 539 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; … … 547 546 // Do not remove the element's hovered and active status 548 547 // if performing a reattach. 549 if ( !context.performingReattach)548 if (detachType != ReattachDetach) 550 549 current->clearHoverAndActiveStatusBeforeDetachingRenderer(); 551 550 552 551 if (ShadowRoot* shadowRoot = current->shadowRoot()) 553 detachShadowRoot(*shadowRoot, context);554 555 detachChildren(*current, context);552 detachShadowRoot(*shadowRoot, detachType); 553 554 detachChildren(*current, detachType); 556 555 557 556 if (current->renderer()) … … 563 562 if (current->hasCustomStyleResolveCallbacks()) 564 563 current->didDetachRenderers(); 565 }566 567 void reattachRenderTree(Element* current, const AttachContext& context)568 {569 AttachContext reattachContext(context);570 reattachContext.performingReattach = true;571 572 if (current->attached())573 detachRenderTree(current, reattachContext);574 575 attachRenderTree(current, reattachContext);576 564 } 577 565 … … 622 610 } 623 611 if (localChange == Detach) { 624 AttachContext reattachContext;625 reattachContext.resolvedStyle = newStyle.get();626 reattachRenderTree(current, reattachContext);612 if (current->attached()) 613 detachRenderTree(current, ReattachDetach); 614 attachRenderTree(current, newStyle.get()); 627 615 return Detach; 628 616 } … … 845 833 } 846 834 847 } 848 } 835 void attachRenderTree(Element* element) 836 { 837 attachRenderTree(element, nullptr); 838 } 839 840 void detachRenderTree(Element* element) 841 { 842 detachRenderTree(element, NormalDetach); 843 } 844 845 void detachRenderTreeInReattachMode(Element* element) 846 { 847 detachRenderTree(element, ReattachDetach); 848 } 849 850 void reattachRenderTree(Element* current) 851 { 852 if (current->attached()) 853 detachRenderTree(current, ReattachDetach); 854 attachRenderTree(current, nullptr); 855 } 856 857 } 858 } -
TabularUnified trunk/Source/WebCore/style/StyleResolveTree.h ¶
r154738 r154873 42 42 void resolveTree(Document*, Change); 43 43 44 struct AttachContext { 45 RenderStyle* resolvedStyle; 46 bool performingReattach; 47 48 AttachContext() : resolvedStyle(0), performingReattach(false) { } 49 }; 50 void attachRenderTree(Element*, const AttachContext& = AttachContext()); 51 void detachRenderTree(Element*, const AttachContext& = AttachContext()); 52 void reattachRenderTree(Element*, const AttachContext& = AttachContext()); 44 void attachRenderTree(Element*); 45 void detachRenderTree(Element*); 46 void reattachRenderTree(Element*); 47 // FIXME: This is only used for "lazy reattach" for shadow trees. 48 void detachRenderTreeInReattachMode(Element*); 53 49 54 50 void attachTextRenderer(Text&);
Note:
See TracChangeset
for help on using the changeset viewer.