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

Unified Diff: third_party/WebKit/LayoutTests/css3/calc/calc-overflow.html

Issue 2597103002: Prevent floating point overflow when using calc() with large values (Closed)
Patch Set: Bigger numbers Created 4 years 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
Index: third_party/WebKit/LayoutTests/css3/calc/calc-overflow.html
diff --git a/third_party/WebKit/LayoutTests/css3/calc/calc-overflow.html b/third_party/WebKit/LayoutTests/css3/calc/calc-overflow.html
new file mode 100644
index 0000000000000000000000000000000000000000..a0eebb87fa5a4280539d1eb1ac7d4aac4670c7e7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/calc/calc-overflow.html
@@ -0,0 +1,18 @@
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<body></body>
+<script>
+function undefinedBehaviourTest(input, expected, type) {
+ test(() => {
+ var target = document.createElement('div');
+ document.body.appendChild(target);
+ target.style.lineHeight = input;
+ assert_equals(getComputedStyle(target).lineHeight, expected);
+ target.remove();
+ }, 'Do not invoke undefined behaviour when using calc()s with large ' + type + ' values');
+}
+
+undefinedBehaviourTest('calc(1e400px * 1e400)', '3.35544e+07px', 'pixel');
+undefinedBehaviourTest('calc(1e400% * 1e400)', '3.43597e+08px', 'percentage');
+undefinedBehaviourTest('calc(1e400 * 1e400)', '3.40282e+38px', 'number');
+</script>

Powered by Google App Engine
This is Rietveld 408576698