changed initialization of basefont so as not to override font style on HTML elements

git-svn-id: svn://10.0.0.236/trunk@35703 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterl%netscape.com 1999-06-16 06:15:01 +00:00
parent 994f4f4c20
commit 262c024b61
2 changed files with 18 additions and 8 deletions

View File

@ -260,13 +260,18 @@ BodyRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresConte
{
// set up the basefont (defaults to 3)
nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font);
const nsFont& defaultFont = aPresContext->GetDefaultFontDeprecated();
const nsFont& defaultFixedFont = aPresContext->GetDefaultFixedFontDeprecated();
PRInt32 scaler;
aPresContext->GetFontScaler(&scaler);
float scaleFactor = nsStyleUtil::GetScalingFactor(scaler);
font->mFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFont.size, scaleFactor);
font->mFixedFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFixedFont.size, scaleFactor);
// apply font scaling to the body
font->mFont.size *= scaleFactor;
if (font->mFont.size < 1) {
font->mFont.size = 1;
}
font->mFixedFont.size *= scaleFactor;
if (font->mFixedFont.size < 1) {
font->mFixedFont.size = 1;
}
return NS_OK;
}

View File

@ -260,13 +260,18 @@ BodyRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresConte
{
// set up the basefont (defaults to 3)
nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font);
const nsFont& defaultFont = aPresContext->GetDefaultFontDeprecated();
const nsFont& defaultFixedFont = aPresContext->GetDefaultFixedFontDeprecated();
PRInt32 scaler;
aPresContext->GetFontScaler(&scaler);
float scaleFactor = nsStyleUtil::GetScalingFactor(scaler);
font->mFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFont.size, scaleFactor);
font->mFixedFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFixedFont.size, scaleFactor);
// apply font scaling to the body
font->mFont.size *= scaleFactor;
if (font->mFont.size < 1) {
font->mFont.size = 1;
}
font->mFixedFont.size *= scaleFactor;
if (font->mFixedFont.size < 1) {
font->mFixedFont.size = 1;
}
return NS_OK;
}