Bug 140540 - [CSS Grid Layout] Tracks' growth limits must be >= base sizes
Summary: [CSS Grid Layout] Tracks' growth limits must be >= base sizes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sergio Villar Senin
URL:
Keywords:
Depends on: 140615
Blocks: 60731 140763
  Show dependency treegraph
 
Reported: 2015-01-16 02:42 PST by Sergio Villar Senin
Modified: 2015-02-09 03:34 PST (History)
14 users (show)

See Also:


Attachments
Patch (26.05 KB, patch)
2015-01-22 03:35 PST, Sergio Villar Senin
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio Villar Senin 2015-01-16 02:42:37 PST
I raised this issue to the www-list here https://lists.w3.org/Archives/Public/www-style/2015Jan/0041.html.

Summarizing, the current algorithm does not really enforce the condition of "base size <= growth limit". Not fulfilling it makes the algorithm produce invalid results as explained in the email. Using the example mentioned there:

    <div style="display: grid; grid-template-columns: minmax(40px, min-content) minmax(50px, max-content);">
        <div style="grid-column: 1 / -1;" id="item1"></div>
        <div style="grid-column: 1;" id="item2"></div>
        <div style="grid-column: 2;" id="item3"></div>
    </div>

    Let's use the following sizes (min-content,max-content) in pixels for
    the items:
        - item1: (40, 90)
        - item2: (10, 10)
        - item3: (10, 10)

The track sizing algorithm will generate the following outcome, for the (min,max) sizes of tracks:

    (40, 30) (50, 60)

which means that with enough space the grid will be 40+60 = 100px wide when it should be enough with 90px.
Comment 1 Sergio Villar Senin 2015-01-22 03:35:33 PST
Created attachment 245135 [details]
Patch
Comment 2 Sergio Villar Senin 2015-01-28 01:09:16 PST
Ping reviewers
Comment 3 Sergio Villar Senin 2015-02-02 00:05:55 PST
JFTR this is what the specs now say:

"If at this point any track’s growth limit is now less than its base size, increase its growth limit to match its base size."
Comment 4 Antti Koivisto 2015-02-09 03:07:11 PST
Comment on attachment 245135 [details]
Patch

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

> Source/WebCore/rendering/RenderGrid.cpp:47
> -        : m_usedBreadth(0)
> -        , m_maxBreadth(0)
> +        : m_baseSize(0)
> +        , m_growthLimit(0)

The fashionable approach is to initialize in the header:

LayoutUnit m_baseSize { 0 };
Comment 5 Sergio Villar Senin 2015-02-09 03:34:22 PST
Committed r179824: <http://trac.webkit.org/changeset/179824>