Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e80def2354993b9081623dfc419efa216327da92
https://github.com/WebKit/WebKit/commit/e80def2354993b9081623dfc419efa216327da92
Author: Dan Glastonbury <[email protected]>
Date: 2026-05-13 (Wed, 13 May 2026)
Changed paths:
M Source/WebCore/platform/graphics/cg/ColorCG.cpp
Log Message:
-----------
REGRESSION(294844@main): platformConvertColorComponents creates a new
CGColorTransform on every call
https://bugs.webkit.org/show_bug.cgi?id=314694
rdar://176803517
Reviewed by Simon Fraser.
platformConvertColorComponents() was creating and destroying a
CGColorTransformRef on every invocation. Each creation triggers the full
ColorSync transform pipeline, which becomes catastrophic on pages with many
gradient elements rendered to a display with a non-matching color profile.
On Stashweb PR diff pages, this caused 18% CPU in the GPU process, entirely in
ColorSync transform setup/teardown.
Fix by adding two layers of optimization:
1. For well-known destination color spaces (sRGB, Display P3, and their linear
variants), use WebKit's built-in color conversion math directly. This is pure
inline arithmetic with zero framework overhead.
2. For custom ICC profiles that don't match any known space, cache the
CGColorTransformRef across calls. In practice there is only one destination
color space (the display profile), so a single-entry cache is sufficient.
* Source/WebCore/platform/graphics/cg/ColorCG.cpp:
(WebCore::platformConvertColorComponents):
Canonical link: https://commits.webkit.org/313211@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications