Bug 140540

Summary: [CSS Grid Layout] Tracks' growth limits must be >= base sizes
Product: WebKit Reporter: Sergio Villar Senin <svillar>
Component: CSSAssignee: Sergio Villar Senin <svillar>
Severity: Normal CC: benjamin, cdumez, commit-queue, darin, dino, esprehn+autocc, glenn, hyatt, jfernandez, kling, koivisto, kondapallykalyan, rego, svillar
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 140615    
Bug Blocks: 60731, 140763    
Description Flags
Patch koivisto: review+

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>

    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]
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]

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>