mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 533251. Always insert default font if needed when rebuilding font list. r=jkew
This commit is contained in:
parent
6dbfd82c90
commit
d33c429bba
@ -1854,6 +1854,9 @@ protected:
|
||||
// as invalidation of font lists and caches is not considered.
|
||||
void SetUserFontSet(gfxUserFontSet *aUserFontSet);
|
||||
|
||||
// Initialize the list of fonts
|
||||
void BuildFontList();
|
||||
|
||||
// Init this font group's font metrics. If there no bad fonts, you don't need to call this.
|
||||
// But if there are one or more bad fonts which have bad underline offset,
|
||||
// you should call this with the *first* bad font.
|
||||
|
@ -1417,6 +1417,13 @@ gfxFontGroup::gfxFontGroup(const nsAString& aFamilies, const gfxFontStyle *aStyl
|
||||
mUserFontSet = nsnull;
|
||||
SetUserFontSet(aUserFontSet);
|
||||
|
||||
mPageLang = gfxPlatform::GetFontPrefLangFor(mStyle.langGroup.get());
|
||||
BuildFontList();
|
||||
}
|
||||
|
||||
void
|
||||
gfxFontGroup::BuildFontList()
|
||||
{
|
||||
// "#if" to be removed once all platforms are moved to gfxPlatformFontList interface
|
||||
// and subclasses of gfxFontGroup eliminated
|
||||
#if defined(XP_MACOSX) || defined(XP_WIN)
|
||||
@ -1425,17 +1432,15 @@ gfxFontGroup::gfxFontGroup(const nsAString& aFamilies, const gfxFontStyle *aStyl
|
||||
if (mFonts.Length() == 0) {
|
||||
PRBool needsBold;
|
||||
gfxFontEntry *defaultFont =
|
||||
gfxPlatformFontList::PlatformFontList()->GetDefaultFont(aStyle, needsBold);
|
||||
gfxPlatformFontList::PlatformFontList()->GetDefaultFont(&mStyle, needsBold);
|
||||
NS_ASSERTION(defaultFont, "invalid default font returned by GetDefaultFont");
|
||||
|
||||
nsRefPtr<gfxFont> font = defaultFont->FindOrMakeFont(aStyle, needsBold);
|
||||
nsRefPtr<gfxFont> font = defaultFont->FindOrMakeFont(&mStyle, needsBold);
|
||||
if (font) {
|
||||
mFonts.AppendElement(font);
|
||||
}
|
||||
}
|
||||
|
||||
mPageLang = gfxPlatform::GetFontPrefLangFor(mStyle.langGroup.get());
|
||||
|
||||
if (!mStyle.systemFont) {
|
||||
for (PRUint32 i = 0; i < mFonts.Length(); ++i) {
|
||||
gfxFont* font = mFonts[i];
|
||||
@ -2010,7 +2015,13 @@ gfxFontGroup::UpdateFontList()
|
||||
// xxx - can probably improve this to detect when all fonts were found, so no need to update list
|
||||
mFonts.Clear();
|
||||
mUnderlineOffset = UNDERLINE_OFFSET_NOT_SET;
|
||||
|
||||
// bug 548184 - need to clean up FT2, OS/2 platform code to use BuildFontList
|
||||
#if defined(XP_MACOSX) || defined(XP_WIN)
|
||||
BuildFontList();
|
||||
#else
|
||||
ForEachFont(FindPlatformFont, this);
|
||||
#endif
|
||||
mCurrGeneration = GetGeneration();
|
||||
}
|
||||
}
|
||||
|
25
layout/reftests/font-face/bug533251-ref.html
Normal file
25
layout/reftests/font-face/bug533251-ref.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 533251 crashtest</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
@font-face {
|
||||
font-family: test;
|
||||
src: url(../fonts/markA.ttf);
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
p { font-family: test; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>A</p>
|
||||
</body>
|
||||
</html>
|
31
layout/reftests/font-face/bug533251.html
Normal file
31
layout/reftests/font-face/bug533251.html
Normal file
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<title>Bug 533251 crashtest</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
@font-face {
|
||||
font-family: test;
|
||||
src: url(../fonts/markA.ttf);
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
div {
|
||||
font-family: Bongo2020; /* non-existent font */
|
||||
color: white;
|
||||
}
|
||||
|
||||
p { font-family: test; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>A</p>
|
||||
<div>This shouldn't crash...</div>
|
||||
</body>
|
||||
</html>
|
@ -121,3 +121,4 @@ HTTP(..) == underline-offset-change-2.html underline-offset-change-2-ref.html
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") fails-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) != underline-offset-change-1-ref.html underline-offset-change-2-ref.html # Bug 534132
|
||||
|
||||
HTTP(..) != 534352-1-extra-cmap-sentinel.html 534352-1-extra-cmap-sentinel-ref.html
|
||||
HTTP(..) == bug533251.html bug533251-ref.html
|
||||
|
Loading…
Reference in New Issue
Block a user