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> |