Add width for letter-spacing when calculating desired width of text input controls. b=252783 r=bzbarsky sr=dbaron

git-svn-id: svn://10.0.0.236/trunk@160481 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mats.palmgren%bredband.net
2004-08-07 22:04:27 +00:00
parent 089f6b0704
commit 4635bcbf08
2 changed files with 26 additions and 2 deletions

View File

@@ -1428,7 +1428,8 @@ nsTextControlFrame::CalculateSizeStandard(nsPresContext* aPresContext,
fontMet->GetMaxAdvance(charMaxAdvance);
// Set the width equal to the width in characters
aDesiredSize.width = GetCols() * charWidth;
PRInt32 cols = GetCols();
aDesiredSize.width = cols * charWidth;
// To better match IE, take the maximum character width(in twips) and remove
// 4 pixels add this on as additional padding(internalPadding). But only do
@@ -1456,6 +1457,17 @@ nsTextControlFrame::CalculateSizeStandard(nsPresContext* aPresContext,
}
}
// Increment width with cols * letter-spacing.
{
const nsStyleCoord& lsCoord = GetStyleText()->mLetterSpacing;
if (eStyleUnit_Coord == lsCoord.GetUnit()) {
nscoord letterSpacing = lsCoord.GetCoordValue();
if (letterSpacing != 0) {
aDesiredSize.width += cols * letterSpacing;
}
}
}
// Set the height equal to total number of rows (times the height of each
// line, of course)
aDesiredSize.height = fontHeight * GetRows();