[CSS Shadow Parts] Support 'exportparts' attribute
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2019 08:33:05 +0000 (08:33 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2019 08:33:05 +0000 (08:33 +0000)
commitf8c838edc549c3c235f097a69ac9a8b70c50561d
tree689c9a20213b44ebf4417eab91fab105f20682a1
parente4b200e0412f3dae9ddcac128d6a7c3202d88ab9
[CSS Shadow Parts] Support 'exportparts' attribute
https://bugs.webkit.org/show_bug.cgi?id=202520

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-shadow-parts/double-forward-expected.txt:
* web-platform-tests/css/css-shadow-parts/invalidation-change-exportparts-forward-expected.txt:
* web-platform-tests/css/css-shadow-parts/invalidation-change-part-name-forward-expected.txt:
* web-platform-tests/css/css-shadow-parts/invalidation-complex-selector-forward-expected.txt:
* web-platform-tests/css/css-shadow-parts/precedence-part-vs-part-expected.txt:
* web-platform-tests/css/css-shadow-parts/simple-forward-expected.txt:
* web-platform-tests/css/css-shadow-parts/simple-forward-shorthand-expected.txt:

Source/WebCore:

Support 'exportparts' attribute for exporting part mappings from subcomponents.

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::matchAuthorRules):
(WebCore::ElementRuleCollector::matchPartPseudoElementRules):

Recurse to containing scopes to collect part rules if there are exported mappings.

(WebCore::ElementRuleCollector::ruleMatches):
* css/ElementRuleCollector.h:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively const):

Make ShadowDescendant fake combinator skip directly to the scope where the part rules are coming from.

(WebCore::SelectorChecker::checkOne const):

Resolve names via mappings if needed.

* css/SelectorChecker.h:
* dom/Element.cpp:
(WebCore::Element::attributeChanged):

Invalidate mappings as needed.

* dom/ShadowRoot.cpp:
(WebCore::parsePartMappings):

Parse the mappings microsyntax.

(WebCore::ShadowRoot::partMappings const):
(WebCore::ShadowRoot::invalidatePartMappings):
* dom/ShadowRoot.h:
* html/HTMLAttributeNames.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250712 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/double-forward-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/invalidation-change-exportparts-forward-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/invalidation-change-part-name-forward-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/invalidation-complex-selector-forward-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/precedence-part-vs-part-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/simple-forward-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/simple-forward-shorthand-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/ElementRuleCollector.cpp
Source/WebCore/css/ElementRuleCollector.h
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/css/SelectorChecker.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/ShadowRoot.cpp
Source/WebCore/dom/ShadowRoot.h
Source/WebCore/html/HTMLAttributeNames.in