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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/svg/zoom/text/lowdpi-zoom-text.html
diff --git a/LayoutTests/svg/zoom/text/lowdpi-zoom-text.html b/LayoutTests/svg/zoom/text/lowdpi-zoom-text.html
new file mode 100644
index 0000000000000000000000000000000000000000..5e5d364dd641cc281d330e014d2b78815cc7cc00
--- /dev/null
+++ b/LayoutTests/svg/zoom/text/lowdpi-zoom-text.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<style>
+ html {
+ zoom: 1.25;
+ }
+</style>
+<body>
+Test for crbug.com/405468: zoom should not affect getComputedTextLength().<br>
+<svg width="400" height="300">
+ <text y="30" class="testLowDPI" font-size="16px">1 regular 16px abcd</text>
+ <text y="60" class="testLowDPI" font-size="16px" text-rendering="geometricPrecision">1 geometric precision 16px abcd</text>
+ <text y="90" class="testLowDPI" font-size="12px">1 regular 12px abcd</text>
+
+ <text y="130" class="testHighDPI" font-size="16px">2 regular 16px abcd</text>
+ <text y="160" class="testHighDPI" font-size="16px" text-rendering="geometricPrecision">2 geometric precision 16px abcd</text>
+ <text y="190" class="testHighDPI" font-size="12px">2 regular 12px abcd</text>
+</svg>
+<script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ testRunner.setBackingScaleFactor(1, function() {
+ runTest('testLowDPI');
+ testRunner.setBackingScaleFactor(2, function() {
+ runTest('testHighDPI');
+ testRunner.notifyDone();
+ });
+ });
+ }
+
+ function runTest(className) {
+ var textElements = document.getElementsByClassName(className);
+ for (var t = 0; t < textElements.length; t++) {
+ var text = textElements[t];
+ var longerLength = text.getComputedTextLength();
+ // Remove one character from the text so that it is now shorter.
+ text.textContent = text.textContent.substring(0, text.textContent.length - 1);
+ var shorterLength = text.getComputedTextLength();
+
+ if (longerLength > shorterLength)
+ text.textContent = "PASS";
+ else
+ text.textContent = "FAIL, " + longerLength + " should be greater than " + shorterLength;
+ }
+ }
+</script>
+</body>
+</html>
+

Powered by Google App Engine
This is Rietveld 408576698