Bug 1899525 - Stop lengthAdjust="spacingAndGlyphs" clipping the last character r=jfkthame

Reverts a small part of bug 1621502

Differential Revision: https://phabricator.services.mozilla.com/D212091
This commit is contained in:
longsonr 2024-05-30 14:26:29 +00:00
parent 8c8d2000fc
commit a3a30a77a0
3 changed files with 38 additions and 6 deletions

View File

@ -869,12 +869,6 @@ SVGBBox TextRenderedRun::GetRunUserSpaceRect(nsPresContext* aContext,
fillInAppUnits.height),
aContext);
if (vertical) {
fill.Scale(1.0, mLengthAdjustScaleFactor);
} else {
fill.Scale(mLengthAdjustScaleFactor, 1.0);
}
// Scale the rectangle up due to any mFontSizeScaleFactor.
fill.Scale(1.0 / mFontSizeScaleFactor);

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
<metadata>
<title>lengthAdjust="spacingAndGlyphs" should render properly</title>
<h:link rel="help" href="https://www.w3.org/TR/SVG2/text.html#TextElementLengthAdjustAttribute"/>
<h:link rel="match" href="green-100x100.svg"/>
<h:link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
</metadata>
<style>
text {
font: 100px/1 Ahem;
}
</style>
<rect fill="green" width="100" height="100"/>
<rect fill="red" x="20" y="80" width="60" height="10"/>
<text x="50" y="-85" fill="green" textLength="180" lengthAdjust="spacingAndGlyphs" font-family="Ahem" style="writing-mode: vertical-lr">
XXXXXXX
</text>
</svg>

After

Width:  |  Height:  |  Size: 782 B

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
<metadata>
<title>lengthAdjust="spacingAndGlyphs" should render properly</title>
<h:link rel="help" href="https://www.w3.org/TR/SVG2/text.html#TextElementLengthAdjustAttribute"/>
<h:link rel="match" href="green-100x100.svg"/>
<h:link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
</metadata>
<style>
text {
font: 100px/1 Ahem;
}
</style>
<rect fill="green" width="100" height="100"/>
<rect fill="red" x="80" y="20" width="10" height="60"/>
<text x="-82" y="70" fill="green" textLength="180" lengthAdjust="spacingAndGlyphs" font-family="Ahem">
XXXXXXX
</text>
</svg>

After

Width:  |  Height:  |  Size: 748 B