gecko-dev/layout/reftests/bugs/355548-2.xml
Emilio Cobos Álvarez ac54c9333b Bug 1534494 - Try to bring some more sanity into our font code. r=manishearth
It's not very easy to understand on its current state, and it causes subtle bugs
like bug 1533654.

It could be simpler if we centralized where the interactions between properties
are handled. This patch does this.

This patch also changes how MathML script sizes are tracked when scriptlevel
changes and they have relative fonts in between.

With this patch, any explicitly specified font-size is treated the same (being a
scriptlevel boundary), regardless of whether it's either an absolute size, a
relative size, or a wide keyword.

Relative lengths always resolve relative to the constrained size, which allows
us to avoid the double font-size computation, and not give up on sanity with
keyword font-sizes.

I think given no other browser supports scriptlevel it seems like the right
trade-off.

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

--HG--
extra : moz-landing-system : lando
2019-03-18 15:37:03 +00:00

37 lines
2.4 KiB
XML

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://www.w3.org/1998/Math/MathML">
<body>
<!-- Test interactions between CSS font-size and scriptlevel changes -->
<p><m:math><m:mstyle scriptlevel="0" scriptsizemultiplier="0.5" scriptminsize="18px" style="font-size:48px;">
<m:mstyle scriptlevel="+5"><m:mi>Id</m:mi></m:mstyle>
<!-- Test that we can explicitly go below scriptminsize -->
<m:mi style="font-size:10px;">Id</m:mi>
<!-- Test that a relative font-size ignores the scriptlevel change in the same element -->
<m:mstyle scriptlevel="+5" style="font-size:100%;"><m:mi>Id</m:mi></m:mstyle>
</m:mstyle></m:math></p>
<p><m:math><m:mstyle scriptlevel="0" scriptsizemultiplier="0.5" scriptminsize="18px" style="font-size:48px;">
<!-- Test that scriptlevel changes are incremental (this should be 24px) -->
<m:mstyle scriptlevel="+1" style="font-size:48px;"><m:mstyle scriptlevel="+1"><m:mi>Id</m:mi></m:mstyle></m:mstyle>
</m:mstyle></m:math></p>
<p><m:math><m:mstyle scriptlevel="0" scriptsizemultiplier="0.5" scriptminsize="18px" style="font-size:48px;">
<!-- Decreasing the font size due to a scriptlevel change should do nothing when we're below minscriptsize -->
<m:mstyle style="font-size:10px;"><m:mstyle scriptlevel="+1"><m:mi>Id</m:mi></m:mstyle></m:mstyle>
<!-- but we can increase -->
<m:mstyle style="font-size:10px;"><m:mstyle scriptlevel="-1"><m:mi>Id</m:mi></m:mstyle></m:mstyle>
<m:mstyle style="font-size:10px;"><m:mstyle scriptlevel="-2"><m:mi>Id</m:mi></m:mstyle></m:mstyle>
</m:mstyle></m:math></p>
<p><m:math><m:mstyle scriptlevel="0" scriptsizemultiplier="0.5" scriptminsize="18px" style="font-size:48px;">
<!-- An absolute font-size value resets the unconstrained size to that value, so we
can increase above that value with a negative scriptlevel change -->
<m:mstyle scriptlevel="+5"><m:mstyle style="font-size:24px;"><m:mstyle scriptlevel="-1"><m:mi>Id</m:mi></m:mstyle></m:mstyle></m:mstyle>
<!-- A relative font-size value resets the unconstrained to that value, resolved relative to the constrained size -->
<m:mstyle scriptlevel="+2"><m:mstyle style="font-size:200%;"><m:mstyle scriptlevel="-1"><m:mi>Id</m:mi></m:mstyle></m:mstyle></m:mstyle>
<!-- The unconstrained size does not cap the font size to below scriptminsize (so this is 18px) -->
<m:mstyle scriptlevel="+2"><m:mstyle style="font-size:50%;"><m:mstyle scriptlevel="-1"><m:mi>Id</m:mi></m:mstyle></m:mstyle></m:mstyle>
</m:mstyle></m:math></p>
</body>
</html>