Skip to content
Snippets Groups Projects
Commit e5939669 authored by Robert O'Callahan's avatar Robert O'Callahan
Browse files

Bug 157846. Part 0.2: Relax heuristic used to detect 'monospace' font for...

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
parent 9fee26b1
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "nsTextNode.h" #include "nsTextNode.h"
#include "nsStyleSet.h" #include "nsStyleSet.h"
#include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/ScriptSettings.h"
#include "mozilla/MathAlgorithms.h"
#define DEFAULT_COLUMN_WIDTH 20 #define DEFAULT_COLUMN_WIDTH 20
...@@ -169,11 +170,10 @@ nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext, ...@@ -169,11 +170,10 @@ nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
// To better match IE, take the maximum character width(in twips) and remove // 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 // 4 pixels add this on as additional padding(internalPadding). But only do
// this if charMaxAdvance != charWidth; if they are equal, this is almost // this if we think we have a fixed-width font.
// certainly a fixed-width font. if (std::abs(charWidth - charMaxAdvance) > nsPresContext::CSSPixelsToAppUnits(1)) {
if (charWidth != charMaxAdvance) { nscoord internalPadding =
nscoord internalPadding = std::max(0, charMaxAdvance - std::max(0, charMaxAdvance - nsPresContext::CSSPixelsToAppUnits(4));
nsPresContext::CSSPixelsToAppUnits(4));
nscoord t = nsPresContext::CSSPixelsToAppUnits(1); nscoord t = nsPresContext::CSSPixelsToAppUnits(1);
// Round to a multiple of t // Round to a multiple of t
nscoord rest = internalPadding % t; nscoord rest = internalPadding % t;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment