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

Unified Diff: LayoutTests/svg/custom/zoomed-alignment-baseline.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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/custom/zoomed-alignment-baseline-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/custom/zoomed-alignment-baseline.html
diff --git a/LayoutTests/svg/custom/zoomed-alignment-baseline.html b/LayoutTests/svg/custom/zoomed-alignment-baseline.html
new file mode 100644
index 0000000000000000000000000000000000000000..cb3c4277d22ff96eeea312b4e1274ba48f0ac974
--- /dev/null
+++ b/LayoutTests/svg/custom/zoomed-alignment-baseline.html
@@ -0,0 +1,48 @@
+<!doctype html>
+<title>Test that alignment-baseline 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 alignmentBaselineValues = ["baseline", "before-edge", "text-before-edge", "middle",
+ "central", "after-edge", "text-after-edge",
+ "ideograpic", "alphabetic", "hanging", "mathematical"];
+ var expectedDeltas = {
+ "baseline" : 0,
+ "before-edge": -16,
+ "text-before-edge": -16,
+ "middle": -8,
+ "central": -6,
+ "after-edge": 4,
+ "text-after-edge": 4,
+ "ideograpic": 0,
+ "alphabetic": 0,
+ "hanging": -13,
+ "mathematical": -8
+ };
+
+ var zoomLevels = [1, 4, 16];
+ var html = document.documentElement;
+ alignmentBaselineValues.forEach(function (alignmentBaselineValue) {
+ document.querySelector('tspan').setAttribute('alignment-baseline', alignmentBaselineValue);
+ 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_approx_equals(baselineShiftDelta, expectedDeltas[alignmentBaselineValue], 1);
+ }, "Text bounds height at zoom " + zoom + " with alignment-baseline=" + alignmentBaselineValue);
+ });
+ });
+ html.style.zoom = 1;
+ </script>
+</svg>
+<p>This test requires the Ahem font</p>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/custom/zoomed-alignment-baseline-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698