<!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>[210145] trunk/Source/WebCore</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>RenderBlockFlow::moveFloatsTo does not move floats.
https://bugs.webkit.org/show_bug.cgi?id=166467

Reviewed by Darin Adler.

RenderBlockFlow::moveFloatsTo name is misleading. Floats are not moved from &quot;this&quot; to
the new RenderBlockFlow parent, but rather they are copied so that overhanging floats
don't get lost.

Covered by existing tests.

* rendering/FloatingObjects.cpp:
(WebCore::FloatingObject::cloneForNewParent):
(WebCore::FloatingObject::unsafeClone): Deleted.
* rendering/FloatingObjects.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::addFloatsToNewParent):
(WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
(WebCore::RenderBlockFlow::moveFloatsTo): Deleted.
* rendering/RenderBlockFlow.h:
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::mergeChildrenWithBase):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::removeChild):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingFloatingObjectscpp">trunk/Source/WebCore/rendering/FloatingObjects.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingFloatingObjectsh">trunk/Source/WebCore/rendering/FloatingObjects.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>
<li><a href="#trunkSourceWebCorerenderingRenderRubyBasecpp">trunk/Source/WebCore/rendering/RenderRubyBase.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderRubyBaseh">trunk/Source/WebCore/rendering/RenderRubyBase.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderRubyRuncpp">trunk/Source/WebCore/rendering/RenderRubyRun.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210144 => 210145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-24 04:39:52 UTC (rev 210144)
+++ trunk/Source/WebCore/ChangeLog        2016-12-24 18:00:00 UTC (rev 210145)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2016-12-24  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        RenderBlockFlow::moveFloatsTo does not move floats.
+        https://bugs.webkit.org/show_bug.cgi?id=166467
+
+        Reviewed by Darin Adler.
+
+        RenderBlockFlow::moveFloatsTo name is misleading. Floats are not moved from &quot;this&quot; to
+        the new RenderBlockFlow parent, but rather they are copied so that overhanging floats
+        don't get lost.
+
+        Covered by existing tests.
+
+        * rendering/FloatingObjects.cpp:
+        (WebCore::FloatingObject::cloneForNewParent):
+        (WebCore::FloatingObject::unsafeClone): Deleted.
+        * rendering/FloatingObjects.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::addFloatsToNewParent):
+        (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
+        (WebCore::RenderBlockFlow::moveFloatsTo): Deleted.
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderRubyBase.cpp:
+        (WebCore::RenderRubyBase::mergeChildrenWithBase):
+        * rendering/RenderRubyBase.h:
+        * rendering/RenderRubyRun.cpp:
+        (WebCore::RenderRubyRun::removeChild):
+
</ins><span class="cx"> 2016-12-23  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r209865): Crash when navigating back to some pages with compositing layers.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingFloatingObjectscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/FloatingObjects.cpp (210144 => 210145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/FloatingObjects.cpp        2016-12-24 04:39:52 UTC (rev 210144)
+++ trunk/Source/WebCore/rendering/FloatingObjects.cpp        2016-12-24 18:00:00 UTC (rev 210145)
</span><span class="lines">@@ -88,10 +88,9 @@
</span><span class="cx">     return std::make_unique&lt;FloatingObject&gt;(renderer(), type(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;FloatingObject&gt; FloatingObject::unsafeClone() const
</del><ins>+std::unique_ptr&lt;FloatingObject&gt; FloatingObject::cloneForNewParent() const
</ins><span class="cx"> {
</span><del>-    // FIXME: Use make_unique here, once we can get it to compile on all platforms we support.
-    std::unique_ptr&lt;FloatingObject&gt; cloneObject(new FloatingObject(renderer(), type(), m_frameRect, m_shouldPaint, m_isDescendant));
</del><ins>+    auto cloneObject = std::make_unique&lt;FloatingObject&gt;(renderer(), type(), m_frameRect, m_shouldPaint, m_isDescendant);
</ins><span class="cx">     cloneObject-&gt;m_paginationStrut = m_paginationStrut;
</span><span class="cx">     cloneObject-&gt;m_isPlaced = m_isPlaced;
</span><span class="cx">     return cloneObject;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingFloatingObjectsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/FloatingObjects.h (210144 => 210145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/FloatingObjects.h        2016-12-24 04:39:52 UTC (rev 210144)
+++ trunk/Source/WebCore/rendering/FloatingObjects.h        2016-12-24 18:00:00 UTC (rev 210145)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> 
</span><span class="cx">     static std::unique_ptr&lt;FloatingObject&gt; create(RenderBox&amp;);
</span><span class="cx">     std::unique_ptr&lt;FloatingObject&gt; copyToNewContainer(LayoutSize, bool shouldPaint = false, bool isDescendant = false) const;
</span><del>-    std::unique_ptr&lt;FloatingObject&gt; unsafeClone() const;
</del><ins>+    std::unique_ptr&lt;FloatingObject&gt; cloneForNewParent() const;
</ins><span class="cx"> 
</span><span class="cx">     explicit FloatingObject(RenderBox&amp;);
</span><span class="cx">     FloatingObject(RenderBox&amp;, Type, const LayoutRect&amp;, bool shouldPaint, bool isDescendant);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (210144 => 210145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2016-12-24 04:39:52 UTC (rev 210144)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2016-12-24 18:00:00 UTC (rev 210145)
</span><span class="lines">@@ -2118,7 +2118,7 @@
</span><span class="cx">     RenderBlock::deleteLines();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderBlockFlow::moveFloatsTo(RenderBlockFlow* toBlockFlow)
</del><ins>+void RenderBlockFlow::addFloatsToNewParent(RenderBlockFlow&amp; toBlockFlow) const
</ins><span class="cx"> {
</span><span class="cx">     // When a portion of the render tree is being detached, anonymous blocks
</span><span class="cx">     // will be combined as their children are deleted. In this process, the
</span><span class="lines">@@ -2137,30 +2137,21 @@
</span><span class="cx">     // all be wrong, but since toBlockFlow is already marked for layout, this
</span><span class="cx">     // will get fixed before anything gets displayed.
</span><span class="cx">     // See bug https://bugs.webkit.org/show_bug.cgi?id=115566
</span><del>-    if (m_floatingObjects) {
-        if (!toBlockFlow-&gt;m_floatingObjects)
-            toBlockFlow-&gt;createFloatingObjects();
</del><ins>+    if (!m_floatingObjects)
+        return;
</ins><span class="cx"> 
</span><del>-        const FloatingObjectSet&amp; fromFloatingObjectSet = m_floatingObjects-&gt;set();
-        auto end = fromFloatingObjectSet.end();
</del><ins>+    if (!toBlockFlow.m_floatingObjects)
+        toBlockFlow.createFloatingObjects();
</ins><span class="cx"> 
</span><del>-        for (auto it = fromFloatingObjectSet.begin(); it != end; ++it) {
-            FloatingObject* floatingObject = it-&gt;get();
-
-            // Don't insert the object again if it's already in the list
-            if (toBlockFlow-&gt;containsFloat(floatingObject-&gt;renderer()))
-                continue;
-
-            toBlockFlow-&gt;m_floatingObjects-&gt;add(floatingObject-&gt;unsafeClone());
-        }
-    }
</del><ins>+    for (auto&amp; floatingObject : m_floatingObjects-&gt;set())
+        toBlockFlow.m_floatingObjects-&gt;add(floatingObject-&gt;cloneForNewParent());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock&amp; toBlock, bool fullRemoveInsert)
</span><span class="cx"> {
</span><del>-    RenderBlockFlow&amp; toBlockFlow = downcast&lt;RenderBlockFlow&gt;(toBlock);
</del><ins>+    auto&amp; toBlockFlow = downcast&lt;RenderBlockFlow&gt;(toBlock);
</ins><span class="cx">     moveAllChildrenTo(&amp;toBlockFlow, fullRemoveInsert);
</span><del>-    moveFloatsTo(&amp;toBlockFlow);
</del><ins>+    addFloatsToNewParent(toBlockFlow);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderBlockFlow::addOverflowFromFloats()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (210144 => 210145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.h        2016-12-24 04:39:52 UTC (rev 210144)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h        2016-12-24 18:00:00 UTC (rev 210145)
</span><span class="lines">@@ -461,7 +461,7 @@
</span><span class="cx">     bool isTopLayoutOverflowAllowed() const override;
</span><span class="cx">     bool isLeftLayoutOverflowAllowed() const override;
</span><span class="cx"> 
</span><del>-    void moveFloatsTo(RenderBlockFlow* toBlock);
</del><ins>+    void addFloatsToNewParent(RenderBlockFlow&amp; toBlockFlow) const;
</ins><span class="cx">     
</span><span class="cx">     virtual void computeColumnCountAndWidth();
</span><span class="cx">     virtual bool requiresColumns(int) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderRubyBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderRubyBase.cpp (210144 => 210145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderRubyBase.cpp        2016-12-24 04:39:52 UTC (rev 210144)
+++ trunk/Source/WebCore/rendering/RenderRubyBase.cpp        2016-12-24 18:00:00 UTC (rev 210145)
</span><span class="lines">@@ -71,10 +71,10 @@
</span><span class="cx">     toBase-&gt;setNeedsLayoutAndPrefWidthsRecalc();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderRubyBase::mergeChildrenWithBase(RenderRubyBase* toBlock)
</del><ins>+void RenderRubyBase::mergeChildrenWithBase(RenderRubyBase&amp; toBlock)
</ins><span class="cx"> {
</span><del>-    moveChildren(toBlock);
-    moveFloatsTo(toBlock);
</del><ins>+    moveChildren(&amp;toBlock);
+    addFloatsToNewParent(toBlock);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderRubyBase::moveInlineChildren(RenderRubyBase* toBase, RenderObject* beforeChild)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderRubyBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderRubyBase.h (210144 => 210145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderRubyBase.h        2016-12-24 04:39:52 UTC (rev 210144)
+++ trunk/Source/WebCore/rendering/RenderRubyBase.h        2016-12-24 18:00:00 UTC (rev 210145)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">     bool isChildAllowed(const RenderObject&amp;, const RenderStyle&amp;) const override;
</span><span class="cx">     ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const override;
</span><span class="cx">     void adjustInlineDirectionLineBounds(int expansionOpportunityCount, float&amp; logicalLeft, float&amp; logicalWidth) const override;
</span><del>-    void mergeChildrenWithBase(RenderRubyBase* toBlock);
</del><ins>+    void mergeChildrenWithBase(RenderRubyBase&amp; toBlock);
</ins><span class="cx"> 
</span><span class="cx">     void moveChildren(RenderRubyBase* toBase, RenderObject* beforeChild = 0);
</span><span class="cx">     void moveInlineChildren(RenderRubyBase* toBase, RenderObject* beforeChild = 0);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderRubyRuncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderRubyRun.cpp (210144 => 210145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderRubyRun.cpp        2016-12-24 04:39:52 UTC (rev 210144)
+++ trunk/Source/WebCore/rendering/RenderRubyRun.cpp        2016-12-24 18:00:00 UTC (rev 210145)
</span><span class="lines">@@ -167,7 +167,7 @@
</span><span class="cx">             if (rightRun.hasRubyBase()) {
</span><span class="cx">                 RenderRubyBase* rightBase = rightRun.rubyBaseSafe();
</span><span class="cx">                 // Collect all children in a single base, then swap the bases.
</span><del>-                rightBase-&gt;mergeChildrenWithBase(base);
</del><ins>+                rightBase-&gt;mergeChildrenWithBase(*base);
</ins><span class="cx">                 moveChildTo(&amp;rightRun, base);
</span><span class="cx">                 rightRun.moveChildTo(this, rightBase);
</span><span class="cx">                 // The now empty ruby base will be removed below.
</span></span></pre>
</div>
</div>

</body>
</html>