New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 711539 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
NOT IN USE
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

:host([attr]) selector not getting invalidated correctly on shadow root creation

Project Member Reported by arthure@chromium.org, Apr 14 2017

Issue description

Chrome Version: 58.0.3029.33 (Official Build) beta (64-bit)
OS: OSX

Create an element with an attribute:

<my-el pressed>

Add a shadow root, with a style tag that includes
:host and :host([attribute]) selectors.

```
:host div { color: blue }
:host([pressed]) div { color: red }
```

The div gets the wrong style (in this case, it's styled blue, not red. Devtools shows the correct rule winning, but the computed value for color shows the wrong color. 

Toggling the attribute in devtools results in the style being set correctly.

Live demo:

https://jsbin.com/sumulix/1/edit?html,output

What is the expected result?

The element with the "pressed" attribute is colored red.

What happens instead?

Both elements are colored the same.


 

Comment 1 by samli@chromium.org, Apr 14 2017

Labels: -Pri-3 Needs-Bisect Hotlist-Interop Pri-2
Reproduced on Canary.
Google Chrome	59.0.3070.0 (Official Build) canary (64-bit)
Revision	daf91016aa4560f3c0f72d50eee762eed996fc0e-refs/heads/master@{#464226}
OS	Mac OS X

Confirmed as working in Safari Technology Preview (Release 27 (Safari 10.2, WebKit 12604.1.15.2).

Comment 2 by ajha@chromium.org, Apr 17 2017

Labels: Needs-Triage-M58
Labels: -Needs-Bisect -Needs-Triage-M58 M-60 OS-Linux OS-Mac OS-Windows
Able to reproduce this issue on Mac 10.12.4, Win-10 and Ubuntu 14.04 using chrome reported version #58.0.3029.33 and latest canary #60.0.3072.0.

This is a non-regression issue as it is observed from M54 old builds. 
From M53 and older builds, when opening the url: https://jsbin.com/sumulix/1/edit?html,output gives no output/blank output.

Could anyone from dev team please have a look into this issue.

Thanks...!!
Since the initial repro case uses v1 shadow DOM, it won't work prior to M53 (although theoretically it should work in M53 ...).

The same sample using v0 shadow DOM (createShadowRoot) shows the same issue:

https://jsbin.com/nuzarus/2/edit?html,output

I believe this v0 shadow DOM behavior _is_ a regression (because the tutorial app that this sample is reduced from used to work). But I don't know how to get an older chrome build to test on.
Labels: Needs-Bisect
Test team - can you please bisect with the test case given in comment #4?

Comment 6 by r...@opera.com, Apr 18 2017

Owner: r...@opera.com
Status: Started (was: Untriaged)

Comment 7 by r...@opera.com, Apr 18 2017

The issue is that the elements are incorrectly sharing computed style.

Cc: jmukthavaram@chromium.org
Labels: -Needs-Bisect
Able to reproduce this issue on Mac 10.12.4, Windows 7 and Ubuntu 14.04 using chrome reported version #58.0.3029.33 and latest canary #60.0.3072.0.

This is a non-regression issue as it is observed from M45 builds. 
From M44 and older builds, when opening the "https://jsbin.com/nuzarus/2/edit?html,output" as per comment#4,output gives as blank.
Please find the attached screencast for reference.

rune@,please take a look into this issue.

Thanks...!!
711539.mp4
1.0 MB View Download

Comment 9 by shans@chromium.org, Apr 20 2017

Labels: Update-Quarterly
Project Member

Comment 10 by bugdroid1@chromium.org, Apr 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0e2caa4b6dc7715e9d08e77f46e1dcdf28825405

commit 0e2caa4b6dc7715e9d08e77f46e1dcdf28825405
Author: rune <rune@opera.com>
Date: Thu Apr 20 12:20:51 2017

Scopeless matching of :host rules for style sharing.

The kSharingRules mode for selector matching needs to bypass scope
checking in various places because we match selectors from the set of
global uncommon attribute rules for which the source scope is unknown.

We should really store these rules per scope, at least for Shadow DOM
v1, and pass the correct scope for matching.

BUG= 711539 

Review-Url: https://codereview.chromium.org/2824853004
Cr-Commit-Position: refs/heads/master@{#465980}

[modify] https://crrev.com/0e2caa4b6dc7715e9d08e77f46e1dcdf28825405/third_party/WebKit/Source/core/css/ElementRuleCollector.h
[modify] https://crrev.com/0e2caa4b6dc7715e9d08e77f46e1dcdf28825405/third_party/WebKit/Source/core/css/SelectorChecker.cpp
[modify] https://crrev.com/0e2caa4b6dc7715e9d08e77f46e1dcdf28825405/third_party/WebKit/Source/core/css/resolver/MatchRequest.h
[modify] https://crrev.com/0e2caa4b6dc7715e9d08e77f46e1dcdf28825405/third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp

Comment 11 by r...@opera.com, Apr 20 2017

Status: Fixed (was: Started)

Sign in to add a comment