Add width for letter-spacing when calculating desired width of text input controls. b=252783 r=bzbarsky sr=dbaron
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user