зеркало из https://github.com/mozilla/pjs.git
Bug 386065 - "legend {font-size:0;} still shows the text (yahoo.com mainpage)" [p=chris@pearce.org.nz (Chris Pearce) r+sr=roc a=blocking1.9+]
This commit is contained in:
Родитель
b15f45f431
Коммит
6686e59069
|
@ -72,10 +72,7 @@ nsThebesFontMetrics::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
mIsRightToLeft = PR_FALSE;
|
||||
mTextRunRTL = PR_FALSE;
|
||||
|
||||
// work around layout giving us 0 sized fonts...
|
||||
gfxFloat size = gfxFloat(aFont.size) / mP2A;
|
||||
if (size == 0.0)
|
||||
size = 1.0;
|
||||
|
||||
nsCString langGroup;
|
||||
if (aLangGroup) {
|
||||
|
|
|
@ -362,12 +362,34 @@ TextRunWordCache::FinishTextRun(gfxTextRun *aTextRun, gfxTextRun *aNewRun,
|
|||
}
|
||||
}
|
||||
|
||||
static gfxTextRun *
|
||||
MakeBlankTextRun(const void* aText, PRUint32 aLength,
|
||||
gfxFontGroup *aFontGroup,
|
||||
const gfxFontGroup::Parameters *aParams,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsAutoPtr<gfxTextRun> textRun;
|
||||
textRun = new gfxTextRun(aParams, aText, aLength, aFontGroup, aFlags);
|
||||
if (!textRun || !textRun->GetCharacterGlyphs())
|
||||
return nsnull;
|
||||
gfxFont *font = aFontGroup->GetFontAt(0);
|
||||
textRun->AddGlyphRun(font, 0);
|
||||
return textRun.forget();
|
||||
}
|
||||
|
||||
gfxTextRun *
|
||||
TextRunWordCache::MakeTextRun(const PRUnichar *aText, PRUint32 aLength,
|
||||
gfxFontGroup *aFontGroup,
|
||||
const gfxFontGroup::Parameters *aParams,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
if (aFontGroup->GetStyle()->size == 0) {
|
||||
// Short-circuit for size-0 fonts, as Windows and ATSUI can't handle
|
||||
// them, and always create at least size 1 fonts, i.e. they still
|
||||
// render something for size 0 fonts.
|
||||
return MakeBlankTextRun(aText, aLength, aFontGroup, aParams, aFlags);
|
||||
}
|
||||
|
||||
nsAutoPtr<gfxTextRun> textRun;
|
||||
textRun = new gfxTextRun(aParams, aText, aLength, aFontGroup, aFlags);
|
||||
if (!textRun || !textRun->GetCharacterGlyphs())
|
||||
|
@ -443,6 +465,13 @@ TextRunWordCache::MakeTextRun(const PRUint8 *aText, PRUint32 aLength,
|
|||
const gfxFontGroup::Parameters *aParams,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
if (aFontGroup->GetStyle()->size == 0) {
|
||||
// Short-circuit for size-0 fonts, as Windows and ATSUI can't handle
|
||||
// them, and always create at least size 1 fonts, i.e. they still
|
||||
// render something for size 0 fonts.
|
||||
return MakeBlankTextRun(aText, aLength, aFontGroup, aParams, aFlags);
|
||||
}
|
||||
|
||||
aFlags |= gfxTextRunFactory::TEXT_IS_8BIT;
|
||||
nsAutoPtr<gfxTextRun> textRun;
|
||||
textRun = new gfxTextRun(aParams, aText, aLength, aFontGroup, aFlags);
|
||||
|
|
Загрузка…
Ссылка в новой задаче