Title: [177308] trunk
Revision
177308
Author
[email protected]
Date
2014-12-15 13:07:30 -0800 (Mon, 15 Dec 2014)

Log Message

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 <[email protected]>

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (177307 => 177308)


--- trunk/LayoutTests/ChangeLog	2014-12-15 20:45:53 UTC (rev 177307)
+++ trunk/LayoutTests/ChangeLog	2014-12-15 21:07:30 UTC (rev 177308)
@@ -1,3 +1,18 @@
+2014-12-15  Javier Fernandez  <[email protected]>
+
+        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 <[email protected]>
+
+        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.
+
 2014-12-15  Myles C. Maxfield  <[email protected]>
 
         Delete Notation because we don't use it

Added: trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context-expected.txt (0 => 177308)


--- 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)
@@ -0,0 +1,11 @@
+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

Added: trunk/LayoutTests/fast/block/float/floats-do-not-overhang-from-block-formatting-context.html (0 => 177308)


--- 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)
@@ -0,0 +1,74 @@
+<!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=""
+<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>

Modified: trunk/Source/WebCore/ChangeLog (177307 => 177308)


--- 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)
@@ -1,3 +1,31 @@
+2014-12-15  Javier Fernandez  <[email protected]>
+
+        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 <[email protected]>
+
+        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):
+
 2014-12-15  Myles C. Maxfield  <[email protected]>
 
         Unreviewed build fix after r177301

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (177307 => 177308)


--- 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)
@@ -2668,6 +2668,10 @@
 {
     ASSERT(!avoidsFloats());
 
+    // 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;
+
     // If the parent or previous sibling doesn't have any floats to add, don't bother.
     if (!prev->m_floatingObjects)
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to