<!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>[176263] trunk</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/176263">176263</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2014-11-18 10:04:13 -0800 (Tue, 18 Nov 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use underlining metrics from the font file
https://bugs.webkit.org/show_bug.cgi?id=138762
Patch by Myles C. Maxfield <litherum@gmail.com> on 2014-11-18
Reviewed by Dave Hyatt.
Source/WebCore:
Test: platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness.html
* platform/graphics/FontMetrics.h: Adding variables for text decoration thickness and
underline position.
(WebCore::FontMetrics::FontMetrics):
(WebCore::FontMetrics::decorationThickness):
(WebCore::FontMetrics::setDecorationThickness):
(WebCore::FontMetrics::underlinePosition):
(WebCore::FontMetrics::setUnderlinePosition):
* platform/graphics/freetype/SimpleFontDataFreeType.cpp:
(WebCore::SimpleFontData::platformInit): Initialize new FontMetrics members.
* platform/graphics/ios/SimpleFontDataIOS.mm:
(WebCore::SimpleFontData::platformInit): Ditto.
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::platformInit): Ditto.
* platform/graphics/win/SimpleFontDataCGWin.cpp:
(WebCore::SimpleFontData::platformInit): Ditto.
* platform/graphics/win/SimpleFontDataCairoWin.cpp:
(WebCore::SimpleFontData::platformInit): Ditto.
* platform/graphics/win/SimpleFontDataWin.cpp:
(WebCore::SimpleFontData::initGDIFont): Ditto.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDecoration): Use FontMetrics data.
* style/InlineTextBoxStyle.cpp:
(WebCore::computeUnderlineOffset): Ditto.
(WebCore::visualOverflowForDecorations): Ditto.
* style/InlineTextBoxStyle.h:
(WebCore::textDecorationStrokeThickness): Deleted.
* svg/SVGFontData.cpp:
(WebCore::SVGFontData::initializeFontData): Initialize new FontMetrics members.
LayoutTests:
This patch makes underline placement platform-dependent.
* platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html: Renamed from LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html.
* platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness.html: Renamed from LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness.html.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontMetricsh">trunk/Source/WebCore/platform/graphics/FontMetrics.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsSimpleFontDatah">trunk/Source/WebCore/platform/graphics/SimpleFontData.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfreetypeSimpleFontDataFreeTypecpp">trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsiosSimpleFontDataIOSmm">trunk/Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacSimpleFontDataMacmm">trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswinSimpleFontDataCGWincpp">trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswinSimpleFontDataCairoWincpp">trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswinSimpleFontDataWincpp">trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxcpp">trunk/Source/WebCore/rendering/InlineTextBox.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleInlineTextBoxStylecpp">trunk/Source/WebCore/style/InlineTextBoxStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleInlineTextBoxStyleh">trunk/Source/WebCore/style/InlineTextBoxStyle.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGFontDatacpp">trunk/Source/WebCore/svg/SVGFontData.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacfastcss3textcss3textdecorationtextdecorationthicknessexpectedhtml">trunk/LayoutTests/platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcss3textcss3textdecorationtextdecorationthicknesshtml">trunk/LayoutTests/platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness.html</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationthicknessexpectedhtml">trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationthicknesshtml">trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/LayoutTests/ChangeLog        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-11-18 Myles C. Maxfield <litherum@gmail.com>
+
+ Use underlining metrics from the font file
+ https://bugs.webkit.org/show_bug.cgi?id=138762
+
+ Reviewed by Dave Hyatt.
+
+ This patch makes underline placement platform-dependent.
+
+ * platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html: Renamed from LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html.
+ * platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness.html: Renamed from LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness.html.
+
</ins><span class="cx"> 2014-11-17 David Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> Improve Ruby selection (getting rid of overlap and improving gap filling)
</span></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationthicknessexpectedhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -1,14 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-<style>
-</style>
-</head>
-<body>
-This test draws underlined text at a very large font size. It then positions and clips
-the text so that the underline should fill a box if the underline grows in proportion
-to text size. The comparison is to a box that has its background color set.
-<div style="position: relative; width: 600px; height: 600px; background: #000">
-</div>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationthicknesshtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness.html (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness.html        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness.html        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -1,13 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-</head>
-<body>
-This test draws underlined text at a very large font size. It then positions and clips
-the text so that the underline should fill a box if the underline grows in proportion
-to text size. The comparison is to a box that has its background color set.
-<div style="position: relative; width: 600px; height: 600px; overflow: hidden;">
-<div style="font-family: Ahem; text-decoration: underline; font-size: 10000px; position: absolute; left: 0px; top: -8350px;">&nbsp;</div>
-</div>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastcss3textcss3textdecorationtextdecorationthicknessexpectedhtmlfromrev176262trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationthicknessexpectedhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html (from rev 176262, trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html) (0 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html         (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness-expected.html        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+</style>
+</head>
+<body>
+This test draws underlined text at a very large font size. It then positions and clips
+the text so that the underline should fill a box if the underline grows in proportion
+to text size. The comparison is to a box that has its background color set.
+<div style="position: relative; width: 600px; height: 600px; background: #000">
+</div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastcss3textcss3textdecorationtextdecorationthicknesshtmlfromrev176262trunkLayoutTestsfastcss3textcss3textdecorationtextdecorationthicknesshtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness.html (from rev 176262, trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-thickness.html) (0 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness.html         (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness.html        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test draws underlined text at a very large font size. It then positions and clips
+the text so that the underline should fill a box if the underline grows in proportion
+to text size. The comparison is to a box that has its background color set.
+<div style="position: relative; width: 600px; height: 600px; overflow: hidden;">
+<div style="font-family: Ahem; text-decoration: underline; font-size: 31000px; position: absolute; left: 0px; top: -28925px;">&nbsp;</div>
+</div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/ChangeLog        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-11-18 Myles C. Maxfield <litherum@gmail.com>
+
+ Use underlining metrics from the font file
+ https://bugs.webkit.org/show_bug.cgi?id=138762
+
+ Reviewed by Dave Hyatt.
+
+ Test: platform/mac/fast/css3-text/css3-text-decoration/text-decoration-thickness.html
+
+ * platform/graphics/FontMetrics.h: Adding variables for text decoration thickness and
+ underline position.
+ (WebCore::FontMetrics::FontMetrics):
+ (WebCore::FontMetrics::decorationThickness):
+ (WebCore::FontMetrics::setDecorationThickness):
+ (WebCore::FontMetrics::underlinePosition):
+ (WebCore::FontMetrics::setUnderlinePosition):
+ * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
+ (WebCore::SimpleFontData::platformInit): Initialize new FontMetrics members.
+ * platform/graphics/ios/SimpleFontDataIOS.mm:
+ (WebCore::SimpleFontData::platformInit): Ditto.
+ * platform/graphics/mac/SimpleFontDataMac.mm:
+ (WebCore::SimpleFontData::platformInit): Ditto.
+ * platform/graphics/win/SimpleFontDataCGWin.cpp:
+ (WebCore::SimpleFontData::platformInit): Ditto.
+ * platform/graphics/win/SimpleFontDataCairoWin.cpp:
+ (WebCore::SimpleFontData::platformInit): Ditto.
+ * platform/graphics/win/SimpleFontDataWin.cpp:
+ (WebCore::SimpleFontData::initGDIFont): Ditto.
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paintDecoration): Use FontMetrics data.
+ * style/InlineTextBoxStyle.cpp:
+ (WebCore::computeUnderlineOffset): Ditto.
+ (WebCore::visualOverflowForDecorations): Ditto.
+ * style/InlineTextBoxStyle.h:
+ (WebCore::textDecorationStrokeThickness): Deleted.
+ * svg/SVGFontData.cpp:
+ (WebCore::SVGFontData::initializeFontData): Initialize new FontMetrics members.
+
</ins><span class="cx"> 2014-11-17 David Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> Improve Ruby selection (getting rid of overlap and improving gap filling)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontMetricsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontMetrics.h (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontMetrics.h        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/platform/graphics/FontMetrics.h        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -37,6 +37,8 @@
</span><span class="cx"> , m_lineSpacing(0)
</span><span class="cx"> , m_xHeight(0)
</span><span class="cx"> , m_zeroWidth(0)
</span><ins>+ , m_decorationThickness(1)
+ , m_underlinePosition(1)
</ins><span class="cx"> , m_hasXHeight(false)
</span><span class="cx"> , m_hasZeroWidth(false)
</span><span class="cx"> {
</span><span class="lines">@@ -132,6 +134,12 @@
</span><span class="cx"> bool hasZeroWidth() const { return m_hasZeroWidth; }
</span><span class="cx"> void setHasZeroWidth(bool hasZeroWidth) { m_hasZeroWidth = hasZeroWidth; }
</span><span class="cx">
</span><ins>+ float decorationThickness() const { return m_decorationThickness; }
+ void setDecorationThickness(float decorationThickness) { m_decorationThickness = decorationThickness; }
+
+ float underlinePosition() const { return m_underlinePosition; }
+ void setUnderlinePosition(float underlinePosition) { m_underlinePosition = underlinePosition; }
+
</ins><span class="cx"> private:
</span><span class="cx"> friend class SimpleFontData;
</span><span class="cx">
</span><span class="lines">@@ -154,6 +162,8 @@
</span><span class="cx"> float m_xHeight;
</span><span class="cx"> float m_capHeight;
</span><span class="cx"> float m_zeroWidth;
</span><ins>+ float m_decorationThickness;
+ float m_underlinePosition;
</ins><span class="cx"> bool m_hasXHeight;
</span><span class="cx"> bool m_hasCapHeight;
</span><span class="cx"> bool m_hasZeroWidth;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsSimpleFontDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.h (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/SimpleFontData.h        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.h        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -362,6 +362,14 @@
</span><span class="cx"> return width;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline void populateDecorationMetrics(float fontSize, float& decorationThickness, float& underlinePosition)
+{
+ // Decoration underlines should be proportional to the font size
+ decorationThickness = fontSize / 16.0f;
+ // An amount to lower the underline below the baseline
+ underlinePosition = std::max(1.0f, ceilf(decorationThickness / 2.0));
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::SimpleFontData)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfreetypeSimpleFontDataFreeTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -65,10 +65,15 @@
</span><span class="cx"> float descent = narrowPrecisionToFloat(fontExtents.descent);
</span><span class="cx"> float capHeight = narrowPrecisionToFloat(fontExtents.height);
</span><span class="cx"> float lineGap = narrowPrecisionToFloat(fontExtents.height - fontExtents.ascent - fontExtents.descent);
</span><ins>+ float decorationThickness;
+ float underlinePosition;
+ populateDecorationMetrics(m_platformData.m_size, decorationThickness, underlinePosition);
</ins><span class="cx">
</span><span class="cx"> m_fontMetrics.setAscent(ascent);
</span><span class="cx"> m_fontMetrics.setDescent(descent);
</span><span class="cx"> m_fontMetrics.setCapHeight(capHeight);
</span><ins>+ m_fontMetrics.setDecorationThickness(decorationThickness);
+ m_fontMetrics.setUnderlinePosition(underlinePosition);
</ins><span class="cx">
</span><span class="cx"> #if PLATFORM(EFL)
</span><span class="cx"> m_fontMetrics.setLineSpacing(ascent + descent + lineGap);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsiosSimpleFontDataIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -79,6 +79,8 @@
</span><span class="cx"> float lineGap;
</span><span class="cx"> float lineSpacing;
</span><span class="cx"> float xHeight;
</span><ins>+ float decorationThickness;
+ float underlinePosition;
</ins><span class="cx"> RetainPtr<CFStringRef> familyName;
</span><span class="cx"> if (CTFontRef ctFont = m_platformData.font()) {
</span><span class="cx"> FontServicesIOS fontService(ctFont);
</span><span class="lines">@@ -87,6 +89,8 @@
</span><span class="cx"> lineSpacing = fontService.lineSpacing();
</span><span class="cx"> lineGap = fontService.lineGap();
</span><span class="cx"> xHeight = fontService.xHeight();
</span><ins>+ decorationThickness = CTFontGetUnderlineThickness(ctFont);
+ underlinePosition = -CTFontGetUnderlinePosition(ctFont);
</ins><span class="cx"> capHeight = fontService.capHeight();
</span><span class="cx"> unitsPerEm = fontService.unitsPerEm();
</span><span class="cx"> familyName = adoptCF(CTFontCopyFamilyName(ctFont));
</span><span class="lines">@@ -101,6 +105,9 @@
</span><span class="cx"> lineGap = lroundf(scaleEmToUnits(CGFontGetLeading(cgFont), unitsPerEm) * pointSize);
</span><span class="cx"> xHeight = scaleEmToUnits(CGFontGetXHeight(cgFont), unitsPerEm) * pointSize;
</span><span class="cx"> capHeight = scaleEmToUnits(CGFontGetCapHeight(cgFont), unitsPerEm) * pointSize;
</span><ins>+ float decorationThickness;
+ float underlinePosition;
+ populateDecorationMetrics(m_platformData.size(), decorationThickness, underlinePosition);
</ins><span class="cx">
</span><span class="cx"> lineSpacing = ascent + descent + lineGap;
</span><span class="cx"> familyName = adoptCF(CGFontCopyFamilyName(cgFont));
</span><span class="lines">@@ -113,6 +120,8 @@
</span><span class="cx"> m_fontMetrics.setLineSpacing(lineSpacing);
</span><span class="cx"> m_fontMetrics.setXHeight(xHeight);
</span><span class="cx"> m_fontMetrics.setCapHeight(capHeight);
</span><ins>+ m_fontMetrics.setDecorationThickness(decorationThickness);
+ m_fontMetrics.setUnderlinePosition(underlinePosition);
</ins><span class="cx"> m_shouldNotBeUsedForArabic = fontFamilyShouldNotBeUsedForArabic(familyName.get());
</span><span class="cx">
</span><span class="cx"> if (platformData().orientation() == Vertical && !isTextOrientationFallback())
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacSimpleFontDataMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -193,6 +193,8 @@
</span><span class="cx"> float capHeight = scaleEmToUnits(iCapHeight, unitsPerEm) * pointSize;
</span><span class="cx">
</span><span class="cx"> float lineGap = scaleEmToUnits(iLineGap, unitsPerEm) * pointSize;
</span><ins>+ float decorationThickness = CTFontGetUnderlineThickness(m_platformData.ctFont());
+ float underlinePosition = -CTFontGetUnderlinePosition(m_platformData.ctFont());
</ins><span class="cx">
</span><span class="cx"> // We need to adjust Times, Helvetica, and Courier to closely match the
</span><span class="cx"> // vertical metrics of their Microsoft counterparts that are the de facto
</span><span class="lines">@@ -236,6 +238,8 @@
</span><span class="cx"> m_fontMetrics.setCapHeight(capHeight);
</span><span class="cx"> m_fontMetrics.setLineGap(lineGap);
</span><span class="cx"> m_fontMetrics.setXHeight(xHeight);
</span><ins>+ m_fontMetrics.setDecorationThickness(decorationThickness);
+ m_fontMetrics.setUnderlinePosition(underlinePosition);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static CFDataRef copyFontTableForTag(FontPlatformData& platformData, FourCharCode tableName)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswinSimpleFontDataCGWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -69,6 +69,9 @@
</span><span class="cx"> float fDescent = -scaleEmToUnits(iDescent, unitsPerEm) * pointSize;
</span><span class="cx"> float fCapHeight = scaleEmToUnits(iCapHeight, unitsPerEm) * pointSize;
</span><span class="cx"> float fLineGap = scaleEmToUnits(iLineGap, unitsPerEm) * pointSize;
</span><ins>+ float decorationThickness;
+ float underlinePosition;
+ populateDecorationMetrics(m_platformData.size(), decorationThickness, underlinePosition);
</ins><span class="cx">
</span><span class="cx"> if (!isCustomFont()) {
</span><span class="cx"> HWndDC dc(0);
</span><span class="lines">@@ -87,6 +90,8 @@
</span><span class="cx"> m_fontMetrics.setCapHeight(fCapHeight);
</span><span class="cx"> m_fontMetrics.setLineGap(fLineGap);
</span><span class="cx"> m_fontMetrics.setLineSpacing(lroundf(fAscent) + lroundf(fDescent) + lroundf(fLineGap));
</span><ins>+ m_fontMetrics.setDecorationThickness(decorationThickness);
+ m_fontMetrics.setUnderlinePosition(underlinePosition);
</ins><span class="cx">
</span><span class="cx"> GlyphPage* glyphPageZero = GlyphPageTreeNode::getRootChild(this, 0)->page();
</span><span class="cx"> Glyph xGlyph = glyphPageZero ? glyphPageZero->glyphDataForCharacter('x').glyph : 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswinSimpleFontDataCairoWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -76,6 +76,9 @@
</span><span class="cx"> float descent = textMetrics.tmDescent * metricsMultiplier;
</span><span class="cx"> float xHeight = ascent * 0.56f; // Best guess for xHeight for non-Truetype fonts.
</span><span class="cx"> float lineGap = textMetrics.tmExternalLeading * metricsMultiplier;
</span><ins>+ float decorationThickness;
+ float underlinePosition;
+ populateDecorationMetrics(m_platformData.size(), decorationThickness, underlinePosition);
</ins><span class="cx">
</span><span class="cx"> int faceLength = ::GetTextFace(dc, 0, 0);
</span><span class="cx"> Vector<WCHAR> faceName(faceLength);
</span><span class="lines">@@ -88,6 +91,8 @@
</span><span class="cx"> m_fontMetrics.setDescent(descent);
</span><span class="cx"> m_fontMetrics.setLineGap(lineGap);
</span><span class="cx"> m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
</span><ins>+ m_fontMetrics.setDecorationThickness(decorationThickness);
+ m_fontMetrics.setUnderlinePosition(underlinePosition);
</ins><span class="cx"> m_avgCharWidth = textMetrics.tmAveCharWidth * metricsMultiplier;
</span><span class="cx"> m_maxCharWidth = textMetrics.tmMaxCharWidth * metricsMultiplier;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswinSimpleFontDataWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -89,10 +89,15 @@
</span><span class="cx"> float ascent = textMetrics.tmAscent;
</span><span class="cx"> float descent = textMetrics.tmDescent;
</span><span class="cx"> float lineGap = textMetrics.tmExternalLeading;
</span><ins>+ float decorationThickness;
+ float underlinePosition;
+ populateDecorationMetrics(m_platformData.size(), decorationThickness, underlinePosition);
</ins><span class="cx"> m_fontMetrics.setAscent(ascent);
</span><span class="cx"> m_fontMetrics.setDescent(descent);
</span><span class="cx"> m_fontMetrics.setLineGap(lineGap);
</span><span class="cx"> m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
</span><ins>+ m_fontMetrics.setDecorationThickness(decorationThickness);
+ m_fontMetrics.setUnderlinePosition(underlinePosition);
</ins><span class="cx"> m_avgCharWidth = textMetrics.tmAveCharWidth;
</span><span class="cx"> m_maxCharWidth = textMetrics.tmMaxCharWidth;
</span><span class="cx"> float xHeight = ascent * 0.56f; // Best guess for xHeight if no x glyph is present.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.cpp        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -925,7 +925,7 @@
</span><span class="cx"> // Use a special function for underlines to get the positioning exactly right.
</span><span class="cx"> bool isPrinting = renderer().document().printing();
</span><span class="cx">
</span><del>- float textDecorationThickness = textDecorationStrokeThickness(renderer().style().fontSize());
</del><ins>+ float textDecorationThickness = renderer().style().fontMetrics().decorationThickness();
</ins><span class="cx"> context.setStrokeThickness(textDecorationThickness);
</span><span class="cx">
</span><span class="cx"> bool linesAreOpaque = !isPrinting && (!(decoration & TextDecorationUnderline) || underline.alpha() == 255) && (!(decoration & TextDecorationOverline) || overline.alpha() == 255) && (!(decoration & TextDecorationLineThrough) || linethrough.alpha() == 255);
</span><span class="lines">@@ -977,7 +977,7 @@
</span><span class="cx"> // These decorations should match the visual overflows computed in visualOverflowForDecorations()
</span><span class="cx"> if (decoration & TextDecorationUnderline) {
</span><span class="cx"> context.setStrokeColor(underline, colorSpace);
</span><del>- const int underlineOffset = computeUnderlineOffset(lineStyle.textUnderlinePosition(), lineStyle.fontMetrics(), this, textDecorationThickness);
</del><ins>+ const int underlineOffset = computeUnderlineOffset(lineStyle.textUnderlinePosition(), lineStyle.fontMetrics(), this);
</ins><span class="cx">
</span><span class="cx"> switch (decorationStyle) {
</span><span class="cx"> case TextDecorationStyleWavy: {
</span></span></pre></div>
<a id="trunkSourceWebCorestyleInlineTextBoxStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -32,10 +32,10 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-int computeUnderlineOffset(TextUnderlinePosition underlinePosition, const FontMetrics& fontMetrics, InlineTextBox* inlineTextBox, int textDecorationThickness)
</del><ins>+int computeUnderlineOffset(TextUnderlinePosition underlinePosition, const FontMetrics& fontMetrics, InlineTextBox* inlineTextBox)
</ins><span class="cx"> {
</span><span class="cx"> // This represents the gap between the baseline and the closest edge of the underline.
</span><del>- int gap = std::max<int>(1, ceilf(textDecorationThickness / 2.0));
</del><ins>+ float gap = fontMetrics.underlinePosition();
</ins><span class="cx">
</span><span class="cx"> // According to the specification TextUnderlinePositionAuto should default to 'alphabetic' for horizontal text
</span><span class="cx"> // and to 'under Left' for vertical text (e.g. japanese). We support only horizontal text for now.
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx"> if (decoration == TextDecorationNone)
</span><span class="cx"> return GlyphOverflow();
</span><span class="cx">
</span><del>- float strokeThickness = textDecorationStrokeThickness(lineStyle.fontSize());
</del><ins>+ float strokeThickness = lineStyle.fontMetrics().decorationThickness();
</ins><span class="cx"> float controlPointDistance;
</span><span class="cx"> float step;
</span><span class="cx"> float wavyOffset;
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">
</span><span class="cx"> // These metrics must match where underlines get drawn.
</span><span class="cx"> if (decoration & TextDecorationUnderline) {
</span><del>- float underlineOffset = computeUnderlineOffset(lineStyle.textUnderlinePosition(), lineStyle.fontMetrics(), inlineTextBox, strokeThickness);
</del><ins>+ float underlineOffset = computeUnderlineOffset(lineStyle.textUnderlinePosition(), lineStyle.fontMetrics(), inlineTextBox);
</ins><span class="cx"> if (decorationStyle == TextDecorationStyleWavy) {
</span><span class="cx"> extendIntToFloat(overflowResult.bottom, underlineOffset + wavyOffset + controlPointDistance + strokeThickness - height);
</span><span class="cx"> extendIntToFloat(overflowResult.top, -(underlineOffset + wavyOffset - controlPointDistance - strokeThickness));
</span></span></pre></div>
<a id="trunkSourceWebCorestyleInlineTextBoxStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.h (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/InlineTextBoxStyle.h        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.h        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -33,12 +33,6 @@
</span><span class="cx">
</span><span class="cx"> class InlineTextBox;
</span><span class="cx">
</span><del>-inline float textDecorationStrokeThickness(float fontSize)
-{
- const float textDecorationBaseFontSize = 16;
- return fontSize / textDecorationBaseFontSize;
-}
-
</del><span class="cx"> inline float wavyOffsetFromDecoration()
</span><span class="cx"> {
</span><span class="cx"> return 2;
</span><span class="lines">@@ -46,7 +40,7 @@
</span><span class="cx">
</span><span class="cx"> GlyphOverflow visualOverflowForDecorations(const RenderStyle& lineStyle, InlineTextBox*);
</span><span class="cx"> void getWavyStrokeParameters(float strokeThickness, float& controlPointDistance, float& step);
</span><del>-int computeUnderlineOffset(TextUnderlinePosition, const FontMetrics&, InlineTextBox*, int textDecorationThickness);
</del><ins>+int computeUnderlineOffset(TextUnderlinePosition, const FontMetrics&, InlineTextBox*);
</ins><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGFontDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGFontData.cpp (176262 => 176263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGFontData.cpp        2014-11-18 17:54:52 UTC (rev 176262)
+++ trunk/Source/WebCore/svg/SVGFontData.cpp        2014-11-18 18:04:13 UTC (rev 176263)
</span><span class="lines">@@ -79,6 +79,9 @@
</span><span class="cx"> float ascent = svgFontFaceElement->ascent() * scale;
</span><span class="cx"> float descent = svgFontFaceElement->descent() * scale;
</span><span class="cx"> float lineGap = 0.1f * fontSize;
</span><ins>+ float decorationThickness;
+ float underlinePosition;
+ populateDecorationMetrics(fontSize, decorationThickness, underlinePosition);
</ins><span class="cx">
</span><span class="cx"> GlyphPage* glyphPageZero = GlyphPageTreeNode::getRootChild(fontData, 0)->page();
</span><span class="cx">
</span><span class="lines">@@ -95,6 +98,8 @@
</span><span class="cx"> fontMetrics.setLineGap(lineGap);
</span><span class="cx"> fontMetrics.setLineSpacing(roundf(ascent) + roundf(descent) + roundf(lineGap));
</span><span class="cx"> fontMetrics.setXHeight(xHeight);
</span><ins>+ fontMetrics.setDecorationThickness(decorationThickness);
+ fontMetrics.setUnderlinePosition(underlinePosition);
</ins><span class="cx">
</span><span class="cx"> if (!glyphPageZero) {
</span><span class="cx"> fontData->setSpaceGlyph(0);
</span></span></pre>
</div>
</div>
</body>
</html>