New issue
Advanced search Search tips

Issue 876749 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Nov 14
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

A fixed-layout table at 100% width expands to 800,000px when in a flex-flow: column wrap

Reported by lo...@hvst.com, Aug 22

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36

Example URL:
https://jsfiddle.net/zhv79eub/14/

Steps to reproduce the problem:
1. Have a flexbox container with `flex-flow: column wrap`.
2. Create multiple items such that a wrap occurs.
3. If one of the items is a div with a table which has `width: 100%` and `table-layout: fixed`, it will expand to become ~800,000px wide instead of a reasonable size.

What is the expected behavior?
From a UI perspective, the table should be a sane size - either the width of a single column prior to wrapping or however big it needs to be to fit the content (i.e., table-layout: auto).

What went wrong?
Each table grows to be enormous (800k pixels).

The table has a width of 100%, so it's possible there is some broken loop where the container's width is 'as big as needed' and each table effectively grows as large as it can before hitting some weird maximum?

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 67.0.3396.87  Channel: n/a
OS Version: 
Flash Version: Shockwave Flash 30.0 r0
 
In Firefox, the fiddle does not trigger this bug and the table appears to be a sane size.
Components: -Blink Blink>Layout>Flexbox
Cc: mstensho@chromium.org dgro...@chromium.org
I think Morten fixed something like this
This does sound somewhat familiar, especially the bogus table width.
tc.html
296 bytes View Download
The table sets its max intrinsic width to 1000000 (from kTableMaxWidth, I guess). That's as close to infinity as we get, and all browsers (except Presto) agrees on this IMHO weird behavior.
fixed-table-problem.html
244 bytes View Download
So.. in fixed-table-problem.html we're at least constrained by the containing block of the shrink to fit container, but there's no such thing inside a flexbox to save us.
Labels: Needs-Milestone
Labels: -Pri-2 Pri-3
Owner: mstensho@chromium.org
Status: Assigned (was: Unconfirmed)
Re comment #3: That must have been https://chromium-review.googlesource.com/c/chromium/src/+/1095220 - i.e.  bug 850566 .

In this case, though, I'm not sure if we want to prevent the table algorithm from propagating "infinite" values. The fix for  bug 850566  included changes for both flex and grid, and it would be natural to do the same in this case.

But it looks like at least for grid, all browsers end up with "infinite" wide items in such situations. For flex, both Edge and Firefox limit the width to the width of the flex container. Which looks pretty strange since there are multiple flex lines.

Attaching grid demo. Behaves identically in Chrome, Firefox and Edge.
demo-grid.html
284 bytes View Download
Cc: cbiesin...@chromium.org
Owner: ----
Status: Available (was: Assigned)
I won't be working on this any time soon, so unassigning.
I have a fix for flex, this is in fact a bug in our implementation.

Re "pretty strange", https://drafts.csswg.org/css-flexbox/#algo-cross-item requires laying this out as fit-content.
Project Member

Comment 12 by bugdroid1@chromium.org, Nov 12

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5918bde3b81e8d418ba290ad0df7a751601d56b7

commit 5918bde3b81e8d418ba290ad0df7a751601d56b7
Author: Christian Biesinger <cbiesinger@chromium.org>
Date: Mon Nov 12 21:57:41 2018

[css-flexbox] ChildIntrinsicLogicalWidth should use fit-content, not max-content

This function needs to match the actual sizing we use. But, since
this is the cross-axis size, we use fit-content:
https://drafts.csswg.org/css-flexbox/#algo-cross-item

See LayoutBox::SizesLogicalWidthToFitContent and LayoutBox::ComputeLogicalWidthUsing
for where we do that fit-content sizing; this code makes us
match the ComputeLogicalWidthUsing calculation.

This bug is currently somewhat hard to trigger because it requires
a combination of all of:
- flex-wrap: wrap
- flex-direction: column
- More than one flex line
- Not using align-items: flex-start or align-content: flex-start
- No explicit width on the flex item
- The max-content width needs to be larger than the width of flexbox

The reason this does not matter in other cases is because we only use
this function to set FlexLine::cross_axis_extent, which we overwrite in
AlignFlexLines if we only have one line. And if we do have more than
one line, we only use this value for aligning items and lines, so
it only matters if we don't use flex-start alignment.

This bug will be much easier to trigger once bug 599828 is fixed (there
are at least two real-world sites that are affected by this once
that bug is fixed)

Bug:  876749 
Change-Id: I673026bedfaf0e4c4a25830ef686b200ec8f54a1
Reviewed-on: https://chromium-review.googlesource.com/c/1327746
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607342}
[modify] https://crrev.com/5918bde3b81e8d418ba290ad0df7a751601d56b7/third_party/WebKit/LayoutTests/TestExpectations
[add] https://crrev.com/5918bde3b81e8d418ba290ad0df7a751601d56b7/third_party/WebKit/LayoutTests/external/wpt/css/css-flexbox/flex-wrap-002.html
[add] https://crrev.com/5918bde3b81e8d418ba290ad0df7a751601d56b7/third_party/WebKit/LayoutTests/external/wpt/css/css-flexbox/flex-wrap-003.html
[modify] https://crrev.com/5918bde3b81e8d418ba290ad0df7a751601d56b7/third_party/blink/renderer/core/layout/layout_flexible_box.cc

Status: Fixed (was: Available)
Testcase works in latest canary.

As per comment 9, for Grid we match the other browsers, and for Flex we do now too, so closing this.

Sign in to add a comment