Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2016 21:59:33 +0000 (21:59 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2016 21:59:33 +0000 (21:59 +0000)
commitdd7fe9fec99801a195bbf63813123458adb187c1
treee854c70e4f4c8b55b725ec9f6902791b7ea6be91
parent103692ce768c12cdbe0548e140654b918a2a4626
Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc
https://bugs.webkit.org/show_bug.cgi?id=160864

Reviewed by Ryosuke Niwa.

Source/WebCore:

Also fix similar issue with ::host

Test: fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html

* css/StyleInvalidationAnalysis.cpp:
(WebCore::StyleInvalidationAnalysis::invalidateIfNeeded):

    If we have ::slotted rules and encounter a <slot>, invalidate the slotted host children.

(WebCore::StyleInvalidationAnalysis::invalidateStyle):

    Invalidate the shadow host if we have ::host rules.

* css/StyleInvalidationAnalysis.h:
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet):

    Fix a bug where it was possible to mutate stylesheets in the inline stylesheet cache.
    The included test covers this.

* style/StyleScope.cpp:
(WebCore::Style::Scope::updateActiveStyleSheets):

    Handle the full invalidation case.

LayoutTests:

* fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation-expected.html: Added.
* fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@208610 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation-expected.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/StyleInvalidationAnalysis.cpp
Source/WebCore/css/StyleInvalidationAnalysis.h
Source/WebCore/dom/InlineStyleSheetOwner.cpp
Source/WebCore/style/StyleScope.cpp