Bug 160754

Summary: Can't style descendants in shadow tree using the :host pseudo class
Product: WebKit Reporter: Emmanuel <egarciad>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, commit-queue, hyatt, kling, koivisto, rniwa, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: All   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 148695    
Attachments:
Description Flags
Run in Safari TP
none
patch none

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.