Bug 1522857 - Ensure the CHAR_IS_SPACE flag is set properly in the textrun's mCharacterGlyphs array even when the space glyph does not fit into a simple CompressedGlyph record. r=jrmuizel
authorJonathan Kew <jkew@mozilla.com>
Sat, 26 Jan 2019 15:48:38 +0000
changeset 515562 7761a0f081bfa5bd0bd2e84dfe7e37c278848adf
parent 515561 3c9dd9f66747e807faadaaf4d37661728ae78836
child 515563 960911b3928ceaadacccf4879a0755ef7d7ebf38
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1522857
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1522857 - Ensure the CHAR_IS_SPACE flag is set properly in the textrun's mCharacterGlyphs array even when the space glyph does not fit into a simple CompressedGlyph record. r=jrmuizel
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxTextRun.cpp
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -3056,16 +3056,19 @@ bool gfxFont::SplitAndInitTextRun(
         DebugOnly<char16_t> boundary16 = boundary;
         NS_ASSERTION(boundary16 < 256, "unexpected boundary!");
         gfxShapedWord* sw = GetShapedWord(
             aDrawTarget, &boundary, 1, gfxShapedWord::HashMix(0, boundary),
             aRunScript, vertical, appUnitsPerDevUnit,
             flags | gfx::ShapedTextFlags::TEXT_IS_8BIT, rounding, tp);
         if (sw) {
           aTextRun->CopyGlyphDataFrom(sw, aRunStart + i);
+          if (boundary == ' ') {
+            aTextRun->GetCharacterGlyphs()[aRunStart + i].SetIsSpace();
+          }
         } else {
           return false;
         }
       }
       hash = 0;
       wordStart = i + 1;
       wordIs8Bit = true;
       continue;
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -1531,16 +1531,17 @@ void gfxTextRun::SetSpaceGlyph(gfxFont* 
       aFont->GetRoundOffsetsToPixels(aDrawTarget);
   gfxShapedWord* sw = aFont->GetShapedWord(
       aDrawTarget, &space, 1, gfxShapedWord::HashMix(0, ' '), Script::LATIN,
       vertical, mAppUnitsPerDevUnit, flags, roundingFlags, nullptr);
   if (sw) {
     AddGlyphRun(aFont, gfxTextRange::MatchType::kFontGroup, aCharIndex, false,
                 aOrientation);
     CopyGlyphDataFrom(sw, aCharIndex);
+    GetCharacterGlyphs()[aCharIndex].SetIsSpace();
   }
 }
 
 bool gfxTextRun::SetSpaceGlyphIfSimple(gfxFont* aFont, uint32_t aCharIndex,
                                        char16_t aSpaceChar,
                                        gfx::ShapedTextFlags aOrientation) {
   uint32_t spaceGlyph = aFont->GetSpaceGlyph();
   if (!spaceGlyph || !CompressedGlyph::IsSimpleGlyphID(spaceGlyph)) {