| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset="UTF-8"> | 2 <meta charset="UTF-8"> |
| 3 <style> | 3 <style> |
| 4 .parent { |
| 5 border-image-source: url(../resources/blue-100.png); |
| 6 } |
| 4 .target { | 7 .target { |
| 5 width: 50px; | 8 width: 50px; |
| 6 height: 50px; | 9 height: 50px; |
| 7 background-color: black; | 10 background-color: black; |
| 8 display: inline-block; | 11 display: inline-block; |
| 9 border: 25px; | 12 border: 25px; |
| 13 border-image-source: url(../resources/stripes-100.png); |
| 10 } | 14 } |
| 11 .expected { | 15 .expected { |
| 12 background-color: green; | 16 background-color: green; |
| 13 margin-right: 2px; | 17 margin-right: 2px; |
| 14 } | 18 } |
| 15 </style> | 19 </style> |
| 16 <body> | 20 <body> |
| 17 <script src="resources/interpolation-test.js"></script> | 21 <script src="resources/interpolation-test.js"></script> |
| 18 <script> | 22 <script> |
| 19 // None to image | 23 function assertCrossfadeInterpolation(options) { |
| 20 var from = 'none'; | 24 var fromComputed = options.fromComputed || options.from; |
| 21 var to = 'url(../resources/stripes-100.png)'; | 25 assertInterpolation({ |
| 26 property: 'border-image-source', |
| 27 from: options.from, |
| 28 to: options.to, |
| 29 }, [ |
| 30 {at: -0.3, is: fromComputed}, |
| 31 {at: 0, is: fromComputed}, |
| 32 {at: 0.3, is: '-webkit-cross-fade(' + fromComputed + ', ' + options.to + ',
0.3)'}, |
| 33 {at: 0.5, is: '-webkit-cross-fade(' + fromComputed + ', ' + options.to + ',
0.5)'}, |
| 34 {at: 0.6, is: '-webkit-cross-fade(' + fromComputed + ', ' + options.to + ',
0.6)'}, |
| 35 {at: 1, is: options.to}, |
| 36 {at: 1.5, is: options.to}, |
| 37 ]); |
| 38 } |
| 39 |
| 40 // neutral |
| 41 assertCrossfadeInterpolation({ |
| 42 from: '', |
| 43 fromComputed: 'url(../resources/stripes-100.png)', |
| 44 to: 'url(../resources/green-100.png)', |
| 45 }); |
| 46 |
| 47 // initial |
| 22 assertNoInterpolation({ | 48 assertNoInterpolation({ |
| 23 property: 'border-image-source', | 49 property: 'border-image-source', |
| 24 from: from, | 50 from: 'initial', |
| 25 to: to | 51 to: 'url(../resources/green-100.png)', |
| 52 }); |
| 53 |
| 54 // inherit |
| 55 assertCrossfadeInterpolation({ |
| 56 from: 'inherit', |
| 57 fromComputed: 'url(../resources/blue-100.png)', |
| 58 to: 'url(../resources/green-100.png)', |
| 59 }); |
| 60 |
| 61 // unset |
| 62 assertNoInterpolation({ |
| 63 property: 'border-image-source', |
| 64 from: 'unset', |
| 65 to: 'url(../resources/stripes-100.png)', |
| 66 }); |
| 67 |
| 68 // None to image |
| 69 assertNoInterpolation({ |
| 70 property: 'border-image-source', |
| 71 from: 'none', |
| 72 to: 'url(../resources/stripes-100.png)', |
| 26 }); | 73 }); |
| 27 | 74 |
| 28 // Image to image | 75 // Image to image |
| 29 from = 'url(../resources/green-100.png)'; | 76 assertCrossfadeInterpolation({ |
| 30 to = 'url(../resources/stripes-100.png)'; | 77 from: 'url(../resources/green-100.png)', |
| 31 assertInterpolation({ | 78 to: 'url(../resources/stripes-100.png)', |
| 32 property: 'border-image-source', | 79 }); |
| 33 from: from, | |
| 34 to: to | |
| 35 }, [ | |
| 36 {at: -0.3, is: from}, | |
| 37 {at: 0, is: from}, | |
| 38 {at: 0.3, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.3)'}, | |
| 39 {at: 0.6, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.6)'}, | |
| 40 {at: 1, is: to}, | |
| 41 {at: 1.5, is: to}, | |
| 42 ]); | |
| 43 | 80 |
| 44 // Image to gradient | 81 // Image to gradient |
| 45 to = 'linear-gradient(45deg, blue, orange)'; | 82 assertCrossfadeInterpolation({ |
| 46 assertInterpolation({ | 83 from: 'url(../resources/green-100.png)', |
| 47 property: 'border-image-source', | 84 to: 'linear-gradient(45deg, blue, orange)', |
| 48 from: from, | 85 }); |
| 49 to: to | |
| 50 }, [ | |
| 51 {at: -0.3, is: from}, | |
| 52 {at: 0, is: from}, | |
| 53 {at: 0.3, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.3)'}, | |
| 54 {at: 0.6, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.6)'}, | |
| 55 {at: 1, is: to}, | |
| 56 {at: 1.5, is: to}, | |
| 57 ]); | |
| 58 | 86 |
| 59 // Gradient to gradient | 87 // Gradient to gradient |
| 60 from = 'linear-gradient(-45deg, red, yellow)'; | 88 assertCrossfadeInterpolation({ |
| 61 assertInterpolation({ | 89 from: 'linear-gradient(-45deg, red, yellow)', |
| 62 property: 'border-image-source', | 90 to: 'linear-gradient(45deg, blue, orange)', |
| 63 from: from, | 91 }); |
| 64 to: to | |
| 65 }, [ | |
| 66 {at: -0.3, is: from}, | |
| 67 {at: 0, is: from}, | |
| 68 {at: 0.3, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.3)'}, | |
| 69 {at: 0.6, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.6)'}, | |
| 70 {at: 1, is: to}, | |
| 71 {at: 1.5, is: to}, | |
| 72 ]); | |
| 73 </script> | 92 </script> |
| 74 </body> | 93 </body> |
| OLD | NEW |