<!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 "this" 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 <zalan@apple.com>
+
+ 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 "this" 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 <akling@apple.com>
</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<FloatingObject>(renderer(), type(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::unique_ptr<FloatingObject> FloatingObject::unsafeClone() const
</del><ins>+std::unique_ptr<FloatingObject> 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<FloatingObject> cloneObject(new FloatingObject(renderer(), type(), m_frameRect, m_shouldPaint, m_isDescendant));
</del><ins>+ auto cloneObject = std::make_unique<FloatingObject>(renderer(), type(), m_frameRect, m_shouldPaint, m_isDescendant);
</ins><span class="cx"> cloneObject->m_paginationStrut = m_paginationStrut;
</span><span class="cx"> cloneObject->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<FloatingObject> create(RenderBox&);
</span><span class="cx"> std::unique_ptr<FloatingObject> copyToNewContainer(LayoutSize, bool shouldPaint = false, bool isDescendant = false) const;
</span><del>- std::unique_ptr<FloatingObject> unsafeClone() const;
</del><ins>+ std::unique_ptr<FloatingObject> cloneForNewParent() const;
</ins><span class="cx">
</span><span class="cx"> explicit FloatingObject(RenderBox&);
</span><span class="cx"> FloatingObject(RenderBox&, Type, const LayoutRect&, 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& 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->m_floatingObjects)
- toBlockFlow->createFloatingObjects();
</del><ins>+ if (!m_floatingObjects)
+ return;
</ins><span class="cx">
</span><del>- const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->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->get();
-
- // Don't insert the object again if it's already in the list
- if (toBlockFlow->containsFloat(floatingObject->renderer()))
- continue;
-
- toBlockFlow->m_floatingObjects->add(floatingObject->unsafeClone());
- }
- }
</del><ins>+ for (auto& floatingObject : m_floatingObjects->set())
+ toBlockFlow.m_floatingObjects->add(floatingObject->cloneForNewParent());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock& toBlock, bool fullRemoveInsert)
</span><span class="cx"> {
</span><del>- RenderBlockFlow& toBlockFlow = downcast<RenderBlockFlow>(toBlock);
</del><ins>+ auto& toBlockFlow = downcast<RenderBlockFlow>(toBlock);
</ins><span class="cx"> moveAllChildrenTo(&toBlockFlow, fullRemoveInsert);
</span><del>- moveFloatsTo(&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& 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->setNeedsLayoutAndPrefWidthsRecalc();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderRubyBase::mergeChildrenWithBase(RenderRubyBase* toBlock)
</del><ins>+void RenderRubyBase::mergeChildrenWithBase(RenderRubyBase& toBlock)
</ins><span class="cx"> {
</span><del>- moveChildren(toBlock);
- moveFloatsTo(toBlock);
</del><ins>+ moveChildren(&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&, const RenderStyle&) const override;
</span><span class="cx"> ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const override;
</span><span class="cx"> void adjustInlineDirectionLineBounds(int expansionOpportunityCount, float& logicalLeft, float& logicalWidth) const override;
</span><del>- void mergeChildrenWithBase(RenderRubyBase* toBlock);
</del><ins>+ void mergeChildrenWithBase(RenderRubyBase& 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->mergeChildrenWithBase(base);
</del><ins>+ rightBase->mergeChildrenWithBase(*base);
</ins><span class="cx"> moveChildTo(&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>