[LFC][Floating] Add support for negative clearance.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2018 02:59:51 +0000 (02:59 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2018 02:59:51 +0000 (02:59 +0000)
commitdcb6f0e0e209d9a92651fde23a7f3417108eb137
treeb7bc69603f87bf7eb46c10777309bad18dc3baf7
parent7fcf5d7c82452b026cae3dc9c83d268450d7203e
[LFC][Floating] Add support for negative clearance.
https://bugs.webkit.org/show_bug.cgi?id=188555

Reviewed by Simon Fraser.

Source/WebCore:

1. Compute clearance to avoid float(s) (border box needs to avoid floats)
2. Reset vertical margins to non-collapsed values.
4. Adjust clearance with the new margins.
5. Take the adjusted clearance and move the box vertically if needed.

Test: fast/block/block-only/margin-collapse-with-clearance.html

* layout/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
* layout/FloatingState.cpp:
(WebCore::Layout::FloatingState::FloatItem::FloatItem):
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::mapBoxToAncestor):
(WebCore::Layout::FormattingContext::mapTopLeftToAncestor):
(WebCore::Layout::FormattingContext::mapCoordinateToAncestor):
(WebCore::Layout::FormattingContext::mapToAncestor): Deleted.
* layout/FormattingContext.h:
* layout/LayoutUnits.h:
(WebCore::Layout::Position::Position):
(WebCore::Layout::Position::moveBy):
* layout/displaytree/DisplayBox.h:

Tools:

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

LayoutTests:

* fast/block/block-only/margin-collapse-with-clearance-expected.txt: Added.
* fast/block/block-only/margin-collapse-with-clearance.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/block/block-only/margin-collapse-with-clearance-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/block-only/margin-collapse-with-clearance.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/layout/FloatingContext.cpp
Source/WebCore/layout/FloatingState.cpp
Source/WebCore/layout/FormattingContext.cpp
Source/WebCore/layout/FormattingContext.h
Source/WebCore/layout/LayoutUnits.h
Source/WebCore/layout/displaytree/DisplayBox.h
Tools/ChangeLog
Tools/LayoutReloaded/misc/LFC-passing-tests.txt