Changeset 190084 in webkit
- Timestamp:
- Sep 21, 2015 3:27:28 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r190081 r190084 1 2015-09-21 Antti Koivisto <antti@apple.com> 2 3 HTMLSlotElement should render its assigned nodes 4 https://bugs.webkit.org/show_bug.cgi?id=149242 5 6 Reviewed by Ryosuke Niwa. 7 8 Enable the relevant tests. 9 10 * platform/mac/TestExpectations: 11 1 12 2015-09-21 Alex Christensen <achristensen@webkit.org> 2 13 -
trunk/LayoutTests/platform/mac/TestExpectations
r190074 r190084 1304 1304 1305 1305 webkit.org/b/148695 fast/shadow-dom [ Pass ] 1306 webkit.org/b/149242 fast/shadow-dom/css-scoping-shadow-slot.html [ ImageOnlyFailure ]1307 webkit.org/b/149242 fast/shadow-dom/css-scoping-shadow-invisible-slot.html [ ImageOnlyFailure ]1308 1306 webkit.org/b/149328 fast/shadow-dom/css-scoping-shadow-with-rules.html [ ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r190079 r190084 1 2015-09-21 Antti Koivisto <antti@apple.com> 2 3 HTMLSlotElement should render its assigned nodes 4 https://bugs.webkit.org/show_bug.cgi?id=149242 5 6 Reviewed by Ryosuke Niwa. 7 8 Support rendering the assigned nodes under HTMLSlotElement. 9 10 * dom/SlotAssignment.cpp: 11 (WebCore::SlotAssignment::assignSlots): 12 13 Move the empty slot finding to the loop as the hash table may mutate. 14 15 * html/HTMLSlotElement.cpp: 16 (WebCore::HTMLSlotElement::attributeChanged): 17 (WebCore::HTMLSlotElement::assignedNodes): 18 (WebCore::HTMLSlotElement::getDistributedNodes): 19 * html/HTMLSlotElement.h: 20 * style/StyleResolveTree.cpp: 21 (WebCore::Style::attachBeforeOrAfterPseudoElementIfNeeded): 22 (WebCore::Style::attachSlot): 23 (WebCore::Style::attachRenderTree): 24 (WebCore::Style::detachChildren): 25 (WebCore::Style::detachShadowRoot): 26 (WebCore::Style::detachSlot): 27 (WebCore::Style::detachRenderTree): 28 (WebCore::Style::resolveChildren): 29 (WebCore::Style::resolveSlot): 30 (WebCore::Style::resolveTree): 31 1 32 2015-09-21 Tim Horton <timothy_horton@apple.com> 2 33 -
trunk/Source/WebCore/dom/SlotAssignment.cpp
r189950 r190084 176 176 entry.value->assignedNodes.shrink(0); 177 177 178 auto defaultSlotEntry = m_slots.find(emptyAtom);179 180 178 for (Node* child = host->firstChild(); child; child = child->nextSibling()) { 181 179 if (is<Element>(child)) { … … 187 185 } 188 186 } 187 auto defaultSlotEntry = m_slots.find(emptyAtom); 189 188 if (defaultSlotEntry != m_slots.end()) 190 189 defaultSlotEntry->value->assignedNodes.append(child); -
trunk/Source/WebCore/html/HTMLSlotElement.cpp
r190008 r190084 86 86 } 87 87 88 const Vector<Node*>* HTMLSlotElement::assignedNodes() const 89 { 90 auto* shadowRoot = containingShadowRoot(); 91 if (!shadowRoot) 92 return nullptr; 93 94 return shadowRoot->assignedNodesForSlot(*this); 95 } 96 88 97 Vector<RefPtr<Node>> HTMLSlotElement::getDistributedNodes() const 89 98 { 90 99 Vector<RefPtr<Node>> distributedNodes; 91 100 92 if (auto shadowRoot = containingShadowRoot()) { 93 if (auto assignedNodes = shadowRoot->assignedNodesForSlot(*this)) { 94 for (auto* node : *assignedNodes) 95 distributedNodes.append(node); 96 } 101 if (auto* assignedNodes = this->assignedNodes()) { 102 for (auto* node : *assignedNodes) 103 distributedNodes.append(node); 97 104 } 98 105 -
trunk/Source/WebCore/html/HTMLSlotElement.h
r189950 r190084 37 37 static Ref<HTMLSlotElement> create(const QualifiedName&, Document&); 38 38 39 const Vector<Node*>* assignedNodes() const; 40 39 41 Vector<RefPtr<Node>> getDistributedNodes() const; 40 42 -
trunk/Source/WebCore/style/StyleResolveTree.cpp
r190006 r190084 33 33 #include "ElementRareData.h" 34 34 #include "FlowThreadController.h" 35 #include "HTMLSlotElement.h" 35 36 #include "InsertionPoint.h" 36 37 #include "InspectorInstrumentation.h" … … 469 470 } 470 471 472 #if ENABLE(SHADOW_DOM) 473 static void attachSlotAssignees(HTMLSlotElement& slot, RenderStyle& inheritedStyle, RenderTreePosition& renderTreePosition) 474 { 475 if (auto* assignedNodes = slot.assignedNodes()) { 476 for (auto* child : *assignedNodes) { 477 if (is<Text>(*child)) 478 attachTextRenderer(downcast<Text>(*child), renderTreePosition); 479 else if (is<Element>(*child)) 480 attachRenderTree(downcast<Element>(*child), inheritedStyle, renderTreePosition, nullptr); 481 } 482 } 483 slot.clearNeedsStyleRecalc(); 484 slot.clearChildNeedsStyleRecalc(); 485 } 486 #endif 487 471 488 static void attachRenderTree(Element& current, RenderStyle& inheritedStyle, RenderTreePosition& renderTreePosition, PassRefPtr<RenderStyle> resolvedStyle) 472 489 { … … 474 491 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; 475 492 493 #if ENABLE(SHADOW_DOM) 494 if (is<HTMLSlotElement>(current)) { 495 attachSlotAssignees(downcast<HTMLSlotElement>(current), inheritedStyle, renderTreePosition); 496 return; 497 } 498 #endif 476 499 if (is<InsertionPoint>(current)) { 477 500 attachDistributedChildren(downcast<InsertionPoint>(current), inheritedStyle, renderTreePosition); … … 533 556 static void detachChildren(ContainerNode& current, DetachType detachType) 534 557 { 535 if (is<InsertionPoint>(current))536 detachDistributedChildren(downcast<InsertionPoint>(current));537 538 558 for (Node* child = current.firstChild(); child; child = child->nextSibling()) { 539 if (is<Text>(*child)) { 540 Style::detachTextRenderer(downcast<Text>(*child)); 541 continue; 542 } 543 if (is<Element>(*child)) 559 if (is<Text>(*child)) 560 detachTextRenderer(downcast<Text>(*child)); 561 else if (is<Element>(*child)) 544 562 detachRenderTree(downcast<Element>(*child), detachType); 545 563 } … … 551 569 detachChildren(shadowRoot, detachType); 552 570 } 571 572 #if ENABLE(SHADOW_DOM) 573 static void detachSlotAssignees(HTMLSlotElement& slot, DetachType detachType) 574 { 575 ASSERT(!slot.renderer()); 576 if (auto* assignedNodes = slot.assignedNodes()) { 577 for (auto* child : *assignedNodes) { 578 if (is<Text>(*child)) 579 detachTextRenderer(downcast<Text>(*child)); 580 else if (is<Element>(*child)) 581 detachRenderTree(downcast<Element>(*child), detachType); 582 } 583 } 584 slot.clearNeedsStyleRecalc(); 585 slot.clearChildNeedsStyleRecalc(); 586 } 587 #endif 553 588 554 589 static void detachRenderTree(Element& current, DetachType detachType) … … 566 601 current.clearHoverAndActiveStatusBeforeDetachingRenderer(); 567 602 568 if (ShadowRoot* shadowRoot = current.shadowRoot()) 603 if (is<InsertionPoint>(current)) 604 detachDistributedChildren(downcast<InsertionPoint>(current)); 605 #if ENABLE(SHADOW_DOM) 606 else if (is<HTMLSlotElement>(current)) 607 detachSlotAssignees(downcast<HTMLSlotElement>(current), detachType); 608 #endif 609 else if (ShadowRoot* shadowRoot = current.shadowRoot()) 569 610 detachShadowRoot(*shadowRoot, detachType); 570 611 … … 799 840 } 800 841 842 #if ENABLE(SHADOW_DOM) 843 static void resolveSlotAssignees(HTMLSlotElement& slot, RenderStyle& inheritedStyle, RenderTreePosition& renderTreePosition, Change change) 844 { 845 if (auto* assignedNodes = slot.assignedNodes()) { 846 for (auto* child : *assignedNodes) { 847 if (is<Text>(*child)) 848 resolveTextNode(downcast<Text>(*child), renderTreePosition); 849 else if (is<Element>(*child)) 850 resolveTree(downcast<Element>(*child), inheritedStyle, renderTreePosition, change); 851 } 852 } 853 slot.clearNeedsStyleRecalc(); 854 slot.clearChildNeedsStyleRecalc(); 855 } 856 #endif 857 801 858 void resolveTree(Element& current, RenderStyle& inheritedStyle, RenderTreePosition& renderTreePosition, Change change) 802 859 { 803 860 ASSERT(change != Detach); 804 861 862 #if ENABLE(SHADOW_DOM) 863 if (is<HTMLSlotElement>(current)) { 864 resolveSlotAssignees(downcast<HTMLSlotElement>(current), inheritedStyle, renderTreePosition, change); 865 return; 866 } 867 #endif 805 868 if (is<InsertionPoint>(current)) { 806 869 current.clearNeedsStyleRecalc();
Note: See TracChangeset
for help on using the changeset viewer.