Source/WebCore:
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Aug 2018 14:44:59 +0000 (14:44 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Aug 2018 14:44:59 +0000 (14:44 +0000)
commit9f734bdecd3c21c64aa45613d5dd8d6b84dfbd3b
treea1cf6fdb316c59948e5daa0573e1092777767c38
parentc7ec74b448d81fc56b631e45c45bb596a992b5f4
Source/WebCore:
[LFC][Floating] Block formatting context roots avoid floats.
https://bugs.webkit.org/show_bug.cgi?id=189150

Reviewed by Antti Koivisto.

This patch implements the float avoiding behaviour for block formatting context roots.

When a box establishes a block formatting context, floats from outside of the context can't interfere with content inside. In order
to achive this, such formatting root boxes need to be positioned so that they don't overlap with floats (floats that share the same
context with the formatting root). In ltr block direction, roots start with avoiding floats on the left, while in rtl on the right.

Tests: fast/block/block-only/float-avoider-multiple-roots.html
       fast/block/block-only/float-avoider-simple-left.html
       fast/block/block-only/float-avoider-simple-right.html
       fast/block/block-only/float-avoider-with-margins.html

* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
(WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const):
(WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
* layout/blockformatting/BlockFormattingContext.h:
* layout/floats/FloatAvoider.cpp:
(WebCore::Layout::FloatAvoider::FloatAvoider):
* layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::positionForFloatAvoiding const):
* layout/floats/FloatingContext.h:

Tools:
[LFC][Floating] Formatting context roots avoid floats.
https://bugs.webkit.org/show_bug.cgi?id=189150

Reviewed by Antti Koivisto.

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

LayoutTests:
[LFC][Floating] Formatting context roots avoid floats.
https://bugs.webkit.org/show_bug.cgi?id=189150

Reviewed by Antti Koivisto.

* fast/block/block-only/float-avoider-multiple-roots-expected.txt: Added.
* fast/block/block-only/float-avoider-multiple-roots.html: Added.
* fast/block/block-only/float-avoider-simple-left-expected.txt: Added.
* fast/block/block-only/float-avoider-simple-left.html: Added.
* fast/block/block-only/float-avoider-simple-right-expected.txt: Added.
* fast/block/block-only/float-avoider-simple-right.html: Added.
* fast/block/block-only/float-avoider-with-margins-expected.txt: Added.
* fast/block/block-only/float-avoider-with-margins.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/block/block-only/float-avoider-multiple-roots-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/block-only/float-avoider-multiple-roots.html [new file with mode: 0644]
LayoutTests/fast/block/block-only/float-avoider-simple-left-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/block-only/float-avoider-simple-left.html [new file with mode: 0644]
LayoutTests/fast/block/block-only/float-avoider-simple-right-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/block-only/float-avoider-simple-right.html [new file with mode: 0644]
LayoutTests/fast/block/block-only/float-avoider-with-margins-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/block-only/float-avoider-with-margins.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContext.h
Source/WebCore/layout/floats/FloatAvoider.cpp
Source/WebCore/layout/floats/FloatingContext.cpp
Source/WebCore/layout/floats/FloatingContext.h
Tools/ChangeLog
Tools/LayoutReloaded/misc/LFC-passing-tests.txt