Skip to content
Permalink
Browse files
Support extended color animation interpolation
https://bugs.webkit.org/show_bug.cgi?id=245645
<rdar://100437917>

Reviewed by Dean Jackson and Antti Koivisto.

Adds support for animating non-sRGB colors by using the new default interpolation
method, OKLab, for cases where one or more of the two keyframes in an animation
interpolation are specified using a non-legacy color syntax (e.g. color(), lch(),
etc.).

For now, there is no syntax for specifying a specific interpolation method to use,
as none has been specified yet, so only the two default spaces, sRGB for legacy
and OKLab for non-legacy are available.

* LayoutTests/imported/w3c/web-platform-tests/css/css-color/animation/color-interpolation-expected.txt:
Update results for additional passing test cases.

* Source/WebCore/platform/graphics/ColorBlending.cpp:
(WebCore::requiresLegacyInterpolationRules): Helper to choose which
kind of interpolation to use.
(WebCore::blend): When using the legacy path, also continue to clamp
to the 8-bit per channel sRGB to avoid any change for existing content.

* Source/WebCore/platform/graphics/ColorNormalization.h:
(WebCore::makeColorTypeByNormalizingComponents):
(WebCore::makeColorTypeByNormalizingComponents<HWBA<float>>):
Interpolation can produce negative and otherwise out of range
values, so ensure we clamp here. Fixes test case where the
progress was set to -0.3.

Canonical link: https://commits.webkit.org/254960@main
  • Loading branch information
weinig authored and Sam Weinig committed Sep 28, 2022
1 parent 71c5f15 commit 1140e61c63402f8b7f84b620960a1a28a2ce4513
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 103 deletions.

0 comments on commit 1140e61

Please sign in to comment.