Changeset 199661 in webkit


Ignore:
Timestamp:
Apr 18, 2016 2:45:30 AM (8 years ago)
Author:
Manuel Rego Casasnovas
Message:

[css-grid] Use grid-template-areas to determine the explicit grid
https://bugs.webkit.org/show_bug.cgi?id=156575

Reviewed by Darin Adler.

Source/WebCore:

From the spec (https://drafts.csswg.org/css-grid/#grid-definition):
"The size of the explicit grid is determined by the larger of the number
of rows/columns defined by grid-template-areas and the number
of rows/columns sized by grid-template-rows/grid-template-columns."

So we need to take into account the rows/columns defined by
grid-template-areas to determine the size of the explicit grid.

Test: fast/css-grid-layout/explicit-grid-size.html

  • rendering/style/GridPositionsResolver.cpp:

(WebCore::GridPositionsResolver::explicitGridColumnCount):
(WebCore::GridPositionsResolver::explicitGridRowCount):

LayoutTests:

Created new test to check the right behavior.

  • fast/css-grid-layout/explicit-grid-size-expected.txt: Added.
  • fast/css-grid-layout/explicit-grid-size.html: Added.
  • fast/css-grid-layout/grid-template-shorthand-get-set-expected.txt:

Small modification as now the columns defined by
grid-tempalte-areas are in the explicit grid.

  • fast/css-grid-layout/grid-template-shorthand-get-set.html:

Ditto.

Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r199657 r199661  
     12016-04-18  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Use grid-template-areas to determine the explicit grid
     4        https://bugs.webkit.org/show_bug.cgi?id=156575
     5
     6        Reviewed by Darin Adler.
     7
     8        Created new test to check the right behavior.
     9
     10        * fast/css-grid-layout/explicit-grid-size-expected.txt: Added.
     11        * fast/css-grid-layout/explicit-grid-size.html: Added.
     12        * fast/css-grid-layout/grid-template-shorthand-get-set-expected.txt:
     13        Small modification as now the columns defined by
     14        grid-tempalte-areas are in the explicit grid.
     15        * fast/css-grid-layout/grid-template-shorthand-get-set.html:
     16        Ditto.
     17
    1182016-04-18  Manuel Rego Casasnovas  <rego@igalia.com>
    219
  • trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-get-set-expected.txt

    r197669 r199661  
    2929PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesWithoutRowSize, '').getPropertyValue('-webkit-grid-template-rows') is "[head] 0px [tail]"
    3030PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesWithoutRowSize, '').getPropertyValue('-webkit-grid-template-areas') is "\"a\""
    31 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleColumns, '').getPropertyValue('-webkit-grid-template-columns') is "10px"
     31PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleColumns, '').getPropertyValue('-webkit-grid-template-columns') is "10px 20px"
    3232PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleColumns, '').getPropertyValue('-webkit-grid-template-rows') is "[head] 15px [tail]"
    3333PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleColumns, '').getPropertyValue('-webkit-grid-template-areas') is "\"a b\""
    34 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize, '').getPropertyValue('-webkit-grid-template-columns') is "10px"
     34PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize, '').getPropertyValue('-webkit-grid-template-columns') is "10px 20px"
    3535PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize, '').getPropertyValue('-webkit-grid-template-rows') is "[head] 0px [tail]"
    3636PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize, '').getPropertyValue('-webkit-grid-template-areas') is "\"a b\""
  • trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-get-set.html

    r197669 r199661  
    2929}
    3030#gridTemplateComplexFormWithLineNamesMultipleColumns {
    31     -webkit-grid-template: [head] "a b" 15px [tail] / 10px;
     31    -webkit-grid-template: [head] "a b" 15px [tail] / 10px 20px;
    3232}
    3333#gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize {
    34     -webkit-grid-template: [head] "a b" [tail] / 10px;
     34    -webkit-grid-template: [head] "a b" [tail] / 10px 20px;
    3535}
    3636#gridTemplateComplexFormWithLineNamesMultipleRows {
     
    197197    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNames"), "10px", "[head] 15px [tail]", '"a"');
    198198    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesWithoutRowSize"), "10px", "[head] 0px [tail]", '"a"');
    199     testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleColumns"), "10px", "[head] 15px [tail]", '"a b"');
    200     testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize"), "10px", "[head] 0px [tail]", '"a b"');
     199    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleColumns"), "10px 20px", "[head] 15px [tail]", '"a b"');
     200    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize"), "10px 20px", "[head] 0px [tail]", '"a b"');
    201201    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRows"), "10px", "[head1] 15px [tail1 head2] 20px [tail2]", '"a" "b"');
    202202    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRowsWithoutRowsSizes"), "10px", "[head1] 0px [tail1 head2] 0px [tail2]", '"a" "b"');
  • trunk/Source/WebCore/ChangeLog

    r199659 r199661  
     12016-04-18  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Use grid-template-areas to determine the explicit grid
     4        https://bugs.webkit.org/show_bug.cgi?id=156575
     5
     6        Reviewed by Darin Adler.
     7
     8        From the spec (https://drafts.csswg.org/css-grid/#grid-definition):
     9        "The size of the explicit grid is determined by the larger of the number
     10        of rows/columns defined by grid-template-areas and the number
     11        of rows/columns sized by grid-template-rows/grid-template-columns."
     12
     13        So we need to take into account the rows/columns defined by
     14        grid-template-areas to determine the size of the explicit grid.
     15
     16        Test: fast/css-grid-layout/explicit-grid-size.html
     17
     18        * rendering/style/GridPositionsResolver.cpp:
     19        (WebCore::GridPositionsResolver::explicitGridColumnCount):
     20        (WebCore::GridPositionsResolver::explicitGridRowCount):
     21
    1222016-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
    223
  • trunk/Source/WebCore/rendering/style/GridPositionsResolver.cpp

    r198399 r199661  
    105105unsigned GridPositionsResolver::explicitGridColumnCount(const RenderStyle& gridContainerStyle)
    106106{
    107     return std::min<unsigned>(gridContainerStyle.gridColumns().size(), kGridMaxTracks);
     107    return std::min<unsigned>(std::max(gridContainerStyle.gridColumns().size(), gridContainerStyle.namedGridAreaColumnCount()), kGridMaxTracks);
    108108}
    109109
    110110unsigned GridPositionsResolver::explicitGridRowCount(const RenderStyle& gridContainerStyle)
    111111{
    112     return std::min<unsigned>(gridContainerStyle.gridRows().size(), kGridMaxTracks);
     112    return std::min<unsigned>(std::max(gridContainerStyle.gridRows().size(), gridContainerStyle.namedGridAreaRowCount()), kGridMaxTracks);
    113113}
    114114
Note: See TracChangeset for help on using the changeset viewer.