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

Side by Side Diff: LayoutTests/fast/css/getFloatValueForUnit.html

Issue 293113007: Simplify animation/transition parsing slightly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/css/getFloatValueForUnit-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <div id="test-div" style="font-size: 10pt; -webkit-transform: rotate(100grad); - webkit-animation-delay: 0.2s;"></div> 7 <div id="test-div" style="font-size: 10pt; -webkit-transform: rotate(100grad); - webkit-animation-delay: 0.2s;"></div>
8 <script> 8 <script>
9 if (window.testRunner) 9 if (window.testRunner)
10 testRunner.dumpAsText(); 10 testRunner.dumpAsText();
11 11
12 description("Testing whether CSSPrimitiveValue.getFloatValue() converts units co rrectly."); 12 description("Testing whether CSSPrimitiveValue.getFloatValue() converts units co rrectly.");
13 13
14 function getFloatValue(propertyName, unit) 14 function getFloatValue(nestLevel, propertyName, unit)
15 { 15 {
16 var result = document.getElementById("test-div").style.getPropertyCSSValue(p ropertyName).getFloatValue(unit); 16 var value = document.getElementById("test-div").style.getPropertyCSSValue(pr opertyName);
17 return Number(result.toFixed(6)); 17 while (nestLevel--)
18 value = value[0];
19 return Number(value.getFloatValue(unit).toFixed(6));
18 } 20 }
19 21
20 function getFirstFloatValueInList(propertyName, unit) 22 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PT)", "10");
21 { 23 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_MM)", "3.527778");
22 var result = document.getElementById("test-div").style.getPropertyCSSValue(p ropertyName)[0][0].getFloatValue(unit); 24 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_CM)", "0.352778");
23 return Number(result.toFixed(6)); 25 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_IN)", "0.138889");
24 } 26 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PC)", "0.833333");
27 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PX)", "13.333333") ;
28 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_NUMBER)", "13.3333 33");
29 shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_DEG)", "90 ");
30 shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_RAD)", "1. 570796");
31 shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_GRAD)", "1 00");
32 shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_NUMBER)", "90");
33 shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_MS)" , "200");
34 shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_S)", "0.2");
35 shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_NUMB ER)", "200");
25 36
26 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PT)", "10"); 37 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PERCENTAGE)");
27 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_MM)", "3.527778"); 38 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_MS)");
28 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_CM)", "0.352778"); 39 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_HZ)");
29 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_IN)", "0.138889"); 40 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_DEG)");
30 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PC)", "0.833333"); 41 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_RGBCOLOR)");
31 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PX)", "13.333333");
32 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_NUMBER)", "13.333333" );
33 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_DE G)", "90");
34 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_RA D)", "1.570796");
35 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_GR AD)", "100");
36 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_NU MBER)", "90");
37 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_MS)", " 200");
38 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_S)", "0 .2");
39 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_NUMBER) ", "200");
40 42
41 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_PERCENTAGE)"); 43 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_PERCENT AGE)");
42 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_MS)"); 44 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_PX)");
43 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_HZ)"); 45 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_MS)");
44 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_DEG)"); 46 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_HZ)");
45 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_RGBCOLOR)"); 47 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_RGBCOLO R)");
46 48
47 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS _PERCENTAGE)"); 49 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_P ERCENTAGE)");
48 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS _PX)"); 50 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_P X)");
49 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS _MS)"); 51 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_D EG)");
50 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS _HZ)"); 52 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_H Z)");
51 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS _RGBCOLOR)"); 53 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_R GBCOLOR)");
52
53 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PERC ENTAGE)");
54 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PX)" );
55 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_DEG) ");
56 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_HZ)" );
57 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_RGBC OLOR)");
58 </script> 54 </script>
59 </body> 55 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/css/getFloatValueForUnit-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698