No subject
Fri Mar 7 15:32:22 PST 2014
Source/WebCore:
Floats Don't Overhang Their Block Formatting Context Per
http://www.w3.org/TR/CSS2/visuren.html#float-position: "References
to [the elements] in the [rules that govern the behaviour of
floats] refer only to other elements in the same block formatting
context as the float."
This means we don't need to look for intruding or overhanging
floats in boxes that establish a new block formatting
context. Even that we don't have a test breaking this rule it
seems we are doing unnecessary work in
rebuildFloatsFromIntruding() so make sure we avoid adding floats
from different block formatting contexts.
Test:
fast/block/float/floats-do-not-overhang-from-block-formatting-context.html
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::addIntrudingFloats):
LayoutTests:
Tests to verify that float elements don't overhang blocks with a
different formatting context.
* fast/block/float/floats-do-not-overhang-from-block-formatting-context-expected.txt: Added.
* fast/block/float/floats-do-not-overhang-from-block-formatting-context.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowcpp">trunk/Source/WebCore/rendering/RenderBlockFlow.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastblockfloatfloatsdonotoverhangfromblockformattingcontextexpectedtxt">trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastblockfloatfloatsdonotoverhangfromblockformattingcontexthtml">trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (177307 => 177308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog 2014-12-15 20:45:53 UTC (rev 177307)
+++ trunk/LayoutTests/ChangeLog 2014-12-15 21:07:30 UTC (rev 177308)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-12-15 Javier Fernandez <jfernandez at igalia.com>
+
+ Floats Don't Overhang Their Block Formatting Contex
+ https://bugs.webkit.org/show_bug.cgi?id=139476
+
+ Reviewed by David Hyatt.
+
+ From Blink r172530 by <robhogan at gmail.com>
+
+ Tests to verify that float elements don't overhang blocks with a
+ different formatting context.
+
+ * fast/block/float/floats-do-not-overhang-from-block-formatting-context-expected.txt: Added.
+ * fast/block/float/floats-do-not-overhang-from-block-formatting-context.html: Added.
+
</ins><span class="cx"> 2014-12-15 Myles C. Maxfield <mmaxfield at apple.com>
</span><span class="cx">
</span><span class="cx"> Delete Notation because we don't use it
</span></span></pre></div>
<a id="trunkLayoutTestsfastblockfloatfloatsdonotoverhangfromblockformattingcontextexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context-expected.txt (0 => 177308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context-expected.txt 2014-12-15 21:07:30 UTC (rev 177308)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+http://www.w3.org/TR/CSS2/visuren.html#float-position: "References to [the elements] in the [rules that govern the behaviour of floats] refer only to other elements in the same block formatting context as the float."
+ PASS
+
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastblockfloatfloatsdonotoverhangfromblockformattingcontexthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context.html (0 => 177308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context.html (rev 0)
+++ trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context.html 2014-12-15 21:07:30 UTC (rev 177308)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+<!DOCTYPE HTML>
+<html>
+<style>
+body {
+ margin: 0px;
+ padding: 0px;
+}
+.item {
+ height: 40px;
+ width: 40px;
+}
+fieldset {
+ border: 0px;
+ padding: 0px;
+ margin: 0px;
+}
+.test {
+ width: 40px;
+ height:40px;
+ background-color: red;
+}
+.container {
+ position: relative;
+ margin: 0px;
+ padding: 0px;
+}
+.float {
+ float: left;
+ width: 40px;
+ height:80px;
+ background-color: blue;
+}
+</style>
+<script src="../../../resources/check-layout.js"></script>
+<body onload="checkLayout('.test')">
+http://www.w3.org/TR/CSS2/visuren.html#float-position:
+"References to [the elements] in the [rules that govern the behaviour of floats] refer only to other elements in the same block formatting context as the float."
+<br>
+<div class="container">
+ <div class="item" style="display: inline-block;"><div class="float"></div></div>
+ <div class="test" data-total-x=0></div>
+</div>
+<div class="container">
+ <div class="item" style="display: inline-table;"><div class="float"></div></div>
+ <div class="test" data-total-x=0></div>
+</div>
+<div class="container">
+ <div class="item" style="display: table-caption;"><div class="float"></div></div>
+ <div class="test" data-total-x=0 data-offset-y=40></div>
+</div>
+<div class="container">
+ <div class="item" style="overflow:hidden;"><div class="float"></div></div>
+ <div class="test" data-total-x=0 data-offset-y=40></div>
+</div>
+<div class="container">
+ <div class="item" style="-webkit-columns: 10px 2;"><div class="float"></div></div>
+ <div class="test" data-total-x=0 data-offset-y=40></div>
+</div>
+<div class="container">
+ <div class="item" style="-webkit-column-span: all;"><div class="float"></div></div>
+ <div class="test" data-total-x=0 data-offset-y=40></div>
+</div>
+<div class="container">
+ <div style="display: flex; -webkit-flex-direction: column;">
+ <div class="item"><div class="float"></div></div>
+ <div class="test" data-total-x=0 data-offset-y=40></div>
+ </div>
+</div>
+<div class="container">
+ <fieldset class="item"><div class="float"></div></fieldset>
+ <div class="test" data-total-x=0 data-offset-y=40></div>
+</div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177307 => 177308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog 2014-12-15 20:45:53 UTC (rev 177307)
+++ trunk/Source/WebCore/ChangeLog 2014-12-15 21:07:30 UTC (rev 177308)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2014-12-15 Javier Fernandez <jfernandez at igalia.com>
+
+ Floats Don't Overhang Their Block Formatting Contex
+ https://bugs.webkit.org/show_bug.cgi?id=139476
+
+ Reviewed by David Hyatt.
+
+ From Blink r172530 by <robhogan at gmail.com>
+
+ Floats Don't Overhang Their Block Formatting Context Per
+ http://www.w3.org/TR/CSS2/visuren.html#float-position: "References
+ to [the elements] in the [rules that govern the behaviour of
+ floats] refer only to other elements in the same block formatting
+ context as the float."
+
+ This means we don't need to look for intruding or overhanging
+ floats in boxes that establish a new block formatting
+ context. Even that we don't have a test breaking this rule it
+ seems we are doing unnecessary work in
+ rebuildFloatsFromIntruding() so make sure we avoid adding floats
+ from different block formatting contexts.
+
+ Test:
+ fast/block/float/floats-do-not-overhang-from-block-formatting-context.html
+
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::addIntrudingFloats):
+
</ins><span class="cx"> 2014-12-15 Myles C. Maxfield <mmaxfield at apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed build fix after r177301
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (177307 => 177308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-12-15 20:45:53 UTC (rev 177307)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-12-15 21:07:30 UTC (rev 177308)
</span><span class="lines">@@ -2668,6 +2668,10 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!avoidsFloats());
</span><span class="cx">
</span><ins>+ // If we create our own block formatting context then our contents don't interact with floats outside it, even those from our parent.
+ if (createsNewFormattingContext())
+ return;
+
</ins><span class="cx"> // If the parent or previous sibling doesn't have any floats to add, don't bother.
</span><span class="cx"> if (!prev->m_floatingObjects)
</span><span class="cx"> return;
</span></span></pre>
</div>
</div>
</body>
</html>
More information about the webkit-changes
mailing list