Bug 1460858 - Fix serialization/deserialization of SlantStyle for the Android startupCache, to ensure proper styled face selection. r=jwatt
☠☠ backed out by 44f7d6fa6c7a ☠ ☠
authorJonathan Kew <jkew@mozilla.com>
Thu, 17 May 2018 14:44:37 +0100
changeset 418723 4d6aa78bf59d45b9468c38540d1e9c4f3d65838b
parent 418722 2908cc9102b0f1547b20370deed80176dfeaddf7
child 418724 2e8ec34f785e394f4f7c5f8b98f06422a598e1af
push id34011
push userbtara@mozilla.com
push dateThu, 17 May 2018 22:04:35 +0000
treeherdermozilla-central@54063deb2f1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1460858
milestone62.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 1460858 - Fix serialization/deserialization of SlantStyle for the Android startupCache, to ensure proper styled face selection. r=jwatt
gfx/src/FontPropertyTypes.h
gfx/thebes/gfxFT2FontList.cpp
--- a/gfx/src/FontPropertyTypes.h
+++ b/gfx/src/FontPropertyTypes.h
@@ -342,18 +342,19 @@ public:
     } else if (strcmp(aString, "italic") == 0) {
       return Italic();
     } else {
       if (isdigit(aString[0]) && strstr(aString, "deg")) {
         float angle = strtof(aString, nullptr);
         return Oblique(angle);
       }
       // Not recognized as an oblique angle; maybe it's from a startup-cache
-      // created by an older version. Just treat it as 'normal'.      
-      return Normal();
+      // created by an older version. The style field there used a simple 0/1
+      // for normal/italic respectively.
+      return aString[0] == '0' ? Normal() : Italic();
     }
   }
 
   bool IsNormal() const { return mValue == kNormal; }
   bool IsItalic() const { return mValue == kItalic; }
   bool IsOblique() const { return mValue != kItalic && mValue != kNormal; }
 
   float ObliqueAngle() const
--- a/gfx/thebes/gfxFT2FontList.cpp
+++ b/gfx/thebes/gfxFT2FontList.cpp
@@ -1055,17 +1055,21 @@ AppendToFaceList(nsCString& aFaceList,
                  nsAString& aFamilyName, FT2FontEntry* aFontEntry)
 {
     aFaceList.Append(NS_ConvertUTF16toUTF8(aFamilyName));
     aFaceList.Append(',');
     aFaceList.Append(NS_ConvertUTF16toUTF8(aFontEntry->Name()));
     aFaceList.Append(',');
     aFaceList.AppendInt(aFontEntry->mFTFontIndex);
     aFaceList.Append(',');
-    aFaceList.Append(aFontEntry->IsItalic() ? '1' : '0');
+    // Note that ToString() appends to the destination string without
+    // replacing existing contents (see FontPropertyTypes.h)
+    aFontEntry->SlantStyle().Min().ToString(aFaceList);
+    aFaceList.Append(':');
+    aFontEntry->SlantStyle().Max().ToString(aFaceList);
     aFaceList.Append(',');
     aFaceList.AppendFloat(aFontEntry->Weight().Min().ToFloat());
     aFaceList.Append(':');
     aFaceList.AppendFloat(aFontEntry->Weight().Max().ToFloat());
     aFaceList.Append(',');
     aFaceList.AppendFloat(aFontEntry->Stretch().Min().Percentage());
     aFaceList.Append(':');
     aFaceList.AppendFloat(aFontEntry->Stretch().Max().Percentage());