Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cssom-1][css-pseudo-4] getComputedStyle and pseudo-elements with pseudo-classes or sub-pseudo-elements #10297

Open
delan opened this issue May 9, 2024 · 0 comments
Labels

Comments

@delan
Copy link
Contributor

delan commented May 9, 2024

getComputedStyle currently takes an optional <pseudo-element-selector>, and for highlight pseudos like ::search-text (#3812), it returns the styles that would apply to the element if that highlight is the only one active.

But pseudo-elements can have their own pseudo-classes, such as ::search-text:current (#10212) or ::first-line:hover, or even their own sub-pseudo-elements, such as ::before::marker. Note that while an element’s ::first-line is either :hover or :not(hover), both the :current and :not(current) styles can apply to different parts of an element’s ::search-text at once.

  1. Should getComputedStyle(x, "::search-text") return the :current styles or the :not(:current) styles? We propose :not(:current), and specifying this behaviour for ::search-text in css-pseudo #getComputedStyle.

  2. Given that getComputedStyle(x) returns the :hover styles when x is being hovered, should getComputedStyle(x, "::first-line") return the ::first-line:hover styles when the first line is being hovered? My current belief is that it should, and that in general, getComputedStyle should take pseudo-classes of the given pseudoElt into account. Note that ::first-line:hover rules are not yet supported by major impls (demo).

  3. Can we give authors a way to get the ::search-text:current styles? My current belief is that we should change pseudoElt from “<pseudo-element-selector>” to “<pseudo-compound-selector>”, but I’m not yet sure how we would update the algorithm in a way that satisfies both my beliefs in question 2 and question 3.

  4. Can we give authors a way to get the ::before::marker styles? My current belief is that we should change pseudoElt to “<pseudo-element-selector>+” or “<pseudo-compound-selector>+”, depending on the outcome of question 3.

I may experiment with questions 2 through 4 in Chromium to see what’s feasible, before putting this on the agenda.

@delan delan added css-pseudo-4 Current Work cssom-1 labels May 9, 2024
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 10, 2024
This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 13, 2024
This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 13, 2024
This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 14, 2024
This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 14, 2024
This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 15, 2024
This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
aarongable pushed a commit to chromium/chromium that referenced this issue May 15, 2024
This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5528894
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1301073}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 15, 2024
This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5528894
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1301073}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 15, 2024
This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5528894
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1301073}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue May 23, 2024
…r ::search-text, a=testonly

Automatic update from web-platform-tests
CSS highlight pseudos: resolve styles for ::search-text

This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5528894
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1301073}

--

wpt-commits: 3a7dc02c636e569c65292e4152e183aeaf7c2722
wpt-pr: 46197
jamienicol pushed a commit to jamienicol/gecko that referenced this issue May 24, 2024
…r ::search-text, a=testonly

Automatic update from web-platform-tests
CSS highlight pseudos: resolve styles for ::search-text

This patch resolves the styles for ::search-text twice during element
style recalc (once for :current, once for :not(:current)), and once
for :not(:current) only during getComputedStyle [1].

We use StyleRequest::SearchTextRequest to tell the resolver which
state we want styles for, which then gets plumbed to the selector
checker via ElementRuleCollector, ContextWithStyleScopeFrame, and
SelectorCheckingContext.

SelectorChecker then uses that request to decide whether a selector
with :current is a match, but only when the last dynamic pseudo was
::search-text (using a SelectorCheckingContext flag, like we do for
::selection:window-inactive).

[1] <w3c/csswg-drafts#10297>

Bug: 339298411
Change-Id: Id8cb1cc14399318a18d305f54b64b686a5c6d60a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5528894
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1301073}

--

wpt-commits: 3a7dc02c636e569c65292e4152e183aeaf7c2722
wpt-pr: 46197
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant