Bug 1574392: fix for crash caused by a zero length textblob r=dholbert

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Charlie Marlow 2019-08-16 20:57:45 +00:00
Родитель 9c7cf7138d
Коммит c762d7b259
3 изменённых файлов: 10 добавлений и 2 удалений

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

@ -0,0 +1 @@
<u>🏴󠁵󠁳󠁣󠁡󠁿</u>

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

@ -21,4 +21,4 @@ load 1547420-1.html
load 1549909.html
asserts(6) load 1551389-1.html # bug 847368
asserts(0-2) load 1555819-1.html
load 1574392.html

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

@ -3877,7 +3877,10 @@ static sk_sp<const SkTextBlob> CreateTextBlob(
// allocate space for the run buffer, then fill it with the glyphs
uint32_t len =
CountAllGlyphs(aTextRun, aCompressedGlyph, aStringStart, aStringEnd);
MOZ_ASSERT(len > 0, "there must be at least one glyph for skip ink");
if (len <= 0) {
return nullptr;
}
SkTextBlobBuilder builder;
const SkTextBlobBuilder::RunBuffer& run = builder.allocRunPos(aFont, len);
@ -4116,6 +4119,10 @@ void nsCSSRendering::PaintDecorationLine(
iter.GetStringStart(), iter.GetStringEnd(),
(float)appUnitsPerDevPixel, textPos, spacingOffset);
if (!textBlob) {
continue;
}
if (textRun->UseCenterBaseline()) {
// writing modes that use a center baseline need to be adjusted on a
// font-by-font basis since Skia lines up the text on a alphabetic