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

Side by Side Diff: LayoutTests/animations/interpolation/border-image-width-interpolation.html

Issue 54123007: Web Animations CSS: Fix clamping to non-negative values for BorderImageLength (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bug with clampTo() Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset="UTF-8"> 2 <meta charset="UTF-8">
3 <style> 3 <style>
4 .target { 4 .target {
5 width: 100px; 5 width: 100px;
6 height: 100px; 6 height: 100px;
7 background-color: black; 7 background-color: black;
8 display: inline-block; 8 display: inline-block;
9 border: 10px; 9 border: 10px;
10 border-image-source: linear-gradient(45deg, red, blue, green); 10 border-image-source: linear-gradient(45deg, red, blue, green);
11 } 11 }
12 .replica { 12 .replica {
13 background-color: green; 13 background-color: green;
14 margin-right: 2px; 14 margin-right: 2px;
15 } 15 }
16 </style> 16 </style>
17 <body> 17 <body>
18 <script src="resources/interpolation-test.js"></script> 18 <script src="resources/interpolation-test.js"></script>
19 <script> 19 <script>
20 assertInterpolation({ 20 assertInterpolation({
21 property: 'border-image-width', 21 property: 'border-image-width',
22 from: '0px', 22 from: '0px',
23 to: '20px' 23 to: '20px'
24 }, [ 24 }, [
25 {at: -0.3, is: '0px'}, // CSS border-image-width can't be negative. 25 {at: -0.3, is: '0px'}, // CSS border-image-width can't be negative.
26 {at: 0, is: '0px'}, 26 {at: 0, is: '0px'},
27 {at: 0.3, is: '6px'}, 27 {at: 0.3, is: '6px'},
28 {at: 0.6, is: '12px'}, 28 {at: 0.6, is: '12px'},
29 {at: 1, is: '20px'}, 29 {at: 1, is: '20px'},
30 {at: 1.5, is: '30px'}, 30 {at: 1.5, is: '30px'},
31 {at: 5, is: '100px'}, 31 {at: 5, is: '100px'},
32 {at: 10, is: '200px'} 32 {at: 10, is: '200px'}
33 ]);
34 assertInterpolation({
35 property: 'border-image-width',
36 from: '0%',
37 to: '20%'
38 }, [
39 {at: -0.3, is: '0%'}, // CSS border-image-width can't be negative.
40 {at: 0, is: '0%'},
41 {at: 0.3, is: '6%'},
42 {at: 0.6, is: '12%'},
43 {at: 1, is: '20%'},
44 {at: 1.5, is: '30%'},
45 {at: 5, is: '100%'},
46 {at: 10, is: '200%'}
47 ]);
48 assertInterpolation({
49 property: 'border-image-width',
50 from: '0',
51 to: '20'
52 }, [
53 {at: -0.3, is: '0'}, // CSS border-image-width can't be negative.
54 {at: 0, is: '0'},
55 {at: 0.3, is: '6'},
56 {at: 0.6, is: '12'},
57 {at: 1, is: '20'},
58 {at: 1.5, is: '30'},
59 {at: 5, is: '100'},
60 {at: 10, is: '200'}
61 ]);
62 assertInterpolation({
63 property: 'border-image-width',
64 from: '10px 20% 30 40px',
65 to: '80px 70% 60 50px'
66 }, [
67 {at: -0.3, is: '0px 5% 21 37px'}, // CSS border-image-width can't be neg ative.
68 {at: 0, is: '10px 20% 30 40px'},
69 {at: 0.3, is: '31px 35% 39 43px'},
70 {at: 0.6, is: '52px 50% 48 46px'},
71 {at: 1, is: '80px 70% 60 50px'},
72 {at: 1.5, is: '115px 95% 75 55px'},
73 {at: 5, is: '360px 270% 180 90px'},
74 {at: 10, is: '710px 520% 330 140px'}
75 ]);
76 assertInterpolation({
77 property: 'border-image-width',
78 from: '10%',
79 to: '20px'
80 }, [
81 // Percentages are relative to the size of the border image area, which is 120 px.
82 {at: -0.3, is: 'calc(13% + -6px)'}, // Should be parsed as 16px - 6px = 10px
83 {at: 0, is: '10%'}, // Should be parsed as 12px
84 {at: 0.3, is: 'calc(7% + 6px)'}, // Should be parsed as 8px + 6px = 14px
85 {at: 0.6, is: 'calc(4% + 12px)'}, // Should be parsed as 5px + 12px = 17px
86 {at: 1, is: '20px'},
87 {at: 1.5, is: 'calc(-5% + 30px)'}, // Should be parsed as -6px + 30px = 24px
88 ]);
89 assertInterpolation({
90 property: 'border-image-width',
91 from: '10px',
92 to: '20%'
93 }, [
94 // Percentages are relative to the size of the border image area, which is 120 px.
95 {at: -0.3, is: 'calc(13px + -6%)'}, // Should be parsed as 13px - 7px = 6px
96 {at: 0, is: '10px'},
97 {at: 0.3, is: 'calc(7px + 6%)'}, // Should be parsed as 7px + 7px = 14px
98 {at: 0.6, is: 'calc(4px + 12%)'}, // Should be parsed as 4px + 14px = 18px
99 {at: 1, is: '20%'}, // Should be parsed as 24px
100 {at: 1.5, is: 'calc(-5px + 30%)'}, // Should be parsed as -5px + 36px = 31px
101 ]);
102
103 assertInterpolation({
104 property: 'border-image-width',
105 from: '10px',
106 to: '20'
107 }, [
108 {at: -0.3, is: '10px'},
109 {at: 0, is: '10px'},
110 {at: 0.3, is: '10px'},
111 {at: 0.6, is: '20'},
112 {at: 1, is: '20'},
113 {at: 1.5, is: '20'},
114 ]);
115 assertInterpolation({
116 property: 'border-image-width',
117 from: '10',
118 to: '20px'
119 }, [
120 {at: -0.3, is: '10'},
121 {at: 0, is: '10'},
122 {at: 0.3, is: '10'},
123 {at: 0.6, is: '20px'},
124 {at: 1, is: '20px'},
125 {at: 1.5, is: '20px'},
126 ]);
127 assertInterpolation({
128 property: 'border-image-width',
129 from: '10%',
130 to: '20'
131 }, [
132 {at: -0.3, is: '10%'},
133 {at: 0, is: '10%'},
134 {at: 0.3, is: '10%'},
135 {at: 0.6, is: '20'},
136 {at: 1, is: '20'},
137 {at: 1.5, is: '20'},
138 ]);
139 assertInterpolation({
140 property: 'border-image-width',
141 from: '10',
142 to: '20%'
143 }, [
144 {at: -0.3, is: '10'},
145 {at: 0, is: '10'},
146 {at: 0.3, is: '10'},
147 {at: 0.6, is: '20%'},
148 {at: 1, is: '20%'},
149 {at: 1.5, is: '20%'},
33 ]); 150 ]);
34 </script> 151 </script>
35 </body> 152 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698