diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 990af34c9bd..d5b890bfe4e 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -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(); diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index 990af34c9bd..d5b890bfe4e 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -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();