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

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

Issue 1292593003: Revert "Revert "Reland 2: mac: Use a placeholder string for the family name of the system font." Br… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « Source/core/layout/LayoutTextControlMultiLine.cpp ('k') | Source/core/layout/LayoutTheme.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « Source/core/layout/LayoutTextControlMultiLine.cpp ('k') | Source/core/layout/LayoutTheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698