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

Unified Diff: LayoutTests/transforms/translate-parsing.html

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase master Created 5 years, 6 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
Index: LayoutTests/transforms/translate-parsing.html
diff --git a/LayoutTests/transforms/translate-parsing.html b/LayoutTests/transforms/translate-parsing.html
new file mode 100644
index 0000000000000000000000000000000000000000..33e4758a067b713779f9cc7559d8b39954d26c16
--- /dev/null
+++ b/LayoutTests/transforms/translate-parsing.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id="target" style="width: 100px; height: 200px; display: inline-block"></div>
+<script src="resources/parsing-test-helper.js"></script>
+<script>
+expect = expect.bind(this, 'translate', 'translate');
+
+expect('initial').parsesAs('initial').isComputedTo('0px');
+expect('inherit').parsesAs('inherit');
+
+expect('10px').parsesAs('10px').isComputedTo('10px');
+expect('10px -2.5px').parsesAs('10px -2.5px').isComputedTo('10px -2.5px');
+expect('10px -2.5px 0').parsesAs('10px -2.5px 0px').isComputedTo('10px -2.5px');
+
+expect('42.5%').parsesAs('42.5%').isComputedTo('42.5px');
+expect('42.5% -20.5%').parsesAs('42.5% -20.5%').isComputedTo('42.5px -41px');
+expect('42.5% -20.5% 5px').parsesAs('42.5% -20.5% 5px').isComputedTo('42.5px -41px 5px');
+
+expect('10px -2%').parsesAs('10px -2%').isComputedTo('10px -4px');
+expect('10% -2px').parsesAs('10% -2px').isComputedTo('10px -2px');
+expect('10% -2px 4px').parsesAs('10% -2px 4px').isComputedTo('10px -2px 4px');
+
+expect('calc(100%) calc(20px) calc(-1px)').isComputedTo('100px 20px -1px');
+expect('calc(100% + 10px) calc(100% - 10px) calc(100px + 200px)').parsesAs('calc(100% + 10px) calc(100% - 10px) calc(300px)').isComputedTo('110px 190px 300px');
+expect('calc(100% * 0.5 + 2px) calc(100% - 10px / 2) calc(100px - 200px)').parsesAs('calc(50% + 2px) calc(100% - 5px) calc(-100px)').isComputedTo('52px 195px -100px');
+
+expect('2').isInvalid();
+expect('none').isInvalid();
+expect('10deg 10px').isInvalid();
+expect('10px 10px 10%').isInvalid();
+expect('20smigens').isInvalid();
+expect('10px 20px 5 6').isInvalid();
+expect('10% 20% 30%').isInvalid();
+expect('calc(100% + 10px) calc(100% - 10px) calc(100% + 200px)').isInvalid(); // Last parameter should not have percent
+
+/* Test codepath where layout box is not available */
+target.style.display = 'none';
+
+expect('42.5%').parsesAs('42.5%').isComputedTo('42.5%');
+expect('42.5% -20.5%').parsesAs('42.5% -20.5%').isComputedTo('42.5% -20.5%');
+expect('42.5% -20.5% 5px').parsesAs('42.5% -20.5% 5px').isComputedTo('42.5% -20.5% 5px');
+
+expect('calc(100%) calc(20px) calc(-1px)').isComputedTo('100% 20px -1px');
+expect('calc(100% + 10px) calc(100% - 10px) calc(100px + 200px)').parsesAs('calc(100% + 10px) calc(100% - 10px) calc(300px)').isComputedTo('calc(10px + 100%) calc(-10px + 100%) 300px');
+expect('calc(100% * 0.5 + 2px) calc(100% - 10px / 2) calc(100px - 200px)').parsesAs('calc(50% + 2px) calc(100% - 5px) calc(-100px)').isComputedTo('calc(2px + 50%) calc(-5px + 100%) -100px');
+</script>
« no previous file with comments | « LayoutTests/transforms/translate-expected.html ('k') | LayoutTests/webexposed/css-properties-as-js-properties-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698