gecko-dev/layout/svg/tests/test_bug1544209.html
violet 1ce98d921c Bug 1544209 - Should not scale mFontSizeScaleFactor for user space r=longsonr
We already get the user space metrics, mFontSizeScaleFactor is irrelevant
and the scaling should not be applied in the first place.

Otherwise we will get very wrong bounding box when <text> has SVG transform
or the font has extreme size.

Differential Revision: https://phabricator.services.mozilla.com/D27443

--HG--
extra : moz-landing-system : lando
2019-04-14 07:41:42 +00:00

20 lines
770 B
HTML

<!DOCTYPE HTML>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1544209">Mozilla Bug 1544209</a>
<svg height="800px" width="800px">
<text transform="scale(3,3)" id="a" x="20px" y="20px">ABC<tspan id="b">ABC</tspan></text>
</svg>
<script type="application/javascript">
let a = document.getElementById("a"),
b = document.getElementById("b");
let wtext = a.getBoundingClientRect().width,
wtspan = b.getBoundingClientRect().width;
ok(wtext >= wtspan, "<tspan> should not be wider than <text>");
isfuzzy((wtext - wtspan) / wtext, 0.5, 0.1, "<tspan> should be approximately half of the <text> width");
</script>