Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / custom / zoomed-ex-em-font-sizes.html
blobdfe98d465744dea03cfb75d6e4ee8c0af519d3eb
1 <!DOCTYPE html>
2 <title>Test that ex, em, rem and ch font sizes are unaffected by zoom level</title>
3 <script src="../../resources/ahem.js"></script>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <style>
7 svg {
8 font-size: 100px;
9 font-family: ahem;
11 </style>
12 <svg width="100%" height="1em" xmlns="http://www.w3.org/2000/svg" version="1.1">
14 <text id="em" y="1em" dy="4em">XXXXXX XXX</text>
15 <text id="rem" y="1em" dy="25rem">XXXXXX XXX</text>
16 <text id="ex" y="1em" dy="5ex">XXXXXX XXX</text>
17 <text id="ch" y="1em" dy="4ch">XXXXXX XXX</text>
19 <script>
20 var zoomLevels = [0.3, 4];
21 var html = document.documentElement;
22 var textElements = document.querySelectorAll('text');
24 [].forEach.call(textElements, function(elm) {
25 html.style.zoom = 1;
26 var reference_y = elm.getStartPositionOfChar(0).y;
28 zoomLevels.forEach(function (zoom) {
29 html.style.zoom = zoom;
30 test(function () {
31 assert_approx_equals(elm.getStartPositionOfChar(0).y, reference_y, 1);
32 }, "Unit " + elm.id + " not affected by zoom level " + zoom);
33 });
35 // Clean up to avoid being classified as a text test; avoids an -expected.txt file.
36 elm.remove();
37 });
38 html.style.zoom = 1;
39 </script>
40 </svg>