Skip to content

merge_pr_46968

Compare
Choose a tag to compare
@github-actions github-actions released this 03 Jul 04:07

CSS highlight pseudos: fix ‘currentColor’ resolution and painting

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}