Commit 209ad984 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

Handle multicol intrinsic inline-size changes.

This was broken both in legacy multicol and with
LayoutNGBlockFragmentation.

Legacy: We stored the intrinsic size in the column sets, in addition to
in the flow thread. There was no good reason for this, and it caused
trouble once something caused the intrinsic size of the multicol
container to change, since the column sets would never be marked dirty
again. Just set the intrinsic size of column sets to 0 to fix this.

LayoutNGBlockFragmentation: The flow thread is still created even if NG
block fragmentation is enabled, but the flow thread is invisible to NG,
so when calculating the intrinsic size of nodes in a subtree, we'll skip
the flow thread - which means that it will never be marked clean. Skip
to the containing block of the flow thread when marking preferred
logical widths dirty.

This fixes the remaining part of the demo in bug 1037790 - when trying
to reduce column-count to 1. Without this fix, the multicol container
would remain too wide.

Bug: 1037790
Change-Id: I89c7cbeb3132162b6c52ae30e98a0da21cd34ef1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1985770Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728401}
parent c8c971e5
...@@ -452,8 +452,7 @@ void LayoutMultiColumnSet::UpdateLayout() { ...@@ -452,8 +452,7 @@ void LayoutMultiColumnSet::UpdateLayout() {
void LayoutMultiColumnSet::ComputeIntrinsicLogicalWidths( void LayoutMultiColumnSet::ComputeIntrinsicLogicalWidths(
LayoutUnit& min_logical_width, LayoutUnit& min_logical_width,
LayoutUnit& max_logical_width) const { LayoutUnit& max_logical_width) const {
min_logical_width = flow_thread_->MinPreferredLogicalWidth(); max_logical_width = min_logical_width = LayoutUnit();
max_logical_width = flow_thread_->MaxPreferredLogicalWidth();
} }
void LayoutMultiColumnSet::ComputeLogicalHeight( void LayoutMultiColumnSet::ComputeLogicalHeight(
......
...@@ -1131,9 +1131,11 @@ static inline bool NGKeepInvalidatingBeyond(LayoutObject* o) { ...@@ -1131,9 +1131,11 @@ static inline bool NGKeepInvalidatingBeyond(LayoutObject* o) {
// next block container. // next block container.
// Atomic inlines do not have this problem as they are treated like blocks // Atomic inlines do not have this problem as they are treated like blocks
// in this context. // in this context.
// There's a similar issue for flow thread objects, as they are invisible to
// LayoutNG.
if (!RuntimeEnabledFeatures::LayoutNGEnabled()) if (!RuntimeEnabledFeatures::LayoutNGEnabled())
return false; return false;
if (o->IsLayoutInline() || o->IsText()) if (o->IsLayoutInline() || o->IsText() || o->IsLayoutFlowThread())
return true; return true;
return false; return false;
} }
......
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-multicol-1/#pseudo-algorithm">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1037790">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="columns:2; column-fill:auto; column-gap:0; width:fit-content; height:100px; background:red;">
<div id="firstChild" style="width:200px; height:100px; background:green;"></div>
<div style="width:50px; height:100px; background:green;"></div>
</div>
<script>
document.body.offsetTop;
firstChild.style.width = "50px";
</script>
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