Title: [240145] trunk
Revision
240145
Author
[email protected]
Date
2019-01-18 06:39:58 -0800 (Fri, 18 Jan 2019)

Log Message

[LFC] Do not skip float boxes that are not part of the current formatting context when computing bottom.
https://bugs.webkit.org/show_bug.cgi?id=193562

Reviewed by Antti Koivisto.

Source/WebCore:

The current floating context's (float) boxes could belong to descendant formatting contexts.
We need to include them as well when computing height (bottom) (we essentially need to skip ancestor floats only).

<div id=container style="overflow: hidden"><div>foo<div style="float: left">bar</div></div></div>
While computing the height for "container", the float box needs to be taken into account even though
it is part of another (descendant) formatting context (the inline formatting context established by its parent div).

* layout/floats/FloatingState.cpp:
(WebCore::Layout::FloatingState::bottom const):
* layout/floats/FloatingState.h:
(WebCore::Layout::FloatingState::FloatItem::isDescendantOfFormattingRoot const):
(WebCore::Layout::FloatingState::FloatItem::inFormattingContext const): Deleted.

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240144 => 240145)


--- trunk/Source/WebCore/ChangeLog	2019-01-18 14:25:08 UTC (rev 240144)
+++ trunk/Source/WebCore/ChangeLog	2019-01-18 14:39:58 UTC (rev 240145)
@@ -1,5 +1,25 @@
 2019-01-18  Zalan Bujtas  <[email protected]>
 
+        [LFC] Do not skip float boxes that are not part of the current formatting context when computing bottom.
+        https://bugs.webkit.org/show_bug.cgi?id=193562
+
+        Reviewed by Antti Koivisto.
+
+        The current floating context's (float) boxes could belong to descendant formatting contexts.
+        We need to include them as well when computing height (bottom) (we essentially need to skip ancestor floats only).
+
+        <div id=container style="overflow: hidden"><div>foo<div style="float: left">bar</div></div></div>
+        While computing the height for "container", the float box needs to be taken into account even though
+        it is part of another (descendant) formatting context (the inline formatting context established by its parent div).
+
+        * layout/floats/FloatingState.cpp:
+        (WebCore::Layout::FloatingState::bottom const):
+        * layout/floats/FloatingState.h:
+        (WebCore::Layout::FloatingState::FloatItem::isDescendantOfFormattingRoot const):
+        (WebCore::Layout::FloatingState::FloatItem::inFormattingContext const): Deleted.
+
+2019-01-18  Zalan Bujtas  <[email protected]>
+
         [LFC][BFC] Check for inflow children while computing height for block formatting context roots.
         https://bugs.webkit.org/show_bug.cgi?id=193555
 

Modified: trunk/Source/WebCore/layout/floats/FloatingState.cpp (240144 => 240145)


--- trunk/Source/WebCore/layout/floats/FloatingState.cpp	2019-01-18 14:25:08 UTC (rev 240144)
+++ trunk/Source/WebCore/layout/floats/FloatingState.cpp	2019-01-18 14:39:58 UTC (rev 240145)
@@ -143,8 +143,8 @@
     // Cache the value if we end up calling it more frequently (and update it at append/remove).
     Optional<PositionInContextRoot> bottom;
     for (auto& floatItem : m_floats) {
-        // Ignore floats from other formatting contexts when the floating state is inherited.
-        if (!floatItem.inFormattingContext(formattingContextRoot))
+        // Ignore floats from ancestor formatting contexts when the floating state is inherited.
+        if (!floatItem.isDescendantOfFormattingRoot(formattingContextRoot))
             continue;
 
         if ((type == Clear::Left && !floatItem.isLeftPositioned())

Modified: trunk/Source/WebCore/layout/floats/FloatingState.h (240144 => 240145)


--- trunk/Source/WebCore/layout/floats/FloatingState.h	2019-01-18 14:25:08 UTC (rev 240144)
+++ trunk/Source/WebCore/layout/floats/FloatingState.h	2019-01-18 14:39:58 UTC (rev 240145)
@@ -71,7 +71,7 @@
         bool operator==(const Box& layoutBox) const { return m_layoutBox.get() == &layoutBox; }
 
         bool isLeftPositioned() const { return m_layoutBox->isLeftFloatingPositioned(); }
-        bool inFormattingContext(const Box&) const;
+        bool isDescendantOfFormattingRoot(const Box&) const;
 
         Display::Box::Rect rectWithMargin() const { return m_absoluteDisplayBox.rectWithMargin(); }
         PositionInContextRoot bottom() const { return { m_absoluteDisplayBox.bottom() }; }
@@ -115,10 +115,12 @@
     return bottom(formattingContextRoot, Clear::Both);
 }
 
-inline bool FloatingState::FloatItem::inFormattingContext(const Box& formattingContextRoot) const
+inline bool FloatingState::FloatItem::isDescendantOfFormattingRoot(const Box& formattingContextRoot) const
 {
     ASSERT(formattingContextRoot.establishesFormattingContext());
-    return &m_layoutBox->formattingContextRoot() == &formattingContextRoot;
+    if (!is<Container>(formattingContextRoot))
+        return false;
+    return m_layoutBox->isDescendantOf(downcast<Container>(formattingContextRoot));
 }
 
 }

Modified: trunk/Tools/ChangeLog (240144 => 240145)


--- trunk/Tools/ChangeLog	2019-01-18 14:25:08 UTC (rev 240144)
+++ trunk/Tools/ChangeLog	2019-01-18 14:39:58 UTC (rev 240145)
@@ -1,5 +1,14 @@
 2019-01-18  Zalan Bujtas  <[email protected]>
 
+        [LFC] Do not skip float boxes that are not part of the current formatting context when computing bottom.
+        https://bugs.webkit.org/show_bug.cgi?id=193562
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2019-01-18  Zalan Bujtas  <[email protected]>
+
         [LFC][BFC] Check for inflow children while computing height for block formatting context roots.
         https://bugs.webkit.org/show_bug.cgi?id=193555
 

Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (240144 => 240145)


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-18 14:25:08 UTC (rev 240144)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-18 14:39:58 UTC (rev 240145)
@@ -119,6 +119,7 @@
 fast/block/float/float-overhangs-root.html
 fast/block/float/float-with-anonymous-previous-sibling.html
 fast/block/float/floats-not-cleared-crash.html
+fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html
 fast/block/margin-collapse/002.html
 fast/block/margin-collapse/003.html
 fast/block/margin-collapse/026.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to