Changeset 178577 in webkit


Ignore:
Timestamp:
Jan 16, 2015 2:22:45 AM (9 years ago)
Author:
svillar@igalia.com
Message:

[CSS Grid Layout] Tracks shrink sometimes with indefinite remaining space
https://bugs.webkit.org/show_bug.cgi?id=139059

Reviewed by David Hyatt.

Source/WebCore:

Test: fast/css-grid-layout/grid-grow-tracks-to-their-max.html

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::computeUsedBreadthOfGridTracks):

LayoutTests:

The third step of the grid track sizing algorithm (method
ComputeUsedBreadthOfGridTracks in the old specs version of the
algorithm) tries to grow all grid tracks until the remaining space
is exhausted. Should the remaining space is undefined we should fill
the tracks up to their limits. This is specified in pseudocode like
this:

For each Grid track t in GridTracks

t.UsedBreadth = t.MaxBreadth

That's correct for most of the cases, but it becomes
wrong whenever t.UsedBreadth > t.MaxBreadth something that is not
incorrect. What we actually want to do is to grow the track to its
maximum if and only if the used breadth is smaller than the maximum.

due to another bug (wkb.ug/139058).

  • fast/css-grid-layout/grid-auto-columns-rows-update.html:
  • fast/css-grid-layout/grid-content-sized-columns-resolution-expected.txt:
  • fast/css-grid-layout/grid-content-sized-columns-resolution.html:
  • fast/css-grid-layout/grid-grow-tracks-to-their-max-expected.txt: Added.
  • fast/css-grid-layout/grid-grow-tracks-to-their-max.html: Added.
  • fast/css-grid-layout/grid-item-removal-track-breadth-update.html:
  • fast/css-grid-layout/minmax-max-content-resolution-rows.html:
  • fast/css-grid-layout/minmax-min-content-column-resolution-rows.html:
  • fast/css-grid-layout/percent-of-indefinite-track-size-in-auto.html:
  • fast/css-grid-layout/percent-of-indefinite-track-size.html:
Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r178574 r178577  
     12014-11-26  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [CSS Grid Layout] Tracks shrink sometimes with indefinite remaining space
     4        https://bugs.webkit.org/show_bug.cgi?id=139059
     5
     6        Reviewed by David Hyatt.
     7
     8        The third step of the grid track sizing algorithm (method
     9        ComputeUsedBreadthOfGridTracks in the old specs version of the
     10        algorithm) tries to grow all grid tracks until the remaining space
     11        is exhausted. Should the remaining space is undefined we should fill
     12        the tracks up to their limits. This is specified in pseudocode like
     13        this:
     14
     15            For each Grid track t in GridTracks
     16                t.UsedBreadth = t.MaxBreadth
     17
     18        That's correct for most of the cases, but it becomes
     19        wrong whenever t.UsedBreadth > t.MaxBreadth something that is not
     20        incorrect. What we actually want to do is to grow the track to its
     21        maximum if and only if the used breadth is smaller than the maximum.
     22
     23        * TestExpectations: Added a test which is correct but starts to fail
     24        due to another bug (wkb.ug/139058).
     25        * fast/css-grid-layout/grid-auto-columns-rows-update.html:
     26        * fast/css-grid-layout/grid-content-sized-columns-resolution-expected.txt:
     27        * fast/css-grid-layout/grid-content-sized-columns-resolution.html:
     28        * fast/css-grid-layout/grid-grow-tracks-to-their-max-expected.txt: Added.
     29        * fast/css-grid-layout/grid-grow-tracks-to-their-max.html: Added.
     30        * fast/css-grid-layout/grid-item-removal-track-breadth-update.html:
     31        * fast/css-grid-layout/minmax-max-content-resolution-rows.html:
     32        * fast/css-grid-layout/minmax-min-content-column-resolution-rows.html:
     33        * fast/css-grid-layout/percent-of-indefinite-track-size-in-auto.html:
     34        * fast/css-grid-layout/percent-of-indefinite-track-size.html:
     35
    1362015-01-15  Zalan Bujtas  <zalan@apple.com>
    237
  • trunk/LayoutTests/TestExpectations

    r178386 r178577  
    456456
    457457webkit.org/b/140309 css3/background/background-repeat-space-content.html [ ImageOnlyFailure ]
     458
     459webkit.org/b/139058 fast/css-grid-layout/flex-and-minmax-content-resolution-rows.html [ Failure ]
  • trunk/LayoutTests/fast/css-grid-layout/grid-auto-columns-rows-update.html

    r174057 r178577  
    4444    updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(20em, 15px)', 'columns': '50px' }, { 'width': '50px', 'height': '200px' });
    4545    updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(20em, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '100px', 'height': '200px' });
    46     updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(-webkit-min-content, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '100px', 'height': '15px' });
     46    updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(-webkit-min-content, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '100px', 'height': '20px' });
    4747    updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(-webkit-min-content, 15px)', 'columns': 'minmax(10%, -webkit-max-content)' }, { 'width': '120px', 'height': '15px' });
    4848    updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(-webkit-min-content, 15px)', 'columns': 'minmax(10%, -webkit-max-content)' }, { 'width': '120px', 'height': '15px' });
     
    5353    updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(20em, 15px)', 'columns': '50px' }, { 'width': '50px', 'height': '200px' });
    5454    updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(20em, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '1px', 'height': '200px' });
    55     updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(-webkit-min-content, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '1px', 'height': '15px' });
     55    updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(-webkit-min-content, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '1px', 'height': '20px' });
    5656    updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(-webkit-min-content, 15px)', 'columns': 'minmax(-webkit-max-content, 100px)' }, { 'width': '120px', 'height': '15px' });
    5757    updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(40em, 15px)', 'columns': 'minmax(-webkit-max-content, 100px)' }, { 'width': '120px', 'height': '400px' });
  • trunk/LayoutTests/fast/css-grid-layout/grid-content-sized-columns-resolution-expected.txt

    r174643 r178577  
    1414PASS window.getComputedStyle(gridMaxContentFixedAndAutoAboveLimits, '').getPropertyValue('-webkit-grid-template-columns') is "65px 85px"
    1515PASS window.getComputedStyle(gridMinContentFixedAndFixedFixedAndAuto, '').getPropertyValue('-webkit-grid-template-columns') is "20px 20px 60px"
    16 PASS window.getComputedStyle(gridAutoAndFixedFixedAndMaxContentFixed, '').getPropertyValue('-webkit-grid-template-columns') is "40px 20px 90px"
     16PASS window.getComputedStyle(gridAutoAndFixedFixedAndMaxContentFixed, '').getPropertyValue('-webkit-grid-template-columns') is "70px 20px 60px"
    1717PASS successfullyParsed is true
    1818
  • trunk/LayoutTests/fast/css-grid-layout/grid-content-sized-columns-resolution.html

    r174643 r178577  
    155155testGridColumnsValues("gridMaxContentFixedAndAutoAboveLimits", "65px 85px");
    156156testGridColumnsValues("gridMinContentFixedAndFixedFixedAndAuto", "20px 20px 60px");
    157 testGridColumnsValues("gridAutoAndFixedFixedAndMaxContentFixed", "40px 20px 90px");
     157testGridColumnsValues("gridAutoAndFixedFixedAndMaxContentFixed", "70px 20px 60px");
    158158</script>
    159159</body>
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-removal-track-breadth-update.html

    r168416 r178577  
    8181    testRemoval("unconstrainedAutoGrid", { 'width': '390', 'height': '10' }, { 'width': '350', 'height': '10' }, { 'width': '170', 'height': '10' });
    8282    testRemoval("unconstrainedMinContentFixedGrid", { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '40' });
    83     testRemoval("unconstrainedMinContentFixedGridUndefinedHeight", { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' });
     83    testRemoval("unconstrainedMinContentFixedGridUndefinedHeight", { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '40' });
    8484    testRemoval("unconstrainedMaxContentFixedGrid", { 'width': '390', 'height': '40' }, { 'width': '350', 'height': '40' }, { 'width': '170', 'height': '40' });
    8585    testRemoval("unconstrainedFixedMinContentGrid", { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '40' });
     
    8888    testRemoval("lessConstrainedAutoGrid", { 'width': '60', 'height': '90' }, { 'width': '60', 'height': '60' }, { 'width': '60', 'height': '30' });
    8989    testRemoval("lessConstrainedMinContentFixedGrid", { 'width': '60', 'height': '90' }, { 'width': '60', 'height': '60' }, { 'width': '60', 'height': '30' });
    90     testRemoval("lessConstrainedMinContentFixedGridUndefinedHeight", { 'width': '60', 'height': '40' }, { 'width': '60', 'height': '40' }, { 'width': '60', 'height': '40' });
     90    testRemoval("lessConstrainedMinContentFixedGridUndefinedHeight", { 'width': '60', 'height': '90' }, { 'width': '60', 'height': '60' }, { 'width': '60', 'height': '40' });
    9191    testRemoval("lessConstrainedMaxContentFixedGrid", { 'width': '350', 'height': '20' }, { 'width': '350', 'height': '20' }, { 'width': '170', 'height': '20' });
    9292    testRemoval("lessConstrainedMaxContentFixedGridUndefinedHeight", { 'width': '350', 'height': '40' }, { 'width': '350', 'height': '40' }, { 'width': '170', 'height': '40' });
  • trunk/LayoutTests/fast/css-grid-layout/minmax-max-content-resolution-rows.html

    r168416 r178577  
    5656<div class="constrainedContainer">
    5757    <div class="grid gridMinMaxContent">
    58         <div class="firstRowFirstColumn" data-expected-width="20" data-expected-height="50">XX XX XX XX XX XX XX XX</div>
     58        <div class="firstRowFirstColumn" data-expected-width="20" data-expected-height="80">XX XX XX XX XX XX XX XX</div>
    5959    </div>
    6060</div>
     
    7777    <div class="grid gridMinMaxContent">
    7878        <!-- The 'max' logical width ends up being smaller than the 'min' so per the spec we ignore the 'max'. -->
    79         <div class="firstRowFirstColumn" data-expected-width="20" data-expected-height="50">XX XX XX XX XX XX XX XX</div>
     79        <div class="firstRowFirstColumn" data-expected-width="20" data-expected-height="80">XX XX XX XX XX XX XX XX</div>
    8080    </div>
    8181</div>
  • trunk/LayoutTests/fast/css-grid-layout/minmax-min-content-column-resolution-rows.html

    r168416 r178577  
    5151<div class="constrainedContainer">
    5252    <div class="grid gridMinMinContent">
    53         <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="40">XX XX XX XX XX XX</div>
     53        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="60">XX XX XX XX XX XX</div>
    5454    </div>
    5555</div>
     
    7070<div style="width: 30px; height: 100px">
    7171    <div class="grid gridMinMinContent">
    72         <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="40">XX XX XX XX XX XX</div>
     72        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="60">XX XX XX XX XX XX</div>
    7373    </div>
    7474</div>
  • trunk/LayoutTests/fast/css-grid-layout/percent-of-indefinite-track-size-in-auto.html

    r174057 r178577  
    3939</div>
    4040<div style="position: relative;">
    41     <div class="indefiniteSizeGrid gridWithPercentInMinOfMinMax" data-expected-width="30" data-expected-height="15">
     41    <div class="indefiniteSizeGrid gridWithPercentInMinOfMinMax" data-expected-width="30" data-expected-height="20">
    4242        <div class="firstRowFirstColumn">XXX</div>
    4343        <div class="firstRowFirstColumn">XX XX</div>
  • trunk/LayoutTests/fast/css-grid-layout/percent-of-indefinite-track-size.html

    r174057 r178577  
    3939</div>
    4040<div style="position: relative;">
    41     <div class="indefiniteSizeGrid gridWithPercentInMinOfMinMax" data-expected-width="30" data-expected-height="15">
     41    <div class="indefiniteSizeGrid gridWithPercentInMinOfMinMax" data-expected-width="30" data-expected-height="20">
    4242        <div class="firstRowFirstColumn">XXX</div>
    4343        <div class="firstRowFirstColumn">XX XX</div>
  • trunk/Source/WebCore/ChangeLog

    r178575 r178577  
     12014-11-26  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [CSS Grid Layout] Tracks shrink sometimes with indefinite remaining space
     4        https://bugs.webkit.org/show_bug.cgi?id=139059
     5
     6        Reviewed by David Hyatt.
     7
     8        Test: fast/css-grid-layout/grid-grow-tracks-to-their-max.html
     9
     10        * rendering/RenderGrid.cpp:
     11        (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
     12
    1132015-01-15  Csaba Osztrogonác  <ossy@webkit.org>
    214
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r177858 r178577  
    346346    } else {
    347347        for (auto& track : tracks)
    348             track.m_usedBreadth = track.m_maxBreadth;
     348            track.m_usedBreadth = std::max(track.m_usedBreadth, track.m_maxBreadth);
    349349    }
    350350
Note: See TracChangeset for help on using the changeset viewer.