Changeset 285211 in webkit
- Timestamp:
- Nov 3, 2021 9:59:48 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-scoping/slotted-nested-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/style/StyleInvalidator.cpp (modified) (2 diffs)
-
Source/WebCore/style/StyleInvalidator.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r285209 r285211 1 2021-11-03 Antti Koivisto <antti@apple.com> 2 3 ::slotted element style not invalidated correctly in nested case 4 https://bugs.webkit.org/show_bug.cgi?id=232665 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/css/css-scoping/slotted-nested-expected.txt: 9 1 10 2021-11-03 Antti Koivisto <antti@apple.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scoping/slotted-nested-expected.txt
r267650 r285211 3 3 4 4 PASS Slotted matches rules against the slot in the right tree 5 FAIL Style invalidation works correctly for nested slots assert_not_equals: got disallowed value "rgb(0, 128, 0)" 5 PASS Style invalidation works correctly for nested slots 6 6 -
trunk/Source/WebCore/ChangeLog
r285210 r285211 1 2021-11-03 Antti Koivisto <antti@apple.com> 2 3 ::slotted element style not invalidated correctly in nested case 4 https://bugs.webkit.org/show_bug.cgi?id=232665 5 6 Reviewed by Simon Fraser. 7 8 We fail to invalidate ::slotted style if the assigned node is not from the current host scope. 9 10 * style/StyleInvalidator.cpp: 11 (WebCore::Style::invalidateAssignedElements): 12 13 Invalidate more accurately by following assigned node chain recursively instead of just invalidating all host children. 14 15 (WebCore::Style::Invalidator::invalidateIfNeeded): 16 17 Remove the unnecessary and incorrect m_didInvalidateHostChildren optimization. 18 19 * style/StyleInvalidator.h: 20 1 21 2021-11-03 Jer Noble <jer.noble@apple.com> 2 22 -
trunk/Source/WebCore/style/StyleInvalidator.cpp
r283552 r285211 129 129 } 130 130 131 static void invalidateAssignedElements(HTMLSlotElement& slot) 132 { 133 auto* assignedNodes = slot.assignedNodes(); 134 if (!assignedNodes) 135 return; 136 for (auto& node : *assignedNodes) { 137 if (!is<Element>(node.get())) 138 continue; 139 if (is<HTMLSlotElement>(*node) && node->containingShadowRoot()) { 140 invalidateAssignedElements(downcast<HTMLSlotElement>(*node)); 141 continue; 142 } 143 downcast<Element>(*node).invalidateStyleInternal(); 144 } 145 } 146 131 147 Invalidator::CheckDescendants Invalidator::invalidateIfNeeded(Element& element, const SelectorFilter* filter) 132 148 { 133 149 invalidateInShadowTreeIfNeeded(element); 134 150 135 bool shouldCheckForSlots = m_ruleInformation.hasSlottedPseudoElementRules && !m_didInvalidateHostChildren; 136 if (shouldCheckForSlots && is<HTMLSlotElement>(element)) { 137 auto* containingShadowRoot = element.containingShadowRoot(); 138 if (containingShadowRoot && containingShadowRoot->host()) { 139 for (auto& possiblySlotted : childrenOfType<Element>(*containingShadowRoot->host())) 140 possiblySlotted.invalidateStyleInternal(); 141 } 142 // No need to do this again. 143 m_didInvalidateHostChildren = true; 144 } 151 if (m_ruleInformation.hasSlottedPseudoElementRules && is<HTMLSlotElement>(element)) 152 invalidateAssignedElements(downcast<HTMLSlotElement>(element)); 145 153 146 154 switch (element.styleValidity()) { … … 162 170 case Style::Validity::SubtreeInvalid: 163 171 case Style::Validity::SubtreeAndRenderersInvalid: 164 if (shouldCheckForSlots)165 return CheckDescendants::Yes;166 172 return CheckDescendants::No; 167 173 } -
trunk/Source/WebCore/style/StyleInvalidator.h
r284857 r285211 91 91 92 92 bool m_dirtiesAllStyle { false }; 93 bool m_didInvalidateHostChildren { false };94 93 }; 95 94
Note: See TracChangeset
for help on using the changeset viewer.