[CSS Parser] Remove WebkitCSSTransformValue
[WebKit-https.git] / LayoutTests / fast / css / getFloatValueForUnit.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <div id="test-div" style="font-size: 10pt; -webkit-transform: rotate(100grad); -webkit-animation-delay: 0.2s;"></div>
8 <script>
9 if (window.testRunner)
10     testRunner.dumpAsText();
11
12 var invalidAccessError = "InvalidAccessError (DOM Exception 15): The object does not support the operation or argument.";
13
14 description("Testing whether CSSPrimitiveValue.getFloatValue() converts units correctly.");
15
16 function getFloatValue(propertyName, unit)
17 {
18     var result = document.getElementById("test-div").style.getPropertyCSSValue(propertyName).getFloatValue(unit);
19     return Number(result.toFixed(6));
20 }
21
22 function getFirstFloatValueInList(propertyName, unit)
23 {
24     var result = document.getElementById("test-div").style.getPropertyCSSValue(propertyName)[0][0].getFloatValue(unit);
25     return Number(result.toFixed(6));
26 }
27
28 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PT)", "10");
29 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_MM)", "3.527778");
30 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_CM)", "0.352778");
31 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_IN)", "0.138889");
32 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PC)", "0.833333");
33 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PX)", "13.333333");
34 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_NUMBER)", "13.333333");
35 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_MS)", "200");
36 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_S)", "0.2");
37 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_NUMBER)", "200");
38
39 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_PERCENTAGE)", "invalidAccessError");
40 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_MS)", "invalidAccessError");
41 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_HZ)", "invalidAccessError");
42 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_DEG)", "invalidAccessError");
43 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_RGBCOLOR)", "invalidAccessError");
44
45 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PERCENTAGE)", "invalidAccessError");
46 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PX)", "invalidAccessError");
47 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_DEG)", "invalidAccessError");
48 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_HZ)", "invalidAccessError");
49 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_RGBCOLOR)", "invalidAccessError");
50 </script>
51 <script src="../../resources/js-test-post.js"></script>
52 </body>