[wpt-sync] Sync PR 35356 - HighlightInheritance: fix ‘currentColor’ for all other properties
Categories
(Core :: Layout: Generated Content, Lists, and Counters, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox106 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 35356 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/35356
Details from upstream follow.
Delan Azabani <dazabani@igalia.com> wrote:
HighlightInheritance: fix ‘currentColor’ for all other properties
Highlight pseudos have a special case for ‘color:currentColor’, where
it means the ‘color’ of the next active highlight layer below, rather
than being equivalent to ‘color:inherit’. This not only means that the
‘color’ of a highlight might be unknown until paint determines where
the highlights are active, but so can any other property with \<color>
values, thanks to ‘currentColor’.HighlightPaintingUtils contains the logic for this, but currently only
for ‘color’ and ‘background-color’, and even then the latter is bugged
since it always checks whether the unvisited value is currentColor.
The general approach of having only Color-returning methods plus bool
methods telling you whether to use them is also prone to bugs, since
we can just blindly use the Color without checking.The ideal interface for highlights is for VisitedDependentColor and
the ColorIncludingFallback methods to return optional\<Color>, but we
also don’t want to penalise non-highlight code with all of these extra
optional checks, nor do we want to maintain two copies of the code.This patch adds an optional bool out parameter to
• ComputedStyle::VisitedDependentColor
• Longhand::ColorIncludingFallback
• StyleColor::Resolveand the helper functions
• ComputedStyle::ResolvedColor
• ComputedStyle::GetCurrentColor
• ComputedStyle::GetInternalVisitedCurrentColor
• ComputedStyle::GetInternalForcedCurrentColor
• ComputedStyle::GetInternalForcedVisitedCurrentColor
• ComputedStyleUtils::BorderSideColor
• StyleColor::ResolveWithAlphathat (if present) indicates whether the property that was ultimately
chosen was ‘currentColor’, while resolving the color as usual. We also
remove the old functions for handling ‘currentColor’ in highlights:• ComputedStyle::IsBackgroundColorCurrentColor
• ComputedStyle::VisitedDependentColorIsCurrentColorThis in turn allows us to create HighlightPaintingUtils::ResolveColor,
which encapsulates the “property color or this layer currentColor or
previous layer currentColor or originating currentColor” dance.While this patch won’t completely prevent misuse of the Color-based
interface, the new helper in HighlightPaintingUtils should at least
make the correct logic easy enough to discourage it.Bug: 1295264
Change-Id: Ic0e5ee6787162b33172b9f7023e404c82be1b14d
Reviewed-on: https://chromium-review.googlesource.com/3781986
WPT-Export-Revision: f4dc39af293ef1ac854682382af7959f974aad82
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Comment 1•4 years ago
|
||
Comment 3•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/9da8753bcd7c
https://hg.mozilla.org/mozilla-central/rev/8f5085fcfe16
Description
•