Index: Source/core/layout/LayoutTextControlSingleLine.cpp |
diff --git a/Source/core/layout/LayoutTextControlSingleLine.cpp b/Source/core/layout/LayoutTextControlSingleLine.cpp |
index bf8ec2b730dad4147596d39d95d85dae3816184b..e5c9e5e56766beee07abe19e7882681457b35940 100644 |
--- a/Source/core/layout/LayoutTextControlSingleLine.cpp |
+++ b/Source/core/layout/LayoutTextControlSingleLine.cpp |
@@ -299,11 +299,11 @@ LayoutRect LayoutTextControlSingleLine::controlClipRect(const LayoutPoint& addit |
float LayoutTextControlSingleLine::getAvgCharWidth(const AtomicString& family) const |
{ |
- // Since Lucida Grande is the default font, we want this to match the width |
- // of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and |
- // IE for some encodings (in IE, the default font is encoding specific). |
- // 901 is the avgCharWidth value in the OS/2 table for MS Shell Dlg. |
- if (family == "Lucida Grande") |
+ // Match the default system font to the width of MS Shell Dlg, the default |
+ // font for textareas in Firefox, Safari Win and IE for some encodings (in |
+ // IE, the default font is encoding specific). 901 is the avgCharWidth value |
+ // in the OS/2 table for MS Shell Dlg. |
+ if (LayoutTheme::theme().needsHackForTextControlWithFontFamily(family)) |
return scaleEmToUnits(901); |
return LayoutTextControl::getAvgCharWidth(family); |
@@ -320,11 +320,11 @@ LayoutUnit LayoutTextControlSingleLine::preferredContentLogicalWidth(float charW |
float maxCharWidth = 0.f; |
AtomicString family = styleRef().font().fontDescription().family().family(); |
- // Since Lucida Grande is the default font, we want this to match the width |
- // of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and |
- // IE for some encodings (in IE, the default font is encoding specific). |
- // 4027 is the (xMax - xMin) value in the "head" font table for MS Shell Dlg. |
- if (family == "Lucida Grande") |
+ // Match the default system font to the width of MS Shell Dlg, the default |
+ // font for textareas in Firefox, Safari Win and IE for some encodings (in |
+ // IE, the default font is encoding specific). 4027 is the (xMax - xMin) |
+ // value in the "head" font table for MS Shell Dlg. |
+ if (LayoutTheme::theme().needsHackForTextControlWithFontFamily(family)) |
maxCharWidth = scaleEmToUnits(4027); |
else if (hasValidAvgCharWidth(family)) |
maxCharWidth = roundf(styleRef().font().primaryFont()->maxCharWidth()); |