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

Unified Diff: LayoutTests/svg/css/parse-length.html

Issue 896773002: [svg2] Make 'x' and 'y' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cleanup Created 5 years, 10 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/svg/css/parse-length.html
diff --git a/LayoutTests/svg/css/parse-length.html b/LayoutTests/svg/css/parse-length.html
new file mode 100644
index 0000000000000000000000000000000000000000..9ddcb96908f76ea2994fc64beb04f58732f6df40
--- /dev/null
+++ b/LayoutTests/svg/css/parse-length.html
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<html>
+<style>
+* { font-size: 16px; }
+svg, rect { font-family: 'Ahem'; }
+div { font-size: 8px; }
+</style>
+<html>
+<svg id="svg" width="0" height="0"></svg>
+<script src="../../resources/js-test.js"></script>
+<script>
+description("Test that 'length' presentation attribute values are parsed with CSS presentation rules.");
+
+function computedStyle(property, value) {
+ var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
+ document.getElementById('svg').appendChild(rect);
+ rect.setAttribute(property, value);
+ var computedValue = getComputedStyle(rect).getPropertyValue(property);
+ document.getElementById('svg').removeChild(rect);
+ return computedValue;
+}
+
+function testComputed(property, value, expected) {
+ shouldBeEqualToString('computedStyle("' + property + '", "' + value + '")', expected);
+}
+
+function negativeTest(property, value) {
+ testComputed(property, value, "auto");
+}
+
+function negativeTestZero(property, value) {
+ testComputed(property, value, "0px");
+}
+
+// Test 'width'.
+//testComputed("width", "auto", "auto");
+//testComputed("width", " 100", "100px");
+//testComputed("width", "100 ", "100px");
+//testComputed("width", "100px", "100px");
+//testComputed("width", "1em", "16px");
+//testComputed("width", "1ex", "12.8000001907349px");
+//testComputed("width", "20%", "20%");
+// FIXME: Vieport units not implemented for SVG at the moment.
+// testComputed("width", "1vh", "7.869999885559082px");
+// testComputed("width", "1vw", "14.029999732971191px");
+
+// Test 'x'.
+testComputed("x", " 100", "100px");
+testComputed("x", "100 ", "100px");
+testComputed("x", "100px", "100px");
+testComputed("x", "1em", "16px");
+// testComputed("x", "1ex", "12.8000001907349px"); // enable this again once http://crbug.com/441840 is fixed
+testComputed("x", "20%", "20%");
+testComputed("x", "-200px", "-200px");
+
+// Test 'y'.
+testComputed("y", " 100", "100px");
+testComputed("y", "100 ", "100px");
+testComputed("y", "100px", "100px");
+testComputed("y", "1em", "16px");
+// testComputed("y", "1ex", "12.8000001907349px"); // enable this again once http://crbug.com/441840 is fixed
+testComputed("y", "20%", "20%");
+testComputed("y", "-200px", "-200px");
+
+// Negative tests for 'width'.
+//negativeTest("width", "100 px");
+//negativeTest("width", "100px;");
+//negativeTest("width", "100px !important");
+//negativeTest("width", "{ 100px }");
+//negativeTest("width", "-100px");
+
+// Negative tests for 'x'.
+negativeTestZero("x", "auto", "auto");
+negativeTestZero("x", "100 px");
+negativeTestZero("x", "100px;");
+negativeTestZero("x", "100px !important");
+negativeTestZero("x", "{ 100px }");
+
+// Negative tests for 'y'.
+negativeTestZero("y", "auto");
+negativeTestZero("y", "100 px");
+negativeTestZero("y", "100px;");
+negativeTestZero("y", "100px !important");
+negativeTestZero("y", "{ 100px }");
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/svg/css/parse-length-expected.txt » ('j') | Source/core/rendering/style/RenderStyle.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698