Implement scoped styling for shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=149230
Reviewed by Ryosuke Niwa.
Source/WebCore:
Test: fast/shadow-dom/css-scoping-shadow-with-rules-no-style-leak.html
* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::collectMatchingRules):
Only use special path here for user agent shadow trees.
* dom/AuthorStyleSheets.cpp:
(WebCore::AuthorStyleSheets::AuthorStyleSheets):
(WebCore::AuthorStyleSheets::removePendingSheet):
(WebCore::AuthorStyleSheets::updateActiveStyleSheets):
Basic support for ShadowRoot scoped stylesheets.
* dom/AuthorStyleSheets.h:
(WebCore::AuthorStyleSheets::activeStyleSheets):
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::~InlineStyleSheetOwner):
(WebCore::authorStyleSheetsForElement):
(WebCore::InlineStyleSheetOwner::insertedIntoDocument):
(WebCore::InlineStyleSheetOwner::removedFromDocument):
(WebCore::InlineStyleSheetOwner::clearDocumentData):
(WebCore::InlineStyleSheetOwner::childrenChanged):
(WebCore::InlineStyleSheetOwner::createSheet):
(WebCore::InlineStyleSheetOwner::isLoading):
(WebCore::InlineStyleSheetOwner::sheetLoaded):
(WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
Basic support for ShadowRoot scoped inline stylesheets.
* dom/InlineStyleSheetOwner.h:
(WebCore::InlineStyleSheetOwner::sheet):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::styleResolver):
Create and initialize ShadowRoot scoped style resolver.
(WebCore::ShadowRoot::resetStyleResolver):
(WebCore::ShadowRoot::authorStyleSheets):
Collection of author stylesheets in the shadow tree.
(WebCore::ShadowRoot::updateStyle):
Trigger style recalc when stylesheets change.
(WebCore::ShadowRoot::cloneNode):
* dom/ShadowRoot.h:
(WebCore::ShadowRoot::resetStyleInheritance):
* html/HTMLStyleElement.h:
* svg/SVGStyleElement.h:
LayoutTests:
* fast/shadow-dom/css-scoping-shadow-with-rules-no-style-leak-expected.html: Added.
* fast/shadow-dom/css-scoping-shadow-with-rules-no-style-leak.html: Added.
Add a test that verifies that shadow DOM style doesn't affect normal DOM.
* platform/mac/TestExpectations:
Enable fast/shadow-dom/css-scoping-shadow-with-rules.html
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190256
268f45cc-cd09-0410-ab3c-
d52691b4dbfc