<!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>[177021] 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/177021">177021</a></dd>
<dt>Author</dt> <dd>jfernandez@igalia.com</dd>
<dt>Date</dt> <dd>2014-12-09 09:44:40 -0800 (Tue, 09 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Refactor of rebuildFloatingObjectSetFromIntrudingFloats function after <a href="http://trac.webkit.org/projects/webkit/changeset/176957">r176957</a>.
https://bugs.webkit.org/show_bug.cgi?id=139445
Reviewed by Darin Adler.
The function rebuildFloatingObjectSetFromIntrudingFloats would be clearer if
we use a helper function to locate the previous sibling with overhanging floats.
These changes has been suggested as part of the patch review for bug #139150, which
landed in <a href="http://trac.webkit.org/projects/webkit/changeset/176957">r176957</a>.
No new tests, no behavior change.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::avoidsFloats):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::previousSiblingWithOverhangingFloats):
(WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.h:
(WebCore::RenderBox::isGridItem):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177020 => 177021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-09 17:16:12 UTC (rev 177020)
+++ trunk/Source/WebCore/ChangeLog        2014-12-09 17:44:40 UTC (rev 177021)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-12-09 Javier Fernandez <jfernandez@igalia.com>
+
+ Refactor of rebuildFloatingObjectSetFromIntrudingFloats function after r176957.
+ https://bugs.webkit.org/show_bug.cgi?id=139445
+
+ Reviewed by Darin Adler.
+
+ The function rebuildFloatingObjectSetFromIntrudingFloats would be clearer if
+ we use a helper function to locate the previous sibling with overhanging floats.
+
+ These changes has been suggested as part of the patch review for bug #139150, which
+ landed in r176957.
+
+ No new tests, no behavior change.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::avoidsFloats):
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::previousSiblingWithOverhangingFloats):
+ (WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
+ * rendering/RenderBlockFlow.h:
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::isGridItem):
+
</ins><span class="cx"> 2014-12-09 Alberto Garcia <berto@igalia.com>
</span><span class="cx">
</span><span class="cx"> convertToUTF8String converts null string to empty string
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (177020 => 177021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-12-09 17:16:12 UTC (rev 177020)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-12-09 17:44:40 UTC (rev 177021)
</span><span class="lines">@@ -2384,8 +2384,7 @@
</span><span class="cx"> bool RenderBlock::avoidsFloats() const
</span><span class="cx"> {
</span><span class="cx"> // Floats can't intrude into our box if we have a non-auto column count or width.
</span><del>- return RenderBox::avoidsFloats()
- || style().hasFlowFrom();
</del><ins>+ return RenderBox::avoidsFloats() || style().hasFlowFrom();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderBlock::isPointInOverflowControl(HitTestResult& result, const LayoutPoint& locationInContainer, const LayoutPoint& accumulatedOffset)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (177020 => 177021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-12-09 17:16:12 UTC (rev 177020)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-12-09 17:44:40 UTC (rev 177021)
</span><span class="lines">@@ -175,6 +175,24 @@
</span><span class="cx"> RenderBox::willBeDestroyed();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RenderBlockFlow* RenderBlockFlow::previousSiblingWithOverhangingFloats(bool& parentHasFloats) const
+{
+ // Attempt to locate a previous sibling with overhanging floats. We skip any elements that are
+ // out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted
+ // to avoid floats.
+ parentHasFloats = false;
+ for (RenderObject* sibling = previousSibling(); sibling; sibling = sibling->previousSibling()) {
+ if (is<RenderBlockFlow>(*sibling)) {
+ auto& siblingBlock = downcast<RenderBlockFlow>(*sibling);
+ if (!siblingBlock.avoidsFloats())
+ return &siblingBlock;
+ }
+ if (sibling->isFloating())
+ parentHasFloats = true;
+ }
+ return nullptr;
+}
+
</ins><span class="cx"> void RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats()
</span><span class="cx"> {
</span><span class="cx"> if (m_floatingObjects)
</span><span class="lines">@@ -215,36 +233,26 @@
</span><span class="cx"> if (!is<RenderBlockFlow>(parent()))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- // Attempt to locate a previous sibling with overhanging floats. We skip any elements that are
- // out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted
- // to avoid floats.
</del><ins>+ // First add in floats from the parent. Self-collapsing blocks let their parent track any floats that intrude into
+ // them (as opposed to floats they contain themselves) so check for those here too.
</ins><span class="cx"> RenderBlockFlow& parentBlock = downcast<RenderBlockFlow>(*parent());
</span><span class="cx"> bool parentHasFloats = false;
</span><del>- RenderObject* prev = previousSibling();
- while (prev && (!is<RenderBox>(*prev) || !is<RenderBlockFlow>(*prev) || downcast<RenderBlockFlow>(*prev).avoidsFloats() || downcast<RenderBlock>(prev)->createsNewFormattingContext())) {
- if (prev->isFloating())
- parentHasFloats = true;
- prev = prev->previousSibling();
- }
-
- // First add in floats from the parent. Self-collapsing blocks let their parent track any floats that intrude into
- // them (as opposed to floats they contain themselves) so check for those here too.
</del><ins>+ RenderBlockFlow* previousBlock = previousSiblingWithOverhangingFloats(parentHasFloats);
</ins><span class="cx"> LayoutUnit logicalTopOffset = logicalTop();
</span><del>- if (parentHasFloats || (parentBlock.lowestFloatLogicalBottom() > logicalTopOffset && prev && downcast<RenderBlockFlow>(*prev).isSelfCollapsingBlock()))
</del><ins>+ if (parentHasFloats || (parentBlock.lowestFloatLogicalBottom() > logicalTopOffset && previousBlock && previousBlock->isSelfCollapsingBlock()))
</ins><span class="cx"> addIntrudingFloats(&parentBlock, parentBlock.logicalLeftOffsetForContent(), logicalTopOffset);
</span><span class="cx">
</span><span class="cx"> LayoutUnit logicalLeftOffset = 0;
</span><del>- if (prev)
- logicalTopOffset -= downcast<RenderBox>(*prev).logicalTop();
</del><ins>+ if (previousBlock)
+ logicalTopOffset -= previousBlock->logicalTop();
</ins><span class="cx"> else {
</span><del>- prev = &parentBlock;
</del><ins>+ previousBlock = &parentBlock;
</ins><span class="cx"> logicalLeftOffset += parentBlock.logicalLeftOffsetForContent();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Add overhanging floats from the previous RenderBlock, but only if it has a float that intrudes into our space.
</span><del>- RenderBlockFlow& block = downcast<RenderBlockFlow>(*prev);
- if (block.m_floatingObjects && block.lowestFloatLogicalBottom() > logicalTopOffset)
- addIntrudingFloats(&block, logicalLeftOffset, logicalTopOffset);
</del><ins>+ if (previousBlock->m_floatingObjects && previousBlock->lowestFloatLogicalBottom() > logicalTopOffset)
+ addIntrudingFloats(previousBlock, logicalLeftOffset, logicalTopOffset);
</ins><span class="cx">
</span><span class="cx"> if (childrenInline()) {
</span><span class="cx"> LayoutUnit changeLogicalTop = LayoutUnit::max();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (177020 => 177021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.h        2014-12-09 17:16:12 UTC (rev 177020)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h        2014-12-09 17:44:40 UTC (rev 177021)
</span><span class="lines">@@ -462,6 +462,8 @@
</span><span class="cx"> bool recomputeLogicalWidthAndColumnWidth();
</span><span class="cx"> LayoutUnit columnGap() const;
</span><span class="cx">
</span><ins>+ RenderBlockFlow* previousSiblingWithOverhangingFloats(bool& parentHasFloats) const;
+
</ins><span class="cx"> // Called to lay out the legend for a fieldset or the ruby text of a ruby run. Also used by multi-column layout to handle
</span><span class="cx"> // the flow thread child.
</span><span class="cx"> virtual RenderObject* layoutSpecialExcludedChild(bool /*relayoutChildren*/);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (177020 => 177021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h        2014-12-09 17:16:12 UTC (rev 177020)
+++ trunk/Source/WebCore/rendering/RenderBox.h        2014-12-09 17:44:40 UTC (rev 177021)
</span><span class="lines">@@ -530,10 +530,6 @@
</span><span class="cx"> bool isDeprecatedFlexItem() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isDeprecatedFlexibleBox(); }
</span><span class="cx"> bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDeprecated(); }
</span><span class="cx">
</span><del>-#if ENABLE(CSS_GRID_LAYOUT)
- bool isGridItem() const { return parent() && parent()->isRenderGrid(); }
-#endif
-
</del><span class="cx"> virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
</span><span class="cx"> virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
</span><span class="cx">
</span><span class="lines">@@ -659,6 +655,10 @@
</span><span class="cx"> void updateShapeOutsideInfoAfterStyleChange(const RenderStyle&, const RenderStyle* oldStyle);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if ENABLE(CSS_GRID_LAYOUT)
+ bool isGridItem() const { return parent() && parent()->isRenderGrid(); }
+#endif
+
</ins><span class="cx"> bool scrollLayer(ScrollDirection, ScrollGranularity, float multiplier, Element** stopElement);
</span><span class="cx">
</span><span class="cx"> bool fixedElementLaysOutRelativeToFrame(const FrameView&) const;
</span></span></pre>
</div>
</div>
</body>
</html>