[LFC][BFC][MarginCollapsing] Add "clear" to static position computation.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 16:50:18 +0000 (16:50 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 16:50:18 +0000 (16:50 +0000)
commit084149c3c6be94beec19642da6e7a8876cb5a85f
treea676fab3978cd9a46386495aaa1e19e2a18a0b43
parent1de349c27d95ebf04fa71d8b9dc4fac4d2e03f73
[LFC][BFC][MarginCollapsing] Add "clear" to static position computation.
https://bugs.webkit.org/show_bug.cgi?id=193824

Reviewed by Antti Koivisto.

Source/WebCore:

When clear property is set and floats are present, we have to estimate and set the box's vertical position during
static positioning to be able to properly layout its subtree.

<div style="float: left; width: 100px; height: 100px;"></div>
<div style="clear: left;">
  <div style="float: left; width: 100px; height: 100px;"></div>
</div>

In the above example since the second float's parent clears the first float, the second float is positioned below
the first float. If we didn't push down (clear) the box, the float child would get placed next to the first float.

* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layout const):
(WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
(WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
(WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition const):
(WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPositionForFloatClear const):
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
(WebCore::Layout::BlockFormattingContext::verticalPositionWithMargin const):
(WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const): Deleted.
(WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const): Deleted.
* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
* layout/displaytree/DisplayBox.h:

Tools:

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240475 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContext.h
Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp
Source/WebCore/layout/displaytree/DisplayBox.h
Tools/ChangeLog
Tools/LayoutReloaded/misc/LFC-passing-tests.txt