Commit c9fdf504 authored by Alison Maher's avatar Alison Maher Committed by Commit Bot

[LayoutNG] Delay layout of OOF elements inside a nested fragmentainer

Currently, we wait to layout fragmented OOF elements until they've
reached the fragmentation context root. In the case of nested
fragmentation, we need to wait until that fragmentation context
root has finished layout to ensure that the containing block has
also finished layout.

This change delays layout of fragmented OOF elements until we've
reached a fragmentation context root that is not itself fragmented.
This results in OOF elements being added as children to the outermost
fragmentainer that it is found in rather than the innermost.

We will need to bubble up some extra information about the innermost
fragmentainer in order to properly position the OOF elements. This
will be done in a follow-up CL.

Bug: 1079031
Change-Id: Ia2d5ed3af2a99f5c091d1cd9c399cc34bc580038
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2462048
Commit-Queue: Alison Maher <almaher@microsoft.com>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815698}
parent 568b4fff
...@@ -129,6 +129,7 @@ NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart( ...@@ -129,6 +129,7 @@ NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart(
void NGOutOfFlowLayoutPart::Run(const LayoutBox* only_layout) { void NGOutOfFlowLayoutPart::Run(const LayoutBox* only_layout) {
if (container_builder_->IsBlockFragmentationContextRoot() && if (container_builder_->IsBlockFragmentationContextRoot() &&
!container_space_.HasBlockFragmentation() &&
container_builder_->HasOutOfFlowFragmentainerDescendants()) { container_builder_->HasOutOfFlowFragmentainerDescendants()) {
Vector<NGLogicalOutOfFlowPositionedNode> fragmentainer_descendants; Vector<NGLogicalOutOfFlowPositionedNode> fragmentainer_descendants;
container_builder_->SwapOutOfFlowFragmentainerDescendants( container_builder_->SwapOutOfFlowFragmentainerDescendants(
......
...@@ -1247,5 +1247,65 @@ TEST_F(NGOutOfFlowLayoutPartTest, ...@@ -1247,5 +1247,65 @@ TEST_F(NGOutOfFlowLayoutPartTest,
EXPECT_EQ(expectation, dump); EXPECT_EQ(expectation, dump);
} }
// Fragmented OOF element inside a nested multi-column.
TEST_F(NGOutOfFlowLayoutPartTest, AbsposNestedFragmentation) {
SetBodyInnerHTML(
R"HTML(
<style>
.multicol {
columns:2; column-fill:auto; column-gap:0px;
}
.rel {
position: relative; width:55px;
}
.abs {
position:absolute; top:0px; bottom:0px; width:5px;
}
</style>
<div id="container">
<div class="multicol" id="outer" style="height:100px;">
<div style="height:40px; width:40px;"></div>
<div class="multicol" id="inner">
<div class="rel">
<div class="abs"></div>
<div style="height:250px; width:25px;"></div>
</div>
</div>
</div>
</div>
)HTML");
String dump = DumpFragmentTree(GetElementById("container"));
// TODO(almaher): There should be two abspos fragments with height 60 in the
// first outer column, and two with height 100/30 in the second outer column.
// There should not be a third outer column.
String expectation = R"DUMP(.:: LayoutNG Physical Fragment Tree ::.
offset:unplaced size:1000x100
offset:0,0 size:1000x100
offset:0,0 size:500x100
offset:0,0 size:40x40
offset:0,40 size:500x60
offset:0,0 size:250x60
offset:0,0 size:55x60
offset:0,0 size:25x60
offset:250,0 size:250x60
offset:0,0 size:55x60
offset:0,0 size:25x60
offset:0,40 size:5x60
offset:500,0 size:500x100
offset:0,0 size:500x100
offset:0,0 size:250x100
offset:0,0 size:55x100
offset:0,0 size:25x100
offset:250,0 size:250x100
offset:0,0 size:55x30
offset:0,0 size:25x30
offset:0,0 size:5x100
offset:1000,0 size:500x100
offset:0,0 size:5x90
)DUMP";
EXPECT_EQ(expectation, dump);
}
} // namespace } // namespace
} // namespace blink } // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment