Backout changeset f39ad7e4054e (bug 623711) because of reftest failure

This commit is contained in:
Ehsan Akhgari 2011-03-24 00:15:02 -04:00
Родитель 7b29685e29
Коммит bb34d2452e
4 изменённых файлов: 38 добавлений и 41 удалений

Просмотреть файл

@ -2040,26 +2040,21 @@ gfxFontGroup::FindPlatformFont(const nsAString& aName,
PRBool needsBold; PRBool needsBold;
gfxFontEntry *fe = nsnull; gfxFontEntry *fe = nsnull;
// First, look up in the user font set... // 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;
gfxUserFontSet *fs = fontGroup->GetUserFontSet(); gfxUserFontSet *fs = fontGroup->GetUserFontSet();
if (fs) { if (fs) {
// If the fontSet matches the family, but the font has not yet finished // if the fontSet matches the family, but the font has not yet finished
// loading (nor has its load timeout fired), the fontGroup should wait // loading (nor has its load timeout fired), the fontGroup should wait
// for the download, and not actually draw its text yet. // for the download, and not actually draw its text yet
PRBool waitForUserFont = PR_FALSE; PRBool waitForUserFont = PR_FALSE;
fe = fs->FindFontEntry(aName, *fontStyle, foundFamily, fe = fs->FindFontEntry(aName, *fontStyle, needsBold, waitForUserFont);
needsBold, waitForUserFont);
if (!fe && waitForUserFont) { if (!fe && waitForUserFont) {
fontGroup->mSkipDrawing = PR_TRUE; fontGroup->mSkipDrawing = PR_TRUE;
} }
} }
// Not known in the user font set ==> check system fonts // nothing in the user font set ==> check system fonts
if (!foundFamily) { if (!fe) {
fe = gfxPlatformFontList::PlatformFontList()-> fe = gfxPlatformFontList::PlatformFontList()->
FindFontForFamily(aName, fontStyle, needsBold); FindFontForFamily(aName, fontStyle, needsBold);
} }
@ -2252,24 +2247,22 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies,
if (aResolveFontName) { if (aResolveFontName) {
ResolveData data(fc, gf, closure); ResolveData data(fc, gf, closure);
PRBool aborted = PR_FALSE, needsBold; PRBool aborted = PR_FALSE, needsBold;
nsresult rv = NS_OK; nsresult rv;
PRBool foundFamily = PR_FALSE;
PRBool waitForUserFont = PR_FALSE; PRBool waitForUserFont = PR_FALSE;
if (mUserFontSet && if (mUserFontSet &&
mUserFontSet->FindFontEntry(family, mStyle, foundFamily, mUserFontSet->FindFontEntry(family, mStyle, needsBold,
needsBold, waitForUserFont)) waitForUserFont))
{ {
gfxFontGroup::FontResolverProc(family, &data); gfxFontGroup::FontResolverProc(family, &data);
rv = NS_OK;
} else { } else {
if (waitForUserFont) { if (waitForUserFont) {
mSkipDrawing = PR_TRUE; mSkipDrawing = PR_TRUE;
} }
if (!foundFamily) { gfxPlatform *pf = gfxPlatform::GetPlatform();
gfxPlatform *pf = gfxPlatform::GetPlatform(); rv = pf->ResolveFontName(family,
rv = pf->ResolveFontName(family, gfxFontGroup::FontResolverProc,
gfxFontGroup::FontResolverProc, &data, aborted);
&data, aborted);
}
} }
if (NS_FAILED(rv) || aborted) if (NS_FAILED(rv) || aborted)
return PR_FALSE; return PR_FALSE;

Просмотреть файл

@ -1184,7 +1184,7 @@ private:
static const nsTArray< nsCountedRef<FcPattern> >* static const nsTArray< nsCountedRef<FcPattern> >*
FindFontPatterns(gfxUserFontSet *mUserFontSet, FindFontPatterns(gfxUserFontSet *mUserFontSet,
const nsACString &aFamily, PRUint8 aStyle, PRUint16 aWeight, const nsACString &aFamily, PRUint8 aStyle, PRUint16 aWeight,
PRBool& aFoundFamily, PRBool& aWaitForUserFont) PRBool& aWaitForUserFont)
{ {
// Convert to UTF16 // Convert to UTF16
NS_ConvertUTF8toUTF16 utf16Family(aFamily); NS_ConvertUTF8toUTF16 utf16Family(aFamily);
@ -1199,15 +1199,15 @@ FindFontPatterns(gfxUserFontSet *mUserFontSet,
style.weight = aWeight; style.weight = aWeight;
gfxUserFcFontEntry *fontEntry = static_cast<gfxUserFcFontEntry*> gfxUserFcFontEntry *fontEntry = static_cast<gfxUserFcFontEntry*>
(mUserFontSet->FindFontEntry(utf16Family, style, aFoundFamily, (mUserFontSet->FindFontEntry(utf16Family, style, needsBold,
needsBold, aWaitForUserFont)); aWaitForUserFont));
// Accept synthetic oblique for italic and oblique. // Accept synthetic oblique for italic and oblique.
if (!fontEntry && aStyle != FONT_STYLE_NORMAL) { if (!fontEntry && aStyle != FONT_STYLE_NORMAL) {
style.style = FONT_STYLE_NORMAL; style.style = FONT_STYLE_NORMAL;
fontEntry = static_cast<gfxUserFcFontEntry*> fontEntry = static_cast<gfxUserFcFontEntry*>
(mUserFontSet->FindFontEntry(utf16Family, style, aFoundFamily, (mUserFontSet->FindFontEntry(utf16Family, style, needsBold,
needsBold, aWaitForUserFont)); aWaitForUserFont));
} }
if (!fontEntry) if (!fontEntry)
@ -1365,15 +1365,13 @@ gfxFcFontSet::SortPreferredFonts(PRBool &aWaitForUserFont)
PRUint16 thebesWeight = PRUint16 thebesWeight =
gfxFontconfigUtils::GetThebesWeight(mSortPattern); gfxFontconfigUtils::GetThebesWeight(mSortPattern);
PRBool foundFamily, waitForUserFont; PRBool waitForUserFont;
familyFonts = FindFontPatterns(mUserFontSet, cssFamily, familyFonts = FindFontPatterns(mUserFontSet, cssFamily,
thebesStyle, thebesWeight, thebesStyle, thebesWeight,
foundFamily, waitForUserFont); waitForUserFont);
if (waitForUserFont) { if (waitForUserFont) {
aWaitForUserFont = PR_TRUE; aWaitForUserFont = PR_TRUE;
} }
NS_ASSERTION(foundFamily,
"expected to find a user font, but it's missing!");
} }
} }

Просмотреть файл

@ -163,7 +163,6 @@ gfxUserFontSet::AddFontFace(const nsAString& aFamilyName,
gfxFontEntry* gfxFontEntry*
gfxUserFontSet::FindFontEntry(const nsAString& aName, gfxUserFontSet::FindFontEntry(const nsAString& aName,
const gfxFontStyle& aFontStyle, const gfxFontStyle& aFontStyle,
PRBool& aFoundFamily,
PRBool& aNeedsBold, PRBool& aNeedsBold,
PRBool& aWaitForUserFont) PRBool& aWaitForUserFont)
{ {
@ -172,11 +171,9 @@ gfxUserFontSet::FindFontEntry(const nsAString& aName,
// no user font defined for this name // no user font defined for this name
if (!family) { if (!family) {
aFoundFamily = PR_FALSE;
return nsnull; return nsnull;
} }
aFoundFamily = PR_TRUE;
gfxFontEntry* fe = family->FindFontForStyle(aFontStyle, aNeedsBold); gfxFontEntry* fe = family->FindFontForStyle(aFontStyle, aNeedsBold);
// if not a proxy, font has already been loaded // if not a proxy, font has already been loaded
@ -685,14 +682,25 @@ gfxUserFontSet::LoadNext(gfxProxyFontEntry *aProxyEntry)
aProxyEntry->mSrcIndex++; aProxyEntry->mSrcIndex++;
} }
// all src's failed; mark this entry as unusable (so fallback will occur) // all src's failed, remove this face
LOG(("userfonts (%p) failed all src for (%s)\n", LOG(("userfonts (%p) failed all src for (%s)\n",
this, NS_ConvertUTF16toUTF8(aProxyEntry->mFamily->Name()).get())); this, NS_ConvertUTF16toUTF8(aProxyEntry->mFamily->Name()).get()));
aProxyEntry->mLoadingState = gfxProxyFontEntry::LOADING_FAILED;
gfxMixedFontFamily *family = static_cast<gfxMixedFontFamily*>(aProxyEntry->mFamily);
family->RemoveFontEntry(aProxyEntry);
// no more faces? remove the entire family
if (family->mAvailableFonts.Length() == 0) {
LOG(("userfonts (%p) failed all faces, remove family (%s)\n",
this, NS_ConvertUTF16toUTF8(family->Name()).get()));
RemoveFamily(family->Name());
}
return STATUS_END_OF_LIST; return STATUS_END_OF_LIST;
} }
void void
gfxUserFontSet::IncrementGeneration() gfxUserFontSet::IncrementGeneration()
{ {

Просмотреть файл

@ -188,9 +188,8 @@ public:
} }
// lookup a font entry for a given style, returns null if not loaded // lookup a font entry for a given style, returns null if not loaded
gfxFontEntry *FindFontEntry(const nsAString& aName, gfxFontEntry *FindFontEntry(const nsAString& aName,
const gfxFontStyle& aFontStyle, const gfxFontStyle& aFontStyle,
PRBool& aFoundFamily,
PRBool& aNeedsBold, PRBool& aNeedsBold,
PRBool& aWaitForUserFont); PRBool& aWaitForUserFont);
@ -257,9 +256,8 @@ public:
LOADING_STARTED, // loading has started; hide fallback font LOADING_STARTED, // loading has started; hide fallback font
LOADING_ALMOST_DONE, // timeout happened but we're nearly done, LOADING_ALMOST_DONE, // timeout happened but we're nearly done,
// so keep hiding fallback font // so keep hiding fallback font
LOADING_SLOWLY, // timeout happened and we're not nearly done, LOADING_SLOWLY // timeout happened and we're not nearly done,
// so use the fallback font // so use the fallback font
LOADING_FAILED // failed to load any source: use fallback
}; };
LoadingState mLoadingState; LoadingState mLoadingState;