Changeset 190323 in webkit
- Timestamp:
- Sep 29, 2015 1:22:18 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r190322 r190323 1 2015-09-29 Ryosuke Niwa <rniwa@webkit.org> 2 3 Update style/layout when a slot is added or removed 4 https://bugs.webkit.org/show_bug.cgi?id=149593 5 6 Reviewed by Antti Koivisto. 7 8 Removed failing test expectations from fast/shadow-dom/shadow-layout-after-slot-changes.html 9 10 Also added an explicit test case for when a default slot is introduced dynamically after 11 calling getDistributedNodes() once, thereby forcing the slot assignments. 12 13 * fast/shadow-dom/HTMLSlotElement-interface-expected.txt: 14 * fast/shadow-dom/HTMLSlotElement-interface.html: 15 * fast/shadow-dom/shadow-layout-after-slot-changes.html: 16 * platform/mac/TestExpectations: 17 1 18 2015-09-29 Ryan Haddad <ryanhaddad@apple.com> 2 19 -
trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface-expected.txt
r189950 r190323 4 4 PASS getDistributedNodes method on HTMLSlotElement must return the list of distributed nodes 5 5 PASS getDistributedNodes must update when slot and name attributes are modified 6 PASS getDistributedNodes must update when a default slot is introduced dynamically by a slot rename 6 7 PASS getDistributedNodes must update when slot elements are inserted or removed 7 8 -
trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface.html
r189950 r190323 93 93 test(function () { 94 94 var shadowHost = document.createElement('div'); 95 var child = document.createElement('span'); 96 shadowHost.appendChild(child); 97 98 var shadowRoot = shadowHost.attachShadow({mode: 'open'}); 99 var slotElement = document.createElement('slot'); 100 slotElement.name = 'foo'; 101 shadowRoot.appendChild(slotElement); 102 103 assert_array_equals(slotElement.getDistributedNodes(), [], 'getDistributedNodes must be empty when there are no matching elements for the slot name'); 104 105 slotElement.name = null; 106 assert_array_equals(slotElement.getDistributedNodes(), [child], 'getDistributedNodes must be empty when there are no matching elements for the slot name'); 107 108 }, 'getDistributedNodes must update when a default slot is introduced dynamically by a slot rename'); 109 110 test(function () { 111 var shadowHost = document.createElement('div'); 95 112 var p = document.createElement('p'); 96 113 var text = document.createTextNode(''); -
trunk/LayoutTests/platform/mac/TestExpectations
r190320 r190323 1331 1331 webkit.org/b/149441 fast/shadow-dom/css-scoping-shadow-slotted-rule.html [ ImageOnlyFailure ] 1332 1332 webkit.org/b/149441 fast/shadow-dom/css-scoping-shadow-slot-display-override.html [ ImageOnlyFailure ] 1333 webkit.org/b/149593 fast/shadow-dom/shadow-layout-after-slot-changes.html [ ImageOnlyFailure ]1334 1333 1335 1334 webkit.org/b/149510 accessibility/mac/aria-expanded-notifications.html [ Pass Failure ] -
trunk/Source/WebCore/ChangeLog
r190314 r190323 1 2015-09-29 Ryosuke Niwa <rniwa@webkit.org> 2 3 Update style/layout when a slot is added or removed 4 https://bugs.webkit.org/show_bug.cgi?id=149593 5 6 Reviewed by Antti Koivisto. 7 8 Fixed the bug by forcing the render tree reconstruction on the shadow host when a slot is inserted or removed. 9 We should optimize these reconstructions by only triggering them on the affected slot elements in the future. 10 11 Also fixed a bug that we were not invalidating the slot assignments when a default slot is introduced dynamically 12 after the slot assignment algorithm had run. 13 14 Test (existing): fast/shadow-dom/shadow-layout-after-slot-changes.html 15 16 * dom/ShadowRoot.cpp: 17 (WebCore::ShadowRoot::addSlotElementByName): Passes in ShadowRoot. 18 (WebCore::ShadowRoot::removeSlotElementByName): Ditto. 19 * dom/SlotAssignment.cpp: 20 (WebCore::SlotAssignment::addSlotElementByName): Call setNeedsStyleRecalc. 21 (WebCore::SlotAssignment::removeSlotElementByName): Call setNeedsStyleRecalc if the host is still alive since this 22 function can be called while the host is being destructed in which case shadowRoot.host() would be nullptr. 23 * dom/SlotAssignment.h: 24 1 25 2015-09-29 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 26 -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r190256 r190323 1 1 /* 2 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 190 191 m_slotAssignments = std::make_unique<SlotAssignment>(); 191 192 192 return m_slotAssignments->addSlotElementByName(name, slot );193 return m_slotAssignments->addSlotElementByName(name, slot, *this); 193 194 } 194 195 195 196 void ShadowRoot::removeSlotElementByName(const AtomicString& name, HTMLSlotElement& slot) 196 197 { 197 return m_slotAssignments->removeSlotElementByName(name, slot );198 return m_slotAssignments->removeSlotElementByName(name, slot, *this); 198 199 } 199 200 -
trunk/Source/WebCore/dom/SlotAssignment.cpp
r190109 r190323 52 52 } 53 53 54 void SlotAssignment::addSlotElementByName(const AtomicString& name, HTMLSlotElement& slotElement )54 void SlotAssignment::addSlotElementByName(const AtomicString& name, HTMLSlotElement& slotElement, ShadowRoot& shadowRoot) 55 55 { 56 56 #ifndef NDEBUG … … 59 59 #endif 60 60 61 auto addResult = m_slots.add(treatNullAsEmpty(name), std::unique_ptr<SlotInfo>()); 61 // FIXME: We should be able to do a targeted reconstruction. 62 shadowRoot.host()->setNeedsStyleRecalc(ReconstructRenderTree); 63 64 const AtomicString& key = treatNullAsEmpty(name); 65 auto addResult = m_slots.add(key, std::unique_ptr<SlotInfo>()); 62 66 if (addResult.isNewEntry) { 63 67 addResult.iterator->value = std::make_unique<SlotInfo>(slotElement); 68 if (key == emptyAtom) // Because assignSlots doesn't collect nodes assgined to the default slot as an optimzation. 69 m_slotAssignmentsIsValid = false; 64 70 return; 65 71 } … … 78 84 } 79 85 80 void SlotAssignment::removeSlotElementByName(const AtomicString& name, HTMLSlotElement& slotElement )86 void SlotAssignment::removeSlotElementByName(const AtomicString& name, HTMLSlotElement& slotElement, ShadowRoot& shadowRoot) 81 87 { 82 88 #ifndef NDEBUG … … 84 90 m_slotElementsForConsistencyCheck.remove(&slotElement); 85 91 #endif 92 93 if (auto* host = shadowRoot.host()) // FIXME: We should be able to do a targeted reconstruction. 94 host->setNeedsStyleRecalc(ReconstructRenderTree); 86 95 87 96 auto it = m_slots.find(treatNullAsEmpty(name)); -
trunk/Source/WebCore/dom/SlotAssignment.h
r190109 r190323 48 48 HTMLSlotElement* findAssignedSlot(const Node&, ShadowRoot&); 49 49 50 void addSlotElementByName(const AtomicString&, HTMLSlotElement& );51 void removeSlotElementByName(const AtomicString&, HTMLSlotElement& );50 void addSlotElementByName(const AtomicString&, HTMLSlotElement&, ShadowRoot&); 51 void removeSlotElementByName(const AtomicString&, HTMLSlotElement&, ShadowRoot&); 52 52 53 53 const Vector<Node*>* assignedNodesForSlot(const HTMLSlotElement&, ShadowRoot&);
Note: See TracChangeset
for help on using the changeset viewer.