Bug 191365

Summary: [css-grid] [css-flex] Width of table as grid/flex item is infinite when the sum of columns' width exceed 100%
Product: WebKit Reporter: Javier Fernandez <jfernandez>
Component: Layout and RenderingAssignee: Sergio Villar Senin <svillar>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, changseok, clopez, dino, esprehn+autocc, ews-watchlist, ggaren, glenn, jfernandez, kondapallykalyan, pdr, rego, simon.fraser, svillar, webkit-bug-importer, youennf, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.chromium.org/p/chromium/issues/detail?id=850566
https://bugs.webkit.org/show_bug.cgi?id=210103
Attachments:
Description Flags
Test case to reproduce the issue
none
Patch
none
Patch rego: review+

Description Javier Fernandez 2018-11-07 08:39:29 PST
Created attachment 354094 [details]
Test case to reproduce the issue

Steps to reproduce the problem:
1. Load the attached test case

What is the expected behavior?
The width of the columns (yellow and green boxes) should be just 1ch  

What went wrong?
The width of the columns are 999969 px.
Comment 1 Sergio Villar Senin 2020-05-21 07:14:55 PDT
Created attachment 399952 [details]
Patch
Comment 2 Sergio Villar Senin 2020-05-21 07:18:39 PDT
*** Bug 210103 has been marked as a duplicate of this bug. ***
Comment 3 Sergio Villar Senin 2020-05-21 07:19:05 PDT
Created attachment 399953 [details]
Patch

Improved ChangeLog
Comment 4 Manuel Rego Casasnovas 2020-05-21 07:28:54 PDT
Comment on attachment 399953 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=399953&action=review

r+

> Source/WebCore/ChangeLog:3
> +        [css-grid] width of table in a grid is incorrect when table cell has width:100%

This is also for flexbox, so please reword the title adding [css-flex] and mentioning flexbox too.

> Source/WebCore/rendering/AutoTableLayout.cpp:201
> +        // The max logical width of a table may be "infinity" (or tableMaxWidth, to
> +        // be more exact) if the sum of the columns' percentages is 100% or more,
> +        // AND there is at least one column that has a non-percentage-based positive
> +        // logical width. In such situations no table logical width will be large
> +        // enough to satisfy the constraint set by the contents. So the idea is to
> +        // use ~infinity to make sure we use all available size in the containing
> +        // block. However, this just doesn't work if this is a flex or grid item, so
> +        // disallow scaling in that case.

Nit: You don't need to wrap comments to 80 chars in WebKit.
Comment 5 Sergio Villar Senin 2020-05-21 07:37:04 PDT
Comment on attachment 399953 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=399953&action=review

Thanks!

>> Source/WebCore/ChangeLog:3
>> +        [css-grid] width of table in a grid is incorrect when table cell has width:100%
> 
> This is also for flexbox, so please reword the title adding [css-flex] and mentioning flexbox too.

Hmmm the bug was about grid and I marked the flex one as duplicate. I guess I could reword the title in the bug and the update this.

>> Source/WebCore/rendering/AutoTableLayout.cpp:201
>> +        // disallow scaling in that case.
> 
> Nit: You don't need to wrap comments to 80 chars in WebKit.

Yeah, it was the editor that formatted it like that. I'll expand it a bit.
Comment 6 Sergio Villar Senin 2020-05-21 07:45:25 PDT
Committed r261996: <https://trac.webkit.org/changeset/261996>
Comment 7 Radar WebKit Bug Importer 2020-05-21 07:46:16 PDT
<rdar://problem/63493063>