Bug 156235

Summary: Shadow DOM: :host() From The First Shadow Context Should Not Style All Shadow Context
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test
none
patch kling: review+

Antti Koivisto
Reported 2016-04-05 08:55:14 PDT
* SUMMARY The first “:host()” context in a template seems to dictate the the “host” styles for all shadow context in the document. Quoting draft from here https://drafts.csswg.org/css-scoping/#host-selector (if it is up-to-date),: “The :host pseudo-class, when evaluated in the context of a shadow tree, matches the shadow tree’s host element. In any other context, it matches nothing.” * STEPS TO REPRODUCE 1. Open included test-case * RESULTS Expected: Host 2 from test case shold have a black border instead of pink. Actual: Both hosts have pink borders.
Attachments
test (1.21 KB, text/html)
2016-04-05 08:55 PDT, Antti Koivisto
no flags
patch (5.88 KB, patch)
2016-04-05 09:11 PDT, Antti Koivisto
kling: review+
Antti Koivisto
Comment 1 2016-04-05 08:55:56 PDT
Antti Koivisto
Comment 2 2016-04-05 08:56:25 PDT
Antti Koivisto
Comment 3 2016-04-05 09:11:31 PDT
Andreas Kling
Comment 4 2016-04-05 09:14:03 PDT
Comment on attachment 275669 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=275669&action=review r=me > Source/WebCore/style/StyleSharingResolver.cpp:100 > + if (element.shadowRoot() && !element.shadowRoot()->styleResolver().ruleSets().authorStyle()->hostPseudoClassRules().isEmpty()) This would look so nice if we made authorStyle() return a reference, too. > Source/WebCore/style/StyleSharingResolver.cpp:287 > + if (element.shadowRoot() && !element.shadowRoot()->styleResolver().ruleSets().authorStyle()->hostPseudoClassRules().isEmpty()) Mhm.
Antti Koivisto
Comment 5 2016-04-05 09:46:30 PDT
Alex Christensen
Comment 6 2016-04-13 23:28:24 PDT
Comment on attachment 275669 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=275669&action=review > Source/WebCore/style/StyleSharingResolver.cpp:288 > + return nullptr; nullptr -> false :(
Antti Koivisto
Comment 7 2016-04-15 01:16:34 PDT
Note You need to log in before you can comment on or make changes to this bug.