<!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>[167018] 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/167018">167018</a></dd>
<dt>Author</dt> <dd>stavila@adobe.com</dd>
<dt>Date</dt> <dd>2014-04-09 10:07:50 -0700 (Wed, 09 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Regions] Monolithic elements should not affect the layout of the content outside its region
https://bugs.webkit.org/show_bug.cgi?id=130499

Reviewed by David Hyatt.

Source/WebCore:

When performing layout on an element flowed into regions, its logical height must not be incremented
past the region's logical bottom for monolithic elements in regions different than the last region their containing
block is fragmented into. This ensures that the following elements are correctly laid out
from the top of the next region.
This change must also be applied to floats in order to prevent text from avoiding part
of a float that did not actually made it into the current region, but instead overflowed
the previous one.

Tests: fast/regions/fragmentation-after-float-overflow-single-region.html
       fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html
       fast/regions/fragmentation-after-monolithic-overflow-single-region.html
       fast/regions/fragmentation-after-monolithic-overflow.html

* rendering/FloatingObjects.cpp:
(WebCore::FloatingObjects::computePlacedFloatsTree):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutBlockChild):
(WebCore::RenderBlockFlow::adjustBlockChildForPagination):
(WebCore::RenderBlockFlow::lowestFloatLogicalBottom):
(WebCore::RenderBlockFlow::getClearDelta):
(WebCore::RenderBlockFlow::applyAfterBreak): Deleted.
(WebCore::RenderBlockFlow::nextFloatLogicalBottomBelow): Deleted.
(WebCore::RenderBlockFlow::nextFloatLogicalBottomBelowForBlock): Deleted.
(WebCore::RenderBlockFlow::flipFloatForWritingModeForChild): Deleted.
* rendering/RenderBlockFlow.h:
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::isBoxInDifferentRegionsAsFloat):
* rendering/RenderFlowThread.h:

LayoutTests:

Added tests for different types of fragmentation following monolithic content
overflowing its region.
Rebased the webkit-flow-float-unable-to-push test as its expected result was not the correct one.

* fast/regions/webkit-flow-float-unable-to-push-expected.html:
* fast/regions/fragmentation-after-float-overflow-single-region-expected.html: Added.
* fast/regions/fragmentation-after-float-overflow-single-region.html: Added.
* fast/regions/fragmentation-after-monolithic-overflow-expected.html: Added.
* fast/regions/fragmentation-after-monolithic-overflow-self-collapsed-expected.html: Added.
* fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html: Added.
* fast/regions/fragmentation-after-monolithic-overflow-single-region-expected.html: Added.
* fast/regions/fragmentation-after-monolithic-overflow-single-region.html: Added.
* fast/regions/fragmentation-after-monolithic-overflow.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastregionswebkitflowfloatunabletopushexpectedhtml">trunk/LayoutTests/fast/regions/webkit-flow-float-unable-to-push-expected.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkLayoutTestsfastregionsfragmentationafterfloatoverflowsingleregionexpectedhtml">trunk/LayoutTests/fast/regions/fragmentation-after-float-overflow-single-region-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsfragmentationafterfloatoverflowsingleregionhtml">trunk/LayoutTests/fast/regions/fragmentation-after-float-overflow-single-region.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowexpectedhtml">trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowselfcollapsedexpectedhtml">trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-self-collapsed-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowselfcollapsedhtml">trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowsingleregionexpectedhtml">trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-single-region-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowsingleregionhtml">trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-single-region.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowhtml">trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (167017 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-04-09 17:05:18 UTC (rev 167017)
+++ trunk/LayoutTests/ChangeLog        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-04-09  Radu Stavila  &lt;stavila@adobe.com&gt;
+
+        [CSS Regions] Monolithic elements should not affect the layout of the content outside its region
+        https://bugs.webkit.org/show_bug.cgi?id=130499
+
+        Reviewed by David Hyatt.
+
+        Added tests for different types of fragmentation following monolithic content
+        overflowing its region.
+        Rebased the webkit-flow-float-unable-to-push test as its expected result was not the correct one.
+
+        * fast/regions/webkit-flow-float-unable-to-push-expected.html:
+        * fast/regions/fragmentation-after-float-overflow-single-region-expected.html: Added.
+        * fast/regions/fragmentation-after-float-overflow-single-region.html: Added.
+        * fast/regions/fragmentation-after-monolithic-overflow-expected.html: Added.
+        * fast/regions/fragmentation-after-monolithic-overflow-self-collapsed-expected.html: Added.
+        * fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html: Added.
+        * fast/regions/fragmentation-after-monolithic-overflow-single-region-expected.html: Added.
+        * fast/regions/fragmentation-after-monolithic-overflow-single-region.html: Added.
+        * fast/regions/fragmentation-after-monolithic-overflow.html: Added.
+
</ins><span class="cx"> 2014-04-09  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r166853): fast/preloader/document-write.html is very flaky
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsfragmentationafterfloatoverflowsingleregionexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/fragmentation-after-float-overflow-single-region-expected.html (0 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/fragmentation-after-float-overflow-single-region-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/fragmentation-after-float-overflow-single-region-expected.html        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            .region {
+                width: 200px;
+                height: 200px;
+                border: thin solid black;
+                float: left;
+                margin: 10px;
+            }
+
+            #mono {
+                width: 150px;
+                height: 300px;
+                overflow: scroll;
+                background-color: green;
+                color: white;
+                float: left;
+            }
+
+            #after {
+                width: 150px;
+                background-color: blue;
+                color: white;
+                clear: left;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=130499&quot;&gt;Bug 130499 - [CSS Regions] Monolithic elements should not affect the layout of the content outside its region&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;The blue div should be positioned below the green float.&lt;/p&gt;
+
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;div id=&quot;mono&quot; class=&quot;flow&quot;&gt;MONOLITHIC FLOAT&lt;/div&gt;
+            &lt;div id=&quot;after&quot; class=&quot;flow&quot;&gt;AFTER - One one one one one one one one one one one one one one one one one&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsfragmentationafterfloatoverflowsingleregionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/fragmentation-after-float-overflow-single-region.html (0 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/fragmentation-after-float-overflow-single-region.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/fragmentation-after-float-overflow-single-region.html        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            .region {
+                width: 200px;
+                height: 200px;
+                border: thin solid black;
+                -webkit-flow-from: flow;
+                float: left;
+                margin: 10px;
+            }
+
+            #mono {
+                width: 150px;
+                height: 300px;
+                overflow: scroll;
+                background-color: green;
+                color: white;
+                float: left;
+            }
+
+            #after {
+                width: 150px;
+                background-color: blue;
+                color: white;
+                clear: left;
+            }
+
+            .flow {
+                -webkit-flow-into: flow;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=130499&quot;&gt;Bug 130499 - [CSS Regions] Monolithic elements should not affect the layout of the content outside its region&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;The blue div should be positioned below the green float.&lt;/p&gt;
+
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+
+        &lt;div id=&quot;mono&quot; class=&quot;flow&quot;&gt;MONOLITHIC FLOAT&lt;/div&gt;
+        
+        &lt;div id=&quot;after&quot; class=&quot;flow&quot;&gt;AFTER - One one one one one one one one one one one one one one one one one&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-expected.html (0 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-expected.html        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            .region {
+                width: 200px;
+                height: 200px;
+                border: thin solid black;
+                float: left;
+                margin: 10px;
+            }
+
+            #mono {
+                width: 150px;
+                height: 300px;
+                overflow: scroll;
+                background-color: green;
+                color: white;
+            }
+
+            #after {
+                width: 150px;
+                background-color: blue;
+                color: white;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=130499&quot;&gt;Bug 130499 - [CSS Regions] Monolithic elements should not affect the layout of the content outside its region&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;The blue div should be positioned at the very top of the 2nd region.&lt;/p&gt;
+
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;div id=&quot;mono&quot; class=&quot;flow&quot;&gt;MONOLITHIC&lt;/div&gt;
+        &lt;/div&gt;
+
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;div id=&quot;after&quot; class=&quot;flow&quot;&gt;AFTER - One one one one one one one one one one one one one one one one one&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowselfcollapsedexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-self-collapsed-expected.html (0 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-self-collapsed-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-self-collapsed-expected.html        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            .region {
+                width: 400px;
+                height: 200px;
+                border: thin solid black;
+                float: left;
+                margin: 10px;
+            }
+
+            #mono {
+                width: 150px;
+                height: 300px;
+                overflow: scroll;
+                background-color: green;
+                color: white;
+                float: left;
+            }
+
+            #mono2 {
+                width: 110px;
+                height: 250px;
+                overflow: scroll;
+                background-color: lightgreen;
+                color: black;
+                float: left;
+            }
+
+            #after {
+                width: 150px;
+                height: 0px;
+                background-color: red;
+                color: black;
+                clear: left;
+            }
+
+            #after2 {
+                width: 150px;
+                background-color: blue;
+                margin: 10px;
+                margin-top: 0px;
+                color: white;
+                clear: left;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=130499&quot;&gt;Bug 130499 - [CSS Regions] Monolithic elements should not affect the layout of the content outside its region&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;The blue div should be positioned at the top of the 2nd region. Above it is a red self-collapsing div, which should not be visible.&lt;/p&gt;
+
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;div id=&quot;mono&quot;&gt;MONOLITHIC FLOAT&lt;/div&gt;
+            &lt;div id=&quot;mono2&quot;&gt;MONOLITHIC FLOAT 2&lt;/div&gt;
+        &lt;/div&gt;
+
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;div id=&quot;after&quot;&gt;&lt;/div&gt;
+            &lt;div id=&quot;after2&quot;&gt;AFTER2 - One one one one one one one one one one one one one one one one one&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowselfcollapsedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html (0 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            .region {
+                width: 400px;
+                height: 200px;
+                border: thin solid black;
+                -webkit-flow-from: flow;
+                float: left;
+                margin: 10px;
+            }
+
+            #mono {
+                width: 150px;
+                height: 300px;
+                overflow: scroll;
+                background-color: green;
+                color: white;
+                float: left;
+            }
+
+            #mono2 {
+                width: 110px;
+                height: 250px;
+                overflow: scroll;
+                background-color: lightgreen;
+                color: black;
+                float: left;
+            }
+
+            #after {
+                width: 150px;
+                height: 0px;
+                background-color: red;
+                margin: 20px;
+                color: black;
+                clear: left;
+            }
+
+            #after2 {
+                width: 150px;
+                background-color: blue;
+                margin: 10px;
+                color: white;
+                clear: left;
+            }
+
+            .flow {
+                -webkit-flow-into: flow;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=130499&quot;&gt;Bug 130499 - [CSS Regions] Monolithic elements should not affect the layout of the content outside its region&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;The blue div should be positioned at the top of the 2nd region. Above it is a red self-collapsing div, which should not be visible.&lt;/p&gt;
+
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+
+        &lt;div id=&quot;mono&quot; class=&quot;flow&quot;&gt;MONOLITHIC FLOAT&lt;/div&gt;
+        &lt;div id=&quot;mono2&quot; class=&quot;flow&quot;&gt;MONOLITHIC FLOAT 2&lt;/div&gt;
+        
+        &lt;div id=&quot;after&quot; class=&quot;flow&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;after2&quot; class=&quot;flow&quot;&gt;AFTER2 - One one one one one one one one one one one one one one one one one&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowsingleregionexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-single-region-expected.html (0 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-single-region-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-single-region-expected.html        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            .region {
+                width: 200px;
+                height: 200px;
+                border: thin solid black;
+                float: left;
+                margin: 10px;
+            }
+
+            #mono {
+                margin-top: 50px;
+                margin-left: 20px;
+                width: 150px;
+                height: 300px;
+                overflow: scroll;
+                background-color: green;
+                color: white;
+            }
+
+            #after {
+                width: 150px;
+                background-color: blue;
+                color: white;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=130499&quot;&gt;Bug 130499 - [CSS Regions] Monolithic elements should not affect the layout of the content outside its region&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;The blue div should be positioned below the green div.&lt;/p&gt;
+
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;div id=&quot;mono&quot; class=&quot;flow&quot;&gt;MONOLITHIC&lt;/div&gt;
+            &lt;div id=&quot;after&quot; class=&quot;flow&quot;&gt;AFTER - One one one one one one one one one one one one one one one one one&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowsingleregionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-single-region.html (0 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-single-region.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow-single-region.html        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            .region {
+                width: 200px;
+                height: 200px;
+                border: thin solid black;
+                -webkit-flow-from: flow;
+                float: left;
+                margin: 10px;
+            }
+
+            #mono {
+                margin-top: 50px;
+                margin-left: 20px;
+                width: 150px;
+                height: 300px;
+                overflow: scroll;
+                background-color: green;
+                color: white;
+            }
+
+            #after {
+                width: 150px;
+                background-color: blue;
+                color: white;
+            }
+
+            .flow {
+                -webkit-flow-into: flow;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=130499&quot;&gt;Bug 130499 - [CSS Regions] Monolithic elements should not affect the layout of the content outside its region&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;The blue div should be positioned below the green div.&lt;/p&gt;
+
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+
+        &lt;div id=&quot;mono&quot; class=&quot;flow&quot;&gt;MONOLITHIC&lt;/div&gt;
+        
+        &lt;div id=&quot;after&quot; class=&quot;flow&quot;&gt;AFTER - One one one one one one one one one one one one one one one one one&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsfragmentationaftermonolithicoverflowhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow.html (0 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/fragmentation-after-monolithic-overflow.html        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            .region {
+                width: 200px;
+                height: 200px;
+                border: thin solid black;
+                -webkit-flow-from: flow;
+                float: left;
+                margin: 10px;
+            }
+
+            #mono {
+                width: 150px;
+                height: 300px;
+                overflow: scroll;
+                background-color: green;
+                color: white;
+            }
+
+            #after {
+                width: 150px;
+                background-color: blue;
+                color: white;
+            }
+
+            .flow {
+                -webkit-flow-into: flow;
+            }
+        &lt;/style&gt;
+    &lt;/head&gt;
+
+    &lt;body&gt;
+        &lt;p&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=130499&quot;&gt;Bug 130499 - [CSS Regions] Monolithic elements should not affect the layout of the content outside its region&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;The blue div should be positioned at the very top of the 2nd region.&lt;/p&gt;
+
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+
+        &lt;div id=&quot;mono&quot; class=&quot;flow&quot;&gt;MONOLITHIC&lt;/div&gt;
+        
+        &lt;div id=&quot;after&quot; class=&quot;flow&quot;&gt;AFTER - One one one one one one one one one one one one one one one one one&lt;/div&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionswebkitflowfloatunabletopushexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/regions/webkit-flow-float-unable-to-push-expected.html (167017 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/webkit-flow-float-unable-to-push-expected.html        2014-04-09 17:05:18 UTC (rev 167017)
+++ trunk/LayoutTests/fast/regions/webkit-flow-float-unable-to-push-expected.html        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -131,13 +131,6 @@
</span><span class="cx">         width: 130px;
</span><span class="cx">         height: 100px;
</span><span class="cx">     }
</span><del>-
-    #float2 {
-        float: right;
-        width: 34px;
-        height: 70px;
-        visibility: hidden;
-    }
</del><span class="cx"> &lt;/style&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;div&gt;
</span><span class="lines">@@ -155,8 +148,8 @@
</span><span class="cx">         &lt;div class=&quot;content&quot; id=&quot;content2&quot;&gt;
</span><span class="cx">             &lt;div class=&quot;first-box&quot; id=&quot;first-box2&quot;&gt;
</span><span class="cx">                 &lt;div class=&quot;second-box&quot; id=&quot;second-box2&quot;&gt;
</span><del>-                    &lt;div class=&quot;test_paragraph&quot; id=&quot;first-paragraph2&quot;&gt;region. &lt;img id=&quot;float2&quot; src=&quot;resources/transparent.png&quot;&gt;This line of text should not get out of the region. This line of text should not get out of the region.&lt;/div&gt;
-                    &lt;div class=&quot;test_paragraph&quot; id=&quot;second-paragraph2&quot;&gt;This line of text should not get out of the&lt;/div&gt;
</del><ins>+                    &lt;div class=&quot;test_paragraph&quot; id=&quot;first-paragraph2&quot;&gt;region. This line of text should not get out of the region. This line of text should not get out of the region.&lt;/div&gt;
+                    &lt;div class=&quot;test_paragraph&quot; id=&quot;second-paragraph2&quot;&gt;This line of text should not get out of the region. This line of&lt;/div&gt;
</ins><span class="cx">                 &lt;/div&gt;
</span><span class="cx">             &lt;/div&gt;
</span><span class="cx">         &lt;/div&gt;
</span><span class="lines">@@ -166,7 +159,7 @@
</span><span class="cx">         &lt;div class=&quot;content&quot; id=&quot;content3&quot;&gt;
</span><span class="cx">             &lt;div class=&quot;first-box&quot; id=&quot;first-box3&quot;&gt;
</span><span class="cx">                 &lt;div class=&quot;second-box&quot; id=&quot;second-box3&quot;&gt;
</span><del>-                    &lt;div class=&quot;test_paragraph&quot; id=&quot;first-paragraph3&quot;&gt;region. This line of text should not get out of the region. This line of text should not get out of the region. This line of text should not get out of the region.&lt;/div&gt;
</del><ins>+                    &lt;div class=&quot;test_paragraph&quot; id=&quot;first-paragraph3&quot;&gt;text should not get out of the region. This line of text should not get out of the region. This line of text should not get out of the region.&lt;/div&gt;
</ins><span class="cx">                     &lt;div class=&quot;test_paragraph&quot; id=&quot;second-paragraph3&quot;&gt;This line of text should not get out of the region.&lt;/div&gt;
</span><span class="cx">                 &lt;/div&gt;
</span><span class="cx">             &lt;/div&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167017 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-09 17:05:18 UTC (rev 167017)
+++ trunk/Source/WebCore/ChangeLog        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-04-09  Radu Stavila  &lt;stavila@adobe.com&gt;
+
+        [CSS Regions] Monolithic elements should not affect the layout of the content outside its region
+        https://bugs.webkit.org/show_bug.cgi?id=130499
+
+        Reviewed by David Hyatt.
+
+        When performing layout on an element flowed into regions, its logical height must not be incremented 
+        past the region's logical bottom for monolithic elements in regions different than the last region their containing
+        block is fragmented into. This ensures that the following elements are correctly laid out 
+        from the top of the next region.
+        This change must also be applied to floats in order to prevent text from avoiding part
+        of a float that did not actually made it into the current region, but instead overflowed
+        the previous one.
+
+        Tests: fast/regions/fragmentation-after-float-overflow-single-region.html
+               fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html
+               fast/regions/fragmentation-after-monolithic-overflow-single-region.html
+               fast/regions/fragmentation-after-monolithic-overflow.html
+
+        * rendering/FloatingObjects.cpp:
+        (WebCore::FloatingObjects::computePlacedFloatsTree):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::layoutBlockChild):
+        (WebCore::RenderBlockFlow::adjustBlockChildForPagination):
+        (WebCore::RenderBlockFlow::lowestFloatLogicalBottom):
+        (WebCore::RenderBlockFlow::getClearDelta):
+        (WebCore::RenderBlockFlow::applyAfterBreak): Deleted.
+        (WebCore::RenderBlockFlow::nextFloatLogicalBottomBelow): Deleted.
+        (WebCore::RenderBlockFlow::nextFloatLogicalBottomBelowForBlock): Deleted.
+        (WebCore::RenderBlockFlow::flipFloatForWritingModeForChild): Deleted.
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::isBoxInDifferentRegionsAsFloat):
+        * rendering/RenderFlowThread.h:
+
</ins><span class="cx"> 2014-04-09  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use std::array in AffineTransform, and get rid of setMatrix
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (167017 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-04-09 17:05:18 UTC (rev 167017)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -676,7 +676,7 @@
</span><span class="cx">     determineLogicalLeftPositionForChild(child, ApplyLayoutDelta);
</span><span class="cx"> 
</span><span class="cx">     // Update our height now that the child has been placed in the correct position.
</span><del>-    setLogicalHeight(logicalHeight() + logicalHeightForChild(child));
</del><ins>+    setLogicalHeight(logicalHeight() + logicalHeightForChildForFragmentation(child));
</ins><span class="cx">     if (mustSeparateMarginAfterForChild(child)) {
</span><span class="cx">         setLogicalHeight(logicalHeight() + marginAfterForChild(child));
</span><span class="cx">         marginInfo.clearMargin();
</span><span class="lines">@@ -1783,7 +1783,36 @@
</span><span class="cx">     return flowThread-&gt;pageRemainingLogicalHeightForOffset(offset, pageBoundaryRule);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+LayoutUnit RenderBlockFlow::logicalHeightForChildForFragmentation(const RenderBox&amp; child) const
+{
+    // This method is required because regions do not fragment monolithic elements but instead
+    // they let them overflow the region they flow in. This behaviour is different from the 
+    // multicol/printing implementations, which have not yet been updated to correctly handle
+    // monolithic elements.
+    // As a result, for the moment, this method will only be used for regions, the multicol and
+    // printing implementations will stick to the existing behaviour until their fragmentation
+    // implementation is updated to match the regions implementation.
+    if (!flowThreadContainingBlock() || !flowThreadContainingBlock()-&gt;isRenderNamedFlowThread())
+        return logicalHeightForChild(child);
</ins><span class="cx"> 
</span><ins>+    // For unsplittable elements, this method will just return the height of the element that
+    // fits into the current region, without the height of the part that overflows the region.
+    // This is done for all regions, except the last one because in that case, the logical
+    // height of the flow thread needs to also
+    if (!childBoxIsUnsplittableForFragmentation(child) || !pageLogicalHeightForOffset(logicalTopForChild(child)))
+        return logicalHeightForChild(child);
+
+    // If we're on the last page this block fragments to, the logical height of the flow thread must include
+    // the entire unsplittable child because any following children will not be moved to the next page
+    // so they will need to be laid out below the current unsplittable child.
+    LayoutUnit childLogicalTop = logicalTopForChild(child);
+    if (!hasNextPage(childLogicalTop))
+        return logicalHeightForChild(child);
+    
+    LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(childLogicalTop, ExcludePageBoundary);
+    return std::min(child.logicalHeight(), remainingLogicalHeight);
+}
+
</ins><span class="cx"> void RenderBlockFlow::layoutLineGridBox()
</span><span class="cx"> {
</span><span class="cx">     if (style().lineGrid() == RenderStyle::initialLineGrid()) {
</span><span class="lines">@@ -2297,7 +2326,7 @@
</span><span class="cx"> 
</span><span class="cx">         setLogicalTopForFloat(floatingObject, floatLogicalLocation.y());
</span><span class="cx"> 
</span><del>-        setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
</del><ins>+        setLogicalHeightForFloat(floatingObject, logicalHeightForChildForFragmentation(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
</ins><span class="cx"> 
</span><span class="cx">         m_floatingObjects-&gt;addPlacedObject(floatingObject);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (167017 => 167018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.h        2014-04-09 17:05:18 UTC (rev 167017)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h        2014-04-09 17:07:50 UTC (rev 167018)
</span><span class="lines">@@ -373,6 +373,7 @@
</span><span class="cx">     LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const;
</span><span class="cx">     LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const;
</span><span class="cx">     LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule = IncludePageBoundary) const;
</span><ins>+    LayoutUnit logicalHeightForChildForFragmentation(const RenderBox&amp; child) const;
</ins><span class="cx">     bool hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule = ExcludePageBoundary) const;
</span><span class="cx"> 
</span><span class="cx">     void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
</span></span></pre>
</div>
</div>

</body>
</html>