Bug 280443 p5 - fixup problem with MathML stretchy fallback. r=fredw
authorJohn Daggett <jdaggett@mozilla.com>
Fri, 06 Jun 2014 15:09:24 +0900
changeset 207345 3af2e9f88905ad83af5492fc210c575675386d7f
parent 207344 a73b48626bb5c404a6519c43b5c4e5d7829aa5f0
child 207346 9e1590531e5c902a4ec337db0f555da2363304f9
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfredw
bugs280443
milestone32.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 280443 p5 - fixup problem with MathML stretchy fallback. r=fredw
gfx/thebes/gfxFontFamilyList.h
layout/mathml/nsMathMLChar.cpp
--- a/gfx/thebes/gfxFontFamilyList.h
+++ b/gfx/thebes/gfxFontFamilyList.h
@@ -272,17 +272,17 @@ public:
             }
             const FontFamilyName& name = mFontlist[i];
             name.AppendToString(aFamilyList, aQuotes);
         }
         if (aIncludeDefault && mDefaultFontType != eFamily_none) {
             if (!aFamilyList.IsEmpty()) {
                 aFamilyList.Append(',');
             }
-            if (mDefaultFontType != eFamily_serif) {
+            if (mDefaultFontType == eFamily_serif) {
                 aFamilyList.AppendLiteral("serif");
             } else {
                 aFamilyList.AppendLiteral("sans-serif");
             }
         }
     }
 
     FontFamilyType GetDefaultFontType() const { return mDefaultFontType; }
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -1401,24 +1401,30 @@ nsMathMLChar::StretchEnumContext::TryPar
 
 // This is called for each family, whether it exists or not
 bool
 nsMathMLChar::StretchEnumContext::EnumCallback(const FontFamilyName& aFamily,
                                                bool aGeneric, void *aData)
 {
   StretchEnumContext* context = static_cast<StretchEnumContext*>(aData);
 
+  // for comparisons, force use of unquoted names
+  FontFamilyName unquotedFamilyName(aFamily);
+  if (unquotedFamilyName.mType == eFamily_named_quoted) {
+    unquotedFamilyName.mType = eFamily_named;
+  }
+
   // Check font family if it is not a generic one
   // We test with the kNullGlyph
   nsStyleContext *sc = context->mChar->mStyleContext;
   nsFont font = sc->StyleFont()->mFont;
   NormalizeDefaultFont(font);
   nsRefPtr<gfxFontGroup> fontGroup;
   FontFamilyList family;
-  family.Append(aFamily);
+  family.Append(unquotedFamilyName);
   if (!aGeneric && !context->mChar->SetFontFamily(context->mPresContext,
                                                   nullptr, kNullGlyph, family,
                                                   font, &fontGroup))
      return true; // Could not set the family
 
   // Determine the glyph table to use for this font.
   nsAutoPtr<nsOpenTypeTable> openTypeTable;
   nsGlyphTable* glyphTable;
@@ -1429,17 +1435,17 @@ nsMathMLChar::StretchEnumContext::EnumCa
     // If the font contains an Open Type MATH table, use it.
     openTypeTable = nsOpenTypeTable::Create(fontGroup->GetFontAt(0));
     if (openTypeTable) {
       glyphTable = openTypeTable;
     } else {
       // Otherwise try to find a .properties file corresponding to that font
       // family or fallback to the Unicode table.
       nsAutoString familyName;
-      aFamily.AppendToString(familyName);
+      unquotedFamilyName.AppendToString(familyName);
       glyphTable = gGlyphTableList->GetGlyphTableFor(familyName);
     }
   }
 
   if (!openTypeTable) {
     if (context->mTablesTried.Contains(glyphTable))
       return true; // already tried this one