Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 369f5fbfa3ebb83aa4667c6316596af3894d6feb
      
https://github.com/WebKit/WebKit/commit/369f5fbfa3ebb83aa4667c6316596af3894d6feb
  Author: Kiet Ho <[email protected]>
  Date:   2026-10-14 (Wed, 14 Oct 2026)

  Changed paths:
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/DocumentEnums.h
    M Source/WebCore/editing/FrameSelection.cpp
    M Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h
    M Source/WebCore/rendering/AttachmentLayout.mm
    M Source/WebCore/rendering/OutlinePainter.cpp
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderImage.cpp
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderListBox.cpp
    M Source/WebCore/rendering/RenderObject.cpp
    M Source/WebCore/rendering/RenderObject.h
    M Source/WebCore/rendering/RenderTheme.cpp
    M Source/WebCore/rendering/TextBoxPainter.cpp
    M Source/WebCore/rendering/TextPaintStyle.cpp
    M Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm
    M Source/WebCore/rendering/ios/RenderThemeIOS.mm
    M Source/WebCore/style/values/color/StyleKeywordColor.cpp
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [AXCustomColorMode] Differentiate StyleColorOptions for style vs. rendering 
purpose
rdar://189679609
https://bugs.webkit.org/show_bug.cgi?id=327065

Reviewed by Simon Fraser.

The StyleColorOptions returned by Document::styleColorOptions is used in various
places to resolve system colors to absolute. AXCustomColorMode can alter the 
returned
StyleColorOptions (e.g by forcing system appearence at all time), but its effect
should not be observable. For example, if a webpage uses `color: CanvasText`, 
the
resolved color is different when AXCustomColorMode is on/off. The used value 
(color
used to render the text) can be different, but the computed value should not 
change.

This patch achieves this by adding a new argument to 
Document::styleColorOptions,
which specifies the purpose of the resulting StyleColorOptions:
- If it's used to resolve a color for rendering purpose (e.g to get the color to
paint text/rectangle/...), use StyleColorOptionsPurpose::Rendering
- If it's for other purposes (e.g to get the computed value of a CSS property),
use StyleColorOptionsPurpose::ComputedStyle.

The main change is the new argument in Document::styleColorOptions. We only 
adjust
StyleColorOptions if the purpose is Rendering. All other code changes are to
add the new argument in its callers.

For now, CSS color => Style color resolution still uses Rendering purpose, 
because
additional plumbing is needed to specify whether the resolved color will be 
used for
style or rendering purpose. That'll come in a follow-up patch.

Tested by existing test suite.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::linkColor const):
(WebCore::Document::visitedLinkColor const):
(WebCore::Document::activeLinkColor const):
(WebCore::Document::styleColorOptions const):
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/DocumentEnums.h:
* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::CaretBase::computeCaretColor):
* Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::styleColorOptions const):
(WebCore::LocalFrameView::setBaseBackgroundColor):
(WebCore::LocalFrameView::updateBaseBackgroundColorIfNecessary):
(WebCore::LocalFrameView::updateBackgroundRecursively):
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/rendering/AttachmentLayout.mm:
(WebCore::titleTextColorForAttachment):
(WebCore::attachmentTitleColor):
* Source/WebCore/rendering/OutlinePainter.cpp:
(WebCore::OutlinePainter::paintFocusRing const):
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionColor const):
(WebCore::RenderElement::selectionBackgroundColor const):
* Source/WebCore/rendering/RenderImage.cpp:
(WebCore::RenderImage::paintAreaElementFocusRing):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
* Source/WebCore/rendering/RenderListBox.cpp:
(WebCore::RenderListBox::paintItemForeground):
(WebCore::RenderListBox::paintItemBackground):
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::styleColorOptions const):
* Source/WebCore/rendering/RenderObject.h:
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::extractControlStyleForRenderer const):
(WebCore::RenderTheme::autocorrectionReplacementMarkerColor const):
(WebCore::RenderTheme::documentMarkerLineColor const):
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::fillCompositionUnderline const):
* Source/WebCore/rendering/TextPaintStyle.cpp:
(WebCore::adjustColorForPunchedOutBackground):
* Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm:
(WebCore::drawFocusRingForPathForVectorBasedControls):
(WebCore::switchTrackColor):
(WebCore::liquidGlassSwitchThumbColor):
(WebCore::renderThemePaintLiquidGlassSwitchThumb):
(WebCore::renderThemePaintLiquidGlassSwitchTrack):
(WebCore::RenderThemeCocoa::pictureFrameColor):
(WebCore::RenderThemeCocoa::paintCheckboxForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintRadioForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintButtonForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintColorWellForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintInnerSpinButtonForVectorBasedControls):
(WebCore::paintTextAreaOrTextField):
(WebCore::RenderThemeCocoa::adjustMenuListStyleForVectorBasedControls const):
(WebCore::RenderThemeCocoa::adjustButtonStyleForVectorBasedControls const):
(WebCore::RenderThemeCocoa::adjustMenuListButtonStyleForVectorBasedControls 
const):
(WebCore::RenderThemeCocoa::paintMenuListButtonDecorationsForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintMeterForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintListButtonForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintProgressBarForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintSliderTrackForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintSliderThumbForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintSearchFieldForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintSearchFieldCancelButtonForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintSearchFieldDecorationPartForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintPlatformResizerForVectorBasedControls):
(WebCore::RenderThemeCocoa::submitButtonTextColor const):
(WebCore::RenderThemeCocoa::paintSwitch):
* Source/WebCore/rendering/ios/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::adjustTextFieldStyle const):
(WebCore::RenderThemeIOS::paintMenuListButtonDecorations):
(WebCore::RenderThemeIOS::paintSliderTrack):
(WebCore::RenderThemeIOS::paintProgressBar):
(WebCore::RenderThemeIOS::adjustButtonLikeControlStyle const):
(WebCore::RenderThemeIOS::autocorrectionReplacementMarkerColor const):
(WebCore::RenderThemeIOS::paintCheckbox):
(WebCore::RenderThemeIOS::paintRadio):
(WebCore::RenderThemeIOS::paintMeter):
(WebCore::RenderThemeIOS::paintListButton):
(WebCore::RenderThemeIOS::paintSliderTicks):
(WebCore::RenderThemeIOS::paintSearchFieldDecorationPart):
* Source/WebCore/style/values/color/StyleKeywordColor.cpp:
(WebCore::Style::toStyleColor):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::pluginBackgroundColor const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::paintPDFSelection):

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



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

Reply via email to