<!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>[189594] 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/189594">189594</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2015-09-10 15:15:46 -0700 (Thu, 10 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[New Block-Inside-Inline Model] Self-collapsing block check needs to account for anonymous inline blocks
https://bugs.webkit.org/show_bug.cgi?id=149042

Reviewed by Dean Jackson.

Source/WebCore:

Added new tests in fast/block/inside-inlines/

* rendering/InlineFlowBox.cpp:
* rendering/InlineFlowBox.h:
(WebCore::InlineFlowBox::anonymousInlineBlock):
Add a new accessor to get the anonymousInlineBlock() for lines that wrap them.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::childrenPreventSelfCollapsing):
(WebCore::RenderBlock::isSelfCollapsingBlock):
isSelfCollapsingBlock() now calls a virtual method that checks lines/children called childrenPreventSelfCollapsing.
This lets us farm out the lines check to the derived RenderBlockFlow class.

* rendering/RenderBlock.h:
(WebCore::RenderBlock::childrenPreventSelfCollapsing):
Added new virtual method for checking children.

* rendering/RenderBlockFlow.cpp:
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::childrenPreventSelfCollapsing):
Overridden to ensure that blocks can still be self-collapsing if they only contain anonymous inline-block lines that
are also self-collapsing.

LayoutTests:

* fast/block/inside-inlines/new-model/self-collapsing-test-expected.html: Added.
* fast/block/inside-inlines/new-model/self-collapsing-test.html: Added.
* fast/block/inside-inlines/self-collapsing-test-expected.html: Added.
* fast/block/inside-inlines/self-collapsing-test.html: 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="#trunkSourceWebCorerenderingInlineFlowBoxcpp">trunk/Source/WebCore/rendering/InlineFlowBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineFlowBoxh">trunk/Source/WebCore/rendering/InlineFlowBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockcpp">trunk/Source/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockh">trunk/Source/WebCore/rendering/RenderBlock.h</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>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastblockinsideinlinesnewmodelselfcollapsingtestexpectedhtml">trunk/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastblockinsideinlinesnewmodelselfcollapsingtesthtml">trunk/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test.html</a></li>
<li><a href="#trunkLayoutTestsfastblockinsideinlinesselfcollapsingtestexpectedhtml">trunk/LayoutTests/fast/block/inside-inlines/self-collapsing-test-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastblockinsideinlinesselfcollapsingtesthtml">trunk/LayoutTests/fast/block/inside-inlines/self-collapsing-test.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189593 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-10 21:54:31 UTC (rev 189593)
+++ trunk/LayoutTests/ChangeLog        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-09-10  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        [New Block-Inside-Inline Model] Self-collapsing block check needs to account for anonymous inline blocks
+        https://bugs.webkit.org/show_bug.cgi?id=149042
+
+        Reviewed by Dean Jackson.
+
+        * fast/block/inside-inlines/new-model/self-collapsing-test-expected.html: Added.
+        * fast/block/inside-inlines/new-model/self-collapsing-test.html: Added.
+        * fast/block/inside-inlines/self-collapsing-test-expected.html: Added.
+        * fast/block/inside-inlines/self-collapsing-test.html: Added.
+
</ins><span class="cx"> 2015-09-10  Dewei Zhu  &lt;dewei_zhu@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update windows platform expected results for bug 148810.
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockinsideinlinesnewmodelselfcollapsingtestexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test-expected.html (0 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test-expected.html        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.margin { margin:20px 0 }
+p { margin:0 }
+span { clear:left; float:left; width:20px; height:20px; background-color:green }
+&lt;/style&gt;
+&lt;body&gt;
+The two green floats should be stacked right on top of one another.
+&lt;div&gt;
+&lt;span&gt;&lt;/span&gt;
+&lt;span&gt;&lt;/span&gt;
+&lt;/div&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockinsideinlinesnewmodelselfcollapsingtesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test.html (0 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test.html                                (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test.html        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.margin { margin:20px 0 }
+p { margin:0 }
+span { float:left; width:20px; height:20px; background-color:green }
+&lt;/style&gt;
+&lt;script&gt;
+if (window.internals)
+    window.internals.settings.setNewBlockInsideInlineModelEnabled(true)
+&lt;/script&gt;
+&lt;body&gt;
+The two green floats should be stacked right on top of one another.
+&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
+&lt;div class=&quot;margin&quot;&gt;
+&lt;i&gt;
+&lt;div&gt;&lt;/div&gt;
+&lt;/i&gt;
+&lt;/div&gt;
+&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockinsideinlinesselfcollapsingtestexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/inside-inlines/self-collapsing-test-expected.html (0 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/inside-inlines/self-collapsing-test-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/self-collapsing-test-expected.html        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.margin { margin:20px 0 }
+p { margin:0 }
+span { clear:left; float:left; width:20px; height:20px; background-color:green }
+&lt;/style&gt;
+&lt;body&gt;
+The two green floats should be stacked right on top of one another.
+&lt;div&gt;
+&lt;span&gt;&lt;/span&gt;
+&lt;span&gt;&lt;/span&gt;
+&lt;/div&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockinsideinlinesselfcollapsingtesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/inside-inlines/self-collapsing-test.html (0 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/inside-inlines/self-collapsing-test.html                                (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/self-collapsing-test.html        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.margin { margin:20px 0 }
+p { margin:0 }
+span { float:left; width:20px; height:20px; background-color:green }
+&lt;/style&gt;
+&lt;body&gt;
+The two green floats should be stacked right on top of one another.
+&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
+&lt;div class=&quot;margin&quot;&gt;
+&lt;i&gt;
+&lt;div&gt;&lt;/div&gt;
+&lt;/i&gt;
+&lt;/div&gt;
+&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189593 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-10 21:54:31 UTC (rev 189593)
+++ trunk/Source/WebCore/ChangeLog        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-09-10  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        [New Block-Inside-Inline Model] Self-collapsing block check needs to account for anonymous inline blocks
+        https://bugs.webkit.org/show_bug.cgi?id=149042
+
+        Reviewed by Dean Jackson.
+
+        Added new tests in fast/block/inside-inlines/
+
+        * rendering/InlineFlowBox.cpp:
+        * rendering/InlineFlowBox.h:
+        (WebCore::InlineFlowBox::anonymousInlineBlock):
+        Add a new accessor to get the anonymousInlineBlock() for lines that wrap them.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::childrenPreventSelfCollapsing):
+        (WebCore::RenderBlock::isSelfCollapsingBlock):
+        isSelfCollapsingBlock() now calls a virtual method that checks lines/children called childrenPreventSelfCollapsing.
+        This lets us farm out the lines check to the derived RenderBlockFlow class.
+
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::childrenPreventSelfCollapsing):
+        Added new virtual method for checking children.
+
+        * rendering/RenderBlockFlow.cpp:
+        * rendering/RenderBlockFlow.h:
+        (WebCore::RenderBlockFlow::childrenPreventSelfCollapsing):
+        Overridden to ensure that blocks can still be self-collapsing if they only contain anonymous inline-block lines that
+        are also self-collapsing.
+
</ins><span class="cx"> 2015-09-10  Jinyoung Hur  &lt;hur.ims@navercorp.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WebGL][GLES] bad shaders should not be linked not only for GL but also for GL ES
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (189593 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2015-09-10 21:54:31 UTC (rev 189593)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -69,6 +69,11 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+RenderBlockFlow* InlineFlowBox::anonymousInlineBlock() const
+{
+    return m_hasAnonymousInlineBlock ? &amp;downcast&lt;RenderBlockFlow&gt;(firstChild()-&gt;renderer()) : nullptr;
+}
+
</ins><span class="cx"> LayoutUnit InlineFlowBox::getFlowSpacingLogicalWidth()
</span><span class="cx"> {
</span><span class="cx">     LayoutUnit totalWidth = marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (189593 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.h        2015-09-10 21:54:31 UTC (rev 189593)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -214,7 +214,8 @@
</span><span class="cx">     
</span><span class="cx">     bool hasAnonymousInlineBlock() const { return m_hasAnonymousInlineBlock; }
</span><span class="cx">     void setHasAnonymousInlineBlock(bool b) { m_hasAnonymousInlineBlock = b; }
</span><del>-
</del><ins>+    RenderBlockFlow* anonymousInlineBlock() const;
+    
</ins><span class="cx">     void checkConsistency() const;
</span><span class="cx">     void setHasBadChildList();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (189593 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2015-09-10 21:54:31 UTC (rev 189593)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -795,6 +795,19 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RenderBlock::childrenPreventSelfCollapsing() const
+{
+    // Whether or not we collapse is dependent on whether all our normal flow children
+    // are also self-collapsing.
+    for (RenderBox* child = firstChildBox(); child; child = child-&gt;nextSiblingBox()) {
+        if (child-&gt;isFloatingOrOutOfFlowPositioned())
+            continue;
+        if (!child-&gt;isSelfCollapsingBlock())
+            return true;
+    }
+    return false;
+}
+
</ins><span class="cx"> bool RenderBlock::isSelfCollapsingBlock() const
</span><span class="cx"> {
</span><span class="cx">     // We are not self-collapsing if we
</span><span class="lines">@@ -821,22 +834,9 @@
</span><span class="cx"> 
</span><span class="cx">     // If the height is 0 or auto, then whether or not we are a self-collapsing block depends
</span><span class="cx">     // on whether we have content that is all self-collapsing or not.
</span><del>-    if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.isPercentOrCalculated()) &amp;&amp; logicalHeightLength.isZero())) {
-        // If the block has inline children, see if we generated any line boxes.  If we have any
-        // line boxes, then we can't be self-collapsing, since we have content.
-        if (childrenInline())
-            return !hasLines();
-        
-        // Whether or not we collapse is dependent on whether all our normal flow children
-        // are also self-collapsing.
-        for (RenderBox* child = firstChildBox(); child; child = child-&gt;nextSiblingBox()) {
-            if (child-&gt;isFloatingOrOutOfFlowPositioned())
-                continue;
-            if (!child-&gt;isSelfCollapsingBlock())
-                return false;
-        }
-        return true;
-    }
</del><ins>+    if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.isPercentOrCalculated()) &amp;&amp; logicalHeightLength.isZero()))
+        return !childrenPreventSelfCollapsing();
+
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.h (189593 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.h        2015-09-10 21:54:31 UTC (rev 189593)
+++ trunk/Source/WebCore/rendering/RenderBlock.h        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -413,7 +413,9 @@
</span><span class="cx">     void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild);
</span><span class="cx">     virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild) override;
</span><span class="cx"> 
</span><del>-    virtual bool isSelfCollapsingBlock() const override final;
</del><ins>+    virtual bool isSelfCollapsingBlock() const override;
+    virtual bool childrenPreventSelfCollapsing() const;
+    
</ins><span class="cx">     // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
</span><span class="cx">     virtual bool hasLines() const { return false; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (189593 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2015-09-10 21:54:31 UTC (rev 189593)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -944,6 +944,27 @@
</span><span class="cx">     return MarginValues(childBeforePositive, childBeforeNegative, childAfterPositive, childAfterNegative);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RenderBlockFlow::childrenPreventSelfCollapsing() const
+{
+    if (!childrenInline())
+        return RenderBlock::childrenPreventSelfCollapsing();
+
+    // If the block has inline children, see if we generated any line boxes. If we have any
+    // line boxes, then we can only be self-collapsing if we have nothing but anonymous inline blocks
+    // that are also self-collapsing inside us.
+    if (!hasLines())
+        return false;
+    
+    if (simpleLineLayout())
+        return true; // We have simple line layout lines, so we can't be self-collapsing.
+    
+    for (auto* child = firstRootBox(); child; child = child-&gt;nextRootBox()) {
+        if (!child-&gt;hasAnonymousInlineBlock() || !child-&gt;anonymousInlineBlock()-&gt;isSelfCollapsingBlock())
+            return true;
+    }
+    return false; // We have no line boxes, so we must be self-collapsing.
+}
+
</ins><span class="cx"> LayoutUnit RenderBlockFlow::collapseMargins(RenderBox&amp; child, MarginInfo&amp; marginInfo)
</span><span class="cx"> {
</span><span class="cx">     bool childDiscardMarginBefore = mustDiscardMarginBeforeForChild(child);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (189593 => 189594)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.h        2015-09-10 21:54:31 UTC (rev 189593)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h        2015-09-10 22:15:46 UTC (rev 189594)
</span><span class="lines">@@ -255,6 +255,8 @@
</span><span class="cx">     void handleAfterSideOfBlock(LayoutUnit top, LayoutUnit bottom, MarginInfo&amp;);
</span><span class="cx">     void setCollapsedBottomMargin(const MarginInfo&amp;);
</span><span class="cx"> 
</span><ins>+    virtual bool childrenPreventSelfCollapsing() const override final;
+
</ins><span class="cx">     bool shouldBreakAtLineToAvoidWidow() const { return hasRareBlockFlowData() &amp;&amp; rareBlockFlowData()-&gt;m_lineBreakToAvoidWidow &gt;= 0; }
</span><span class="cx">     void clearShouldBreakAtLineToAvoidWidow() const;
</span><span class="cx">     int lineBreakToAvoidWidow() const { return hasRareBlockFlowData() ? rareBlockFlowData()-&gt;m_lineBreakToAvoidWidow : -1; }
</span></span></pre>
</div>
</div>

</body>
</html>