12021-04-13 Rob Buis <rbuis@igalia.com>
2
3 Support contain: layout
4 https://bugs.webkit.org/show_bug.cgi?id=223569
5
6 Reviewed by NOBODY (OOPS!).
7
8 This patch implements layout containment as specified[1].
9 It adds shouldApplyLayoutContainment to check whether the
10 element applies for layout containment. Is so, then:
11 - an independent formatting context is established.
12 - any overflow is treated as ink overflow.
13 - an absolute positioning and fixed positioning
14 containing block is established.
15 - a stacking context is created.
16 - for baseline handling, the box is treated as having no
17 baseline. For grid/flexible box containers/items, this needs
18 a baseline synthesized from the border edges [2], for buttons it
19 requires a baseline synthesized from the margin edges [2, 3].
20
21 [1] https://drafts.csswg.org/css-contain-2/#layout-containment
22 [2] https://drafts.csswg.org/css-align-3/#synthesize-baseline
23 [3] https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align
24
25 * rendering/RenderBlock.cpp:
26 (WebCore::RenderBlock::firstLineBaseline const):
27 (WebCore::RenderBlock::inlineBlockBaseline const):
28 * rendering/RenderBlockFlow.cpp:
29 (WebCore::RenderBlockFlow::firstLineBaseline const):
30 (WebCore::RenderBlockFlow::inlineBlockBaseline const):
31 * rendering/RenderBox.cpp:
32 (WebCore::RenderBox::createsNewFormattingContext const):
33 (WebCore::RenderBox::layoutOverflowRectForPropagation const):
34 * rendering/RenderBox.h:
35 * rendering/RenderButton.cpp:
36 (WebCore::RenderButton::baselinePosition const):
37 * rendering/RenderElement.h:
38 (WebCore::RenderElement::canContainFixedPositionObjects const):
39 (WebCore::RenderElement::canContainAbsolutelyPositionedObjects const):
40 * rendering/RenderFlexibleBox.cpp:
41 (WebCore::RenderFlexibleBox::firstLineBaseline const):
42 * rendering/RenderGrid.cpp:
43 (WebCore::RenderGrid::firstLineBaseline const):
44 * rendering/RenderListBox.cpp:
45 (WebCore::RenderListBox::baselinePosition const):
46 * rendering/RenderObject.cpp:
47 (WebCore::objectIsRelayoutBoundary):
48 * rendering/RenderObject.h:
49 (WebCore::RenderObject::isAtomicInlineLevelBox const):
50 (WebCore::RenderObject::shouldApplyLayoutContainment const):
51 * rendering/RenderTable.cpp:
52 (WebCore::RenderTable::firstLineBaseline const):
53 * rendering/style/RenderStyle.h:
54 (WebCore::RenderStyle::containsLayout const):
55 * style/StyleAdjuster.cpp:
56 (WebCore::Style::Adjuster::adjust const):
57