Index: Source/core/layout/LayoutTextControlSingleLine.cpp |
diff --git a/Source/core/layout/LayoutTextControlSingleLine.cpp b/Source/core/layout/LayoutTextControlSingleLine.cpp |
index bf8ec2b730dad4147596d39d95d85dae3816184b..494b3ef3d982127b83ab80274ba92b6b59b2ca72 100644 |
--- a/Source/core/layout/LayoutTextControlSingleLine.cpp |
+++ b/Source/core/layout/LayoutTextControlSingleLine.cpp |
@@ -299,11 +299,13 @@ 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. |
+ // This is a hack which Blink no longer applies on OSX 10.10+. |
tkent
2015/08/11 05:24:48
nit: This line looks redundant because LayoutTheme
erikchen
2015/08/11 05:30:02
Done.
|
+ // https://code.google.com/p/chromium/issues/detail?id=515989#c8 |
+ if (LayoutTheme::theme().needsHackForTextControlWithFontFamily(family)) |
return scaleEmToUnits(901); |
return LayoutTextControl::getAvgCharWidth(family); |
@@ -320,11 +322,13 @@ 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. |
+ // This is a hack which Blink no longer applies on OSX 10.10+. |
tkent
2015/08/11 05:24:48
Ditto.
erikchen
2015/08/11 05:30:02
Done.
|
+ // https://code.google.com/p/chromium/issues/detail?id=515989#c8 |
+ if (LayoutTheme::theme().needsHackForTextControlWithFontFamily(family)) |
maxCharWidth = scaleEmToUnits(4027); |
else if (hasValidAvgCharWidth(family)) |
maxCharWidth = roundf(styleRef().font().primaryFont()->maxCharWidth()); |