test_bug1426594.html (1283B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1426594 5 --> 6 <head> 7 <title>Test for Bug 1426594</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 <script class="testbody" type="application/javascript"> 11 SimpleTest.waitForExplicitFinish(); 12 13 function runTests() { 14 let textElement = document.getElementById("textId"), 15 textClientRect = textElement.getBoundingClientRect(), 16 tspanClientRect = document.getElementById("tspanId").getBoundingClientRect(); 17 18 // TODO: tspan bounds should account for stroke, decorations and text-shadow 19 isfuzzy(textClientRect.width, tspanClientRect.width, 6, "unexpected width"); 20 isfuzzy(textClientRect.height, tspanClientRect.height, 6, "unexpected height"); 21 22 SimpleTest.finish(); 23 } 24 </script> 25 </head> 26 <body onload="runTests()"> 27 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=589640">Mozilla Bug 1426594</a> 28 <svg height="1.5em" width="200px"> 29 <text id="textId" y="1em"><tspan id="tspanId">ABCDEF</tspan></text> 30 </svg> 31 <div style="pointer-events: none; border: 1px solid red; position: absolute; 32 z-index: 1" 33 id="highlight"> 34 </div> 35 </body> 36 </html>