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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/css/getFloatValueForUnit-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/css/getFloatValueForUnit.html
diff --git a/LayoutTests/fast/css/getFloatValueForUnit.html b/LayoutTests/fast/css/getFloatValueForUnit.html
index 3c2d1c46e255b86b85324abe85f731c506a26993..2fa0040e9b3315463aba531dcc51dfb7d51f8ec1 100644
--- a/LayoutTests/fast/css/getFloatValueForUnit.html
+++ b/LayoutTests/fast/css/getFloatValueForUnit.html
@@ -11,49 +11,45 @@ if (window.testRunner)
description("Testing whether CSSPrimitiveValue.getFloatValue() converts units correctly.");
-function getFloatValue(propertyName, unit)
+function getFloatValue(nestLevel, propertyName, unit)
{
- var result = document.getElementById("test-div").style.getPropertyCSSValue(propertyName).getFloatValue(unit);
- return Number(result.toFixed(6));
+ var value = document.getElementById("test-div").style.getPropertyCSSValue(propertyName);
+ while (nestLevel--)
+ value = value[0];
+ return Number(value.getFloatValue(unit).toFixed(6));
}
-function getFirstFloatValueInList(propertyName, unit)
-{
- var result = document.getElementById("test-div").style.getPropertyCSSValue(propertyName)[0][0].getFloatValue(unit);
- return Number(result.toFixed(6));
-}
-
-shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PT)", "10");
-shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_MM)", "3.527778");
-shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_CM)", "0.352778");
-shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_IN)", "0.138889");
-shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PC)", "0.833333");
-shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PX)", "13.333333");
-shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_NUMBER)", "13.333333");
-shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_DEG)", "90");
-shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_RAD)", "1.570796");
-shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_GRAD)", "100");
-shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_NUMBER)", "90");
-shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_MS)", "200");
-shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_S)", "0.2");
-shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_NUMBER)", "200");
+shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PT)", "10");
+shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_MM)", "3.527778");
+shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_CM)", "0.352778");
+shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_IN)", "0.138889");
+shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PC)", "0.833333");
+shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PX)", "13.333333");
+shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_NUMBER)", "13.333333");
+shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_DEG)", "90");
+shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_RAD)", "1.570796");
+shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_GRAD)", "100");
+shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_NUMBER)", "90");
+shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_MS)", "200");
+shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_S)", "0.2");
+shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_NUMBER)", "200");
-shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_PERCENTAGE)");
-shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_MS)");
-shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_HZ)");
-shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_DEG)");
-shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_RGBCOLOR)");
+shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PERCENTAGE)");
+shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_MS)");
+shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_HZ)");
+shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_DEG)");
+shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_RGBCOLOR)");
-shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_PERCENTAGE)");
-shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_PX)");
-shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_MS)");
-shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_HZ)");
-shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_RGBCOLOR)");
+shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_PERCENTAGE)");
+shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_PX)");
+shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_MS)");
+shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_HZ)");
+shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_RGBCOLOR)");
-shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PERCENTAGE)");
-shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PX)");
-shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_DEG)");
-shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_HZ)");
-shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_RGBCOLOR)");
+shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_PERCENTAGE)");
+shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_PX)");
+shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_DEG)");
+shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_HZ)");
+shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_RGBCOLOR)");
</script>
</body>
« 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