Bug 160754 - Can't style descendants in shadow tree using the :host pseudo class
Summary: Can't style descendants in shadow tree using the :host pseudo class
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari Technology Preview
Hardware: All Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 148695
  Show dependency treegraph
 
Reported: 2016-08-10 15:01 PDT by Emmanuel
Modified: 2016-08-22 10:21 PDT (History)
10 users (show)

See Also:


Attachments
Run in Safari TP (1.45 KB, text/html)
2016-08-10 15:01 PDT, Emmanuel
no flags Details
patch (9.16 KB, patch)
2016-08-15 08:21 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emmanuel 2016-08-10 15:01:37 PDT
Created attachment 285767 [details]
Run in Safari TP

I'd expect complex selectors such as:

:host > div {
  ...
}

or

:host(.foo) > div {
  ...
}

to work in a style inside a shadow root.
Repro: http://jsbin.com/sinidob/edit?html,output

Tested in Safari TP, Chrome stable works as expected.
Comment 1 Radar WebKit Bug Importer 2016-08-15 05:24:34 PDT
<rdar://problem/27845430>
Comment 2 Antti Koivisto 2016-08-15 08:21:46 PDT
Created attachment 286054 [details]
patch

This enables

:host(.foo) div { ... }

but doesn't cover 

:host::after { ... }

case.
Comment 3 Darin Adler 2016-08-20 19:45:17 PDT
Comment on attachment 286054 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=286054&action=review

> Source/WebCore/css/SelectorChecker.cpp:1039
> +            const Node* contextualReferenceNode = !checkingContext.scope ? element.document().documentElement() : checkingContext.scope;

Maybe auto or auto* here?
Comment 4 WebKit Commit Bot 2016-08-22 10:21:11 PDT
Comment on attachment 286054 [details]
patch

Clearing flags on attachment: 286054

Committed r204724: <http://trac.webkit.org/changeset/204724>
Comment 5 WebKit Commit Bot 2016-08-22 10:21:17 PDT
All reviewed patches have been landed.  Closing bug.