merge backout of bug 668758
authorJonathan Kew <jfkthame@gmail.com>
Wed, 13 Jul 2011 10:51:06 +0100
changeset 72681 931f06b807279ad40439ece516461b42d480349b
parent 72679 854daee4377c9440b435bdac15d45835bfaa32ae (current diff)
parent 72680 84bc1d07baccb1fcdd423f1074c93e2f4f5e7a0f (diff)
child 72682 812aa60517a756ba317d649dc102daf91cca266f
push id20757
push userjkew@mozilla.com
push dateWed, 13 Jul 2011 09:52:20 +0000
treeherdermozilla-central@931f06b80727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs668758
milestone8.0a1
first release with
nightly linux32
931f06b80727 / 8.0a1 / 20110713030741 / files
nightly linux64
931f06b80727 / 8.0a1 / 20110713030741 / files
nightly mac
931f06b80727 / 8.0a1 / 20110713030741 / files
nightly win32
931f06b80727 / 8.0a1 / 20110713030741 / files
nightly win64
931f06b80727 / 8.0a1 / 20110713030741 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge backout of bug 668758
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2055,42 +2055,39 @@ gfxFontGroup::BuildFontList()
         }
     }
 #endif
 }
 
 PRBool
 gfxFontGroup::FindPlatformFont(const nsAString& aName,
                                const nsACString& aGenericName,
-                               PRBool aUseFontSet,
                                void *aClosure)
 {
     gfxFontGroup *fontGroup = static_cast<gfxFontGroup*>(aClosure);
     const gfxFontStyle *fontStyle = fontGroup->GetStyle();
 
     PRBool needsBold;
     gfxFontEntry *fe = nsnull;
 
+    // First, look up in the user font set...
+    // If the fontSet matches the family, we must not look for a platform
+    // font of the same name, even if we fail to actually get a fontEntry
+    // here; we'll fall back to the next name in the CSS font-family list.
     PRBool foundFamily = PR_FALSE;
-    if (aUseFontSet) {
-        // First, look up in the user font set...
-        // If the fontSet matches the family, we must not look for a platform
-        // font of the same name, even if we fail to actually get a fontEntry
-        // here; we'll fall back to the next name in the CSS font-family list.
-        gfxUserFontSet *fs = fontGroup->GetUserFontSet();
-        if (fs) {
-            // If the fontSet matches the family, but the font has not yet finished
-            // loading (nor has its load timeout fired), the fontGroup should wait
-            // for the download, and not actually draw its text yet.
-            PRBool waitForUserFont = PR_FALSE;
-            fe = fs->FindFontEntry(aName, *fontStyle, foundFamily,
-                                   needsBold, waitForUserFont);
-            if (!fe && waitForUserFont) {
-                fontGroup->mSkipDrawing = PR_TRUE;
-            }
+    gfxUserFontSet *fs = fontGroup->GetUserFontSet();
+    if (fs) {
+        // If the fontSet matches the family, but the font has not yet finished
+        // loading (nor has its load timeout fired), the fontGroup should wait
+        // for the download, and not actually draw its text yet.
+        PRBool waitForUserFont = PR_FALSE;
+        fe = fs->FindFontEntry(aName, *fontStyle, foundFamily,
+                               needsBold, waitForUserFont);
+        if (!fe && waitForUserFont) {
+            fontGroup->mSkipDrawing = PR_TRUE;
         }
     }
 
     // Not known in the user font set ==> check system fonts
     if (!foundFamily) {
         fe = gfxPlatformFontList::PlatformFontList()->
             FindFontForFamily(aName, fontStyle, needsBold);
     }
@@ -2142,51 +2139,47 @@ gfxFontGroup::IsInvalidChar(PRUnichar ch
         (ch >= 0x1c && ch <= 0x1f);
 }
 
 PRBool
 gfxFontGroup::ForEachFont(FontCreationCallback fc,
                           void *closure)
 {
     return ForEachFontInternal(mFamilies, mStyle.language,
-                               PR_TRUE, PR_TRUE, PR_TRUE, fc, closure);
+                               PR_TRUE, PR_TRUE, fc, closure);
 }
 
 PRBool
 gfxFontGroup::ForEachFont(const nsAString& aFamilies,
                           nsIAtom *aLanguage,
                           FontCreationCallback fc,
                           void *closure)
 {
     return ForEachFontInternal(aFamilies, aLanguage,
-                               PR_FALSE, PR_TRUE, PR_TRUE, fc, closure);
+                               PR_FALSE, PR_TRUE, fc, closure);
 }
 
 struct ResolveData {
     ResolveData(gfxFontGroup::FontCreationCallback aCallback,
                 nsACString& aGenericFamily,
-                PRBool aUseFontSet,
                 void *aClosure) :
         mCallback(aCallback),
         mGenericFamily(aGenericFamily),
-        mUseFontSet(aUseFontSet),
         mClosure(aClosure) {
     }
     gfxFontGroup::FontCreationCallback mCallback;
     nsCString mGenericFamily;
-    PRBool mUseFontSet;
     void *mClosure;
 };
 
 PRBool
 gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies,
                                   nsIAtom *aLanguage,
                                   PRBool aResolveGeneric,
                                   PRBool aResolveFontName,
-                                  PRBool aUseFontSet,
                                   FontCreationCallback fc,
                                   void *closure)
 {
     const PRUnichar kSingleQuote  = PRUnichar('\'');
     const PRUnichar kDoubleQuote  = PRUnichar('\"');
     const PRUnichar kComma        = PRUnichar(',');
 
     nsIAtom *groupAtom = nsnull;
@@ -2269,27 +2262,28 @@ gfxFontGroup::ForEachFontInternal(const 
                     family = value;
                 }
             } else {
                 generic = PR_FALSE;
                 genericFamily.SetIsVoid(PR_TRUE);
             }
         }
 
-        NS_LossyConvertUTF16toASCII gf(genericFamily);
         if (generic) {
-            fc(family, gf, PR_FALSE, closure);
+            ForEachFontInternal(family, groupAtom, PR_FALSE,
+                                aResolveFontName, fc, closure);
         } else if (!family.IsEmpty()) {
+            NS_LossyConvertUTF16toASCII gf(genericFamily);
             if (aResolveFontName) {
-                ResolveData data(fc, gf, aUseFontSet, closure);
+                ResolveData data(fc, gf, closure);
                 PRBool aborted = PR_FALSE, needsBold;
                 nsresult rv = NS_OK;
                 PRBool foundFamily = PR_FALSE;
                 PRBool waitForUserFont = PR_FALSE;
-                if (aUseFontSet && mUserFontSet &&
+                if (mUserFontSet &&
                     mUserFontSet->FindFontEntry(family, mStyle, foundFamily,
                                                 needsBold, waitForUserFont))
                 {
                     gfxFontGroup::FontResolverProc(family, &data);
                 } else {
                     if (waitForUserFont) {
                         mSkipDrawing = PR_TRUE;
                     }
@@ -2299,46 +2293,44 @@ gfxFontGroup::ForEachFontInternal(const 
                                                  gfxFontGroup::FontResolverProc,
                                                  &data, aborted);
                     }
                 }
                 if (NS_FAILED(rv) || aborted)
                     return PR_FALSE;
             }
             else {
-                if (!fc(family, gf, aUseFontSet, closure))
+                if (!fc(family, gf, closure))
                     return PR_FALSE;
             }
         }
 
         if (generic && aResolveGeneric) {
             nsCAutoString prefName("font.name-list.");
             prefName.Append(lcFamily);
             prefName.AppendLiteral(".");
             prefName.Append(groupString);
             nsAdoptingString value = Preferences::GetString(prefName.get());
             if (value) {
-                ForEachFontInternal(value, groupAtom, PR_FALSE,
-                                    aResolveFontName, PR_FALSE,
+                ForEachFontInternal(value, groupAtom, PR_FALSE, aResolveFontName,
                                     fc, closure);
             }
         }
 
         ++p; // may advance past p_end
     }
 
     return PR_TRUE;
 }
 
 PRBool
 gfxFontGroup::FontResolverProc(const nsAString& aName, void *aClosure)
 {
     ResolveData *data = reinterpret_cast<ResolveData*>(aClosure);
-    return (data->mCallback)(aName, data->mGenericFamily, data->mUseFontSet,
-                             data->mClosure);
+    return (data->mCallback)(aName, data->mGenericFamily, data->mClosure);
 }
 
 gfxTextRun *
 gfxFontGroup::MakeEmptyTextRun(const Parameters *aParams, PRUint32 aFlags)
 {
     aFlags |= TEXT_IS_8BIT | TEXT_IS_ASCII | TEXT_IS_PERSISTENT;
     return gfxTextRun::Create(aParams, nsnull, 0, this, aFlags);
 }
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -2339,17 +2339,16 @@ public:
     virtual gfxTextRun *MakeTextRun(const PRUint8 *aString, PRUint32 aLength,
                                     const Parameters *aParams, PRUint32 aFlags);
 
     /* helper function for splitting font families on commas and
      * calling a function for each family to fill the mFonts array
      */
     typedef PRBool (*FontCreationCallback) (const nsAString& aName,
                                             const nsACString& aGenericName,
-                                            PRBool aUseFontSet,
                                             void *closure);
     PRBool ForEachFont(const nsAString& aFamilies,
                        nsIAtom *aLanguage,
                        FontCreationCallback fc,
                        void *closure);
     PRBool ForEachFont(FontCreationCallback fc, void *closure);
 
     /**
@@ -2453,29 +2452,25 @@ protected:
 
     /* If aResolveGeneric is true, then CSS/Gecko generic family names are
      * replaced with preferred fonts.
      *
      * If aResolveFontName is true then fc() is called only for existing fonts
      * and with actual font names.  If false then fc() is called with each
      * family name in aFamilies (after resolving CSS/Gecko generic family names
      * if aResolveGeneric).
-     * If aUseFontSet is true, the fontgroup's user font set is checked;
-     * if false then it is skipped.
      */
     PRBool ForEachFontInternal(const nsAString& aFamilies,
                                nsIAtom *aLanguage,
                                PRBool aResolveGeneric,
                                PRBool aResolveFontName,
-                               PRBool aUseFontSet,
                                FontCreationCallback fc,
                                void *closure);
 
     static PRBool FontResolverProc(const nsAString& aName, void *aClosure);
 
     static PRBool FindPlatformFont(const nsAString& aName,
                                    const nsACString& aGenericName,
-                                   PRBool aUseFontSet,
                                    void *closure);
 
     static NS_HIDDEN_(nsILanguageAtomService*) gLangService;
 };
 #endif
--- a/gfx/thebes/gfxPangoFonts.cpp
+++ b/gfx/thebes/gfxPangoFonts.cpp
@@ -1811,17 +1811,17 @@ FFRECountHyphens (const nsAString &aFFRE
         ++h;
         ++hyphen;
     }
     return h;
 }
 
 static PRBool
 FamilyCallback (const nsAString& fontName, const nsACString& genericName,
-                PRBool aUseFontSet, void *closure)
+                void *closure)
 {
     FamilyCallbackData *data = static_cast<FamilyCallbackData*>(closure);
     nsTArray<nsString> *list = data->mFcFamilyList;
 
     // We ignore prefs that have three hypens since they are X style prefs.
     if (genericName.Length() && FFRECountHyphens(fontName) >= 3)
         return PR_TRUE;
 
@@ -1849,17 +1849,17 @@ FamilyCallback (const nsAString& fontNam
         // invalid font data, it should be considered as if a font was present
         // but contained an empty character map; matching a platform font with
         // the same name must not occur in this case."
         //
         // Therefore, for names present in the user font set, this code no
         // longer includes the family name for matching against system fonts.
         //
         const gfxUserFontSet *userFontSet = data->mUserFontSet;
-        if (aUseFontSet && genericName.Length() == 0 &&
+        if (genericName.Length() == 0 &&
             userFontSet && userFontSet->HasFamily(fontName)) {
             nsAutoString userFontName =
                 NS_LITERAL_STRING(FONT_FACE_FAMILY_PREFIX) + fontName;
             list->AppendElement(userFontName);
         } else {
             list->AppendElement(fontName);
         }
     }
@@ -1895,17 +1895,17 @@ gfxPangoFontGroup::Copy(const gfxFontSty
 // An array of family names suitable for fontconfig
 void
 gfxPangoFontGroup::GetFcFamilies(nsTArray<nsString> *aFcFamilyList,
                                  nsIAtom *aLanguage)
 {
     FamilyCallbackData data(aFcFamilyList, mUserFontSet);
     // Leave non-existing fonts in the list so that fontconfig can get the
     // best match.
-    ForEachFontInternal(mFamilies, aLanguage, PR_TRUE, PR_FALSE, PR_TRUE,
+    ForEachFontInternal(mFamilies, aLanguage, PR_TRUE, PR_FALSE,
                         FamilyCallback, &data);
 }
 
 gfxFcFont *
 gfxPangoFontGroup::GetBaseFont()
 {
     if (!mFonts[0]) {
         mFonts[0] = GetBaseFontSet()->GetFontAt(0);