InspectorUtils.selectorMatchesElement returns invalid result for nested shadow host with shared stylesheet
Categories
(DevTools :: Inspector, defect)
Tracking
(firefox146 fixed)
| Tracking | Status | |
|---|---|---|
| firefox146 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
(Blocks 1 open bug)
Details
Attachments
(4 files, 1 obsolete file)
Steps to reproduce
- Open the attached page
- Inspect the "nested shadow dom section" element
- Hover the
--avariable in thesection { color: var(--a); }rule
Expected results
The popup indicates that --a is red
Actual results
The popup says that --a is not defined
This is caused by CSSStyleRule::selectorMatchesElement not property working for the :host rule on the nested shadow host for the shared stylesheet.
D269727 highlights the issue.
CSSStyleRule::selectorMatchesElement was fixed to handle :host in Bug 1836755 , but I guess we missed this specific case
| Assignee | ||
Comment 1•2 months ago
|
||
| Assignee | ||
Comment 2•2 months ago
|
||
Updated•2 months ago
|
| Comment hidden (obsolete) |
| Assignee | ||
Comment 4•2 months ago
|
||
Emilio, since you took care of Bug 1836755, do you know what's happening here?
Updated•2 months ago
|
| Assignee | ||
Comment 5•2 months ago
|
||
Comment 7•2 months ago
|
||
When you call .selectorMatchesElement on a rule from an adopted stylesheet, both answers are technically correct depending on which scope you're matching from. In the regressing bug I added this comment which is still true.
I guess we could try to match all the potentially-relevant hosts? So basically changing that GetHost(..) call by a ForEachHost? I guess that wouldn't be too bad, you're likely to want that answer...
Do you want to give that a try? might not be hard to fix :)
| Assignee | ||
Comment 8•2 months ago
|
||
| Assignee | ||
Comment 9•2 months ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #7)
When you call .selectorMatchesElement on a rule from an adopted stylesheet, both answers are technically correct depending on which scope you're matching from. In the regressing bug I added this comment which is still true.
I guess we could try to match all the potentially-relevant hosts? So basically changing that
GetHost(..)call by aForEachHost? I guess that wouldn't be too bad, you're likely to want that answer...Do you want to give that a try? might not be hard to fix :)
Not sure I understand everything, but I gave it a try: D269931 , we can discuss the details on phab :)
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Updated•2 months ago
|
Comment 10•2 months ago
|
||
Comment 11•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/683392c38072
https://hg.mozilla.org/mozilla-central/rev/f78c58f49a96
Comment 12•2 months ago
|
||
Comment on attachment 9521916 [details]
Bug 1995943 - [devtools] Add rules view test for CSS variables from shared stylesheet used in nested shadow dom element. r=#devtools.
Revision D269733 was moved to bug 1996508. Setting attachment 9521916 [details] to obsolete.
Updated•2 months ago
|
Description
•