Commit 4d94240e authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Shrink columns after spanner in fixed-size multicol.

We had code for this, but it depended on nested multicol to work.

Bug: 829028
Change-Id: I114c0baa394f21005b1e83619db5a577eea1f913
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1944390Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720235}
parent 1d1d6aac
...@@ -373,9 +373,8 @@ scoped_refptr<const NGLayoutResult> NGColumnLayoutAlgorithm::LayoutRow( ...@@ -373,9 +373,8 @@ scoped_refptr<const NGLayoutResult> NGColumnLayoutAlgorithm::LayoutRow(
// If block-size is non-auto, subtract the space for content we've consumed in // If block-size is non-auto, subtract the space for content we've consumed in
// previous fragments. This is necessary when we're nested inside another // previous fragments. This is necessary when we're nested inside another
// fragmentation context. // fragmentation context.
if (is_constrained_by_outer_fragmentation_context_ && if (column_size.block_size != kIndefiniteSize) {
column_size.block_size != kIndefiniteSize) { if (BreakToken() && is_constrained_by_outer_fragmentation_context_)
if (BreakToken())
column_size.block_size -= BreakToken()->ConsumedBlockSize(); column_size.block_size -= BreakToken()->ConsumedBlockSize();
// Subtract the space already taken in the current fragment (spanners and // Subtract the space already taken in the current fragment (spanners and
......
...@@ -4856,6 +4856,47 @@ TEST_F(NGColumnLayoutAlgorithmTest, SpannerMarginsRtl) { ...@@ -4856,6 +4856,47 @@ TEST_F(NGColumnLayoutAlgorithmTest, SpannerMarginsRtl) {
EXPECT_EQ(expectation, dump); EXPECT_EQ(expectation, dump);
} }
TEST_F(NGColumnLayoutAlgorithmTest, FixedSizeMulticolWithSpanner) {
SetBodyInnerHTML(R"HTML(
<style>
#parent {
columns: 3;
column-gap: 10px;
column-fill: auto;
width: 320px;
height: 300px;
}
</style>
<div id="container">
<div id="parent">
<div style="width:33px; height:300px;"></div>
<div style="column-span:all; width:44px; height:50px;"></div>
<div style="width:55px; height:450px;"></div>
</div>
</div>
)HTML");
String dump = DumpFragmentTree(GetElementById("container"));
String expectation = R"DUMP(.:: LayoutNG Physical Fragment Tree ::.
offset:unplaced size:1000x300
offset:0,0 size:320x300
offset:0,0 size:100x100
offset:0,0 size:33x100
offset:110,0 size:100x100
offset:0,0 size:33x100
offset:220,0 size:100x100
offset:0,0 size:33x100
offset:0,100 size:44x50
offset:0,150 size:100x150
offset:0,0 size:55x150
offset:110,150 size:100x150
offset:0,0 size:55x150
offset:220,150 size:100x150
offset:0,0 size:55x150
)DUMP";
EXPECT_EQ(expectation, dump);
}
TEST_F(NGColumnLayoutAlgorithmTest, BreakInsideSpannerWithMargins) { TEST_F(NGColumnLayoutAlgorithmTest, BreakInsideSpannerWithMargins) {
SetBodyInnerHTML(R"HTML( SetBodyInnerHTML(R"HTML(
<style> <style>
......
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