Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / zoom / text / lowdpi-zoom-text.html
blob5e5d364dd641cc281d330e014d2b78815cc7cc00
1 <!DOCTYPE HTML>
2 <html>
3 <style>
4 html {
5 zoom: 1.25;
7 </style>
8 <body>
9 Test for crbug.com/405468: zoom should not affect getComputedTextLength().<br>
10 <svg width="400" height="300">
11 <text y="30" class="testLowDPI" font-size="16px">1 regular 16px abcd</text>
12 <text y="60" class="testLowDPI" font-size="16px" text-rendering="geometricPrecision">1 geometric precision 16px abcd</text>
13 <text y="90" class="testLowDPI" font-size="12px">1 regular 12px abcd</text>
15 <text y="130" class="testHighDPI" font-size="16px">2 regular 16px abcd</text>
16 <text y="160" class="testHighDPI" font-size="16px" text-rendering="geometricPrecision">2 geometric precision 16px abcd</text>
17 <text y="190" class="testHighDPI" font-size="12px">2 regular 12px abcd</text>
18 </svg>
19 <script>
20 if (window.testRunner) {
21 testRunner.waitUntilDone();
22 testRunner.dumpAsText();
23 testRunner.setBackingScaleFactor(1, function() {
24 runTest('testLowDPI');
25 testRunner.setBackingScaleFactor(2, function() {
26 runTest('testHighDPI');
27 testRunner.notifyDone();
28 });
29 });
32 function runTest(className) {
33 var textElements = document.getElementsByClassName(className);
34 for (var t = 0; t < textElements.length; t++) {
35 var text = textElements[t];
36 var longerLength = text.getComputedTextLength();
37 // Remove one character from the text so that it is now shorter.
38 text.textContent = text.textContent.substring(0, text.textContent.length - 1);
39 var shorterLength = text.getComputedTextLength();
41 if (longerLength > shorterLength)
42 text.textContent = "PASS";
43 else
44 text.textContent = "FAIL, " + longerLength + " should be greater than " + shorterLength;
47 </script>
48 </body>
49 </html>