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

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: Update expectations 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..fc89f1494324a95b2df2de73710a8a0dd617f384
--- /dev/null
+++ b/LayoutTests/svg/custom/zoomed-baseline-shift.html
@@ -0,0 +1,33 @@
+<!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 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 baselineShiftDelta = (document.querySelector('text').getStartPositionOfChar(0).y -
+ document.querySelector('tspan').getStartPositionOfChar(0).y);
+ test(function () {
+ assert_equals(Math.abs(baselineShiftDelta), 10, "Baseline half a font-size up or down");
+ }, "Text bounds 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