Backed out changeset acd7efb271c8 (bug 1211867)
authorWes Kocher <wkocher@mozilla.com>
Wed, 14 Oct 2015 09:04:27 -0700
changeset 267675 653d103fbf14ee5e770db2a9bf1980375e30facc
parent 267674 ddbb8d58c3132ed935a3b017e68d453e85c4854a
child 267676 7c8c39371dbd7a52539f4c63587c754b54c89ad6
push id66548
push userkwierso@gmail.com
push dateWed, 14 Oct 2015 16:05:13 +0000
treeherdermozilla-inbound@41166ce51f02 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1211867
milestone44.0a1
backs outacd7efb271c81d078b1f7129ac39bf2518812770
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
Backed out changeset acd7efb271c8 (bug 1211867)
gfx/thebes/gfxFont.cpp
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2338,25 +2338,20 @@ gfxFont::NotifyGlyphsChanged()
 
     if (mGlyphChangeObservers) {
         for (auto it = mGlyphChangeObservers->Iter(); !it.Done(); it.Next()) {
             it.Get()->GetKey()->NotifyGlyphsChanged();
         }
     }
 }
 
-// If aChar is a "word boundary" for shaped-word caching purposes, return it;
-// else return 0.
-static char16_t
+static bool
 IsBoundarySpace(char16_t aChar, char16_t aNextChar)
 {
-    if ((aChar == ' ' || aChar == 0x00A0) && !IsClusterExtender(aNextChar)) {
-        return aChar;
-    }
-    return 0;
+    return (aChar == ' ' || aChar == 0x00A0) && !IsClusterExtender(aNextChar);
 }
 
 #ifdef __GNUC__
 #define GFX_MAYBE_UNUSED __attribute__((unused))
 #else
 #define GFX_MAYBE_UNUSED
 #endif
 
@@ -2765,17 +2760,17 @@ gfxFont::SplitAndInitTextRun(gfxContext 
     uint32_t hash = 0;
     bool wordIs8Bit = true;
     int32_t appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit();
 
     T nextCh = aString[0];
     for (uint32_t i = 0; i <= aRunLength; ++i) {
         T ch = nextCh;
         nextCh = (i < aRunLength - 1) ? aString[i + 1] : '\n';
-        T boundary = IsBoundarySpace(ch, nextCh);
+        bool boundary = IsBoundarySpace(ch, nextCh);
         bool invalid = !boundary && gfxFontGroup::IsInvalidChar(ch);
         uint32_t length = i - wordStart;
 
         // break into separate ShapedWords when we hit an invalid char,
         // or a boundary space (always handled individually),
         // or the first non-space after a space
         if (!boundary && !invalid) {
             if (!IsChar8Bit(ch)) {
@@ -2827,29 +2822,26 @@ gfxFont::SplitAndInitTextRun(gfxContext 
         if (boundary) {
             // word was terminated by a space: add that to the textrun
             uint16_t orientation = flags & gfxTextRunFactory::TEXT_ORIENT_MASK;
             if (orientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED) {
                 orientation = aVertical ?
                     gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT :
                     gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
             }
-            if (boundary != ' ' ||
-                !aTextRun->SetSpaceGlyphIfSimple(this, aContext,
+            if (!aTextRun->SetSpaceGlyphIfSimple(this, aContext,
                                                  aRunStart + i, ch,
-                                                 orientation)) {
-                // Currently, the only "boundary" characters we recognize are
-                // space and no-break space, which are both 8-bit, so we force
-                // that flag (below). If we ever change IsBoundarySpace, we
-                // may need to revise this.
-                NS_ASSERTION(uint32_t(boundary) < 256, "unexpected boundary!");
+                                                 orientation))
+            {
+                static const uint8_t space = ' ';
                 gfxShapedWord *sw =
-                    GetShapedWord(aContext, &boundary, 1,
-                                  gfxShapedWord::HashMix(0, boundary),
-                                  aRunScript, aVertical, appUnitsPerDevUnit,
+                    GetShapedWord(aContext,
+                                  &space, 1,
+                                  gfxShapedWord::HashMix(0, ' '), aRunScript, aVertical,
+                                  appUnitsPerDevUnit,
                                   flags | gfxTextRunFactory::TEXT_IS_8BIT, tp);
                 if (sw) {
                     aTextRun->CopyGlyphDataFrom(sw, aRunStart + i);
                 } else {
                     return false;
                 }
             }
             hash = 0;