Index: Source/core/layout/LayoutTextControlMultiLine.cpp |
diff --git a/Source/core/layout/LayoutTextControlMultiLine.cpp b/Source/core/layout/LayoutTextControlMultiLine.cpp |
index 6a67ae7fad0722e19b98b330ec44dd9dfd7ae5bd..132520816dc57125275d14ef46fc759b19b3811b 100644 |
--- a/Source/core/layout/LayoutTextControlMultiLine.cpp |
+++ b/Source/core/layout/LayoutTextControlMultiLine.cpp |
@@ -25,6 +25,10 @@ |
#include "core/html/HTMLTextAreaElement.h" |
#include "core/layout/HitTestResult.h" |
+#if defined(WTF_OS_MACOSX) |
+#include "platform/mac/VersionUtilMac.h" |
+#endif // defined(WTF_OS_MACOSX) |
+ |
namespace blink { |
LayoutTextControlMultiLine::LayoutTextControlMultiLine(HTMLTextAreaElement* element) |
@@ -50,11 +54,16 @@ bool LayoutTextControlMultiLine::nodeAtPoint(HitTestResult& result, const HitTes |
float LayoutTextControlMultiLine::getAvgCharWidth(const AtomicString& family) const |
{ |
- // Since Lucida Grande is the default font, we want this to match the width |
- // of Courier New, the default font for textareas in IE, Firefox and Safari Win. |
- // 1229 is the avgCharWidth value in the OS/2 table for Courier New. |
- 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). 1229 is the avgCharWidth |
+// value in the OS/2 table for Courier New. |
+// This is a hack which Blink no longer applies on OSX 10.10+. |
+// https://code.google.com/p/chromium/issues/detail?id=515989#c8 |
+#if defined(WTF_OS_MACOSX) |
tkent
2015/08/11 01:34:36
We'd like to minimize OS-specific code in core/.
erikchen
2015/08/11 05:21:13
Done. I made a method called needsHackForTextContr
|
+ if (family == "BlinkMacSystemFont" && IsOSMavericksOrEarlier()) |
return scaleEmToUnits(1229); |
+#endif // defined(WTF_OS_MACOSX) |
return LayoutTextControl::getAvgCharWidth(family); |
} |