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

Side by Side Diff: LayoutTests/svg/zoom/text/lowdpi-zoom-text.html

Issue 508823002: Properly recompute SVG font size under zoom (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <style>
4 html {
5 zoom: 1.25;
6 }
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="geometricPr ecision">1 geometric precision 16px abcd</text>
13 <text y="90" class="testLowDPI" font-size="12px">1 regular 12px abcd</text>
14
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="geometric Precision">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 });
30 }
31
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.le ngth - 1);
39 var shorterLength = text.getComputedTextLength();
40
41 if (longerLength > shorterLength)
42 text.textContent = "PASS";
43 else
44 text.textContent = "FAIL, " + longerLength + " should be greater than " + shorterLength;
45 }
46 }
47 </script>
48 </body>
49 </html>
50
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698