[LFC] Use the containing block's padding box to position out-of-flow elements.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2019 14:48:54 +0000 (14:48 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2019 14:48:54 +0000 (14:48 +0000)
commitb53847e566bd4e2a56976167f48e9ca91f272450
treeafce3c2f10c4c0bb56a49e77e64a3fc1e6eb336c
parentbd5a0950985177151baf7ce11a686d26601b9975
[LFC] Use the containing block's padding box to position out-of-flow elements.
https://bugs.webkit.org/show_bug.cgi?id=193431

Reviewed by Antti Koivisto.

Source/WebCore:

If the element has 'position: absolute', the containing block is established by the nearest ancestor
with a 'position' of 'absolute', 'relative' or 'fixed', in the following way:

1. In the case that the ancestor is an inline element, the containing block is the bounding box around the padding
boxes of the first and the last inline boxes generated for that element. In CSS 2.2, if the inline element is split
across multiple lines, the containing block is undefined.

2. Otherwise, the containing block is formed by the padding edge of the ancestor.

This patch covers #2.

Test: fast/block/block-only/out-of-flow-with-containing-block-border-padding.html

* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::width const):
(WebCore::Display::Box::height const):
(WebCore::Display::Box::contentBoxTop const):
(WebCore::Display::Box::contentBoxLeft const):
(WebCore::Display::Box::paddingBoxTop const):
(WebCore::Display::Box::paddingBoxLeft const):
(WebCore::Display::Box::paddingBoxBottom const):
(WebCore::Display::Box::paddingBoxRight const):
(WebCore::Display::Box::paddingBoxHeight const):
(WebCore::Display::Box::paddingBoxWidth const):
* page/FrameViewLayoutContext.cpp:
(WebCore::layoutUsingFormattingContext):

Tools:

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

LayoutTests:

* fast/block/block-only/out-of-flow-with-containing-block-border-padding-expected.txt: Added.
* fast/block/block-only/out-of-flow-with-containing-block-border-padding.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239983 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/block/block-only/out-of-flow-with-containing-block-border-padding-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/block-only/out-of-flow-with-containing-block-border-padding.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/layout/FormattingContextGeometry.cpp
Source/WebCore/layout/displaytree/DisplayBox.h
Tools/ChangeLog
Tools/LayoutReloaded/misc/LFC-passing-tests.txt