Fix crash and incorrect calculation of percentage line-height by computing relative to self's font-size rather than parent's font size. r=pierre sr=hyatt b=111405

This commit is contained in:
dbaron%fas.harvard.edu 2001-11-28 04:35:52 +00:00
Родитель ee30eb36ed
Коммит ed2b034b08
2 изменённых файлов: 6 добавлений и 6 удалений

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

@ -2196,9 +2196,9 @@ nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
// line-height: normal, number, length, percent, inherit
if (eCSSUnit_Percent == textData.mLineHeight.GetUnit()) {
aInherited = PR_TRUE;
const nsStyleFont* parentFont = NS_STATIC_CAST(const nsStyleFont*,
parentContext->GetStyleData(eStyleStruct_Font));
text->mLineHeight.SetCoordValue((nscoord)((float)(parentFont->mSize) *
const nsStyleFont* font = NS_STATIC_CAST(const nsStyleFont*,
aContext->GetStyleData(eStyleStruct_Font));
text->mLineHeight.SetCoordValue((nscoord)((float)(font->mSize) *
textData.mLineHeight.GetPercentValue()));
} else
SetCoord(textData.mLineHeight, text->mLineHeight, parentText->mLineHeight,

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

@ -2196,9 +2196,9 @@ nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
// line-height: normal, number, length, percent, inherit
if (eCSSUnit_Percent == textData.mLineHeight.GetUnit()) {
aInherited = PR_TRUE;
const nsStyleFont* parentFont = NS_STATIC_CAST(const nsStyleFont*,
parentContext->GetStyleData(eStyleStruct_Font));
text->mLineHeight.SetCoordValue((nscoord)((float)(parentFont->mSize) *
const nsStyleFont* font = NS_STATIC_CAST(const nsStyleFont*,
aContext->GetStyleData(eStyleStruct_Font));
text->mLineHeight.SetCoordValue((nscoord)((float)(font->mSize) *
textData.mLineHeight.GetPercentValue()));
} else
SetCoord(textData.mLineHeight, text->mLineHeight, parentText->mLineHeight,