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

Unified Diff: LayoutTests/svg/dom/svg-root-lengths.html

Issue 67483003: [SVG] Fix root element length values handling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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/dom/svg-root-lengths.html
diff --git a/LayoutTests/svg/dom/svg-root-lengths.html b/LayoutTests/svg/dom/svg-root-lengths.html
new file mode 100644
index 0000000000000000000000000000000000000000..d508f1acbe2185aa6e9fe14e13f3726e7824de24
--- /dev/null
+++ b/LayoutTests/svg/dom/svg-root-lengths.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="../../resources/js-test.js"></script>
+ </head>
+ <body>
+ <p id="description"></p>
+ <div id="div" style="width: 200px; height: 200px; border: 1px solid red;">
+ <svg id="svg" xmlns="http://www.w3.org/2000/svg" style="border: 1px solid blue;">
+ <rect width="100%" height="100%" fill="green"/>
+ </svg>
+ </div>
+ <div id="console"></div>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ setTimeout(function () {
+ var div = document.getElementById('div');
+ var svg = document.getElementById('svg');
+
+ description('This tests the behavior of root SVG length value resolution');
+
+ debug('Initial/default values:');
+ shouldBe('svg.width.baseVal.value', '200');
+ shouldBe('svg.height.baseVal.value', '200');
+
+ svg.setAttribute('width', '50%');
+ svg.setAttribute('height', '10%');
+ debug('');
+ debug('Updated relative values:');
+ shouldBe('svg.width.baseVal.value', '100');
+ shouldBe('svg.height.baseVal.value', '20');
+
+ svg.setAttribute('width', '150');
+ svg.setAttribute('height', '50');
+ debug('');
+ debug('Updated fixed values:');
+ shouldBe('svg.width.baseVal.value', '150');
+ shouldBe('svg.height.baseVal.value', '50');
+
+ svg.setAttribute('width', '100%');
+ svg.setAttribute('height', '50%');
+ svg.setAttribute('viewBox', '0 0 800 600');
+ debug('');
+ debug('viewBox has no effect on top level length resolution.');
+ shouldBe('svg.width.baseVal.value', '200');
+ shouldBe('svg.height.baseVal.value', '100');
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698