Changeset 250821 in webkit
- Timestamp:
- Oct 8, 2019 5:22:21 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r250817 r250821 1 2019-10-08 Antti Koivisto <antti@apple.com> 2 3 [CSS Shadow Parts] Implement style invalidation 4 https://bugs.webkit.org/show_bug.cgi?id=202632 5 6 Reviewed by Ryosuke Niwa. 7 8 Add some tests to verify class mutations and combinators with ::part and exportpart. 9 10 * fast/css/shadow-parts/invalidation-class-descendant-combinator-expected.txt: Added. 11 * fast/css/shadow-parts/invalidation-class-descendant-combinator-export-expected.txt: Added. 12 * fast/css/shadow-parts/invalidation-class-descendant-combinator-export.html: Added. 13 * fast/css/shadow-parts/invalidation-class-descendant-combinator.html: Added. 14 * fast/css/shadow-parts/invalidation-class-sibling-combinator-expected.txt: Added. 15 * fast/css/shadow-parts/invalidation-class-sibling-combinator-export-expected.txt: Added. 16 * fast/css/shadow-parts/invalidation-class-sibling-combinator-export.html: Added. 17 * fast/css/shadow-parts/invalidation-class-sibling-combinator.html: Added. 18 1 19 2019-10-08 Antti Koivisto <antti@apple.com> 2 20 -
trunk/LayoutTests/imported/w3c/ChangeLog
r250787 r250821 1 2019-10-08 Antti Koivisto <antti@apple.com> 2 3 [CSS Shadow Parts] Implement style invalidation 4 https://bugs.webkit.org/show_bug.cgi?id=202632 5 6 Reviewed by Ryosuke Niwa. 7 8 * web-platform-tests/css/css-shadow-parts/invalidation-change-exportparts-forward-expected.txt: 9 * web-platform-tests/css/css-shadow-parts/invalidation-change-part-name-expected.txt: 10 * web-platform-tests/css/css-shadow-parts/invalidation-change-part-name-forward-expected.txt: 11 1 12 2019-10-07 Rob Buis <rbuis@igalia.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/invalidation-change-exportparts-forward-expected.txt
r250712 r250821 1 1 The following text should be green: 2 2 3 FAIL Part in selected host changed color assert_not_equals: got disallowed value "rgb(255, 0, 0)" 3 PASS Part in selected host changed color 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/invalidation-change-part-name-expected.txt
r250628 r250821 1 1 The following text should be green: 2 2 3 FAIL Part in selected host changed color assert_not_equals: got disallowed value "rgb(255, 0, 0)" 3 PASS Part in selected host changed color 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/invalidation-change-part-name-forward-expected.txt
r250712 r250821 1 1 The following text should be green: 2 2 3 FAIL Part in selected host changed color assert_not_equals: got disallowed value "rgb(255, 0, 0)" 3 PASS Part in selected host changed color 4 4 -
trunk/Source/WebCore/ChangeLog
r250819 r250821 1 2019-10-08 Antti Koivisto <antti@apple.com> 2 3 [CSS Shadow Parts] Implement style invalidation 4 https://bugs.webkit.org/show_bug.cgi?id=202632 5 6 Reviewed by Ryosuke Niwa. 7 8 Tests: fast/css/shadow-parts/invalidation-class-descendant-combinator-export.html 9 fast/css/shadow-parts/invalidation-class-descendant-combinator.html 10 fast/css/shadow-parts/invalidation-class-sibling-combinator-export.html 11 fast/css/shadow-parts/invalidation-class-sibling-combinator.html 12 13 * css/RuleFeature.cpp: 14 (WebCore::isSiblingOrSubject): 15 16 Don't treat crossing to host as moving to ancestor when computing elements impacted by a selector. 17 StyleInvalidator expects these relations to be about the host element, shadow tree invalidation in handled separately. 18 19 * dom/Element.cpp: 20 (WebCore::Element::attributeChanged): 21 22 Invalidate parts in shadow tree on 'exportparts' attribute mutation. 23 24 (WebCore::Element::partAttributeChanged): 25 26 Invalidate element on 'part' attribute mutation. 27 28 * style/StyleInvalidator.cpp: 29 (WebCore::Style::Invalidator::Invalidator): 30 (WebCore::Style::Invalidator::invalidateIfNeeded): 31 32 Invalidate parts in shadow tree during class and attribute mutation invalidation. 33 34 (WebCore::Style::Invalidator::invalidateShadowParts): 35 * style/StyleInvalidator.h: 36 (WebCore::Style::Invalidator::dirtiesAllStyle const): 37 (WebCore::Style::Invalidator::hasShadowPseudoElementRulesInAuthorSheet const): Deleted. 38 39 Remove an unncessary bool. 40 1 41 2019-10-08 Carlos Garcia Campos <cgarcia@igalia.com> 2 42 -
trunk/Source/WebCore/css/RuleFeature.cpp
r248846 r250821 43 43 case MatchElement::DirectSibling: 44 44 case MatchElement::AnySibling: 45 case MatchElement::Host: 45 46 return true; 46 47 case MatchElement::Parent: … … 48 49 case MatchElement::ParentSibling: 49 50 case MatchElement::AncestorSibling: 50 case MatchElement::Host:51 51 return false; 52 52 } -
trunk/Source/WebCore/dom/Element.cpp
r250788 r250821 104 104 #include "SimulatedClick.h" 105 105 #include "SlotAssignment.h" 106 #include "StyleInvalidator.h" 106 107 #include "StyleProperties.h" 107 108 #include "StyleResolver.h" … … 1751 1752 partAttributeChanged(newValue); 1752 1753 else if (name == HTMLNames::exportpartsAttr) { 1753 if (auto* shadowRoot = this->shadowRoot()) 1754 if (auto* shadowRoot = this->shadowRoot()) { 1754 1755 shadowRoot->invalidatePartMappings(); 1756 Style::Invalidator::invalidateShadowParts(*shadowRoot); 1757 } 1755 1758 } 1756 1759 } … … 1836 1839 partList->associatedAttributeValueChanged(newValue); 1837 1840 } 1841 1842 if (needsStyleInvalidation() && isInShadowTree()) 1843 invalidateStyleInternal(); 1838 1844 } 1839 1845 -
trunk/Source/WebCore/style/StyleInvalidator.cpp
r248846 r250821 32 32 #include "ElementRuleCollector.h" 33 33 #include "HTMLSlotElement.h" 34 #include "RuntimeEnabledFeatures.h" 34 35 #include "SelectorFilter.h" 35 36 #include "ShadowRoot.h" … … 89 90 for (auto& sheet : sheets) 90 91 m_ownedRuleSet->addRulesFromSheet(*sheet, mediaQueryEvaluator); 91 92 m_hasShadowPseudoElementRulesInAuthorSheet = m_ruleSet.hasShadowPseudoElementRules();93 92 } 94 93 95 94 Invalidator::Invalidator(const RuleSet& ruleSet) 96 95 : m_ruleSet(ruleSet) 97 , m_hasShadowPseudoElementRulesInAuthorSheet(ruleSet.hasShadowPseudoElementRules())98 96 { 99 97 } … … 101 99 Invalidator::CheckDescendants Invalidator::invalidateIfNeeded(Element& element, const SelectorFilter* filter) 102 100 { 103 if (m_ hasShadowPseudoElementRulesInAuthorSheet) {101 if (m_ruleSet.hasShadowPseudoElementRules()) { 104 102 // FIXME: This could do actual rule matching too. 105 103 if (element.shadowRoot()) 106 104 element.invalidateStyleForSubtreeInternal(); 107 105 } 106 107 // FIXME: More fine-grained invalidation for ::part() 108 if (!m_ruleSet.partPseudoElementRules().isEmpty() && element.shadowRoot()) 109 invalidateShadowParts(*element.shadowRoot()); 108 110 109 111 bool shouldCheckForSlots = !m_ruleSet.slottedPseudoElementRules().isEmpty() && !m_didInvalidateHostChildren; … … 263 265 } 264 266 265 } 266 } 267 void Invalidator::invalidateShadowParts(ShadowRoot& shadowRoot) 268 { 269 if (!RuntimeEnabledFeatures::sharedFeatures().cssShadowPartsEnabled()) 270 return; 271 272 if (shadowRoot.mode() == ShadowRootMode::UserAgent) 273 return; 274 275 for (auto& descendant : descendantsOfType<Element>(shadowRoot)) { 276 // FIXME: We could only invalidate part names that actually show up in rules. 277 if (!descendant.partNames().isEmpty()) 278 descendant.invalidateStyleInternal(); 279 280 auto* nestedShadowRoot = descendant.shadowRoot(); 281 if (nestedShadowRoot && !nestedShadowRoot->partMappings().isEmpty()) 282 invalidateShadowParts(*nestedShadowRoot); 283 } 284 } 285 286 } 287 } -
trunk/Source/WebCore/style/StyleInvalidator.h
r227787 r250821 47 47 48 48 bool dirtiesAllStyle() const { return m_dirtiesAllStyle; } 49 bool hasShadowPseudoElementRulesInAuthorSheet() const { return m_hasShadowPseudoElementRulesInAuthorSheet; }50 49 void invalidateStyle(Document&); 51 50 void invalidateStyle(ShadowRoot&); 52 51 void invalidateStyle(Element&); 53 52 void invalidateStyleWithMatchElement(Element&, MatchElement); 53 54 static void invalidateShadowParts(ShadowRoot&); 54 55 55 56 private: … … 62 63 const RuleSet& m_ruleSet; 63 64 bool m_dirtiesAllStyle { false }; 64 bool m_hasShadowPseudoElementRulesInAuthorSheet { false };65 65 bool m_didInvalidateHostChildren { false }; 66 66 };
Note: See TracChangeset
for help on using the changeset viewer.