<!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>[182188] 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/182188">182188</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2015-03-31 10:42:24 -0700 (Tue, 31 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[New Block-Inside-Inline Model] Make sure line breaks occur before and after the anonymous inline-block.
https://bugs.webkit.org/show_bug.cgi?id=143238.

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/blocks/inside-inlines/breaking-behavior.html (and new-model equivalent).

* rendering/InlineFlowBox.h:
(WebCore::InlineFlowBox::InlineFlowBox):
(WebCore::InlineFlowBox::hasAnonymousInlineBlock):
(WebCore::InlineFlowBox::setHasAnonymousInlineBlock):
Add a bit to root line boxes (stored in the InlineFlowBox since it has free bits) that indicates whether
or not a line is an anonymous inline-block line.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
Patch the preferred logical width computation to break both before and after an anonymous inline-block.
Also make sure to strip trailing spaces from the line before the anonymous inline-block.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::constructLine):
Patch line construction so that no intermediate boxes are constructed between the InlineBox for the anonymous
inline-block and the root line box.

* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::ascentAndDescentForBox):
The height of a &quot;line&quot; that holds an anonymous inline-block should ignore line-box-contain and also make sure
that the margins of the replaced element are &quot;outside&quot; the line, since those margins will collapse.

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleReplaced):
Patch handleReplaced to make sure breaks occur both before and after an anonymous inline-block. In the case of
a break after the block, we setPreviousLineBrokeCleanly to true so that &lt;br&gt;s that follow the anonymous inline-block
are respected.

LayoutTests:

* fast/block/inside-inlines/breaking-behavior-expected.html: Added.
* fast/block/inside-inlines/breaking-behavior.html: Added.
* fast/block/inside-inlines/new-model/breaking-behavior-expected.html: Added.
* fast/block/inside-inlines/new-model/breaking-behavior.html: Added.
* fast/block/inside-inlines/new-model/empty-block.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastblockinsideinlinesnewmodelemptyblockhtml">trunk/LayoutTests/fast/block/inside-inlines/new-model/empty-block.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineFlowBoxh">trunk/Source/WebCore/rendering/InlineFlowBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowcpp">trunk/Source/WebCore/rendering/RenderBlockFlow.cpp</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="#trunkSourceWebCorerenderinglineBreakingContexth">trunk/Source/WebCore/rendering/line/BreakingContext.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastblockinsideinlinesbreakingbehaviorexpectedhtml">trunk/LayoutTests/fast/block/inside-inlines/breaking-behavior-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastblockinsideinlinesbreakingbehaviorhtml">trunk/LayoutTests/fast/block/inside-inlines/breaking-behavior.html</a></li>
<li><a href="#trunkLayoutTestsfastblockinsideinlinesnewmodelbreakingbehaviorexpectedhtml">trunk/LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastblockinsideinlinesnewmodelbreakingbehaviorhtml">trunk/LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (182187 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-31 17:32:46 UTC (rev 182187)
+++ trunk/LayoutTests/ChangeLog        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-03-30  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        [New Block-Inside-Inline Model] Make sure line breaks occur before and after the anonymous inline-block.
+        https://bugs.webkit.org/show_bug.cgi?id=143238.
+
+        Reviewed by Dean Jackson.
+
+        * fast/block/inside-inlines/breaking-behavior-expected.html: Added.
+        * fast/block/inside-inlines/breaking-behavior.html: Added.
+        * fast/block/inside-inlines/new-model/breaking-behavior-expected.html: Added.
+        * fast/block/inside-inlines/new-model/breaking-behavior.html: Added.
+        * fast/block/inside-inlines/new-model/empty-block.html:
+
</ins><span class="cx"> 2015-03-31  Marcos Chavarría Teijeiro  &lt;chavarria1991@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         GTK+ Gardening 30th March
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockinsideinlinesbreakingbehaviorexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/inside-inlines/breaking-behavior-expected.html (0 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/inside-inlines/breaking-behavior-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/breaking-behavior-expected.html        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.box { border:1px solid black; padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+&lt;/style&gt;
+&lt;body&gt;
+
+&lt;div class=&quot;box&quot;&gt;&lt;a&gt;One &lt;br&gt; Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box&quot;&gt;&lt;a&gt;One&lt;br&gt;&lt;br&gt;Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box nowrap&quot;&gt;&lt;a&gt;One &lt;br&gt; Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box float&quot;&gt;&lt;a&gt;One&lt;br&gt; Two&lt;/a&gt;&lt;/div&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockinsideinlinesbreakingbehaviorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/inside-inlines/breaking-behavior.html (0 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/inside-inlines/breaking-behavior.html                                (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/breaking-behavior.html        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.box { border:1px solid black; padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+&lt;/style&gt;
+&lt;body&gt;
+
+&lt;div class=&quot;box&quot;&gt;&lt;a&gt;One &lt;div&gt;&lt;/div&gt; Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box&quot;&gt;&lt;a&gt;One&lt;br&gt;&lt;div&gt;&lt;/div&gt;&lt;br&gt;Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box nowrap&quot;&gt;&lt;a&gt;One &lt;div&gt;&lt;/div&gt; Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box float&quot;&gt;&lt;a&gt;One &lt;div&gt;&lt;/div&gt; Two&lt;/a&gt;&lt;/div&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockinsideinlinesnewmodelbreakingbehaviorexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior-expected.html (0 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior-expected.html        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.box { border:1px solid black; padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+&lt;/style&gt;
+&lt;body&gt;
+
+&lt;div class=&quot;box&quot;&gt;&lt;a&gt;One &lt;br&gt; Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box&quot;&gt;&lt;a&gt;One&lt;br&gt;&lt;br&gt;Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box nowrap&quot;&gt;&lt;a&gt;One &lt;br&gt; Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box float&quot;&gt;&lt;a&gt;One&lt;br&gt; Two&lt;/a&gt;&lt;/div&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockinsideinlinesnewmodelbreakingbehaviorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior.html (0 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior.html                                (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/new-model/breaking-behavior.html        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.box { border:1px solid black; padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+&lt;/style&gt;
+&lt;script&gt;
+if (window.internals)
+    window.internals.settings.setNewBlockInsideInlineModelEnabled(true)
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;div class=&quot;box&quot;&gt;&lt;a&gt;One &lt;div&gt;&lt;/div&gt; Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box&quot;&gt;&lt;a&gt;One&lt;br&gt;&lt;div&gt;&lt;/div&gt;&lt;br&gt;Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box nowrap&quot;&gt;&lt;a&gt;One &lt;div&gt;&lt;/div&gt; Two&lt;/a&gt;&lt;/div&gt;
+
+&lt;div class=&quot;box float&quot;&gt;&lt;a&gt;One &lt;div&gt;&lt;/div&gt; Two&lt;/a&gt;&lt;/div&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockinsideinlinesnewmodelemptyblockhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/block/inside-inlines/new-model/empty-block.html (182187 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/inside-inlines/new-model/empty-block.html        2015-03-31 17:32:46 UTC (rev 182187)
+++ trunk/LayoutTests/fast/block/inside-inlines/new-model/empty-block.html        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -1,7 +1,8 @@
</span><span class="cx"> &lt;!doctype html&gt;
</span><span class="cx"> &lt;head&gt;
</span><span class="cx"> &lt;script&gt;
</span><del>-window.internals.settings.setNewBlockInsideInlineModelEnabled(true)
</del><ins>+if (window.internals)
+    window.internals.settings.setNewBlockInsideInlineModelEnabled(true)
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182187 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-31 17:32:46 UTC (rev 182187)
+++ trunk/Source/WebCore/ChangeLog        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2015-03-30  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        [New Block-Inside-Inline Model] Make sure line breaks occur before and after the anonymous inline-block.
+        https://bugs.webkit.org/show_bug.cgi?id=143238.
+
+        Reviewed by Dean Jackson.
+
+        Added fast/blocks/inside-inlines/breaking-behavior.html (and new-model equivalent).
+
+        * rendering/InlineFlowBox.h:
+        (WebCore::InlineFlowBox::InlineFlowBox):
+        (WebCore::InlineFlowBox::hasAnonymousInlineBlock):
+        (WebCore::InlineFlowBox::setHasAnonymousInlineBlock):
+        Add a bit to root line boxes (stored in the InlineFlowBox since it has free bits) that indicates whether
+        or not a line is an anonymous inline-block line.
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
+        Patch the preferred logical width computation to break both before and after an anonymous inline-block.
+        Also make sure to strip trailing spaces from the line before the anonymous inline-block.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::constructLine):
+        Patch line construction so that no intermediate boxes are constructed between the InlineBox for the anonymous
+        inline-block and the root line box.
+
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::ascentAndDescentForBox):
+        The height of a &quot;line&quot; that holds an anonymous inline-block should ignore line-box-contain and also make sure
+        that the margins of the replaced element are &quot;outside&quot; the line, since those margins will collapse.
+
+        * rendering/line/BreakingContext.h:
+        (WebCore::BreakingContext::handleReplaced):
+        Patch handleReplaced to make sure breaks occur both before and after an anonymous inline-block. In the case of
+        a break after the block, we setPreviousLineBrokeCleanly to true so that &lt;br&gt;s that follow the anonymous inline-block
+        are respected.
+
</ins><span class="cx"> 2015-03-31  Csaba Osztrogonác  &lt;ossy@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Add nullptr check to GraphicsContext3D::makeContextCurrent()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (182187 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.h        2015-03-31 17:32:46 UTC (rev 182187)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx">         , m_hasAnnotationsBefore(false)
</span><span class="cx">         , m_hasAnnotationsAfter(false)
</span><span class="cx">         , m_isFirstAfterPageBreak(false)
</span><ins>+        , m_hasAnonymousInlineBlock(false)
</ins><span class="cx"> #if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
</span><span class="cx">         , m_hasBadChildList(false)
</span><span class="cx"> #endif
</span><span class="lines">@@ -211,6 +212,9 @@
</span><span class="cx">     void setHasTextChildren() { m_hasTextChildren = true; setHasTextDescendants(); }
</span><span class="cx">     void setHasTextDescendants() { m_hasTextDescendants = true; }
</span><span class="cx">     
</span><ins>+    bool hasAnonymousInlineBlock() const { return m_hasAnonymousInlineBlock; }
+    void setHasAnonymousInlineBlock(bool b) { m_hasAnonymousInlineBlock = b; }
+
</ins><span class="cx">     void checkConsistency() const;
</span><span class="cx">     void setHasBadChildList();
</span><span class="cx"> 
</span><span class="lines">@@ -338,6 +342,7 @@
</span><span class="cx">     unsigned m_lineBreakBidiStatusLast : 5; // UCharDirection
</span><span class="cx"> 
</span><span class="cx">     unsigned m_isFirstAfterPageBreak : 1;
</span><ins>+    unsigned m_hasAnonymousInlineBlock : 1;
</ins><span class="cx"> 
</span><span class="cx">     // End of RootInlineBox-specific members.
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (182187 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2015-03-31 17:32:46 UTC (rev 182187)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -4024,7 +4024,8 @@
</span><span class="cx">     while (RenderObject* child = childIterator.next()) {
</span><span class="cx">         bool autoWrap = child-&gt;isReplaced() ? child-&gt;parent()-&gt;style().autoWrap() :
</span><span class="cx">             child-&gt;style().autoWrap();
</span><del>-
</del><ins>+        bool isAnonymousInlineBlock = child-&gt;isAnonymousInlineBlock();
+        
</ins><span class="cx">         if (!child-&gt;isBR()) {
</span><span class="cx">             // Step One: determine whether or not we need to go ahead and
</span><span class="cx">             // terminate our current line. Each discrete chunk can become
</span><span class="lines">@@ -4114,19 +4115,21 @@
</span><span class="cx">                     clearPreviousFloat = false;
</span><span class="cx"> 
</span><span class="cx">                 bool canBreakReplacedElement = !child-&gt;isImage() || allowImagesToBreak;
</span><del>-                if ((canBreakReplacedElement &amp;&amp; (autoWrap || oldAutoWrap) &amp;&amp; (!isPrevChildInlineFlow || shouldBreakLineAfterText)) || clearPreviousFloat) {
</del><ins>+                if (((canBreakReplacedElement &amp;&amp; (autoWrap || oldAutoWrap) &amp;&amp; (!isPrevChildInlineFlow || shouldBreakLineAfterText)) || clearPreviousFloat) || isAnonymousInlineBlock) {
+                    if (child-&gt;isAnonymousInlineBlock() &amp;&amp; styleToUse.collapseWhiteSpace())
+                        stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild);
</ins><span class="cx">                     minLogicalWidth = preferredWidth(minLogicalWidth, inlineMin);
</span><span class="cx">                     inlineMin = 0;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // If we're supposed to clear the previous float, then terminate maxwidth as well.
</span><del>-                if (clearPreviousFloat) {
</del><ins>+                if (clearPreviousFloat || isAnonymousInlineBlock) {
</ins><span class="cx">                     maxLogicalWidth = preferredWidth(maxLogicalWidth, inlineMax);
</span><span class="cx">                     inlineMax = 0;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // Add in text-indent. This is added in only once.
</span><del>-                if (!addedTextIndent &amp;&amp; !child-&gt;isFloating()) {
</del><ins>+                if (!addedTextIndent &amp;&amp; !child-&gt;isFloating() &amp;&amp; !isAnonymousInlineBlock) {
</ins><span class="cx">                     LayoutUnit ceiledIndent = textIndent.ceilToFloat();
</span><span class="cx">                     childMin += ceiledIndent;
</span><span class="cx">                     childMax += ceiledIndent;
</span><span class="lines">@@ -4140,7 +4143,7 @@
</span><span class="cx">                 // Add our width to the max.
</span><span class="cx">                 inlineMax += std::max&lt;float&gt;(0, childMax);
</span><span class="cx"> 
</span><del>-                if (!autoWrap || !canBreakReplacedElement || (isPrevChildInlineFlow &amp;&amp; !shouldBreakLineAfterText)) {
</del><ins>+                if ((!autoWrap || !canBreakReplacedElement || (isPrevChildInlineFlow &amp;&amp; !shouldBreakLineAfterText)) &amp;&amp; !isAnonymousInlineBlock) {
</ins><span class="cx">                     if (child-&gt;isFloating())
</span><span class="cx">                         minLogicalWidth = preferredWidth(minLogicalWidth, childMin);
</span><span class="cx">                     else
</span><span class="lines">@@ -4151,6 +4154,12 @@
</span><span class="cx"> 
</span><span class="cx">                     // Now start a new line.
</span><span class="cx">                     inlineMin = 0;
</span><ins>+                    
+                    if (child-&gt;isAnonymousInlineBlock()) {
+                        // Terminate max width as well.
+                        maxLogicalWidth = preferredWidth(maxLogicalWidth, childMax);
+                        inlineMax = 0;
+                    }
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if (autoWrap &amp;&amp; canBreakReplacedElement &amp;&amp; isPrevChildInlineFlow) {
</span><span class="lines">@@ -4261,8 +4270,8 @@
</span><span class="cx">                     inlineMax += std::max&lt;float&gt;(0, childMax);
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            // Ignore spaces after a list marker.
-            if (child-&gt;isListMarker())
</del><ins>+            // Ignore spaces after a list marker and also after an anonymous inline block.
+            if (child-&gt;isListMarker() || isAnonymousInlineBlock)
</ins><span class="cx">                 stripFrontSpaces = true;
</span><span class="cx">         } else {
</span><span class="cx">             minLogicalWidth = preferredWidth(minLogicalWidth, inlineMin);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (182187 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2015-03-31 17:32:46 UTC (rev 182187)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -283,6 +283,8 @@
</span><span class="cx">     bool rootHasSelectedChildren = false;
</span><span class="cx">     InlineFlowBox* parentBox = 0;
</span><span class="cx">     int runCount = bidiRuns.runCount() - lineInfo.runsFromLeadingWhitespace();
</span><ins>+    
+    bool isAnonymousInlineBlock = false;
</ins><span class="cx">     for (BidiRun* r = bidiRuns.firstRun(); r; r = r-&gt;next()) {
</span><span class="cx">         // Create a box for our object.
</span><span class="cx">         bool isOnlyRun = (runCount == 1);
</span><span class="lines">@@ -297,14 +299,19 @@
</span><span class="cx"> 
</span><span class="cx">         if (!rootHasSelectedChildren &amp;&amp; box-&gt;renderer().selectionState() != RenderObject::SelectionNone)
</span><span class="cx">             rootHasSelectedChildren = true;
</span><del>-
</del><ins>+    
+        isAnonymousInlineBlock = r-&gt;renderer().isAnonymousInlineBlock();
+        
</ins><span class="cx">         // If we have no parent box yet, or if the run is not simply a sibling,
</span><span class="cx">         // then we need to construct inline boxes as necessary to properly enclose the
</span><span class="cx">         // run's inline box. Segments can only be siblings at the root level, as
</span><span class="cx">         // they are positioned separately.
</span><span class="cx">         if (!parentBox || &amp;parentBox-&gt;renderer() != r-&gt;renderer().parent()) {
</span><span class="cx">             // Create new inline boxes all the way back to the appropriate insertion point.
</span><del>-            parentBox = createLineBoxes(r-&gt;renderer().parent(), lineInfo, box);
</del><ins>+            // For anonymous inline blocks, we never create intermediate line boxes for the inlines, since
+            // we want to pretend like they don't exist on the line.
+            RenderObject* parentToUse = isAnonymousInlineBlock ? this : r-&gt;renderer().parent();
+            parentBox = createLineBoxes(parentToUse, lineInfo, box);
</ins><span class="cx">         } else {
</span><span class="cx">             // Append the inline box to this line.
</span><span class="cx">             parentBox-&gt;addToLine(box);
</span><span class="lines">@@ -341,6 +348,8 @@
</span><span class="cx"> 
</span><span class="cx">     // Now mark the line boxes as being constructed.
</span><span class="cx">     lastRootBox()-&gt;setConstructed();
</span><ins>+    
+    lastRootBox()-&gt;setHasAnonymousInlineBlock(isAnonymousInlineBlock);
</ins><span class="cx"> 
</span><span class="cx">     // Return the last line.
</span><span class="cx">     return lastRootBox();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRootInlineBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (182187 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RootInlineBox.cpp        2015-03-31 17:32:46 UTC (rev 182187)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -872,6 +872,14 @@
</span><span class="cx">     // Replaced boxes will return 0 for the line-height if line-box-contain says they are
</span><span class="cx">     // not to be included.
</span><span class="cx">     if (box.renderer().isReplaced()) {
</span><ins>+        if (hasAnonymousInlineBlock()) {
+            ascent = box.logicalHeight(); // Margins exist &quot;outside&quot; the line, since they have to collapse.
+            descent = 0;
+            affectsAscent = true;
+            affectsDescent = true;
+            return;
+        }
+            
</ins><span class="cx">         if (lineStyle().lineBoxContain() &amp; LineBoxContainReplaced) {
</span><span class="cx">             ascent = box.baselinePosition(baselineType());
</span><span class="cx">             descent = box.lineHeight() - ascent;
</span><span class="lines">@@ -882,6 +890,9 @@
</span><span class="cx">         }
</span><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+    
+    if (hasAnonymousInlineBlock())
+        return;
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;const Font*&gt;* usedFonts = nullptr;
</span><span class="cx">     GlyphOverflow* glyphOverflow = nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineBreakingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (182187 => 182188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/BreakingContext.h        2015-03-31 17:32:46 UTC (rev 182187)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h        2015-03-31 17:42:24 UTC (rev 182188)
</span><span class="lines">@@ -490,9 +490,15 @@
</span><span class="cx">         m_width.updateAvailableWidth(replacedBox.logicalHeight());
</span><span class="cx"> 
</span><span class="cx">     // Break on replaced elements if either has normal white-space.
</span><del>-    if ((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) &amp;&amp; (!m_current.renderer()-&gt;isImage() || m_allowImagesToBreak)
-        &amp;&amp; (!m_current.renderer()-&gt;isRubyRun() || downcast&lt;RenderRubyRun&gt;(m_current.renderer())-&gt;canBreakBefore(m_renderTextInfo.m_lineBreakIterator))) {
</del><ins>+    if (((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) &amp;&amp; (!m_current.renderer()-&gt;isImage() || m_allowImagesToBreak)
+        &amp;&amp; (!m_current.renderer()-&gt;isRubyRun() || downcast&lt;RenderRubyRun&gt;(m_current.renderer())-&gt;canBreakBefore(m_renderTextInfo.m_lineBreakIterator))) || replacedBox.isAnonymousInlineBlock()) {
</ins><span class="cx">         commitLineBreakAtCurrentWidth(*m_current.renderer());
</span><ins>+        if (m_width.committedWidth() &amp;&amp; replacedBox.isAnonymousInlineBlock()) {
+            // Always force a break before an anonymous inline block if there is content on the line
+            // already.
+            m_atEnd = true;
+            return;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (m_ignoringSpaces)
</span><span class="lines">@@ -526,6 +532,11 @@
</span><span class="cx">         // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element.
</span><span class="cx">         m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
</span><span class="cx">     }
</span><ins>+    
+    if (replacedBox.isAnonymousInlineBlock()) {
+        m_atEnd = true;
+        m_lineInfo.setPreviousLineBrokeCleanly(true);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline float firstPositiveWidth(const WordMeasurements&amp; wordMeasurements)
</span></span></pre>
</div>
</div>

</body>
</html>