Commit c801c26
currentColor for highlight pseudos uses the correct originating element
Per the resolutions in [1], for a highlight pseudo with currentColor
as its color, getComputedStyle(element, "::highlight(...)").color
should return the color of the originating element (since this is the
color that would be painted if that highlight were the only one
applied).
This is currently achieved by having Color::ApplyValue grab the color
from the originating element for highlights using currentColor.
This hits a problem when we do
getComputedStyle(element, "::highlight(...)") on an element that
doesn't directly match a highlight pseudo, but is a child of an
element matching a highlight pseudo. In that case we end up reusing
the computed style for the highlight that was built for the ancestor
element. That highlight style still uses the color from the ancestor
element, which is the wrong result.
Here we fix this by having StyleAdjuster::AdjustComputedStyle adjust
the style to use the color from the correct originating element.
[1] w3c/csswg-drafts#6818 (comment)
Bug: 1321540
Change-Id: Ibbc9126811fe52ecadb358713857df05c1143708
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3690272
Reviewed-by: Delan Azabani <dazabani@igalia.com>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Dan Clark <daniec@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1012045}1 parent 0663e2d commit c801c26
File tree
2 files changed
+48
-0
lines changed- css/css-pseudo
- reference
2 files changed
+48
-0
lines changedLines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments