haikuwebkit/LayoutTests/svg/text/font-small-enlarged-minimum...

8 lines
313 B
XML
Raw Permalink Normal View History

Minimum font size pref breaks SVG text very badly. https://bugs.webkit.org/show_bug.cgi?id=143590. Reviewed by Simon Fraser. Source/WebCore: When enabling the minimum font size perf, the computed font size is set to the minimum font size if the computed value is smaller than the minimum. The bug happens because the SVG text element applies its scaling on the computed value after applying the minimum fort size rule. This means the final computed value for the font size will be the scaling of the minimum font size and not minimum font size itself. What we need is to postpone applying the minimum font size rules, till the SVG scaling is applied. Tests: svg/text/font-small-enlarged-minimum-larger.svg svg/text/font-small-enlarged-minimum-smaller.svg * rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle): Call computedFontSizeFromSpecifiedSizeForSVGInlineText() even if scalingFactor is 1. We need to make sure the minimum font size rules are applied. This function was assuming the mininum font size rule was applied when resolving the style. This is not true anymore for the SVG text. * style/StyleFontSizeFunctions.cpp: (WebCore::Style::computedFontSizeFromSpecifiedSize): Do not apply the minimum size rules for the SVG element until it applies its scaling to the font size. LayoutTests: When enabling the minimum font size perf, the SVG text element should apply the minimum font size rules on the scaled font. * svg/text/font-small-enlarged-minimum-larger-expected.svg: Added. * svg/text/font-small-enlarged-minimum-larger.svg: Added. Minimum font size is larger than the scaled font size. Also the expected file makes sure the minimum font size rules are still applied if no scaling is applied. * svg/text/font-small-enlarged-minimum-smaller-expected.svg: Added. * svg/text/font-small-enlarged-minimum-smaller.svg: Added. Minimum font size is smaller than the scaled font size. So the minimim font size rule should not have any effect on the final computed font size. Canonical link: https://commits.webkit.org/161817@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-04-16 02:50:29 +00:00
<svg xmlns="http://www.w3.org/2000/svg" style="width: 400px; height: 400px;">
<script>
internals.settings.setMinimumFontSize(80.0);
</script>
<rect x="40" y="40" width="320" height="320" stroke="green" fill="none" stroke-width="2"/>
<text x="200" y="200" font-size="40.0" fill="black">1</text>
</svg>