New issue
Advanced search Search tips

Issue 857415 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 8
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

:host specificity is not correct.

Project Member Reported by emilio@chromium.org, Jun 28 2018

Issue description

Chrome Version: (copy from chrome://version)
OS: (e.g. Win10, MacOS 10.12, etc...)

What steps will reproduce the problem?
(1) Open the attached test-case.

What is the expected result?

A green square.

What happens instead?

A red square.

:host is a pseudo-class, so per css-cascade it should count the same as a class selector.
 
test.html
354 bytes View Download

Comment 1 by emilio@chromium.org, Jun 28 2018

Cc: futhark@chromium.org
Components: Blink>CSS

Comment 2 by emilio@chromium.org, Jun 28 2018

Err, I mentioned css-cascade, but the relevant spec is selectors:

  https://drafts.csswg.org/selectors-4/#specificity-rules

Safari and Firefox get the test-case right.

Comment 3 by e...@chromium.org, Jun 28 2018

Status: Available (was: Untriaged)
 Issue 887976  has been merged into this issue.
Owner: emilio@chromium.org
I guess I'll fix it myself before it causes compat pain for us.
Status: Started (was: Available)
Project Member

Comment 8 by bugdroid1@chromium.org, Sep 27

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

commit 1ef23c9360a771f0cadb5717262a4bbe0f0e5cdc
Author: Emilio Cobos Álvarez <emilio@chromium.org>
Date: Thu Sep 27 16:22:02 2018

Make :host account for its own pseudo-class specificity.

Otherwise `:host div` is equally specific to `div`, which seems undesirable and
doesn't match any spec.

Bug:  857415 
Change-Id: I0a012ada134acb022dab85c3912b33ac5d0bd1dd
Reviewed-on: https://chromium-review.googlesource.com/1238445
Commit-Queue: Emilio Cobos Álvarez <emilio@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594745}
[modify] https://crrev.com/1ef23c9360a771f0cadb5717262a4bbe0f0e5cdc/third_party/WebKit/LayoutTests/TestExpectations
[add] https://crrev.com/1ef23c9360a771f0cadb5717262a4bbe0f0e5cdc/third_party/WebKit/LayoutTests/external/wpt/css/css-scoping/host-specificity-003.html
[modify] https://crrev.com/1ef23c9360a771f0cadb5717262a4bbe0f0e5cdc/third_party/WebKit/LayoutTests/fast/dom/shadow/shadow-tree-styles-select-host.html
[modify] https://crrev.com/1ef23c9360a771f0cadb5717262a4bbe0f0e5cdc/third_party/blink/renderer/core/css/css_selector.cc
[modify] https://crrev.com/1ef23c9360a771f0cadb5717262a4bbe0f0e5cdc/third_party/blink/renderer/core/css/css_selector.h
[modify] https://crrev.com/1ef23c9360a771f0cadb5717262a4bbe0f0e5cdc/third_party/blink/renderer/core/css/selector_checker.cc

Status: Fixed (was: Started)
Project Member

Comment 10 by bugdroid1@chromium.org, Sep 27

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

commit 4fbe646e3481903ddeb0ab99152873e715861606
Author: Demetrios Papadopoulos <dpapad@chromium.org>
Date: Thu Sep 27 22:03:44 2018

Revert "Make :host account for its own pseudo-class specificity."

This reverts commit 1ef23c9360a771f0cadb5717262a4bbe0f0e5cdc.

Reason for revert: 
Caused several styling breakages across WebUI surfaces, see https://bugs.chromium.org/p/chromium/issues/detail?id=890030

Original change's description:
> Make :host account for its own pseudo-class specificity.
> 
> Otherwise `:host div` is equally specific to `div`, which seems undesirable and
> doesn't match any spec.
> 
> Bug:  857415 
> Change-Id: I0a012ada134acb022dab85c3912b33ac5d0bd1dd
> Reviewed-on: https://chromium-review.googlesource.com/1238445
> Commit-Queue: Emilio Cobos Álvarez <emilio@chromium.org>
> Reviewed-by: Rune Lillesveen <futhark@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#594745}

TBR=emilio@chromium.org,futhark@chromium.org,andruud@chromium.org

Change-Id: I98ce78a982a1d71356f18ec60a01e9616d5f9eec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  857415 
Reviewed-on: https://chromium-review.googlesource.com/1250054
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594888}
[modify] https://crrev.com/4fbe646e3481903ddeb0ab99152873e715861606/third_party/WebKit/LayoutTests/TestExpectations
[delete] https://crrev.com/52e09e6c6a6ce8108e15375e030139063fe1904c/third_party/WebKit/LayoutTests/external/wpt/css/css-scoping/host-specificity-003.html
[modify] https://crrev.com/4fbe646e3481903ddeb0ab99152873e715861606/third_party/WebKit/LayoutTests/fast/dom/shadow/shadow-tree-styles-select-host.html
[modify] https://crrev.com/4fbe646e3481903ddeb0ab99152873e715861606/third_party/blink/renderer/core/css/css_selector.cc
[modify] https://crrev.com/4fbe646e3481903ddeb0ab99152873e715861606/third_party/blink/renderer/core/css/css_selector.h
[modify] https://crrev.com/4fbe646e3481903ddeb0ab99152873e715861606/third_party/blink/renderer/core/css/selector_checker.cc

Status: Assigned (was: Fixed)
Re-opening since the CL was reverted, see  issue 890030  for more context.
Cc: foolip@chromium.org
Labels: Hotlist-Interop
Rune, Philip, I may not have the cycles to fix all the Chromium front-end issues that may arise from this change... I was just trying to fix the interop issue between Blink and all other engines (just double-checked the WebKit source and WebKit and Gecko behave exactly the same in this regard right now).

Is there any chance you could coordinate this internally somehow to allow this change to land?

I'll try to give a go to fix all the known issues in that bug, but I can make no promises, this is all free-time stuff for me :)

Alternatively, is there any way to expose this change to content but not to WebUIs? I suspect that might be rather hacky...

Keeping myself as Owner to try fix some of those tomorrow or over the weekend, but feel free to steal it from me if you find time to work on it.

Thank you.
Cc: -futhark@chromium.org emilio@chromium.org
Owner: futhark@chromium.org
I'll take this.
Labels: -Pri-3 Pri-2
Ah, keeping this working as-is in v0 as suggested is probably the easiest path forward here indeed. Anyway thanks for taking this Rune!
Status: Started (was: Assigned)
Project Member

Comment 18 by bugdroid1@chromium.org, Oct 8

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

commit 674ef6ac2499fb51d82e752ccf723fd76c505caf
Author: Rune Lillesveen <futhark@chromium.org>
Date: Mon Oct 08 13:41:31 2018

Make :host account for its own pseudo-class specificity.

Otherwise `:host div` is equally specific to `div`, which seems
undesirable and doesn't match any spec.

This is only done for Shadow DOM v1 since there are backward compat
issues with Polymer and WebUI.

Intent to ship:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/gYrR2nR6quI

Bug:  857415 
Change-Id: Ieaaf9b835ae7136806ced8f6e72fb30f9adf02af
Reviewed-on: https://chromium-review.googlesource.com/c/1250963
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Emilio Cobos Álvarez <emilio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597549}
[modify] https://crrev.com/674ef6ac2499fb51d82e752ccf723fd76c505caf/third_party/WebKit/LayoutTests/TestExpectations
[add] https://crrev.com/674ef6ac2499fb51d82e752ccf723fd76c505caf/third_party/WebKit/LayoutTests/external/wpt/css/css-scoping/host-context-specificity-001.html
[add] https://crrev.com/674ef6ac2499fb51d82e752ccf723fd76c505caf/third_party/WebKit/LayoutTests/external/wpt/css/css-scoping/host-context-specificity-002.html
[add] https://crrev.com/674ef6ac2499fb51d82e752ccf723fd76c505caf/third_party/WebKit/LayoutTests/external/wpt/css/css-scoping/host-context-specificity-003.html
[add] https://crrev.com/674ef6ac2499fb51d82e752ccf723fd76c505caf/third_party/WebKit/LayoutTests/external/wpt/css/css-scoping/host-specificity-003.html
[modify] https://crrev.com/674ef6ac2499fb51d82e752ccf723fd76c505caf/third_party/blink/renderer/core/css/css_selector.cc
[modify] https://crrev.com/674ef6ac2499fb51d82e752ccf723fd76c505caf/third_party/blink/renderer/core/css/css_selector.h
[modify] https://crrev.com/674ef6ac2499fb51d82e752ccf723fd76c505caf/third_party/blink/renderer/core/css/selector_checker.cc

Status: Fixed (was: Started)

Sign in to add a comment