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

Unified Diff: LayoutTests/svg/custom/zoomed-baseline-shift.html

Issue 1081813003: Remove effective zoom from font metrics before SVG text layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added tests Created 5 years, 8 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/custom/zoomed-baseline-shift.html
diff --git a/LayoutTests/svg/custom/zoomed-baseline-shift.html b/LayoutTests/svg/custom/zoomed-baseline-shift.html
new file mode 100644
index 0000000000000000000000000000000000000000..eabbe46a8e508af4053f4a83529144077f35b7e5
--- /dev/null
+++ b/LayoutTests/svg/custom/zoomed-baseline-shift.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<title>Test that baseline-shift is unaffected by zoom level</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<svg width="250" height="140" viewBox="0 0 250 140"
+ xmlns="http://www.w3.org/2000/svg" version="1.1">
+ <style>
+ text {
+ font-family: ahem;
+ font-size: 20px;
+ }
+ </style>
+ <text x="15" y="40">before<tspan>inter</tspan>after</text>
+ <script>
+ var expectedHeight = 20 + 10; // font-size + half a step up or down
+ var baselineShiftValues = ["sub", "super", "10px", "-50%" ]; // Shift half a step up or down
+ var zoomLevels = [1, 4, 16];
+ var html = document.documentElement;
+ baselineShiftValues.forEach(function (baselineShiftValue) {
+ document.querySelector('tspan').setAttribute('baseline-shift', baselineShiftValue);
+ zoomLevels.forEach(function (zoom) {
+ html.style.zoom = zoom;
+ var bounds = document.querySelector('text').getBoundingClientRect();
+ test(function () {
+ assert_equals(bounds.height, expectedHeight);
+ }, "text bound height at zoom " + zoom + " with baseline-shift=" + baselineShiftValue);
+ });
+ });
+ html.style.zoom = 1;
+ </script>
+</svg>
+<p>This test requires the Ahem font</p>

Powered by Google App Engine
This is Rietveld 408576698