CSS highlight pseudos: fix ‘currentColor’ resolution and painting #46968
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When ‘color’ is set to ‘currentColor’ in highlight pseudos, the color
(and any other properties that use ‘currentColor’) needs to be taken
from the ‘currentColor’ of the next active highlight overlay below.
Our impl was reworked significantly in CL:5332250 and CL:5368297, and
this patch improves on that by:
• updating HighlightPaintingStyle and ResolveColorsFromPreviousLayer
to let ‘background-color’ participate in ‘currentColor’ resolution
• fixing ResolveColorsFromPreviousLayer to always read ‘currentColor’,
not the property being resolved, from the previous layer
• making PaintHighlightOverlays pass the correct ‘currentColor’ for
the purposes of painting ‘text-shadow’
• extending PaintHighlightOverlays to paint ‘background-color’ and
‘text-shadow’ by as little as one part at a time, if affected by
‘currentColor’, while keeping parts merged where possible
• removing a stray LineRelativeRect::Unite call that made ::selection
parts fail to clip their decorations to the part
This patch adds eleven new tests with overlapping highlights and a
variety of properties set to ‘currentColor’:
• 001.html tests ‘color’ only (full ::selection)
• 001a.html tests ‘color’ only (partial ::selection)
• 002.html tests ‘color’ and ‘background-color’ (full ::selection)
• 002a.html tests ‘color’ and ‘background-color’ (partial ::selection)
• 002b.html tests ‘background-color’ only (full ::selection)
• 003.html tests ‘color’ and ‘text-decoration’ (full ::selection)
• 003a.html tests ‘color’ and ‘text-decoration’ (partial ::selection)
• 003b.html tests ‘text-decoration’ only (full ::selection)
• 004.html tests ‘color’ and ‘text-shadow’ (full ::selection)
• 004a.html tests ‘color’ and ‘text-shadow’ (partial ::selection)
• 004b.html tests ‘text-shadow’ only (full ::selection)
Bug: 339298411
Change-Id: I2e42a0d655683e76daf507aee3e34085f5eb080b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5644614
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1322551}