mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 157846. Part 0.2: Relax heuristic used to detect 'monospace' font for <input> sizing so that it at least includes 'monospace' font-family in Windows 7. r=mats
--HG-- extra : rebase_source : 70bfb8df0c582433ea786b7092536806186ca3d3
This commit is contained in:
parent
9fee26b161
commit
e5939669c9
@ -45,6 +45,7 @@
|
||||
#include "nsTextNode.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
|
||||
#define DEFAULT_COLUMN_WIDTH 20
|
||||
|
||||
@ -169,11 +170,10 @@ nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
|
||||
|
||||
// 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) {
|
||||
nscoord internalPadding = std::max(0, charMaxAdvance -
|
||||
nsPresContext::CSSPixelsToAppUnits(4));
|
||||
// this if we think we have a fixed-width font.
|
||||
if (std::abs(charWidth - charMaxAdvance) > nsPresContext::CSSPixelsToAppUnits(1)) {
|
||||
nscoord internalPadding =
|
||||
std::max(0, charMaxAdvance - nsPresContext::CSSPixelsToAppUnits(4));
|
||||
nscoord t = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
// Round to a multiple of t
|
||||
nscoord rest = internalPadding % t;
|
||||
|
Loading…
Reference in New Issue
Block a user