Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1159)

Unified Diff: Source/core/layout/LayoutTextControlMultiLine.cpp

Issue 1276003003: Reland 2: mac: Use a placeholder string for the family name of the system font. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebaseline Yosemite tests that use bold fonts. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698