Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Issue 789403005: Keep a separate list of :host(-context) rules. (Closed)

Created:
6 years ago by rune
Modified:
6 years ago
Reviewers:
esprehn, kochi
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, dglazkov+blink, ed+blinkwatch_opera.com, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Keep a separate list of :host(-context) rules. :host and :host-context in the rightmost compound selector apply to the host element in the parent scope of a scoped stylesheet. However, we put all these rules into the universal rule list and collected :host rules in its own scope and other rules in the scope outside. For example: <custom-element> <:shadow-root> <style> :host { background: green } * { background: red; } </style> <custom-element></custom-element> </custom-element> ":host" applies to the outer <custom-element>, "*" applies to the inner one. We collected both rules for both elements. Instead keep a list of :host and :host-context rules for each scope to be matched for the outer scope only, and skip all other rules from the inner scope when matching for the outer scope. Note that selectors with :host(-context) in non-rightmost compounds are still in the other rule lists as they don't match the shadow host, but an element in the same scope as the stylesheet is. For instance: ":host(.x) div". R=kochi@chromium.org,esprehn@chromium.org BUG=437846 TEST=fast/dom/shadow/host-pseudo-class.html TEST=fast/dom/shadow/hostcontext-pseudo-class.html Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=187036

Patch Set 1 #

Total comments: 2

Patch Set 2 : Added tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+102 lines, -1 line) Patch
M Source/core/css/ElementRuleCollector.h View 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/css/ElementRuleCollector.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M Source/core/css/RuleSet.h View 2 chunks +2 lines, -0 lines 0 comments Download
M Source/core/css/RuleSet.cpp View 3 chunks +6 lines, -0 lines 0 comments Download
M Source/core/css/RuleSetTest.cpp View 1 1 chunk +74 lines, -0 lines 0 comments Download
M Source/core/css/resolver/ScopedStyleResolver.h View 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/css/resolver/ScopedStyleResolver.cpp View 1 chunk +12 lines, -0 lines 0 comments Download
M Source/core/css/resolver/StyleResolver.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6 (1 generated)
rune
6 years ago (2014-12-11 15:36:52 UTC) #1
kochi
lgtm https://codereview.chromium.org/789403005/diff/1/Source/core/css/RuleSetTest.cpp File Source/core/css/RuleSetTest.cpp (right): https://codereview.chromium.org/789403005/diff/1/Source/core/css/RuleSetTest.cpp#newcode157 Source/core/css/RuleSetTest.cpp:157: } How about adding a test for ".foo:host ...
6 years ago (2014-12-12 09:54:40 UTC) #2
rune
https://codereview.chromium.org/789403005/diff/1/Source/core/css/RuleSetTest.cpp File Source/core/css/RuleSetTest.cpp (right): https://codereview.chromium.org/789403005/diff/1/Source/core/css/RuleSetTest.cpp#newcode157 Source/core/css/RuleSetTest.cpp:157: } On 2014/12/12 at 09:54:40, Takayoshi Kochi wrote: > ...
6 years ago (2014-12-12 15:44:03 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/789403005/20001
6 years ago (2014-12-12 15:44:24 UTC) #5
commit-bot: I haz the power
6 years ago (2014-12-12 16:56:57 UTC) #6
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=187036

Powered by Google App Engine
This is Rietveld 408576698