Don't do our "enlarge the control a bit to make it look better for small sizes"

thing for fixed-width fonts -- it's unnecessary and just makes it look like
"size" is broken.  Bug 103293, r+sr=rbs
This commit is contained in:
bzbarsky%mit.edu 2003-11-10 23:42:43 +00:00
Родитель 81cb7bd2b1
Коммит 6840e86e82
2 изменённых файлов: 40 добавлений и 38 удалений

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

@ -1479,27 +1479,28 @@ nsTextControlFrame::CalculateSizeStandard(nsIPresContext* aPresContext,
fontMet->GetAveCharWidth(charWidth); fontMet->GetAveCharWidth(charWidth);
fontMet->GetMaxAdvance(charMaxAdvance); fontMet->GetMaxAdvance(charMaxAdvance);
// calc the min width and pref width. Pref Width is calced by multiplying the size times avecharwidth
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
// To better match IE, take the maximum character width(in twips) and remove 4 pixels
// add this on as additional padding(internalPadding)
nscoord internalPadding = 0;
internalPadding = PR_MAX(charMaxAdvance - NSToCoordRound(4 * p2t), 0);
// round to a multiple of p2t
nscoord t = NSToCoordRound(p2t);
nscoord rest = internalPadding % t;
if (rest < t - rest) {
internalPadding -= rest;
} else {
internalPadding += t - rest;
}
// Set the width equal to the width in characters // Set the width equal to the width in characters
aDesiredSize.width = GetCols() * charWidth; aDesiredSize.width = GetCols() * charWidth;
// Now add the extra padding on (so that small input sizes work well)
aDesiredSize.width += internalPadding; // 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
// this if charMaxAdvance != charWidth; if they are equal, this is almost
// certainly a fixed-width font.
if (charWidth != charMaxAdvance) {
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
nscoord internalPadding = PR_MAX(charMaxAdvance - NSToCoordRound(4 * p2t), 0);
// round to a multiple of p2t
nscoord t = NSToCoordRound(p2t);
nscoord rest = internalPadding % t;
if (rest < t - rest) {
internalPadding -= rest;
} else {
internalPadding += t - rest;
}
// Now add the extra padding on (so that small input sizes work well)
aDesiredSize.width += internalPadding;
}
// Set the height equal to total number of rows (times the height of each // Set the height equal to total number of rows (times the height of each
// line, of course) // line, of course)

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

@ -1479,27 +1479,28 @@ nsTextControlFrame::CalculateSizeStandard(nsIPresContext* aPresContext,
fontMet->GetAveCharWidth(charWidth); fontMet->GetAveCharWidth(charWidth);
fontMet->GetMaxAdvance(charMaxAdvance); fontMet->GetMaxAdvance(charMaxAdvance);
// calc the min width and pref width. Pref Width is calced by multiplying the size times avecharwidth
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
// To better match IE, take the maximum character width(in twips) and remove 4 pixels
// add this on as additional padding(internalPadding)
nscoord internalPadding = 0;
internalPadding = PR_MAX(charMaxAdvance - NSToCoordRound(4 * p2t), 0);
// round to a multiple of p2t
nscoord t = NSToCoordRound(p2t);
nscoord rest = internalPadding % t;
if (rest < t - rest) {
internalPadding -= rest;
} else {
internalPadding += t - rest;
}
// Set the width equal to the width in characters // Set the width equal to the width in characters
aDesiredSize.width = GetCols() * charWidth; aDesiredSize.width = GetCols() * charWidth;
// Now add the extra padding on (so that small input sizes work well)
aDesiredSize.width += internalPadding; // 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
// this if charMaxAdvance != charWidth; if they are equal, this is almost
// certainly a fixed-width font.
if (charWidth != charMaxAdvance) {
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
nscoord internalPadding = PR_MAX(charMaxAdvance - NSToCoordRound(4 * p2t), 0);
// round to a multiple of p2t
nscoord t = NSToCoordRound(p2t);
nscoord rest = internalPadding % t;
if (rest < t - rest) {
internalPadding -= rest;
} else {
internalPadding += t - rest;
}
// Now add the extra padding on (so that small input sizes work well)
aDesiredSize.width += internalPadding;
}
// Set the height equal to total number of rows (times the height of each // Set the height equal to total number of rows (times the height of each
// line, of course) // line, of course)