Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b65732a3d4277c9daf604dd3e1949c5cd6d1f457
      
https://github.com/WebKit/WebKit/commit/b65732a3d4277c9daf604dd3e1949c5cd6d1f457
  Author: Diego Pino Garcia <[email protected]>
  Date:   2026-08-14 (Fri, 14 Aug 2026)

  Changed paths:
    M LayoutTests/platform/glib/TestExpectations
    A 
LayoutTests/platform/glib/fast/canvas/canvas-color-space-display-p3-ImageData-expected.txt
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WTF/wtf/PlatformEnableGlib.h
    M Source/WebCore/platform/graphics/skia/ColorSpaceSkia.cpp
    M Source/WebCore/platform/graphics/skia/ColorSpaceSkia.h
    M Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
    M Source/cmake/OptionsGTK.cmake
    M Source/cmake/OptionsWPE.cmake

  Log Message:
  -----------
  [GLIB] Add Display-P3 color space support for canvas
https://bugs.webkit.org/show_bug.cgi?id=321596

Reviewed by Nikolas Zimmermann and Carlos Garcia Campos.

Support for color scheme 'display-p3' was missing in GLIB ports. Until
now, 'sRGB' color space was used as a default, which caused several 'display-p3'
related tests to fail.

Support for color spaces 'DisplayP3' and 'LinearDisplayP3', as well as
their counterpart extended versions, was added to 'ColorSpaceSkia.cpp' (Skia
natively supports the extended version of these color spaces).
That file already contained a method to support the 'DisplayP3' color space,
called 'displayP3ColorSpaceSingleton'. However, this method was not a singleton
since Skia returns a new instance per 'SkColorSpace::MakeRGB' call. The
method was refactored into a real singleton. An implementation for
'LinearDisplayP3' was added following the same pattern.

Then, 'GraphicsContextSkia.cpp' was modified to add new method
'setPaintColor' which encapsulates 'paint.setColor' calls taking into
account the 'colorSpace' stored into parameter 'color'. Method
'skColorSpaceForColorSpace' was also added, which maps a native ColorSpace
to a Skia ColorSpace.

Lastly, flag 'CanvasColorSpaceEnabled' was turned on for WebKitGTK and
WPEWebKit ports, to enable this feature.

* Source/WebCore/platform/graphics/skia/ColorSpaceSkia.cpp:
(WebCore::extendedDisplayP3ColorSpaceSingleton):
(WebCore::linearDisplayP3ColorSpaceSingleton):
(WebCore::extendedLinearDisplayP3ColorSpaceSingleton):
(WebCore::displayP3ColorSpaceSingleton):
* Source/WebCore/platform/graphics/skia/ColorSpaceSkia.h:
* LayoutTests/platform/glib/TestExpectations:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WTF/wtf/PlatformEnableGlib.h:
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:
* Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::skColorSpaceForColorSpace):
(WebCore::setPaintColor):
(WebCore::GraphicsContextSkia::drawLine):
(WebCore::GraphicsContextSkia::setupFillSource):
(WebCore::GraphicsContextSkia::setupStrokeSource):
(WebCore::GraphicsContextSkia::fillRect):
(WebCore::skColor4fAndColorSpaceForColor):
(WebCore::GraphicsContextSkia::createDropShadowFilterIfNeeded const):
* 
LayoutTests/platform/glib/fast/canvas/canvas-color-space-display-p3-ImageData-expected.txt:
 Added.

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



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

Reply via email to