Add interpolation tests for oklab animations/transitions
Animations and transitions do not currently define a host syntax. That
means we should interpolate in oklab per spec for non-legacy syntaxes.
If both start/end values for the animation/transition uses a legacy
syntax, we should interpolate in rgb for web compat.
Bug: 1362022
Change-Id: I2e6b6961e4f9f62bbdb3f9d4416b77c55055e37c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3891059
Reviewed-by: Aaron Krajeski <aaronhk@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1046845}
diff --git a/css/css-color/animation/color-interpolation.html b/css/css-color/animation/color-interpolation.html
index 4b39fdc..7bda888 100644
--- a/css/css-color/animation/color-interpolation.html
+++ b/css/css-color/animation/color-interpolation.html
@@ -91,4 +91,43 @@
{at: 1, expect: 'rgb(255, 165, 0)'},
{at: 1.5, expect: 'rgb(255, 248, 0)'},
]);
+
+test_interpolation({
+ property: 'color',
+ from: 'rgb(0 0 0)',
+ to: 'color(srgb 1 1 1)',
+}, [
+ {at: -0.3, expect: 'oklab(0 0 0)'},
+ {at: 0, expect: 'oklab(0 0 0)'},
+ {at: 0.3, expect: 'oklab(0.3 0 0)'},
+ {at: 0.6, expect: 'oklab(0.6 0 0)'},
+ {at: 1, expect: 'oklab(1 0 0)'},
+ {at: 1.5, expect: 'oklab(1.5 0 0)'},
+]);
+
+test_interpolation({
+ property: 'color',
+ from: 'color(srgb 0 0 0)',
+ to: 'rgb(255 255 255)',
+}, [
+ {at: -0.3, expect: 'oklab(0 0 0)'},
+ {at: 0, expect: 'oklab(0 0 0)'},
+ {at: 0.3, expect: 'oklab(0.3 0 0)'},
+ {at: 0.6, expect: 'oklab(0.6 0 0)'},
+ {at: 1, expect: 'oklab(1 0 0)'},
+ {at: 1.5, expect: 'oklab(1.5 0 0)'},
+]);
+
+test_interpolation({
+ property: 'color',
+ from: 'color(srgb 0 0 0)',
+ to: 'color(srgb 1 1 1)',
+}, [
+ {at: -0.3, expect: 'oklab(0 0 0)'},
+ {at: 0, expect: 'oklab(0 0 0)'},
+ {at: 0.3, expect: 'oklab(0.3 0 0)'},
+ {at: 0.6, expect: 'oklab(0.6 0 0)'},
+ {at: 1, expect: 'oklab(1 0 0)'},
+ {at: 1.5, expect: 'oklab(1.5 0 0)'},
+]);
</script>