Updating class name doesn't update the slotted content's style
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2016 23:08:34 +0000 (23:08 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2016 23:08:34 +0000 (23:08 +0000)
commita4ffe068a321a234d9f2bb212250f9c7d60b9cff
tree65646140bbc42d80320d1e0b9af94139b5ebc159
parentb67e01a5cd642d687f189bd9fb11e49cea939040
Updating class name doesn't update the slotted content's style
https://bugs.webkit.org/show_bug.cgi?id=164577
<rdar://problem/29205873>

Reviewed by Ryosuke Niwa.

Source/WebCore:

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

Teach style invalidation code for attribute/class/id mutations about slotted rules.

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

    Helper to find all assigned shadow roots (there may be more than one if slots are assigned to slots).

* dom/ShadowRoot.h:
* style/AttributeChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByAttributeChange):
(WebCore::Style::mayBeAffectedByHostRules):
(WebCore::Style::mayBeAffectedBySlottedRules):
(WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
(WebCore::Style::mayBeAffectedByHostStyle): Deleted.
* style/ClassChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByHostRules):
(WebCore::Style::mayBeAffectedBySlottedRules):
(WebCore::Style::ClassChangeInvalidation::invalidateStyle):
(WebCore::Style::mayBeAffectedByHostStyle): Deleted.
* style/ClassChangeInvalidation.h:
* style/IdChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByHostRules):
(WebCore::Style::mayBeAffectedBySlottedRules):
(WebCore::Style::IdChangeInvalidation::invalidateStyle):
(WebCore::Style::mayBeAffectedByHostStyle): Deleted.
* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::canShareStyleWithElement):

    Fix a bug in style sharing where we were checking wrong element for host rules.
    Tested by the included test too (the last empty div).

LayoutTests:

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208616 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/shadow-dom/css-scoping-slotted-invalidation-expected.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/css-scoping-slotted-invalidation.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/ShadowRoot.cpp
Source/WebCore/dom/ShadowRoot.h
Source/WebCore/style/AttributeChangeInvalidation.cpp
Source/WebCore/style/ClassChangeInvalidation.cpp
Source/WebCore/style/ClassChangeInvalidation.h
Source/WebCore/style/IdChangeInvalidation.cpp
Source/WebCore/style/StyleSharingResolver.cpp