<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[165686] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/165686">165686</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2014-03-15 17:17:56 -0700 (Sat, 15 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>RenderTextControl::hasValidAvgCharWidth doesn't detect System Font
https://bugs.webkit.org/show_bug.cgi?id=130168

Reviewed by Dean Jackson.

No new tests.

* platform/graphics/Font.cpp: Moved functions from RenderTextControl
(WebCore::Font::hasValidAverageCharWidth):
(WebCore::Font::fastAverageCharWidthIfAvailable):
* platform/graphics/Font.h:
* rendering/RenderTextControl.cpp: Moved functions to Font.cpp
(WebCore::RenderTextControl::getAverageCharWidth): Removed redundant function argument
(WebCore::RenderTextControl::computeIntrinsicLogicalWidths):
* rendering/RenderTextControl.h:
* rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::getAverageCharWidth): Removed redundant function argument
* rendering/RenderTextControlMultiLine.h:
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::getAverageCharWidth): Removed redundant function argument
(WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth):
* rendering/RenderTextControlSingleLine.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontcpp">trunk/Source/WebCore/platform/graphics/Font.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFonth">trunk/Source/WebCore/platform/graphics/Font.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextControlcpp">trunk/Source/WebCore/rendering/RenderTextControl.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextControlh">trunk/Source/WebCore/rendering/RenderTextControl.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextControlMultiLinecpp">trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextControlMultiLineh">trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextControlSingleLinecpp">trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextControlSingleLineh">trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (165685 => 165686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-15 23:17:05 UTC (rev 165685)
+++ trunk/Source/WebCore/ChangeLog        2014-03-16 00:17:56 UTC (rev 165686)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-03-14  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        RenderTextControl::hasValidAvgCharWidth doesn't detect System Font
+        https://bugs.webkit.org/show_bug.cgi?id=130168
+
+        Reviewed by Dean Jackson.
+
+        No new tests.
+
+        * platform/graphics/Font.cpp: Moved functions from RenderTextControl
+        (WebCore::Font::hasValidAverageCharWidth):
+        (WebCore::Font::fastAverageCharWidthIfAvailable):
+        * platform/graphics/Font.h:
+        * rendering/RenderTextControl.cpp: Moved functions to Font.cpp
+        (WebCore::RenderTextControl::getAverageCharWidth): Removed redundant function argument
+        (WebCore::RenderTextControl::computeIntrinsicLogicalWidths):
+        * rendering/RenderTextControl.h:
+        * rendering/RenderTextControlMultiLine.cpp:
+        (WebCore::RenderTextControlMultiLine::getAverageCharWidth): Removed redundant function argument
+        * rendering/RenderTextControlMultiLine.h:
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::getAverageCharWidth): Removed redundant function argument
+        (WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth):
+        * rendering/RenderTextControlSingleLine.h:
+
</ins><span class="cx"> 2014-03-15  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Define SYSTEM_VERSION_PREFIX consistently
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (165685 => 165686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Font.cpp        2014-03-15 23:17:05 UTC (rev 165685)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp        2014-03-16 00:17:56 UTC (rev 165686)
</span><span class="lines">@@ -426,6 +426,82 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+
+
+static const char* fontFamiliesWithInvalidCharWidth[] = {
+    &quot;American Typewriter&quot;,
+    &quot;Arial Hebrew&quot;,
+    &quot;Chalkboard&quot;,
+    &quot;Cochin&quot;,
+    &quot;Corsiva Hebrew&quot;,
+    &quot;Courier&quot;,
+    &quot;Euphemia UCAS&quot;,
+    &quot;Geneva&quot;,
+    &quot;Gill Sans&quot;,
+    &quot;Hei&quot;,
+    &quot;Helvetica&quot;,
+    &quot;Hoefler Text&quot;,
+    &quot;InaiMathi&quot;,
+    &quot;Kai&quot;,
+    &quot;Lucida Grande&quot;,
+    &quot;Marker Felt&quot;,
+    &quot;Monaco&quot;,
+    &quot;Mshtakan&quot;,
+    &quot;New Peninim MT&quot;,
+    &quot;Osaka&quot;,
+    &quot;Raanana&quot;,
+    &quot;STHeiti&quot;,
+    &quot;Symbol&quot;,
+    &quot;Times&quot;,
+    &quot;Apple Braille&quot;,
+    &quot;Apple LiGothic&quot;,
+    &quot;Apple LiSung&quot;,
+    &quot;Apple Symbols&quot;,
+    &quot;AppleGothic&quot;,
+    &quot;AppleMyungjo&quot;,
+    &quot;#GungSeo&quot;,
+    &quot;#HeadLineA&quot;,
+    &quot;#PCMyungjo&quot;,
+    &quot;#PilGi&quot;,
+};
+
+// For font families where any of the fonts don't have a valid entry in the OS/2 table
+// for avgCharWidth, fallback to the legacy webkit behavior of getting the avgCharWidth
+// from the width of a '0'. This only seems to apply to a fixed number of Mac fonts,
+// but, in order to get similar rendering across platforms, we do this check for
+// all platforms.
+bool Font::hasValidAverageCharWidth() const
+{
+    AtomicString family = firstFamily();
+    if (family.isEmpty())
+        return false;
+
+    // Internal fonts on OS X also have an invalid entry in the table for avgCharWidth.
+    // They are hidden by having a name that begins with a period, so simply search
+    // for that here rather than try to keep the list up to date.
+    if (family.startsWith('.') || family == &quot;System Font&quot;)
+        return false;
+
+    static HashSet&lt;AtomicString&gt;* fontFamiliesWithInvalidCharWidthMap = 0;
+
+    if (!fontFamiliesWithInvalidCharWidthMap) {
+        fontFamiliesWithInvalidCharWidthMap = new HashSet&lt;AtomicString&gt;;
+
+        for (size_t i = 0; i &lt; WTF_ARRAY_LENGTH(fontFamiliesWithInvalidCharWidth); ++i)
+            fontFamiliesWithInvalidCharWidthMap-&gt;add(AtomicString(fontFamiliesWithInvalidCharWidth[i]));
+    }
+
+    return !fontFamiliesWithInvalidCharWidthMap-&gt;contains(family);
+}
+
+bool Font::fastAverageCharWidthIfAvailable(float&amp; width) const
+{
+    bool success = hasValidAverageCharWidth();
+    if (success)
+        width = roundf(primaryFont()-&gt;avgCharWidth()); // FIXME: primaryFont() might not correspond to firstFamily().
+    return success;
+}
+
</ins><span class="cx"> FloatRect Font::selectionRectForText(const TextRun&amp; run, const FloatPoint&amp; point, int h, int from, int to) const
</span><span class="cx"> {
</span><span class="cx">     to = (to == -1 ? run.length() : to);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFonth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Font.h (165685 => 165686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Font.h        2014-03-15 23:17:05 UTC (rev 165685)
+++ trunk/Source/WebCore/platform/graphics/Font.h        2014-03-16 00:17:56 UTC (rev 165686)
</span><span class="lines">@@ -154,6 +154,8 @@
</span><span class="cx">     float spaceWidth() const { return primaryFont()-&gt;spaceWidth() + m_letterSpacing; }
</span><span class="cx">     float tabWidth(const SimpleFontData&amp;, unsigned tabSize, float position) const;
</span><span class="cx">     float tabWidth(unsigned tabSize, float position) const { return tabWidth(*primaryFont(), tabSize, position); }
</span><ins>+    bool hasValidAverageCharWidth() const;
+    bool fastAverageCharWidthIfAvailable(float &amp;width) const; // returns true on success
</ins><span class="cx"> 
</span><span class="cx">     int emphasisMarkAscent(const AtomicString&amp;) const;
</span><span class="cx">     int emphasisMarkDescent(const AtomicString&amp;) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextControlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (165685 => 165686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextControl.cpp        2014-03-15 23:17:05 UTC (rev 165685)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp        2014-03-16 00:17:56 UTC (rev 165686)
</span><span class="lines">@@ -172,76 +172,12 @@
</span><span class="cx">     result.setLocalPoint(localPoint);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static const char* fontFamiliesWithInvalidCharWidth[] = {
-    &quot;American Typewriter&quot;,
-    &quot;Arial Hebrew&quot;,
-    &quot;Chalkboard&quot;,
-    &quot;Cochin&quot;,
-    &quot;Corsiva Hebrew&quot;,
-    &quot;Courier&quot;,
-    &quot;Euphemia UCAS&quot;,
-    &quot;Geneva&quot;,
-    &quot;Gill Sans&quot;,
-    &quot;Hei&quot;,
-    &quot;Helvetica&quot;,
-    &quot;Hoefler Text&quot;,
-    &quot;InaiMathi&quot;,
-    &quot;Kai&quot;,
-    &quot;Lucida Grande&quot;,
-    &quot;Marker Felt&quot;,
-    &quot;Monaco&quot;,
-    &quot;Mshtakan&quot;,
-    &quot;New Peninim MT&quot;,
-    &quot;Osaka&quot;,
-    &quot;Raanana&quot;,
-    &quot;STHeiti&quot;,
-    &quot;Symbol&quot;,
-    &quot;Times&quot;,
-    &quot;Apple Braille&quot;,
-    &quot;Apple LiGothic&quot;,
-    &quot;Apple LiSung&quot;,
-    &quot;Apple Symbols&quot;,
-    &quot;AppleGothic&quot;,
-    &quot;AppleMyungjo&quot;,
-    &quot;#GungSeo&quot;,
-    &quot;#HeadLineA&quot;,
-    &quot;#PCMyungjo&quot;,
-    &quot;#PilGi&quot;,
-};
-
-// For font families where any of the fonts don't have a valid entry in the OS/2 table
-// for avgCharWidth, fallback to the legacy webkit behavior of getting the avgCharWidth
-// from the width of a '0'. This only seems to apply to a fixed number of Mac fonts,
-// but, in order to get similar rendering across platforms, we do this check for
-// all platforms.
-bool RenderTextControl::hasValidAvgCharWidth(AtomicString family)
</del><ins>+float RenderTextControl::getAverageCharWidth()
</ins><span class="cx"> {
</span><del>-    if (family.isEmpty())
-        return false;
</del><ins>+    float width;
+    if (style().font().fastAverageCharWidthIfAvailable(width))
+        return width;
</ins><span class="cx"> 
</span><del>-    // Internal fonts on OS X also have an invalid entry in the table for avgCharWidth.
-    // They are hidden by having a name that begins with a period, so simply search
-    // for that here rather than try to keep the list up to date.
-    if (family.startsWith('.'))
-        return false;
-
-    static HashSet&lt;AtomicString&gt;* fontFamiliesWithInvalidCharWidthMap = 0;
-    
-    if (!fontFamiliesWithInvalidCharWidthMap) {
-        fontFamiliesWithInvalidCharWidthMap = new HashSet&lt;AtomicString&gt;;
-
-        for (size_t i = 0; i &lt; WTF_ARRAY_LENGTH(fontFamiliesWithInvalidCharWidth); ++i)
-            fontFamiliesWithInvalidCharWidthMap-&gt;add(AtomicString(fontFamiliesWithInvalidCharWidth[i]));
-    }
-
-    return !fontFamiliesWithInvalidCharWidthMap-&gt;contains(family);
-}
-
-float RenderTextControl::getAvgCharWidth(AtomicString family)
-{
-    if (hasValidAvgCharWidth(family))
-        return roundf(style().font().primaryFont()-&gt;avgCharWidth());
-
</del><span class="cx">     const UChar ch = '0';
</span><span class="cx">     const String str = String(&amp;ch, 1);
</span><span class="cx">     const Font&amp; font = style().font();
</span><span class="lines">@@ -260,8 +196,7 @@
</span><span class="cx"> void RenderTextControl::computeIntrinsicLogicalWidths(LayoutUnit&amp; minLogicalWidth, LayoutUnit&amp; maxLogicalWidth) const
</span><span class="cx"> {
</span><span class="cx">     // Use average character width. Matches IE.
</span><del>-    const AtomicString&amp; family = style().font().firstFamily();
-    maxLogicalWidth = preferredContentLogicalWidth(const_cast&lt;RenderTextControl*&gt;(this)-&gt;getAvgCharWidth(family));
</del><ins>+    maxLogicalWidth = preferredContentLogicalWidth(const_cast&lt;RenderTextControl*&gt;(this)-&gt;getAverageCharWidth());
</ins><span class="cx">     if (RenderBox* innerTextRenderBox = innerTextElement()-&gt;renderBox())
</span><span class="cx">         maxLogicalWidth += innerTextRenderBox-&gt;paddingStart() + innerTextRenderBox-&gt;paddingEnd();
</span><span class="cx">     if (!style().logicalWidth().isPercent())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextControlh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextControl.h (165685 => 165686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextControl.h        2014-03-15 23:17:05 UTC (rev 165685)
+++ trunk/Source/WebCore/rendering/RenderTextControl.h        2014-03-16 00:17:56 UTC (rev 165686)
</span><span class="lines">@@ -62,8 +62,7 @@
</span><span class="cx"> 
</span><span class="cx">     float scaleEmToUnits(int x) const;
</span><span class="cx"> 
</span><del>-    static bool hasValidAvgCharWidth(AtomicString family);
-    virtual float getAvgCharWidth(AtomicString family);
</del><ins>+    virtual float getAverageCharWidth();
</ins><span class="cx">     virtual LayoutUnit preferredContentLogicalWidth(float charWidth) const = 0;
</span><span class="cx">     virtual LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const = 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextControlMultiLinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp (165685 => 165686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp        2014-03-15 23:17:05 UTC (rev 165685)
+++ trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp        2014-03-16 00:17:56 UTC (rev 165686)
</span><span class="lines">@@ -59,17 +59,17 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float RenderTextControlMultiLine::getAvgCharWidth(AtomicString family)
</del><ins>+float RenderTextControlMultiLine::getAverageCharWidth()
</ins><span class="cx"> {
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">     // Since Lucida Grande is the default font, we want this to match the width
</span><span class="cx">     // of Courier New, the default font for textareas in IE, Firefox and Safari Win.
</span><span class="cx">     // 1229 is the avgCharWidth value in the OS/2 table for Courier New.
</span><del>-    if (family == &quot;Lucida Grande&quot;)
</del><ins>+    if (style().font().firstFamily() == &quot;Lucida Grande&quot;)
</ins><span class="cx">         return scaleEmToUnits(1229);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    return RenderTextControl::getAvgCharWidth(family);
</del><ins>+    return RenderTextControl::getAverageCharWidth();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit RenderTextControlMultiLine::preferredContentLogicalWidth(float charWidth) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextControlMultiLineh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h (165685 => 165686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h        2014-03-15 23:17:05 UTC (rev 165685)
+++ trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h        2014-03-16 00:17:56 UTC (rev 165686)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool nodeAtPoint(const HitTestRequest&amp;, HitTestResult&amp;, const HitTestLocation&amp; locationInContainer, const LayoutPoint&amp; accumulatedOffset, HitTestAction) override;
</span><span class="cx"> 
</span><del>-    virtual float getAvgCharWidth(AtomicString family);
</del><ins>+    virtual float getAverageCharWidth();
</ins><span class="cx">     virtual LayoutUnit preferredContentLogicalWidth(float charWidth) const;
</span><span class="cx">     virtual LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const override;
</span><span class="cx">     virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextControlSingleLinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (165685 => 165686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp        2014-03-15 23:17:05 UTC (rev 165685)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp        2014-03-16 00:17:56 UTC (rev 165686)
</span><span class="lines">@@ -312,18 +312,18 @@
</span><span class="cx">     return clipRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float RenderTextControlSingleLine::getAvgCharWidth(AtomicString family)
</del><ins>+float RenderTextControlSingleLine::getAverageCharWidth()
</ins><span class="cx"> {
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">     // Since Lucida Grande is the default font, we want this to match the width
</span><span class="cx">     // of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and
</span><span class="cx">     // IE for some encodings (in IE, the default font is encoding specific).
</span><span class="cx">     // 901 is the avgCharWidth value in the OS/2 table for MS Shell Dlg.
</span><del>-    if (family == &quot;Lucida Grande&quot;)
</del><ins>+    if (style().font().firstFamily() == &quot;Lucida Grande&quot;)
</ins><span class="cx">         return scaleEmToUnits(901);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    return RenderTextControl::getAvgCharWidth(family);
</del><ins>+    return RenderTextControl::getAverageCharWidth();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit RenderTextControlSingleLine::preferredContentLogicalWidth(float charWidth) const
</span><span class="lines">@@ -345,7 +345,7 @@
</span><span class="cx">     // 4027 is the (xMax - xMin) value in the &quot;head&quot; font table for MS Shell Dlg.
</span><span class="cx">     if (family == &quot;Lucida Grande&quot;)
</span><span class="cx">         maxCharWidth = scaleEmToUnits(4027);
</span><del>-    else if (hasValidAvgCharWidth(family))
</del><ins>+    else if (style().font().hasValidAverageCharWidth())
</ins><span class="cx">         maxCharWidth = roundf(style().font().primaryFont()-&gt;maxCharWidth());
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextControlSingleLineh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h (165685 => 165686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h        2014-03-15 23:17:05 UTC (rev 165685)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h        2014-03-16 00:17:56 UTC (rev 165686)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">     virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) override final;
</span><span class="cx"> 
</span><span class="cx">     int textBlockWidth() const;
</span><del>-    virtual float getAvgCharWidth(AtomicString family) override;
</del><ins>+    virtual float getAverageCharWidth() override;
</ins><span class="cx">     virtual LayoutUnit preferredContentLogicalWidth(float charWidth) const override;
</span><span class="cx">     virtual LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const override;
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>