<!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>[176957] 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/176957">176957</a></dd>
<dt>Author</dt> <dd>jfernandez@igalia.com</dd>
<dt>Date</dt> <dd>2014-12-08 11:13:16 -0800 (Mon, 08 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[CSS Grid Layout] Grid items must set a new formatting context.
https://bugs.webkit.org/show_bug.cgi?id=139150
Reviewed by David Hyatt.
Source/WebCore:
Grid item's margins must not collapse even when they may be adjoining to
its content's margins. Also, setting a new formatting context prevents any
'float' protruding content on the adjoining grid items.
This patch also renames the expandsToEncloseOverhangingFloats to be more generic now,
determining whether a new formatting context is set or not. This affects not only to
how floats behave, but whether margins should collapse or not.
Tests: fast/css-grid-layout/float-not-protruding-into-next-grid-item.html
fast/css-grid-layout/grid-item-margins-not-collapse.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::avoidsFloats): Using the new createsNewFormattingContext function.
(WebCore::RenderBlock::expandsToEncloseOverhangingFloats): Deleted.
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::MarginInfo::MarginInfo): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::layoutBlock): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::computeOverflow): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::addOverhangingFloats): Using the new createsNewFormattingContext function.
(WebCore::RenderBlockFlow::needsLayoutAfterRegionRangeChange): Using the new createsNewFormattingContext function.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::createsNewFormattingContext): Added.
(WebCore::RenderBox::avoidsFloats): Removed checks already defined in the new createsNewFormattingContext function.
* rendering/RenderBox.h:
(WebCore::RenderBox::isGridItem): Added.
LayoutTests:
Test to verify that grid items's margin don't collapese with its parent's margin
and there is no 'float' protruding content on the adjoining grid items.
I had to rebaseline the form-hides-table.html test because table-caption, which
is supposed to establish a new formatting context, does not allow margins collapsing.
* fast/css-grid-layout/float-not-protruding-into-next-grid-item-expected.html: Added.
* fast/css-grid-layout/float-not-protruding-into-next-grid-item.html: Added.
* fast/css-grid-layout/grid-item-margins-not-collapse-expected.html: Added.
* fast/css-grid-layout/grid-item-margins-not-collapse.html: Added.
* platform/gtk/fast/forms/form-hides-table-expected.txt: Rebaseline needed.
* platform/mac/fast/forms/form-hides-table-expected.txt: Rebaseline needed.
* platform/efl/TestExpectations: Mark fast/forms/form-hides-table-expected as failure.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformeflTestExpectations">trunk/LayoutTests/platform/efl/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformgtkfastformsformhidestableexpectedtxt">trunk/LayoutTests/platform/gtk/fast/forms/form-hides-table-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastformsformhidestableexpectedtxt">trunk/LayoutTests/platform/mac/fast/forms/form-hides-table-expected.txt</a></li>
<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="#trunkSourceWebCorerenderingRenderBlockh">trunk/Source/WebCore/rendering/RenderBlock.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowcpp">trunk/Source/WebCore/rendering/RenderBlockFlow.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcssgridlayoutfloatnotprotrudingintonextgriditemexpectedhtml">trunk/LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutfloatnotprotrudingintonextgriditemhtml">trunk/LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item.html</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgriditemmarginsnotcollapseexpectedhtml">trunk/LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgriditemmarginsnotcollapsehtml">trunk/LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/LayoutTests/ChangeLog        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-12-08 Javier Fernandez <jfernandez@igalia.com>
+
+ [CSS Grid Layout] Grid items must set a new formatting context.
+ https://bugs.webkit.org/show_bug.cgi?id=139150
+
+ Reviewed by David Hyatt.
+
+ Test to verify that grid items's margin don't collapese with its parent's margin
+ and there is no 'float' protruding content on the adjoining grid items.
+
+ I had to rebaseline the form-hides-table.html test because table-caption, which
+ is supposed to establish a new formatting context, does not allow margins collapsing.
+
+ * fast/css-grid-layout/float-not-protruding-into-next-grid-item-expected.html: Added.
+ * fast/css-grid-layout/float-not-protruding-into-next-grid-item.html: Added.
+ * fast/css-grid-layout/grid-item-margins-not-collapse-expected.html: Added.
+ * fast/css-grid-layout/grid-item-margins-not-collapse.html: Added.
+ * platform/gtk/fast/forms/form-hides-table-expected.txt: Rebaseline needed.
+ * platform/mac/fast/forms/form-hides-table-expected.txt: Rebaseline needed.
+ * platform/efl/TestExpectations: Mark fast/forms/form-hides-table-expected as failure.
+
</ins><span class="cx"> 2014-12-08 Andrzej Badowski <a.badowski@samsung.com>
</span><span class="cx">
</span><span class="cx"> [EFL] Change expectations for two accessibility layout tests.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutfloatnotprotrudingintonextgriditemexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item-expected.html (0 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item-expected.html        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<link href="resources/grid.css" rel="stylesheet">
+<style>
+.cell {
+ width: 50px;
+ min-height: 50px
+}
+
+.invisibleFont {
+ color: lime;
+}
+
+.floatLeft {
+ float: left;
+}
+
+.clearLeft {
+ clear: left;
+}
+
+</style>
+</head>
+
+<body>
+
+<div>This test checks that grid item sets a new formatting context for its content, preventing any 'float' protruding content on the adjoining grid item ('Float' text shouldn't overflow the first row).</div>
+
+<div>
+ <div class="cell floatLeft firstRowFirstColumn">
+ <div class="text">Float</div>
+ <div class="text">Float</div>
+ <div class="text">Float</div>
+ <div class="text">Float</div>
+ </div>
+ <div class="cell floatLeft firstRowSecondColumn">
+ <div class="text invisibleFont">Float</div>
+ <div class="text invisibleFont">Float</div>
+ <div class="text invisibleFont">Float</div>
+ <div class="text invisibleFont">Float</div>
+ </div>
+ <div class="cell floatLeft clearLeft secondRowFirstColumn"></div>
+ <div class="cell floatLeft secondRowSecondColumn"></div>
+</div>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutfloatnotprotrudingintonextgriditemhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item.html (0 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item.html         (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/float-not-protruding-into-next-grid-item.html        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<link href="resources/grid.css" rel="stylesheet">
+<style>
+.grid {
+ -webkit-grid-auto-columns: 50px;
+ -webkit-grid-auto-rows: minmax(50px, -webkit-max-content);
+ width: -webkit-fit-content;
+}
+
+.cell {
+ width: 100%;
+ height: 100%;
+}
+
+.floatChild {
+ float: left;
+}
+
+</style>
+</head>
+
+<body>
+
+<div>This test checks that grid item sets a new formatting context for its content, preventing any 'float' protruding content on the adjoining grid item ('Float' text shouldn't overflow the first row).</div>
+
+<div class="grid">
+ <div class="cell firstRowFirstColumn">
+ <div class="floatChild">Float</div>
+ <div class="floatChild">Float</div>
+ <div class="floatChild">Float</div>
+ <div class="floatChild">Float</div>
+ </div>
+ <div class="cell firstRowSecondColumn"></div>
+ <div class="cell secondRowFirstColumn"></div>
+ <div class="cell secondRowSecondColumn"></div>
+</div>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgriditemmarginsnotcollapseexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse-expected.html (0 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse-expected.html        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+<!DOCTYPE html>
+
+<div>This test checks that grid item's margins do not collapse with its content's margins (single margin in the first row and double between subsequent).</div>
+
+<div style="float: left">
+ <div><p margin="20px 0px">XXXXX</p></div>
+ <div style="float: left; margin:20px 0px;">XXXXX</div>
+ <div><p style="float: left;" margin="20px 0px">XXXXX</p></div>
+</div>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgriditemmarginsnotcollapsehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse.html (0 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse.html         (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-item-margins-not-collapse.html        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+<!DOCTYPE html>
+
+<div>This test checks that grid item's margins do not collapse with its content's margins (single margin in the first row and double between subsequent).</div>
+
+<div style="display: -webkit-grid;">
+ <div><p margin="20px 0px">XXXXX</p></div>
+ <div style="margin:20px 0px;">XXXXX</div>
+ <div><p margin="20px 0px">XXXXX</p></div>
+</div>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformeflTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/TestExpectations (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/TestExpectations        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/LayoutTests/platform/efl/TestExpectations        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -2128,3 +2128,6 @@
</span><span class="cx"> webkit.org/b/136406 compositing/video/video-reflection.html [ Failure ]
</span><span class="cx"> webkit.org/b/136406 compositing/visibility/visibility-image-layers-dynamic.html [ Failure ]
</span><span class="cx"> webkit.org/b/136406 compositing/visibility/visibility-simple-video-layer.html [ Failure ]
</span><ins>+
+# This test need a rebaseline.
+webkit.org/b/139150 fast/forms/form-hides-table.html [ Failure ]
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkfastformsformhidestableexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/fast/forms/form-hides-table-expected.txt (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/fast/forms/form-hides-table-expected.txt        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/LayoutTests/platform/gtk/fast/forms/form-hides-table-expected.txt        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><del>-layer at (0,0) size 785x624
</del><ins>+layer at (0,0) size 785x640
</ins><span class="cx"> RenderView at (0,0) size 785x600
</span><del>-layer at (0,0) size 785x624
- RenderBlock {HTML} at (0,0) size 785x624
- RenderBody {BODY} at (8,8) size 769x608
</del><ins>+layer at (0,0) size 785x640
+ RenderBlock {HTML} at (0,0) size 785x640
+ RenderBody {BODY} at (8,8) size 769x624
</ins><span class="cx"> RenderBlock {P} at (0,0) size 769x17
</span><span class="cx"> RenderText {#text} at (0,0) size 551x17
</span><span class="cx"> text run at (0,0) width 551: "This page has a few tables within form elements within divs with various display styles."
</span><span class="lines">@@ -155,9 +155,9 @@
</span><span class="cx"> RenderTableCell {TD} at (2,2) size 112x19 [r=0 c=0 rs=1 cs=1]
</span><span class="cx"> RenderText {#text} at (1,1) size 110x17
</span><span class="cx"> text run at (1,1) width 110: "display: table-cell"
</span><del>- RenderBlock {DIV} at (0,551) size 769x57
- RenderTable at (0,0) size 55x57
- RenderBlock {DIV} at (0,0) size 55x57
</del><ins>+ RenderBlock {DIV} at (0,551) size 769x73
+ RenderTable at (0,0) size 55x73
+ RenderBlock {DIV} at (0,0) size 55x73
</ins><span class="cx"> RenderBlock {FORM} at (0,0) size 55x57
</span><span class="cx"> RenderTable {TABLE} at (0,0) size 55x57
</span><span class="cx"> RenderTableSection {TBODY} at (0,0) size 55x57
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformsformhidestableexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/forms/form-hides-table-expected.txt (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/forms/form-hides-table-expected.txt        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/LayoutTests/platform/mac/fast/forms/form-hides-table-expected.txt        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><del>-layer at (0,0) size 785x642
</del><ins>+layer at (0,0) size 785x658
</ins><span class="cx"> RenderView at (0,0) size 785x600
</span><del>-layer at (0,0) size 785x642
- RenderBlock {HTML} at (0,0) size 785x642
- RenderBody {BODY} at (8,8) size 769x626
</del><ins>+layer at (0,0) size 785x658
+ RenderBlock {HTML} at (0,0) size 785x658
+ RenderBody {BODY} at (8,8) size 769x642
</ins><span class="cx"> RenderBlock {P} at (0,0) size 769x18
</span><span class="cx"> RenderText {#text} at (0,0) size 551x18
</span><span class="cx"> text run at (0,0) width 551: "This page has a few tables within form elements within divs with various display styles."
</span><span class="lines">@@ -155,9 +155,9 @@
</span><span class="cx"> RenderTableCell {TD} at (2,2) size 112x20 [r=0 c=0 rs=1 cs=1]
</span><span class="cx"> RenderText {#text} at (1,1) size 110x18
</span><span class="cx"> text run at (1,1) width 110: "display: table-cell"
</span><del>- RenderBlock {DIV} at (0,566) size 769x60
- RenderTable at (0,0) size 55x60
- RenderBlock {DIV} at (0,0) size 55x60
</del><ins>+ RenderBlock {DIV} at (0,566) size 769x76
+ RenderTable at (0,0) size 55x76
+ RenderBlock {DIV} at (0,0) size 55x76
</ins><span class="cx"> RenderBlock {FORM} at (0,0) size 55x60
</span><span class="cx"> RenderTable {TABLE} at (0,0) size 55x60
</span><span class="cx"> RenderTableSection {TBODY} at (0,0) size 55x60
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/Source/WebCore/ChangeLog        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2014-12-08 Javier Fernandez <jfernandez@igalia.com>
+
+ [CSS Grid Layout] Grid items must set a new formatting context.
+ https://bugs.webkit.org/show_bug.cgi?id=139150
+
+ Reviewed by David Hyatt.
+
+ Grid item's margins must not collapse even when they may be adjoining to
+ its content's margins. Also, setting a new formatting context prevents any
+ 'float' protruding content on the adjoining grid items.
+
+ This patch also renames the expandsToEncloseOverhangingFloats to be more generic now,
+ determining whether a new formatting context is set or not. This affects not only to
+ how floats behave, but whether margins should collapse or not.
+
+ Tests: fast/css-grid-layout/float-not-protruding-into-next-grid-item.html
+ fast/css-grid-layout/grid-item-margins-not-collapse.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::avoidsFloats): Using the new createsNewFormattingContext function.
+ (WebCore::RenderBlock::expandsToEncloseOverhangingFloats): Deleted.
+ * rendering/RenderBlock.h:
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::MarginInfo::MarginInfo): Using the new createsNewFormattingContext function.
+ (WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats): Using the new createsNewFormattingContext function.
+ (WebCore::RenderBlockFlow::layoutBlock): Using the new createsNewFormattingContext function.
+ (WebCore::RenderBlockFlow::computeOverflow): Using the new createsNewFormattingContext function.
+ (WebCore::RenderBlockFlow::addOverhangingFloats): Using the new createsNewFormattingContext function.
+ (WebCore::RenderBlockFlow::needsLayoutAfterRegionRangeChange): Using the new createsNewFormattingContext function.
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::createsNewFormattingContext): Added.
+ (WebCore::RenderBox::avoidsFloats): Removed checks already defined in the new createsNewFormattingContext function.
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::isGridItem): Added.
+
</ins><span class="cx"> 2014-12-08 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Attempt to fix the public SDK build after <https://trac.webkit.org/r176841>
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -1092,12 +1092,6 @@
</span><span class="cx"> flowThread->addRegionsVisualOverflowFromTheme(this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool RenderBlock::expandsToEncloseOverhangingFloats() const
-{
- return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBoxIncludingDeprecated())
- || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isRoot() || isRenderFlowThread();
-}
-
</del><span class="cx"> LayoutUnit RenderBlock::computeStartPositionDeltaForChildAvoidingFloats(const RenderBox& child, LayoutUnit childMarginStart, RenderRegion* region)
</span><span class="cx"> {
</span><span class="cx"> LayoutUnit startPosition = startOffsetForContent(region);
</span><span class="lines">@@ -2381,8 +2375,6 @@
</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><span class="cx"> return RenderBox::avoidsFloats()
</span><del>- || !style().hasAutoColumnCount()
- || !style().hasAutoColumnWidth()
</del><span class="cx"> || style().hasFlowFrom();
</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 (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.h        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/Source/WebCore/rendering/RenderBlock.h        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -486,8 +486,6 @@
</span><span class="cx"> // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
</span><span class="cx"> virtual VisiblePosition positionForPointWithInlineChildren(const LayoutPoint&, const RenderRegion*);
</span><span class="cx">
</span><del>- bool expandsToEncloseOverhangingFloats() const;
-
</del><span class="cx"> RenderPtr<RenderBlock> clone() const;
</span><span class="cx"> RenderBlock* continuationBefore(RenderObject* beforeChild);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -72,10 +72,7 @@
</span><span class="cx"> {
</span><span class="cx"> const RenderStyle& blockStyle = block.style();
</span><span class="cx"> ASSERT(block.isRenderView() || block.parent());
</span><del>- m_canCollapseWithChildren = !block.isRenderView() && !block.isRoot() && !block.isOutOfFlowPositioned()
- && !block.isFloating() && !block.isTableCell() && !block.hasOverflowClip() && !block.isInlineBlockOrInlineTable()
- && !block.isRenderFlowThread() && !block.isWritingModeRoot() && !block.parent()->isFlexibleBox()
- && blockStyle.hasAutoColumnCount() && blockStyle.hasAutoColumnWidth() && !blockStyle.columnSpan();
</del><ins>+ m_canCollapseWithChildren = !block.createsNewFormattingContext() && !block.isRenderView();
</ins><span class="cx">
</span><span class="cx"> m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && !beforeBorderPadding && blockStyle.marginBeforeCollapse() != MSEPARATE;
</span><span class="cx">
</span><span class="lines">@@ -223,7 +220,7 @@
</span><span class="cx"> RenderBlockFlow& parentBlock = downcast<RenderBlockFlow>(*parent());
</span><span class="cx"> bool parentHasFloats = false;
</span><span class="cx"> RenderObject* prev = previousSibling();
</span><del>- while (prev && (prev->isFloatingOrOutOfFlowPositioned() || !is<RenderBox>(*prev) || !is<RenderBlockFlow>(*prev) || downcast<RenderBlockFlow>(*prev).avoidsFloats())) {
</del><ins>+ while (prev && (!is<RenderBox>(*prev) || !is<RenderBlockFlow>(*prev) || downcast<RenderBlockFlow>(*prev).avoidsFloats() || downcast<RenderBlock>(prev)->createsNewFormattingContext())) {
</ins><span class="cx"> if (prev->isFloating())
</span><span class="cx"> parentHasFloats = true;
</span><span class="cx"> prev = prev->previousSibling();
</span><span class="lines">@@ -474,7 +471,7 @@
</span><span class="cx">
</span><span class="cx"> // Expand our intrinsic height to encompass floats.
</span><span class="cx"> LayoutUnit toAdd = borderAndPaddingAfter() + scrollbarLogicalHeight();
</span><del>- if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEncloseOverhangingFloats())
</del><ins>+ if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && createsNewFormattingContext())
</ins><span class="cx"> setLogicalHeight(lowestFloatLogicalBottom() + toAdd);
</span><span class="cx">
</span><span class="cx"> if (relayoutForPagination(statePusher) || relayoutToAvoidWidows(statePusher)) {
</span><span class="lines">@@ -2079,7 +2076,7 @@
</span><span class="cx"> {
</span><span class="cx"> RenderBlock::computeOverflow(oldClientAfterEdge, recomputeFloats);
</span><span class="cx">
</span><del>- if (!multiColumnFlowThread() && (recomputeFloats || isRoot() || expandsToEncloseOverhangingFloats() || hasSelfPaintingLayer()))
</del><ins>+ if (!multiColumnFlowThread() && (recomputeFloats || createsNewFormattingContext() || hasSelfPaintingLayer()))
</ins><span class="cx"> addOverflowFromFloats();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2587,7 +2584,7 @@
</span><span class="cx"> LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow& child, bool makeChildPaintOtherFloats)
</span><span class="cx"> {
</span><span class="cx"> // Prevent floats from being added to the canvas by the root element, e.g., <html>.
</span><del>- if (child.hasOverflowClip() || !child.containsFloats() || child.isRoot() || child.isWritingModeRoot() || child.isRenderFlowThread() || child.isRenderRegion())
</del><ins>+ if (!child.containsFloats() || child.createsNewFormattingContext())
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><span class="cx"> LayoutUnit childLogicalTop = child.logicalTop();
</span><span class="lines">@@ -3077,7 +3074,7 @@
</span><span class="cx"> // A block without floats or that expands to enclose them won't need a relayout
</span><span class="cx"> // after a region range change. There is no overflow content needing relayout
</span><span class="cx"> // in the region chain because the region range can only shrink after the estimation.
</span><del>- if (!containsFloats() || expandsToEncloseOverhangingFloats())
</del><ins>+ if (!containsFloats() || createsNewFormattingContext())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> return true;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -4270,9 +4270,19 @@
</span><span class="cx"> return style().width().isAuto();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool RenderBox::createsNewFormattingContext() const
+{
+ return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated()
+ || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isRoot() || isRenderFlowThread() || isRenderRegion()
+#if ENABLE(CSS_GRID_LAYOUT)
+ || isGridItem()
+#endif
+ || style().specifiesColumns() || style().columnSpan();
+}
+
</ins><span class="cx"> bool RenderBox::avoidsFloats() const
</span><span class="cx"> {
</span><del>- return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritingModeRoot() || isFlexItemIncludingDeprecated();
</del><ins>+ return isReplaced() || isHR() || isLegend() || createsNewFormattingContext();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderBox::addVisualEffectOverflow()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (176956 => 176957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h        2014-12-08 18:50:39 UTC (rev 176956)
+++ trunk/Source/WebCore/rendering/RenderBox.h        2014-12-08 19:13:16 UTC (rev 176957)
</span><span class="lines">@@ -530,6 +530,10 @@
</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><ins>+#if ENABLE(CSS_GRID_LAYOUT)
+ bool isGridItem() const { return parent() && parent()->isRenderGrid(); }
+#endif
+
</ins><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">@@ -619,6 +623,8 @@
</span><span class="cx"> virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
</span><span class="cx"> virtual void updateFromStyle() override;
</span><span class="cx">
</span><ins>+ bool createsNewFormattingContext() const;
+
</ins><span class="cx"> // Returns false if it could not cheaply compute the extent (e.g. fixed background), in which case the returned rect may be incorrect.
</span><span class="cx"> bool getBackgroundPaintedExtent(LayoutRect&) const;
</span><span class="cx"> virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const;
</span></span></pre>
</div>
</div>
</body>
</html>