Bug 1574066 - Correctly count glyphs when determining text decoration intercepts. r=jfkthame

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Cameron McCormack 2019-08-26 09:26:22 +00:00
Родитель 7f5a19c884
Коммит 1ca68445da
1 изменённых файлов: 3 добавлений и 8 удалений

Просмотреть файл

@ -3820,13 +3820,8 @@ static uint32_t CountAllGlyphs(
const gfxTextRun* aTextRun,
const gfxTextRun::CompressedGlyph* aCompressedGlyph, uint32_t aStringStart,
uint32_t aStringEnd) {
bool hasDetailed = aTextRun->HasDetailedGlyphs();
uint32_t totalGlyphCount = 0;
if (!hasDetailed) {
return aStringEnd - aStringStart;
}
for (const gfxTextRun::CompressedGlyph* cg = aCompressedGlyph + aStringStart;
cg < aCompressedGlyph + aStringEnd; ++cg) {
totalGlyphCount += cg->IsSimpleGlyph() ? 1 : cg->GetGlyphCount();
@ -3884,8 +3879,6 @@ static sk_sp<const SkTextBlob> CreateTextBlob(
SkTextBlobBuilder builder;
const SkTextBlobBuilder::RunBuffer& run = builder.allocRunPos(aFont, len);
bool hasDetailed = aTextRun->HasDetailedGlyphs();
// RTL text should be read in by glyph starting at aStringEnd - 1 down until
// aStringStart.
bool isRTL = aTextRun->IsRightToLeft();
@ -3907,7 +3900,7 @@ static sk_sp<const SkTextBlob> CreateTextBlob(
AddSimpleGlyph(run, aCompressedGlyph[currIndex], i, aAppUnitsPerDevPixel,
aTextPos);
i++;
} else if (hasDetailed) {
} else {
// if it's detailed, potentially add multiple into run.glyphs
uint32_t count = aCompressedGlyph[currIndex].GetGlyphCount();
if (count > 0) {
@ -3932,6 +3925,8 @@ static sk_sp<const SkTextBlob> CreateTextBlob(
currIndex += step;
}
MOZ_ASSERT(i == len, "glyph count error!");
return builder.make();
}