Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 73a19c0d770b4597e51c8aad5a57efab8bf9eea1
      
https://github.com/WebKit/WebKit/commit/73a19c0d770b4597e51c8aad5a57efab8bf9eea1
  Author: Antti Koivisto <[email protected]>
  Date:   2026-09-01 (Tue, 01 Sep 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/highlight-cascade/highlight-cascade-currentcolor-color-mix-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/highlight-cascade/highlight-cascade-currentcolor-color-mix.html
    M Source/WebCore/style/StyleBuilderCustom.h
    M Source/WebCore/style/computed/StyleComputedStyleBase+GettersInlines.h
    M Source/WebCore/style/computed/StyleComputedStyleBase+SettersInlines.h
    M Source/WebCore/style/computed/StyleComputedStyleBase.h
    M Source/WebCore/style/computed/data/StyleInheritedData.cpp
    M Source/WebCore/style/computed/data/StyleInheritedData.h
    M Source/WebCore/style/computed/data/StyleInheritedRareData.cpp
    M Source/WebCore/style/computed/data/StyleInheritedRareData.h

  Log Message:
  -----------
  Highlight color should inherit as StyleColor
https://bugs.webkit.org/show_bug.cgi?id=321426
rdar://184495338

Reviewed by Sam Weinig.

Normally currentcolor in `color` property resolves against the inherited parent 
style and can be fully resolved
during style building. However highlight pseudo-elements have special behavior 
where the inheritance
chain goes via the parent element's highlight style but currentcolor is 
resolved against the
originating element. To do this correctly we need to keep around unresolved 
(StyleColor) version of
the color property value we normally don't need. This field can also later be 
used to resolve currentcolor
against the lower highlight layer at paint time.

https://drafts.csswg.org/css-pseudo-4/#highlight-cascade

To avoid complicating the regular paths this patch adds colorForHighlight as a 
separate rare data field.

Test: 
imported/w3c/web-platform-tests/css/css-pseudo/highlight-cascade/highlight-cascade-currentcolor-color-mix.html
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/highlight-cascade/highlight-cascade-currentcolor-color-mix-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/highlight-cascade/highlight-cascade-currentcolor-color-mix.html:
 Added.
* Source/WebCore/style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyHighlightInitialColor):
(WebCore::Style::BuilderCustom::applyHighlightValueColor):
Keep the unresolved value alongside the resolved one.

(WebCore::Style::BuilderCustom::applyHighlightInheritColor):
Resolve the inherited value against the originating element and pass it on 
unresolved. Previously
this took the parent highlight color wholesale unless the bit said it was the 
bare keyword.

* Source/WebCore/style/computed/StyleComputedStyleBase+GettersInlines.h:
(WebCore::Style::ComputedStyleBase::colorForHighlight const):
(WebCore::Style::ComputedStyleBase::colorIsCurrentColorForHighlight const): 
Deleted.
* Source/WebCore/style/computed/StyleComputedStyleBase+SettersInlines.h:
(WebCore::Style::ComputedStyleBase::setColorForHighlight):
(WebCore::Style::ComputedStyleBase::setColorIsCurrentColorForHighlight): 
Deleted.
* Source/WebCore/style/computed/StyleComputedStyleBase.h:
* Source/WebCore/style/computed/data/StyleInheritedData.cpp:
(WebCore::Style::InheritedData::InheritedData):
(WebCore::Style::InheritedData::dumpDifferences const):

(WebCore::Style::InheritedData::fastPathInheritedEqual const):
(WebCore::Style::InheritedData::fastPathInheritFrom):
The bit needed handling here because it sat next to the fast-path-inherited 
color. Rare data is
not part of the fast path, so the replacement field needs none.

* Source/WebCore/style/computed/data/StyleInheritedData.h:
* Source/WebCore/style/computed/data/StyleInheritedRareData.cpp:
(WebCore::Style::InheritedRareData::InheritedRareData):
(WebCore::Style::InheritedRareData::operator== const):
(WebCore::Style::InheritedRareData::dumpDifferences const):
* Source/WebCore/style/computed/data/StyleInheritedRareData.h:

Canonical link: https://commits.webkit.org/320228@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to