<!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>[173217] 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/173217">173217</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2014-09-03 12:26:38 -0700 (Wed, 03 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for the initial-letter CSS property to first-letter
https://bugs.webkit.org/show_bug.cgi?id=136484

Reviewed by Dean Jackson.
Source/WebCore:

        
New tests in fast/css-generated-content/initial-letter-*.html

This patch add support for the CSS initial-letter property, enabling
better drop caps support in WebKit. Letters size to a specified number of
paragraph lines, and align to the cap-height of the first line and the baseline
of the last line.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
Add -webkit-initial-letter to the list.

* css/CSSLineBoxContainValue.cpp:
(WebCore::CSSLineBoxContainValue::customCSSText):
* css/CSSLineBoxContainValue.h:
Add support for a new value of line-box-contain, initial-letter, that causes
lines to use cap-height above the baseline and the glyph bounds below the
baseline.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
Add support for parsing of initial-letter.

(WebCore::CSSParser::parseLineBoxContain):
Add the new line-box-contain value for first-letters with initial-letter set.

* css/CSSPropertyNames.in:
Add the new initial-letter property.

* css/CSSValueKeywords.in:
Add the new initial-letter line-box-contain value.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
Map initial-letter into the RenderStyle.

* platform/graphics/FontMetrics.h:
(WebCore::FontMetrics::hasCapHeight):
(WebCore::FontMetrics::floatCapHeight):
(WebCore::FontMetrics::setCapHeight):
(WebCore::FontMetrics::capHeight):
* platform/graphics/ios/SimpleFontDataIOS.mm:
(WebCore::SimpleFontData::platformInit):
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::platformInit):
Add support for cap-height to the font system. iOS and Mac have been patched.
Other platforms will need to add support for cap-height to get this feature.
hasCapHeight() will return false for unsupported platforms for graceful
degradation.

* rendering/RenderBlock.cpp:
(WebCore::styleForFirstLetter):
Modified to check for initialLetterDrop/Height and to adjust the style
accordingly (e.g., to apply float when needed).

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
Code to adjust the float's position and margin to do cap-height alignment
and sunken letters.

* rendering/RenderBlockFlow.h:
Remove the const from computeLogicalLocationForFloat, since the margin of the
float can now be modified dynamically for sunken first-letters.

* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::ascentAndDescentForBox):
Add support for initial-letter line-box-contain value.

* rendering/RootInlineBox.h:
Add the includeInitialLetterForBox method to support the new line-box-contain value.

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayout):
* rendering/style/RenderStyle.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:
Normal maintenance stuff for addition of a new CSS property (making sure it is diffed
properly for layout changes and copied on assignment, etc.)

LayoutTests:


* fast/css-generated-content/initial-letter-basic.html: Added.
* fast/css-generated-content/initial-letter-border-padding.html: Added.
* fast/css-generated-content/initial-letter-descender.html: Added.
* fast/css-generated-content/initial-letter-raised.html: Added.
* fast/css-generated-content/initial-letter-sunken.html: Added.
* platform/mac/fast/css-generated-content/initial-letter-basic-expected.png: Added.
* platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt: Added.
* platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.png: Added.
* platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt: Added.
* platform/mac/fast/css-generated-content/initial-letter-descender-expected.png: Added.
* platform/mac/fast/css-generated-content/initial-letter-descender-expected.txt: Added.
* platform/mac/fast/css-generated-content/initial-letter-raised-expected.png: Added.
* platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt: Added.
* platform/mac/fast/css-generated-content/initial-letter-sunken-expected.png: Added.
* platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt: Added.</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="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSLineBoxContainValuecpp">trunk/Source/WebCore/css/CSSLineBoxContainValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSLineBoxContainValueh">trunk/Source/WebCore/css/CSSLineBoxContainValue.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSPropertyNamesin">trunk/Source/WebCore/css/CSSPropertyNames.in</a></li>
<li><a href="#trunkSourceWebCorecssCSSValueKeywordsin">trunk/Source/WebCore/css/CSSValueKeywords.in</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontMetricsh">trunk/Source/WebCore/platform/graphics/FontMetrics.h</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="#trunkSourceWebCorerenderingRenderBlockcpp">trunk/Source/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowcpp">trunk/Source/WebCore/rendering/RenderBlockFlow.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowh">trunk/Source/WebCore/rendering/RenderBlockFlow.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockLineLayoutcpp">trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRootInlineBoxcpp">trunk/Source/WebCore/rendering/RootInlineBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRootInlineBoxh">trunk/Source/WebCore/rendering/RootInlineBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStylecpp">trunk/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatacpp">trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatah">trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcssgeneratedcontentinitialletterbasichtml">trunk/LayoutTests/fast/css-generated-content/initial-letter-basic.html</a></li>
<li><a href="#trunkLayoutTestsfastcssgeneratedcontentinitialletterborderpaddinghtml">trunk/LayoutTests/fast/css-generated-content/initial-letter-border-padding.html</a></li>
<li><a href="#trunkLayoutTestsfastcssgeneratedcontentinitialletterdescenderhtml">trunk/LayoutTests/fast/css-generated-content/initial-letter-descender.html</a></li>
<li><a href="#trunkLayoutTestsfastcssgeneratedcontentinitialletterraisedhtml">trunk/LayoutTests/fast/css-generated-content/initial-letter-raised.html</a></li>
<li><a href="#trunkLayoutTestsfastcssgeneratedcontentinitiallettersunkenhtml">trunk/LayoutTests/fast/css-generated-content/initial-letter-sunken.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterbasicexpectedpng">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterbasicexpectedtxt">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterborderpaddingexpectedpng">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterborderpaddingexpectedtxt">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterdescenderexpectedpng">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-descender-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterdescenderexpectedtxt">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-descender-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterraisedexpectedpng">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-raised-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterraisedexpectedtxt">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitiallettersunkenexpectedpng">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-sunken-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentinitiallettersunkenexpectedtxt">trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/LayoutTests/ChangeLog        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-09-03  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        Add support for the initial-letter CSS property to first-letter
+        https://bugs.webkit.org/show_bug.cgi?id=136484
+
+        Reviewed by Dean Jackson.
+
+        * fast/css-generated-content/initial-letter-basic.html: Added.
+        * fast/css-generated-content/initial-letter-border-padding.html: Added.
+        * fast/css-generated-content/initial-letter-descender.html: Added.
+        * fast/css-generated-content/initial-letter-raised.html: Added.
+        * fast/css-generated-content/initial-letter-sunken.html: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-basic-expected.png: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.png: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-descender-expected.png: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-descender-expected.txt: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-raised-expected.png: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-sunken-expected.png: Added.
+        * platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt: Added.
+
</ins><span class="cx"> 2014-09-03  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Unreviewed test gardening.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgeneratedcontentinitialletterbasichtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-generated-content/initial-letter-basic.html (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-generated-content/initial-letter-basic.html                                (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/initial-letter-basic.html        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+div { width:400px; margin:1em }
+div::first-letter { -webkit-initial-letter: 3; margin-right:2px; margin-left:2px }
+span.rtl { direction:rtl; display:block }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;div&gt;
+An example of first-letter. This letter should span 3 lines of text, and
+so it should align itself cleanly with the cap-height of the A lining up with
+the cap-height of the first line, and the baseline of the A lining up with the
+baseline of the third line.
+&lt;/div&gt;
+&lt;span class=&quot;rtl&quot; &gt;
+&lt;div&gt;An RTL example of first-letter. This letter should span 3 lines of text, and
+so it should align itself cleanly with the cap-height of the A lining up with
+the cap-height of the first line, and the baseline of the A lining up with the
+baseline of the third line.
+&lt;/div&gt;
+&lt;/span&gt;
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgeneratedcontentinitialletterborderpaddinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-generated-content/initial-letter-border-padding.html (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-generated-content/initial-letter-border-padding.html                                (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/initial-letter-border-padding.html        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+div { width:400px; margin:1em }
+div::first-letter { color:red; border:2px solid red; padding:1px; -webkit-initial-letter: 2 3; margin-right:2px; margin-left:2px }
+span.rtl { direction:rtl; display:block }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;div&gt;
+An example of first-letter. This letter should span 3 lines of text, and
+so it should align itself cleanly with the cap-height of the A lining up with
+the cap-height of the first line, and the baseline of the A lining up with the
+baseline of the third line.
+&lt;/div&gt;
+&lt;span class=&quot;rtl&quot; &gt;
+&lt;div&gt;An RTL example of first-letter. This letter should span 3 lines of text, and
+so it should align itself cleanly with the cap-height of the A lining up with
+the cap-height of the first line, and the baseline of the A lining up with the
+baseline of the third line.
+&lt;/div&gt;
+&lt;/span&gt;
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgeneratedcontentinitialletterdescenderhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-generated-content/initial-letter-descender.html (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-generated-content/initial-letter-descender.html                                (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/initial-letter-descender.html        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+div { width:400px; margin:1em }
+div::first-letter { font-family: Zapfino; -webkit-initial-letter: 2 4; margin-right:2px; margin-left:2 }
+
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;div&gt;
+Just an example of first-letter. This letter should span 3 lines of text, and
+so it should align itself cleanly with the cap-height of the H lining up with
+the cap-height of the first line, and the baseline of the J lining up with the
+baseline of the third line. The descender of the J is still avoided by following lines.
+&lt;/div&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgeneratedcontentinitialletterraisedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-generated-content/initial-letter-raised.html (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-generated-content/initial-letter-raised.html                                (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/initial-letter-raised.html        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+div { width:400px; margin:1em }
+div::first-letter { -webkit-initial-letter: 2 3; margin-right:2px; margin-left:2px }
+span.rtl { direction:rtl; display:block }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;div&gt;
+An example of first-letter. This letter should span 3 lines of text, and
+so it should align itself cleanly with the cap-height of the A lining up with
+the cap-height of the first line, and the baseline of the A lining up with the
+baseline of the third line.
+&lt;/div&gt;
+&lt;span class=&quot;rtl&quot; &gt;
+&lt;div&gt;An RTL example of first-letter. This letter should span 3 lines of text, and
+so it should align itself cleanly with the cap-height of the A lining up with
+the cap-height of the first line, and the baseline of the A lining up with the
+baseline of the third line.
+&lt;/div&gt;
+&lt;/span&gt;
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgeneratedcontentinitiallettersunkenhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-generated-content/initial-letter-sunken.html (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-generated-content/initial-letter-sunken.html                                (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/initial-letter-sunken.html        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+div { width:400px; margin:1em }
+div::first-letter { -webkit-initial-letter: 3 2; margin-right:2px; margin-left:2px }
+span.rtl { direction:rtl; display:block }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;div&gt;
+An example of first-letter. This letter should span 3 lines of text, and
+so it should align itself cleanly with the cap-height of the A lining up with
+the cap-height of the first line, and the baseline of the A lining up with the
+baseline of the third line.
+&lt;/div&gt;
+&lt;span class=&quot;rtl&quot; &gt;
+&lt;div&gt;An RTL example of first-letter. This letter should span 3 lines of text, and
+so it should align itself cleanly with the cap-height of the A lining up with
+the cap-height of the first line, and the baseline of the A lining up with the
+baseline of the third line.
+&lt;/div&gt;
+&lt;/span&gt;
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterbasicexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterbasicexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,16) size 784x568
+      RenderBlock {DIV} at (16,0) size 400x90
+        RenderBlock (floating) at (2,3) size 51x48
+          RenderText {#text} at (0,-17) size 51x82
+            text run at (0,-17) width 51: &quot;A&quot;
+        RenderText {#text} at (55,0) size 444x90
+          text run at (55,0) width 389: &quot;n example of first-letter. This letter should span 3 lines of text,&quot;
+          text run at (55,18) width 342: &quot;and so it should align itself cleanly with the cap-height&quot;
+          text run at (55,36) width 336: &quot;of the A lining up with the cap-height of the first line,&quot;
+          text run at (0,54) width 400: &quot;and the baseline of the A lining up with the baseline of the third&quot;
+          text run at (0,72) width 27: &quot;line.&quot;
+      RenderBlock {SPAN} at (0,106) size 784x90
+        RenderBlock {DIV} at (368,0) size 400x90
+          RenderBlock (floating) at (347,3) size 51x48
+            RenderText {#text} at (0,-17) size 51x82
+              text run at (0,-17) width 51: &quot;A&quot;
+          RenderText {#text} at (-48,0) size 448x90
+            text run at (-48,0) width 393: &quot;n RTL example of first-letter. This letter should span 3 lines of&quot;
+            text run at (11,18) width 334: &quot;text, and so it should align itself cleanly with the cap-&quot;
+            text run at (25,36) width 320: &quot;height of the A lining up with the cap-height of the&quot;
+            text run at (14,54) width 386: &quot;first line, and the baseline of the A lining up with the baseline&quot;
+            text run at (300,72) width 4 RTL: &quot;.&quot;
+            text run at (304,72) width 96: &quot;of the third line&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterborderpaddingexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterborderpaddingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,16) size 784x568
+      RenderBlock {DIV} at (16,0) size 400x108
+        RenderBlock (floating) at (2,0) size 57x54 [color=#FF0000] [border: (2px solid #FF0000)]
+          RenderText {#text} at (3,-14) size 51x82
+            text run at (3,-14) width 51: &quot;A&quot;
+        RenderText {#text} at (61,18) size 398x90
+          text run at (61,18) width 308: &quot;n example of first-letter. This letter should span 3&quot;
+          text run at (61,36) width 330: &quot;lines of text, and so it should align itself cleanly with&quot;
+          text run at (0,54) width 398: &quot;the cap-height of the A lining up with the cap-height of the first&quot;
+          text run at (0,72) width 398: &quot;line, and the baseline of the A lining up with the baseline of the&quot;
+          text run at (0,90) width 60: &quot;third line.&quot;
+      RenderBlock {SPAN} at (0,124) size 784x108
+        RenderBlock {DIV} at (368,0) size 400x108
+          RenderBlock (floating) at (341,0) size 57x54 [color=#FF0000] [border: (2px solid #FF0000)]
+            RenderText {#text} at (3,-14) size 51x82
+              text run at (3,-14) width 51: &quot;A&quot;
+          RenderText {#text} at (8,18) size 392x90
+            text run at (8,18) width 331: &quot;n RTL example of first-letter. This letter should span&quot;
+            text run at (29,36) width 310: &quot;3 lines of text, and so it should align itself cleanly&quot;
+            text run at (21,54) width 379: &quot;with the cap-height of the A lining up with the cap-height of&quot;
+            text run at (46,72) width 354: &quot;the first line, and the baseline of the A lining up with the&quot;
+            text run at (245,90) width 4 RTL: &quot;.&quot;
+            text run at (249,90) width 151: &quot;baseline of the third line&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterdescenderexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-descender-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-descender-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterdescenderexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-descender-expected.txt (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-descender-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-descender-expected.txt        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,16) size 784x568
+      RenderBlock {DIV} at (16,0) size 400x144
+        RenderBlock (floating) at (2,3) size 48x81
+          RenderText {#text} at (0,-46) size 48x200
+            text run at (0,-46) width 48: &quot;J&quot;
+        RenderText {#text} at (52,36) size 399x108
+          text run at (52,36) width 337: &quot;ust an example of first-letter. This letter should span 3&quot;
+          text run at (52,54) width 330: &quot;lines of text, and so it should align itself cleanly with&quot;
+          text run at (52,72) width 347: &quot;the cap-height of the H lining up with the cap-height of&quot;
+          text run at (0,90) width 348: &quot;the first line, and the baseline of the J lining up with the&quot;
+          text run at (0,108) width 395: &quot;baseline of the third line. The descender of the J is still avoided&quot;
+          text run at (0,126) width 118: &quot;by following lines.&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterraisedexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-raised-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-raised-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitialletterraisedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,16) size 784x568
+      RenderBlock {DIV} at (16,0) size 400x108
+        RenderBlock (floating) at (2,3) size 51x48
+          RenderText {#text} at (0,-17) size 51x82
+            text run at (0,-17) width 51: &quot;A&quot;
+        RenderText {#text} at (55,18) size 398x90
+          text run at (55,18) width 341: &quot;n example of first-letter. This letter should span 3 lines&quot;
+          text run at (55,36) width 320: &quot;of text, and so it should align itself cleanly with the&quot;
+          text run at (0,54) width 375: &quot;cap-height of the A lining up with the cap-height of the first&quot;
+          text run at (0,72) width 398: &quot;line, and the baseline of the A lining up with the baseline of the&quot;
+          text run at (0,90) width 60: &quot;third line.&quot;
+      RenderBlock {SPAN} at (0,124) size 784x108
+        RenderBlock {DIV} at (368,0) size 400x108
+          RenderBlock (floating) at (347,3) size 51x48
+            RenderText {#text} at (0,-17) size 51x82
+              text run at (0,-17) width 51: &quot;A&quot;
+          RenderText {#text} at (2,18) size 398x90
+            text run at (2,18) width 343: &quot;n RTL example of first-letter. This letter should span 3&quot;
+            text run at (15,36) width 330: &quot;lines of text, and so it should align itself cleanly with&quot;
+            text run at (2,54) width 398: &quot;the cap-height of the A lining up with the cap-height of the first&quot;
+            text run at (2,72) width 398: &quot;line, and the baseline of the A lining up with the baseline of the&quot;
+            text run at (340,90) width 4 RTL: &quot;.&quot;
+            text run at (344,90) width 56: &quot;third line&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitiallettersunkenexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-sunken-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-sunken-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentinitiallettersunkenexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt (0 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,16) size 784x568
+      RenderBlock {DIV} at (16,0) size 400x90
+        RenderBlock (floating) at (2,21) size 31x30
+          RenderText {#text} at (0,-9) size 31x49
+            text run at (0,-9) width 31: &quot;A&quot;
+        RenderText {#text} at (35,0) size 398x90
+          text run at (35,0) width 358: &quot;n example of first-letter. This letter should span 3 lines of&quot;
+          text run at (35,18) width 334: &quot;text, and so it should align itself cleanly with the cap-&quot;
+          text run at (35,36) width 348: &quot;height of the A lining up with the cap-height of the first&quot;
+          text run at (0,54) width 398: &quot;line, and the baseline of the A lining up with the baseline of the&quot;
+          text run at (0,72) width 60: &quot;third line.&quot;
+      RenderBlock {SPAN} at (0,106) size 784x90
+        RenderBlock {DIV} at (368,0) size 400x90
+          RenderBlock (floating) at (367,21) size 31x30
+            RenderText {#text} at (0,-9) size 31x49
+              text run at (0,-9) width 31: &quot;A&quot;
+          RenderText {#text} at (22,0) size 388x90
+            text run at (22,0) width 343: &quot;n RTL example of first-letter. This letter should span 3&quot;
+            text run at (12,18) width 353: &quot;lines of text, and so it should align itself cleanly with the&quot;
+            text run at (18,36) width 347: &quot;cap-height of the A lining up with the cap-height of the&quot;
+            text run at (14,54) width 386: &quot;first line, and the baseline of the A lining up with the baseline&quot;
+            text run at (300,72) width 4 RTL: &quot;.&quot;
+            text run at (304,72) width 96: &quot;of the third line&quot;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/ChangeLog        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -1,3 +1,90 @@
</span><ins>+2014-09-03  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        Add support for the initial-letter CSS property to first-letter
+        https://bugs.webkit.org/show_bug.cgi?id=136484
+
+        Reviewed by Dean Jackson.
+        
+        New tests in fast/css-generated-content/initial-letter-*.html
+
+        This patch add support for the CSS initial-letter property, enabling
+        better drop caps support in WebKit. Letters size to a specified number of
+        paragraph lines, and align to the cap-height of the first line and the baseline
+        of the last line.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        Add -webkit-initial-letter to the list.
+
+        * css/CSSLineBoxContainValue.cpp:
+        (WebCore::CSSLineBoxContainValue::customCSSText):
+        * css/CSSLineBoxContainValue.h:
+        Add support for a new value of line-box-contain, initial-letter, that causes
+        lines to use cap-height above the baseline and the glyph bounds below the
+        baseline.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        Add support for parsing of initial-letter.
+
+        (WebCore::CSSParser::parseLineBoxContain):
+        Add the new line-box-contain value for first-letters with initial-letter set.
+
+        * css/CSSPropertyNames.in:
+        Add the new initial-letter property.
+
+        * css/CSSValueKeywords.in:
+        Add the new initial-letter line-box-contain value.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+        Map initial-letter into the RenderStyle.
+
+        * platform/graphics/FontMetrics.h:
+        (WebCore::FontMetrics::hasCapHeight):
+        (WebCore::FontMetrics::floatCapHeight):
+        (WebCore::FontMetrics::setCapHeight):
+        (WebCore::FontMetrics::capHeight):
+        * platform/graphics/ios/SimpleFontDataIOS.mm:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/mac/SimpleFontDataMac.mm:
+        (WebCore::SimpleFontData::platformInit):
+        Add support for cap-height to the font system. iOS and Mac have been patched.
+        Other platforms will need to add support for cap-height to get this feature.
+        hasCapHeight() will return false for unsupported platforms for graceful
+        degradation.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::styleForFirstLetter):
+        Modified to check for initialLetterDrop/Height and to adjust the style
+        accordingly (e.g., to apply float when needed).
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
+        Code to adjust the float's position and margin to do cap-height alignment
+        and sunken letters.
+
+        * rendering/RenderBlockFlow.h:
+        Remove the const from computeLogicalLocationForFloat, since the margin of the
+        float can now be modified dynamically for sunken first-letters.
+
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::ascentAndDescentForBox):
+        Add support for initial-letter line-box-contain value.
+
+        * rendering/RootInlineBox.h:
+        Add the includeInitialLetterForBox method to support the new line-box-contain value.
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::changeRequiresLayout):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator==):
+        * rendering/style/StyleRareNonInheritedData.h:
+        Normal maintenance stuff for addition of a new CSS property (making sure it is diffed
+        properly for layout changes and copied on assignment, etc.)
+
</ins><span class="cx"> 2014-09-03  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Prevent double-release on AVCFURLAssetRef
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -316,6 +316,7 @@
</span><span class="cx">     CSSPropertyWebkitHyphenateLimitBefore,
</span><span class="cx">     CSSPropertyWebkitHyphenateLimitLines,
</span><span class="cx">     CSSPropertyWebkitHyphens,
</span><ins>+    CSSPropertyWebkitInitialLetter,
</ins><span class="cx">     CSSPropertyWebkitLineAlign,
</span><span class="cx">     CSSPropertyWebkitLineBoxContain,
</span><span class="cx">     CSSPropertyWebkitLineBreak,
</span><span class="lines">@@ -2709,6 +2710,11 @@
</span><span class="cx">         case CSSPropertyWebkitFontSizeDelta:
</span><span class="cx">             // Not a real style property -- used by the editing engine -- so has no computed value.
</span><span class="cx">             break;
</span><ins>+        case CSSPropertyWebkitInitialLetter: {
+            RefPtr&lt;CSSPrimitiveValue&gt; drop = !style-&gt;initialLetterDrop() ? cssValuePool().createIdentifierValue(CSSValueNormal) : cssValuePool().createValue(style-&gt;initialLetterDrop(), CSSPrimitiveValue::CSS_NUMBER);
+            RefPtr&lt;CSSPrimitiveValue&gt; size = !style-&gt;initialLetterHeight() ? cssValuePool().createIdentifierValue(CSSValueNormal) : cssValuePool().createValue(style-&gt;initialLetterHeight(), CSSPrimitiveValue::CSS_NUMBER);
+            return cssValuePool().createValue(Pair::create(drop.release(), size.release()));
+        }
</ins><span class="cx">         case CSSPropertyWebkitMarginBottomCollapse:
</span><span class="cx">         case CSSPropertyWebkitMarginAfterCollapse:
</span><span class="cx">             return cssValuePool().createValue(style-&gt;marginAfterCollapse());
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSLineBoxContainValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSLineBoxContainValue.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSLineBoxContainValue.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/css/CSSLineBoxContainValue.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -67,6 +67,11 @@
</span><span class="cx">             text.append(' ');
</span><span class="cx">         text.appendLiteral(&quot;inline-box&quot;);
</span><span class="cx">     }
</span><ins>+    if (m_value &amp; LineBoxContainInitialLetter) {
+        if (!text.isEmpty())
+            text.append(' ');
+        text.appendLiteral(&quot;initial-letter&quot;);
+    }
</ins><span class="cx"> 
</span><span class="cx">     return text.toString();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSLineBoxContainValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSLineBoxContainValue.h (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSLineBoxContainValue.h        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/css/CSSLineBoxContainValue.h        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> class CSSPrimitiveValue;
</span><span class="cx"> 
</span><span class="cx"> enum LineBoxContainFlags { LineBoxContainNone = 0x0, LineBoxContainBlock = 0x1, LineBoxContainInline = 0x2, LineBoxContainFont = 0x4, LineBoxContainGlyphs = 0x8,
</span><del>-                           LineBoxContainReplaced = 0x10, LineBoxContainInlineBox = 0x20 };
</del><ins>+                           LineBoxContainReplaced = 0x10, LineBoxContainInlineBox = 0x20, LineBoxContainInitialLetter = 0x40 };
</ins><span class="cx"> typedef unsigned LineBoxContain;
</span><span class="cx"> 
</span><span class="cx"> // Used for text-CSSLineBoxContain and box-CSSLineBoxContain
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -2414,6 +2414,30 @@
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx">         break;
</span><ins>+    case CSSPropertyWebkitInitialLetter: {
+        if (id == CSSValueNormal)
+            validPrimitive = true;
+        else {
+            if (num != 1 &amp;&amp; num != 2)
+                return false;
+            validPrimitive = validUnit(value, FPositiveInteger);
+            if (!validPrimitive)
+                return false;
+            RefPtr&lt;CSSPrimitiveValue&gt; parsedValue1 = createPrimitiveNumericValue(value);
+            RefPtr&lt;CSSPrimitiveValue&gt; parsedValue2;
+            if (num == 2) {
+                value = m_valueList-&gt;next();
+                validPrimitive = validUnit(value, FPositiveInteger);
+                if (!validPrimitive)
+                    return false;
+                parsedValue2 = createPrimitiveNumericValue(value);
+            } else
+                parsedValue2 = parsedValue1;
+            addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), parsedValue2.release()), important);
+            return true;
+        }
+        break;
+    }
</ins><span class="cx">     case CSSPropertyWebkitBoxReflect:
</span><span class="cx">         if (id == CSSValueNone)
</span><span class="cx">             validPrimitive = true;
</span><span class="lines">@@ -9836,6 +9860,10 @@
</span><span class="cx">             if (lineBoxContain &amp; LineBoxContainInlineBox)
</span><span class="cx">                 return false;
</span><span class="cx">             lineBoxContain |= LineBoxContainInlineBox;
</span><ins>+        } else if (value-&gt;id == CSSValueInitialLetter) {
+            if (lineBoxContain &amp; LineBoxContainInitialLetter)
+                return false;
+            lineBoxContain |= LineBoxContainInitialLetter;
</ins><span class="cx">         } else
</span><span class="cx">             return false;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPropertyNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPropertyNames.in        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -331,6 +331,7 @@
</span><span class="cx"> -webkit-hyphenate-limit-lines [Inherited]
</span><span class="cx"> -webkit-hyphens [Inherited]
</span><span class="cx"> -epub-hyphens = -webkit-hyphens
</span><ins>+-webkit-initial-letter
</ins><span class="cx"> -webkit-line-box-contain [Inherited]
</span><span class="cx"> -webkit-line-align [Inherited]
</span><span class="cx"> -webkit-line-break [Inherited]
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueKeywordsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueKeywords.in        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -971,6 +971,7 @@
</span><span class="cx"> font
</span><span class="cx"> glyphs
</span><span class="cx"> inline-box
</span><ins>+initial-letter
</ins><span class="cx"> replaced
</span><span class="cx"> 
</span><span class="cx"> // -webkit-font-feature-settings
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -2944,6 +2944,25 @@
</span><span class="cx">         state.style()-&gt;setScrollSnapCoordinates(coordinates);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+    case CSSPropertyWebkitInitialLetter: {
+        HANDLE_INHERIT_AND_INITIAL(initialLetter, InitialLetter)
+        if (!value-&gt;isPrimitiveValue())
+            return;
+        
+        if (primitiveValue-&gt;getValueID() == CSSValueNormal) {
+            state.style()-&gt;setInitialLetter(IntSize());
+            return;
+        }
+            
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+        Pair* pair = primitiveValue-&gt;getPairValue();
+        if (!pair || !pair-&gt;first() || !pair-&gt;second())
+            return;
+
+        state.style()-&gt;setInitialLetter(IntSize(pair-&gt;first()-&gt;getIntValue(), pair-&gt;second()-&gt;getIntValue()));
+        return;
+    }
+    
</ins><span class="cx"> #endif
</span><span class="cx">     // These properties are aliased and DeprecatedStyleBuilder already applied the property on the prefixed version.
</span><span class="cx">     case CSSPropertyTransitionDelay:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontMetricsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontMetrics.h (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontMetrics.h        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/platform/graphics/FontMetrics.h        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -83,7 +83,15 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasXHeight() const { return m_hasXHeight &amp;&amp; m_xHeight &gt; 0; }
</span><span class="cx">     void setHasXHeight(bool hasXHeight) { m_hasXHeight = hasXHeight; }
</span><del>-
</del><ins>+    
+    bool hasCapHeight() const { return m_hasCapHeight &amp;&amp; m_capHeight &gt; 0; }
+    float floatCapHeight() const { return m_capHeight; }
+    void setCapHeight(float capHeight)
+    { 
+        m_capHeight = capHeight;
+        m_hasCapHeight = true;
+    }
+    
</ins><span class="cx">     // Integer variants of certain metrics, used for HTML rendering.
</span><span class="cx">     int ascent(FontBaseline baselineType = AlphabeticBaseline) const
</span><span class="cx">     {
</span><span class="lines">@@ -91,7 +99,7 @@
</span><span class="cx">             return lroundf(m_ascent);
</span><span class="cx">         return height() - height() / 2;
</span><span class="cx">     }
</span><del>-
</del><ins>+    
</ins><span class="cx">     int descent(FontBaseline baselineType = AlphabeticBaseline) const
</span><span class="cx">     {
</span><span class="cx">         if (baselineType == AlphabeticBaseline)
</span><span class="lines">@@ -106,7 +114,9 @@
</span><span class="cx"> 
</span><span class="cx">     int lineGap() const { return lroundf(m_lineGap); }
</span><span class="cx">     int lineSpacing() const { return lroundf(m_lineSpacing); }
</span><del>-
</del><ins>+    
+    int capHeight() const { return lroundf(m_capHeight); }
+    
</ins><span class="cx">     bool hasIdenticalAscentDescentAndLineGap(const FontMetrics&amp; other) const
</span><span class="cx">     {
</span><span class="cx">         return ascent() == other.ascent() &amp;&amp; descent() == other.descent() &amp;&amp; lineGap() == other.lineGap();
</span><span class="lines">@@ -142,8 +152,10 @@
</span><span class="cx">     float m_lineGap;
</span><span class="cx">     float m_lineSpacing;
</span><span class="cx">     float m_xHeight;
</span><ins>+    float m_capHeight;
</ins><span class="cx">     float m_zeroWidth;
</span><span class="cx">     bool m_hasXHeight;
</span><ins>+    bool m_hasCapHeight;
</ins><span class="cx">     bool m_hasZeroWidth;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsiosSimpleFontDataIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/platform/graphics/ios/SimpleFontDataIOS.mm        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -75,6 +75,7 @@
</span><span class="cx">     unsigned unitsPerEm;
</span><span class="cx">     float ascent;
</span><span class="cx">     float descent;
</span><ins>+    float capHeight;
</ins><span class="cx">     float lineGap;
</span><span class="cx">     float lineSpacing;
</span><span class="cx">     float xHeight;
</span><span class="lines">@@ -86,6 +87,7 @@
</span><span class="cx">         lineSpacing = fontService.lineSpacing();
</span><span class="cx">         lineGap = fontService.lineGap();
</span><span class="cx">         xHeight = fontService.xHeight();
</span><ins>+        capHeight = fontService.capHeight();
</ins><span class="cx">         unitsPerEm = fontService.unitsPerEm();
</span><span class="cx">         familyName = adoptCF(CTFontCopyFamilyName(ctFont));
</span><span class="cx">     } else {
</span><span class="lines">@@ -98,6 +100,7 @@
</span><span class="cx">         descent = lroundf(-scaleEmToUnits(-abs(CGFontGetDescent(cgFont)), unitsPerEm) * pointSize);
</span><span class="cx">         lineGap = lroundf(scaleEmToUnits(CGFontGetLeading(cgFont), unitsPerEm) * pointSize);
</span><span class="cx">         xHeight = scaleEmToUnits(CGFontGetXHeight(cgFont), unitsPerEm) * pointSize;
</span><ins>+        capHeight = scaleEmToUnits(CGFontGetCapHeight(cgFont), unitsPerEm) * pointSize;
</ins><span class="cx"> 
</span><span class="cx">         lineSpacing = ascent + descent + lineGap;
</span><span class="cx">         familyName = adoptCF(CGFontCopyFamilyName(cgFont));
</span><span class="lines">@@ -109,6 +112,7 @@
</span><span class="cx">     m_fontMetrics.setLineGap(lineGap);
</span><span class="cx">     m_fontMetrics.setLineSpacing(lineSpacing);
</span><span class="cx">     m_fontMetrics.setXHeight(xHeight);
</span><ins>+    m_fontMetrics.setCapHeight(capHeight);
</ins><span class="cx">     m_shouldNotBeUsedForArabic = fontFamilyShouldNotBeUsedForArabic(familyName.get());
</span><span class="cx"> 
</span><span class="cx">     if (platformData().orientation() == Vertical &amp;&amp; !isTextOrientationFallback())
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacSimpleFontDataMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -186,18 +186,22 @@
</span><span class="cx">     
</span><span class="cx">     int iAscent;
</span><span class="cx">     int iDescent;
</span><ins>+    int iCapHeight;
</ins><span class="cx">     int iLineGap;
</span><span class="cx">     unsigned unitsPerEm;
</span><span class="cx">     iAscent = CGFontGetAscent(m_platformData.cgFont());
</span><span class="cx">     // Some fonts erroneously specify a positive descender value. We follow Core Text in assuming that
</span><span class="cx">     // such fonts meant the same distance, but in the reverse direction.
</span><span class="cx">     iDescent = -abs(CGFontGetDescent(m_platformData.cgFont()));
</span><ins>+    iCapHeight = CGFontGetCapHeight(m_platformData.cgFont());
</ins><span class="cx">     iLineGap = CGFontGetLeading(m_platformData.cgFont());
</span><span class="cx">     unitsPerEm = CGFontGetUnitsPerEm(m_platformData.cgFont());
</span><span class="cx"> 
</span><span class="cx">     float pointSize = m_platformData.m_size;
</span><span class="cx">     float ascent = scaleEmToUnits(iAscent, unitsPerEm) * pointSize;
</span><span class="cx">     float descent = -scaleEmToUnits(iDescent, unitsPerEm) * pointSize;
</span><ins>+    float capHeight = scaleEmToUnits(iCapHeight, unitsPerEm) * pointSize;
+    
</ins><span class="cx">     float lineGap = scaleEmToUnits(iLineGap, unitsPerEm) * pointSize;
</span><span class="cx"> 
</span><span class="cx">     // We need to adjust Times, Helvetica, and Courier to closely match the
</span><span class="lines">@@ -239,6 +243,7 @@
</span><span class="cx">     m_fontMetrics.setUnitsPerEm(unitsPerEm);
</span><span class="cx">     m_fontMetrics.setAscent(ascent);
</span><span class="cx">     m_fontMetrics.setDescent(descent);
</span><ins>+    m_fontMetrics.setCapHeight(capHeight);
</ins><span class="cx">     m_fontMetrics.setLineGap(lineGap);
</span><span class="cx">     m_fontMetrics.setXHeight(xHeight);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -3453,6 +3453,44 @@
</span><span class="cx"> static RenderStyle* styleForFirstLetter(RenderObject* firstLetterBlock, RenderObject* firstLetterContainer)
</span><span class="cx"> {
</span><span class="cx">     RenderStyle* pseudoStyle = firstLetterBlock-&gt;getCachedPseudoStyle(FIRST_LETTER, &amp;firstLetterContainer-&gt;firstLineStyle());
</span><ins>+    
+    // If we have an initial letter drop that is &gt;= 1, then we need to force floating to be on.
+    if (pseudoStyle-&gt;initialLetterDrop() &gt;= 1 &amp;&amp; !pseudoStyle-&gt;isFloating())
+        pseudoStyle-&gt;setFloating(pseudoStyle-&gt;isLeftToRightDirection() ? LeftFloat : RightFloat);
+
+    // We have to compute the correct font-size for the first-letter if it has an initial letter height set.
+    RenderObject* paragraph = firstLetterContainer-&gt;isRenderBlockFlow() ? firstLetterContainer : firstLetterContainer-&gt;containingBlock();
+    if (pseudoStyle-&gt;initialLetterHeight() &gt;= 1 &amp;&amp; pseudoStyle-&gt;fontMetrics().hasCapHeight() &amp;&amp; paragraph-&gt;style().fontMetrics().hasCapHeight()) {
+        // FIXME: For ideographic baselines, we want to go from line edge to line edge. This is equivalent to (N-1)*line-height + the font height.
+        // We don't yet support ideographic baselines.
+        // For an N-line first-letter and for alphabetic baselines, the cap-height of the first letter needs to equal (N-1)*line-height of paragraph lines + cap-height of the paragraph
+        // Mathematically we can't rely on font-size, since font().height() doesn't necessarily match. For reliability, the best approach is simply to
+        // compare the final measured cap-heights of the two fonts in order to get to the closest possible value.
+        pseudoStyle-&gt;setLineBoxContain(LineBoxContainInitialLetter);
+        int lineHeight = paragraph-&gt;style().computedLineHeight();
+        
+        // Set the font to be one line too big and then ratchet back to get to a precise fit. We can't just set the desired font size based off font height metrics
+        // because many fonts bake ascent into the font metrics. Therefore we have to look at actual measured cap height values in order to know when we have a good fit.
+        FontDescription newFontDescription = pseudoStyle-&gt;fontDescription();
+        float capRatio = pseudoStyle-&gt;fontMetrics().floatCapHeight() / pseudoStyle-&gt;fontSize();
+        float startingFontSize = ((pseudoStyle-&gt;initialLetterHeight() - 1) * lineHeight + paragraph-&gt;style().fontMetrics().capHeight()) / capRatio;
+        newFontDescription.setSpecifiedSize(startingFontSize);
+        newFontDescription.setComputedSize(startingFontSize);
+        pseudoStyle-&gt;setFontDescription(newFontDescription);
+        pseudoStyle-&gt;font().update(pseudoStyle-&gt;font().fontSelector());
+        
+        int desiredCapHeight = (pseudoStyle-&gt;initialLetterHeight() - 1) * lineHeight + paragraph-&gt;style().fontMetrics().capHeight();
+        int actualCapHeight = pseudoStyle-&gt;fontMetrics().capHeight();
+        while (actualCapHeight &gt; desiredCapHeight) {
+            FontDescription newFontDescription = pseudoStyle-&gt;fontDescription();
+            newFontDescription.setSpecifiedSize(newFontDescription.specifiedSize() - 1);
+            newFontDescription.setComputedSize(newFontDescription.computedSize() -1);
+            pseudoStyle-&gt;setFontDescription(newFontDescription);
+            pseudoStyle-&gt;font().update(pseudoStyle-&gt;font().fontSelector());
+            actualCapHeight = pseudoStyle-&gt;fontMetrics().capHeight();
+        }
+    }
+    
</ins><span class="cx">     // Force inline display (except for floating first-letters).
</span><span class="cx">     pseudoStyle-&gt;setDisplay(pseudoStyle-&gt;isFloating() ? BLOCK : INLINE);
</span><span class="cx">     // CSS2 says first-letter can't be positioned.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -2290,7 +2290,7 @@
</span><span class="cx">     return adjustLogicalRightOffsetForLine(offset, applyTextIndent);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject* floatingObject, LayoutUnit logicalTopOffset) const
</del><ins>+LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject* floatingObject, LayoutUnit logicalTopOffset)
</ins><span class="cx"> {
</span><span class="cx">     RenderBox&amp; childBox = floatingObject-&gt;renderer();
</span><span class="cx">     LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset.
</span><span class="lines">@@ -2337,6 +2337,34 @@
</span><span class="cx">         floatLogicalLeft -= logicalWidthForFloat(floatingObject);
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    if (childBox.style().styleType() == FIRST_LETTER &amp;&amp; childBox.style().initialLetterDrop() &gt; 0) {
+        const RenderStyle&amp; style = firstLineStyle();
+        const FontMetrics&amp; fontMetrics = style.fontMetrics();
+        if (fontMetrics.hasCapHeight()) {
+            LayoutUnit heightOfLine = lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
+            LayoutUnit beforeMarginBorderPadding = childBox.borderAndPaddingBefore() + childBox.marginBefore();
+            
+            // Make an adjustment to align with the cap height of a theoretical block line.
+            LayoutUnit adjustment = fontMetrics.ascent() + (heightOfLine - fontMetrics.height()) / 2 - fontMetrics.capHeight() - beforeMarginBorderPadding;
+            logicalTopOffset += adjustment;
+           
+            // For sunken and raised caps, we have to make some adjustments. Test if we're sunken or raised (dropHeightDelta will be
+            // positive for raised and negative for sunken).
+            int dropHeightDelta = childBox.style().initialLetterHeight() - childBox.style().initialLetterDrop();
+            
+            // If we're sunken, the float needs to shift down but lines still need to avoid it. In order to do that we increase the float's margin.
+            if (dropHeightDelta &lt; 0) {
+                LayoutUnit marginTopIncrease = -dropHeightDelta * heightOfLine;
+                childBox.setMarginBefore(childBox.marginTop() + marginTopIncrease);
+            }
+            
+            // If we're raised, then we actually have to grow the height of the block, since the lines have to be pushed down as though we're placing
+            // empty lines beside the first letter.
+            if (dropHeightDelta &gt; 0)
+                setLogicalHeight(logicalHeight() + dropHeightDelta * heightOfLine);
+        }
+    }
+    
</ins><span class="cx">     return LayoutPoint(floatLogicalLeft, logicalTopOffset);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.h        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -478,7 +478,7 @@
</span><span class="cx">     FloatingObject* insertFloatingObject(RenderBox&amp;);
</span><span class="cx">     void removeFloatingObject(RenderBox&amp;);
</span><span class="cx">     void removeFloatingObjectsBelow(FloatingObject*, int logicalOffset);
</span><del>-    LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit logicalTopOffset) const;
</del><ins>+    LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit logicalTopOffset);
</ins><span class="cx"> 
</span><span class="cx">     // Called from lineWidth, to position the floats added in the last line.
</span><span class="cx">     // Returns true if and only if it has positioned any floats.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -1490,8 +1490,10 @@
</span><span class="cx">             encounteredNewFloat = true;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-
-        if (floats[floatIndex].rect.size() != newSize) {
</del><ins>+    
+        // We have to reset the cap-height alignment done by the first-letter floats when initial-letter is set, so just always treat first-letter floats
+        // as dirty.
+        if (floats[floatIndex].rect.size() != newSize || (floatingBox-&gt;style().styleType() == FIRST_LETTER &amp;&amp; floatingBox-&gt;style().initialLetterDrop() &gt; 0)) {
</ins><span class="cx">             LayoutUnit floatTop = isHorizontalWritingMode() ? floats[floatIndex].rect.y() : floats[floatIndex].rect.x();
</span><span class="cx">             LayoutUnit floatHeight = isHorizontalWritingMode() ? std::max(floats[floatIndex].rect.height(), newSize.height()) : std::max(floats[floatIndex].rect.width(), newSize.width());
</span><span class="cx">             floatHeight = std::min(floatHeight, LayoutUnit::max() - floatTop);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRootInlineBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RootInlineBox.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -900,6 +900,20 @@
</span><span class="cx">         glyphOverflow-&gt;top = std::min(glyphOverflow-&gt;top, std::max(0, glyphOverflow-&gt;top - boxLineStyle.fontMetrics().ascent(baselineType())));
</span><span class="cx">         glyphOverflow-&gt;bottom = std::min(glyphOverflow-&gt;bottom, std::max(0, glyphOverflow-&gt;bottom - boxLineStyle.fontMetrics().descent(baselineType())));
</span><span class="cx">     }
</span><ins>+    
+    if (includeInitialLetterForBox(box)) {
+        // FIXME: Can't use glyph bounds in vertical writing mode because they are garbage.
+        bool canUseGlyphs = isHorizontal() &amp;&amp; glyphOverflow &amp;&amp; glyphOverflow-&gt;computeBounds;
+        int letterAscent = baselineType() == AlphabeticBaseline ? boxLineStyle.fontMetrics().capHeight() : (canUseGlyphs ? glyphOverflow-&gt;top : boxLineStyle.fontMetrics().ascent(baselineType()));
+        int letterDescent = canUseGlyphs ? glyphOverflow-&gt;bottom : (box.isRootInlineBox() ? 0 : boxLineStyle.fontMetrics().descent(baselineType()));
+        setAscentAndDescent(ascent, descent, letterAscent, letterDescent, ascentDescentSet);
+        affectsAscent = letterAscent - box.logicalTop() &gt; 0;
+        affectsDescent = letterDescent + box.logicalTop() &gt; 0;
+        if (canUseGlyphs) {
+            glyphOverflow-&gt;top = std::min(glyphOverflow-&gt;top, std::max(0, glyphOverflow-&gt;top - boxLineStyle.fontMetrics().ascent(baselineType())));
+            glyphOverflow-&gt;bottom = std::min(glyphOverflow-&gt;bottom, std::max(0, glyphOverflow-&gt;bottom - boxLineStyle.fontMetrics().descent(baselineType())));
+        }
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (includeMarginForBox(box)) {
</span><span class="cx">         LayoutUnit ascentWithMargin = boxLineStyle.fontMetrics().ascent(baselineType());
</span><span class="lines">@@ -1024,6 +1038,18 @@
</span><span class="cx">     return isHorizontal() &amp;&amp; (lineBoxContain &amp; LineBoxContainGlyphs);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RootInlineBox::includeInitialLetterForBox(InlineBox&amp; box) const
+{
+    if (box.renderer().isReplaced() || (box.renderer().isTextOrLineBreak() &amp;&amp; !box.behavesLikeText()))
+        return false;
+    
+    if (!box.behavesLikeText() &amp;&amp; box.isInlineFlowBox() &amp;&amp; !toInlineFlowBox(&amp;box)-&gt;hasTextChildren())
+        return false;
+
+    LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
+    return (lineBoxContain &amp; LineBoxContainInitialLetter);
+}
+
</ins><span class="cx"> bool RootInlineBox::includeMarginForBox(InlineBox&amp; box) const
</span><span class="cx"> {
</span><span class="cx">     if (box.renderer().isReplaced() || (box.renderer().isTextOrLineBreak() &amp;&amp; !box.behavesLikeText()))
</span><span class="lines">@@ -1038,7 +1064,7 @@
</span><span class="cx"> {
</span><span class="cx">     // FIXME: We can't fit to glyphs yet for vertical text, since the bounds returned are garbage.
</span><span class="cx">     LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
</span><del>-    return isHorizontal() &amp;&amp; (lineBoxContain &amp; LineBoxContainGlyphs);
</del><ins>+    return isHorizontal() &amp;&amp; ((lineBoxContain &amp; LineBoxContainGlyphs) || (lineBoxContain &amp; LineBoxContainInitialLetter));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RootInlineBox::includesRootLineBoxFontOrLeading() const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRootInlineBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RootInlineBox.h (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RootInlineBox.h        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/RootInlineBox.h        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -195,6 +195,7 @@
</span><span class="cx">     bool includeLeadingForBox(InlineBox&amp;) const;
</span><span class="cx">     bool includeFontForBox(InlineBox&amp;) const;
</span><span class="cx">     bool includeGlyphsForBox(InlineBox&amp;) const;
</span><ins>+    bool includeInitialLetterForBox(InlineBox&amp;) const;
</ins><span class="cx">     bool includeMarginForBox(InlineBox&amp;) const;
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit lineSnapAdjustment(LayoutUnit delta = 0) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -434,6 +434,7 @@
</span><span class="cx">             || rareNonInheritedData-&gt;marginBeforeCollapse != other-&gt;rareNonInheritedData-&gt;marginBeforeCollapse
</span><span class="cx">             || rareNonInheritedData-&gt;marginAfterCollapse != other-&gt;rareNonInheritedData-&gt;marginAfterCollapse
</span><span class="cx">             || rareNonInheritedData-&gt;lineClamp != other-&gt;rareNonInheritedData-&gt;lineClamp
</span><ins>+            || rareNonInheritedData-&gt;m_initialLetter != other-&gt;rareNonInheritedData-&gt;m_initialLetter
</ins><span class="cx">             || rareNonInheritedData-&gt;textOverflow != other-&gt;rareNonInheritedData-&gt;textOverflow)
</span><span class="cx">             return true;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -1082,6 +1082,10 @@
</span><span class="cx"> 
</span><span class="cx">     LineBoxContain lineBoxContain() const { return rareInheritedData-&gt;m_lineBoxContain; }
</span><span class="cx">     const LineClampValue&amp; lineClamp() const { return rareNonInheritedData-&gt;lineClamp; }
</span><ins>+    const IntSize&amp; initialLetter() const { return rareNonInheritedData-&gt;m_initialLetter; }
+    int initialLetterDrop() const { return initialLetter().width(); }
+    int initialLetterHeight() const { return initialLetter().height(); }
+
</ins><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span><span class="cx">     ScrollSnapType scrollSnapType() const { return static_cast&lt;ScrollSnapType&gt;(rareNonInheritedData-&gt;m_scrollSnapType); }
</span><span class="cx">     Vector&lt;Length&gt; scrollSnapOffsetsX() const { return rareNonInheritedData-&gt;m_scrollSnapPoints-&gt;offsetsX; }
</span><span class="lines">@@ -1612,6 +1616,9 @@
</span><span class="cx"> 
</span><span class="cx">     void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
</span><span class="cx">     void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
</span><ins>+    
+    void setInitialLetter(const IntSize&amp; size) { SET_VAR(rareNonInheritedData, m_initialLetter, size); }
+    
</ins><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span><span class="cx">     void setScrollSnapType(ScrollSnapType type) { SET_VAR(rareNonInheritedData, m_scrollSnapType, type); }
</span><span class="cx">     void setScrollSnapOffsetsX(Vector&lt;Length&gt;&amp; offsets) { SET_VAR(rareNonInheritedData.access()-&gt;m_scrollSnapPoints, offsetsX, offsets); }
</span><span class="lines">@@ -1982,6 +1989,7 @@
</span><span class="cx">     static RegionFragment initialRegionFragment() { return AutoRegionFragment; }
</span><span class="cx"> 
</span><span class="cx">     // Keep these at the end.
</span><ins>+    static IntSize initialInitialLetter() { return IntSize(); }
</ins><span class="cx">     static LineClampValue initialLineClamp() { return LineClampValue(); }
</span><span class="cx">     static ETextSecurity initialTextSecurity() { return TSNONE; }
</span><span class="cx"> #if ENABLE(IOS_TEXT_AUTOSIZING)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx">     , m_perspectiveOriginX(RenderStyle::initialPerspectiveOriginX())
</span><span class="cx">     , m_perspectiveOriginY(RenderStyle::initialPerspectiveOriginY())
</span><span class="cx">     , lineClamp(RenderStyle::initialLineClamp())
</span><ins>+    , m_initialLetter(RenderStyle::initialInitialLetter())
</ins><span class="cx">     , m_deprecatedFlexibleBox(StyleDeprecatedFlexibleBoxData::create())
</span><span class="cx">     , m_flexibleBox(StyleFlexibleBoxData::create())
</span><span class="cx">     , m_marquee(StyleMarqueeData::create())
</span><span class="lines">@@ -112,6 +113,7 @@
</span><span class="cx">     , m_perspectiveOriginX(o.m_perspectiveOriginX)
</span><span class="cx">     , m_perspectiveOriginY(o.m_perspectiveOriginY)
</span><span class="cx">     , lineClamp(o.lineClamp)
</span><ins>+    , m_initialLetter(o.m_initialLetter)
</ins><span class="cx">     , m_deprecatedFlexibleBox(o.m_deprecatedFlexibleBox)
</span><span class="cx">     , m_flexibleBox(o.m_flexibleBox)
</span><span class="cx">     , m_marquee(o.m_marquee)
</span><span class="lines">@@ -205,6 +207,7 @@
</span><span class="cx">         &amp;&amp; m_perspectiveOriginX == o.m_perspectiveOriginX
</span><span class="cx">         &amp;&amp; m_perspectiveOriginY == o.m_perspectiveOriginY
</span><span class="cx">         &amp;&amp; lineClamp == o.lineClamp
</span><ins>+        &amp;&amp; m_initialLetter == o.m_initialLetter
</ins><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx">         &amp;&amp; m_dashboardRegions == o.m_dashboardRegions
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (173216 => 173217)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h        2014-09-03 19:22:12 UTC (rev 173216)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h        2014-09-03 19:26:38 UTC (rev 173217)
</span><span class="lines">@@ -108,6 +108,9 @@
</span><span class="cx">     Length m_perspectiveOriginY;
</span><span class="cx"> 
</span><span class="cx">     LineClampValue lineClamp; // An Apple extension.
</span><ins>+    
+    IntSize m_initialLetter;
+
</ins><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx">     Vector&lt;StyleDashboardRegion&gt; m_dashboardRegions;
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>