bug 467722 - don't short-circuit pref font search unless the previous search really did use the first font. r=jdaggett a=roc
authorJonathan Kew <jfkthame@gmail.com>
Mon, 06 Dec 2010 10:51:02 +0000
changeset 58654 a722e6bdd0037fa89274e9ffd05a42d8c5b109dc
parent 58653 64c753b5e23fc48898960fc5ad652167ae81568b
child 58655 5c5042709dd45f1113267479454b2fa203e507f1
child 58725 0d6d19884ccd0ba5214856f41d026c70f843143f
push id17395
push userjkew@mozilla.com
push dateMon, 06 Dec 2010 10:53:52 +0000
treeherdermozilla-central@a722e6bdd003 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett, roc
bugs467722
milestone2.0b8pre
first release with
nightly win64
a722e6bdd003 / 4.0b8pre / 20101206044702 / files
nightly linux32
nightly linux64
nightly mac
nightly win32
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win64
bug 467722 - don't short-circuit pref font search unless the previous search really did use the first font. r=jdaggett a=roc
gfx/thebes/gfxFont.cpp
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2648,21 +2648,21 @@ gfxFontGroup::WhichPrefFontSupportsChar(
             eFontPrefLang prefLangsToSearch[1] = { currentLang };
             PrefFontCallbackData prefFontData(families);
             gfxPlatform::ForEachPrefFont(prefLangsToSearch, 1, PrefFontCallbackData::AddFontFamilyEntry,
                                            &prefFontData);
             fontList->SetPrefFontFamilyEntries(currentLang, families);
         }
 
         // find the first pref font that includes the character
-        PRUint32  i, numPrefs;
+        PRUint32  j, numPrefs;
         numPrefs = families.Length();
-        for (i = 0; i < numPrefs; i++) {
+        for (j = 0; j < numPrefs; j++) {
             // look up the appropriate face
-            gfxFontFamily *family = families[i];
+            gfxFontFamily *family = families[j];
             if (!family) continue;
 
             // if a pref font is used, it's likely to be used again in the same text run.
             // the style doesn't change so the face lookup can be cached rather than calling
             // FindOrMakeFont repeatedly.  speeds up FindFontForChar lookup times for subsequent
             // pref font lookups
             if (family == mLastPrefFamily && mLastPrefFont->HasCharacter(aCh)) {
                 font = mLastPrefFont;
@@ -2674,17 +2674,17 @@ gfxFontGroup::WhichPrefFontSupportsChar(
             gfxFontEntry *fe = family->FindFontForStyle(mStyle, needsBold);
             // if ch in cmap, create and return a gfxFont
             if (fe && fe->TestCharacterMap(aCh)) {
                 nsRefPtr<gfxFont> prefFont = fe->FindOrMakeFont(&mStyle, needsBold);
                 if (!prefFont) continue;
                 mLastPrefFamily = family;
                 mLastPrefFont = prefFont;
                 mLastPrefLang = charLang;
-                mLastPrefFirstFont = (i == 0);
+                mLastPrefFirstFont = (i == 0 && j == 0);
                 return prefFont.forget();
             }
 
         }
     }
 
     return nsnull;
 }