Commit 253fa700 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[fieldset] Fix fieldsets within flex by disabling simplified pass.

When flex did a 2-pass layout (once to determine the intrinsic size, and
a followup to shrink - and the block-size changed, we'd just perform
a simplified layout pass.

The fieldset layout algorithm "stretches" its content to its block-size
upfront. Due to this using the simplified layout pass resulted in an
incorrect layout, never correctly sizing the anonymous fieldset content.

This patch disables the simplified layout pass for fieldsets.

Bug: 1149714
Change-Id: I454a65363c019240dd4b30531009a13e8b596ea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2544755Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828360}
parent e8691be5
......@@ -244,6 +244,11 @@ NGLayoutCacheStatus CalculateSizeBasedLayoutCacheStatusWithGeometry(
if (!node.IsBlockFlow() || node.IsLayoutNGCustom())
return NGLayoutCacheStatus::kNeedsLayout;
// Fieldsets stretch their content to the final block-size, which might
// affect scrollbars.
if (node.IsFieldsetContainer())
return NGLayoutCacheStatus::kNeedsLayout;
// Textfields are block-flow, but we can't apply simplified layout due to
// -internal-align-self-block.
// TODO(tkent): We could store a bit on the |NGLayoutResult| which
......
<!DOCTYPE html>
<div style="width: 100px; height: 100px; border: solid;">
<div style="overflow-y: scroll; max-height: 100%;">
<div style="height: 200px; background: green;"></div>
</div>
</div>
<!DOCTYPE html>
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1149714">
<link rel="match" href="fieldset-as-item-overflow-ref.html">
<meta name="assert" content="A fieldset element when flex-shrink is applied has scrollable overflow.">
<div style="display: flex; flex-direction: column; width: 100px; height: 100px; border: solid;">
<fieldset style="margin: 0; border: none; padding: 0; overflow-y: scroll; overflow-x: hidden; flex-grow: 1;">
<div style="height: 200px; background: green;"></div>
</fieldset>
</div>
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