Bug 1617515 - Properly advance current position for glyph runs where we don't implement ink-skipping. r=dholbert

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Kew 2020-02-25 13:42:58 +00:00
parent f96c310580
commit 92625e728c
4 changed files with 22 additions and 5 deletions

View File

@ -4062,6 +4062,16 @@ void nsCSSRendering::PaintDecorationLine(
int32_t spacingOffset = isRTL ? aParams.glyphRange.Length() - 1 : 0;
gfxTextRun::GlyphRunIterator iter(textRun, aParams.glyphRange, isRTL);
// For any glyph run where we don't actually do skipping, we'll need to
// advance the current position by its width.
// (For runs we do process, CreateTextBlob will update the position.)
auto currentGlyphRunAdvance = [&]() {
return textRun->GetAdvanceWidth(
gfxTextRun::Range(iter.GetStringStart(), iter.GetStringEnd()),
aParams.provider) /
appUnitsPerDevPixel;
};
while (iter.NextRun()) {
if (iter.GetGlyphRun()->mOrientation ==
mozilla::gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT ||
@ -4075,11 +4085,7 @@ void nsCSSRendering::PaintDecorationLine(
// have an underline that looks really bad if this is done
// (see https://bugzilla.mozilla.org/show_bug.cgi?id=1573249),
// when skip-ink is set to 'auto'.
textPos.fX +=
textRun->GetAdvanceWidth(
gfxTextRun::Range(iter.GetStringStart(), iter.GetStringEnd()),
aParams.provider) /
appUnitsPerDevPixel;
textPos.fX += currentGlyphRunAdvance();
continue;
}
@ -4088,6 +4094,7 @@ void nsCSSRendering::PaintDecorationLine(
// because old macOS (10.9) may crash trying to retrieve glyph paths
// that don't exist.
if (font->GetFontEntry()->HasFontTable(TRUETYPE_TAG('s', 'b', 'i', 'x'))) {
textPos.fX += currentGlyphRunAdvance();
continue;
}
@ -4106,6 +4113,7 @@ void nsCSSRendering::PaintDecorationLine(
(float)appUnitsPerDevPixel, textPos, spacingOffset);
if (!textBlob) {
textPos.fX += currentGlyphRunAdvance();
continue;
}

View File

@ -0,0 +1,4 @@
<!DOCTYPE html>
<meta charset=utf-8>
<div style="font: 32px sans-serif">
<u>aa🔥<span></span>aaag-j-q-y</u>

View File

@ -0,0 +1,4 @@
<!DOCTYPE html>
<meta charset=utf-8>
<div style="font: 32px sans-serif">
<u>aa🔥aaag-j-q-y</u>

View File

@ -2090,3 +2090,4 @@ pref(layout.css.xul-box-display-values.content.enabled,true) == 1606130.html 160
== 1608124-1.html 1608124-1-ref.html
skip-if(!OSX) != 1608124-2.html 1608124-2-notref.html
== 1613380.html 1613380-ref.html
fuzzy-if(OSX,0-42,0-4) fuzzy-if((Android||winWidget)&&!webrender,0-115,0-2) == 1617515-1.html 1617515-1-ref.html