Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1006)

Unified Diff: third_party/WebKit/LayoutTests/animations/custom-properties/length-percentage-type-interpolation.html

Issue 2701533005: Support animating <percentage> and <length-percentage> custom properties (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/animations/custom-properties/length-percentage-type-interpolation.html
diff --git a/third_party/WebKit/LayoutTests/animations/custom-properties/length-percentage-type-interpolation.html b/third_party/WebKit/LayoutTests/animations/custom-properties/length-percentage-type-interpolation.html
new file mode 100644
index 0000000000000000000000000000000000000000..c8971efe82d5827d9e461750ad7682b4eb14017d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/animations/custom-properties/length-percentage-type-interpolation.html
@@ -0,0 +1,117 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<style>
+.parent {
+ --length-percentage: 40%;
+}
+.target {
+ --length-percentage: 10px;
+ font-size: 20px;
suzyh_UTC10 (ex-contributor) 2017/02/17 04:59:58 Add a comment to indicate the purpose of this line
alancutter (OOO until 2018) 2017/02/19 23:38:57 Done.
+}
+</style>
+<body>
+<script src="../interpolation/resources/interpolation-test.js"></script>
+<script>
+CSS.registerProperty({
+ name: '--length-percentage',
+ syntax: '<length-percentage>',
+ initialValue: 'calc(40px + 80%)',
+});
+
+assertInterpolation({
+ property: '--length-percentage',
+ from: neutralKeyframe,
+ to: '20px',
+}, [
+ {at: -0.3, is: '7px'},
+ {at: 0, is: '10px'},
+ {at: 0.5, is: '15px'},
+ {at: 1, is: '20px'},
+ {at: 1.5, is: '25px'},
+]);
+
+assertInterpolation({
+ property: '--length-percentage',
+ from: 'initial',
+ to: '40%',
+}, [
+ {at: -0.3, is: 'calc(52px + 92%)'},
+ {at: 0, is: 'calc(40px + 80%)'},
+ {at: 0.5, is: 'calc(20px + 60%)'},
+ {at: 1, is: '40%'},
+ {at: 1.5, is: 'calc(-20px + 20%)'},
+]);
+
+assertInterpolation({
+ property: '--length-percentage',
+ from: 'inherit',
+ to: '20px',
+}, [
+ {at: -0.3, is: 'calc(-6px + 52%)'},
+ {at: 0, is: '40%'},
+ {at: 0.5, is: 'calc(10px + 20%)'},
+ {at: 1, is: '20px'},
+ {at: 1.5, is: 'calc(30px + -20%)'},
+]);
+
+assertInterpolation({
+ property: '--length-percentage',
+ from: 'unset',
+ to: 'calc(20px + 40%)',
+}, [
+ {at: -0.3, is: 'calc(46px + 92%)'},
+ {at: 0, is: 'calc(40px + 80%)'},
+ {at: 0.5, is: 'calc(30px + 60%)'},
+ {at: 1, is: 'calc(20px + 40%)'},
+ {at: 1.5, is: 'calc(10px + 20%)'},
+]);
+
+assertInterpolation({
+ property: '--length-percentage',
+ from: '-10px',
+ to: '10px',
+}, [
+ {at: -0.3, is: '-16px'},
+ {at: 0, is: '-10px'},
+ {at: 0.5, is: '0px'},
+ {at: 1, is: '10px'},
+ {at: 1.5, is: '20px'},
+]);
+
+assertInterpolation({
+ property: '--length-percentage',
+ from: '10em',
+ to: '20em',
+}, [
+ {at: -0.3, is: '140px'},
+ {at: 0, is: '200px'},
+ {at: 0.5, is: '300px'},
+ {at: 1, is: '400px'},
+ {at: 1.5, is: '500px'},
+]);
+
+assertInterpolation({
+ property: '--length-percentage',
+ from: '10em',
+ to: '100px',
+}, [
+ {at: -0.3, is: '230px'},
+ {at: 0, is: '200px'},
+ {at: 0.5, is: '150px'},
+ {at: 1, is: '100px'},
+ {at: 1.5, is: '50px'},
+]);
+
+assertInterpolation({
+ property: '--length-percentage',
+ from: '10em',
+ to: '100%',
+}, [
+ {at: -0.3, is: 'calc(260px + -30%)'},
+ {at: 0, is: '200px'},
+ {at: 0.5, is: 'calc(100px + 50%)'},
+ {at: 1, is: '100%'},
+ {at: 1.5, is: 'calc(-100px + 150%)'},
+]);
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698