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

Unified Diff: LayoutTests/svg/custom/zoomed-ex-em-font-sizes.html

Issue 1283463003: Remove effective zoom from font metrics before length calculations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Avoid hardcoded values in test Created 5 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
« no previous file with comments | « no previous file | Source/core/svg/SVGLengthContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/custom/zoomed-ex-em-font-sizes.html
diff --git a/LayoutTests/svg/custom/zoomed-ex-em-font-sizes.html b/LayoutTests/svg/custom/zoomed-ex-em-font-sizes.html
new file mode 100644
index 0000000000000000000000000000000000000000..dfe98d465744dea03cfb75d6e4ee8c0af519d3eb
--- /dev/null
+++ b/LayoutTests/svg/custom/zoomed-ex-em-font-sizes.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<title>Test that ex, em, rem and ch font sizes are unaffected by zoom level</title>
+<script src="../../resources/ahem.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+ svg {
+ font-size: 100px;
+ font-family: ahem;
+ }
+</style>
+<svg width="100%" height="1em" xmlns="http://www.w3.org/2000/svg" version="1.1">
+
+ <text id="em" y="1em" dy="4em">XXXXXX XXX</text>
+ <text id="rem" y="1em" dy="25rem">XXXXXX XXX</text>
+ <text id="ex" y="1em" dy="5ex">XXXXXX XXX</text>
+ <text id="ch" y="1em" dy="4ch">XXXXXX XXX</text>
+
+ <script>
+ var zoomLevels = [0.3, 4];
+ var html = document.documentElement;
+ var textElements = document.querySelectorAll('text');
+
+ [].forEach.call(textElements, function(elm) {
+ html.style.zoom = 1;
+ var reference_y = elm.getStartPositionOfChar(0).y;
+
+ zoomLevels.forEach(function (zoom) {
+ html.style.zoom = zoom;
+ test(function () {
+ assert_approx_equals(elm.getStartPositionOfChar(0).y, reference_y, 1);
+ }, "Unit " + elm.id + " not affected by zoom level " + zoom);
+ });
+
+ // Clean up to avoid being classified as a text test; avoids an -expected.txt file.
+ elm.remove();
+ });
+ html.style.zoom = 1;
+ </script>
+</svg>
« no previous file with comments | « no previous file | Source/core/svg/SVGLengthContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698