Changeset 136588 in webkit


Ignore:
Timestamp:
Dec 4, 2012, 4:25:44 PM (12 years ago)
Author:
jchaffraix@webkit.org
Message:

[CSS Grid Layout] Implement CSS parsing and handling for <track-minmax>
https://bugs.webkit.org/show_bug.cgi?id=103799

Reviewed by Tony Chang.

Source/WebCore:

This change adds support for:
<track-minmax> => minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth>
(note that we already supported auto | <track-breadth>).

The change is mostly mechanical, the only newness is that GridTrackSize was updated to
hold 2 Lengths internally and we map the single Length case to 2 by duplicating the value
as this matches the rendering algorithm in the spec.

Tests: fast/css-grid-layout/grid-columns-rows-get-set-multiple.html

fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::valueForGridTrackBreadth):
Changed the function to do the conversion of one track breadth (one Length).
This was forgotten in the preparatory change in bug 103703.

(WebCore::valueForGridTrackMinMax):
Convert the value back using valueForGridTrackBreadth.

  • css/CSSFunctionValue.cpp:

(WebCore::CSSFunctionValue::CSSFunctionValue):

  • css/CSSFunctionValue.h:

(WebCore::CSSFunctionValue::create):
(CSSFunctionValue):
Added a new constructor. This enables us to return minmax(..., ...) when queried
from JavaScript. I couldn't find a better way to serialize inside CSSComputedStyleDeclaration
so that it properly match the function output.

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseGridTrackMinMax):
Added parsing for the new syntax. We convert the 2 values into a Pair if we manage to
parse both values correctly.

  • css/StyleResolver.cpp:

(WebCore::createGridTrackMinMax):
Updated to handle a Pair - for minmax - and set the 2 values on GridTrackSize.

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::computedUsedBreadthOfGridTracks):
Updated to check the style. For now, we don't handle minmax values.

  • rendering/style/GridTrackSize.h:

(WebCore::GridTrackSize::GridTrackSize):
(WebCore::GridTrackSize::length):
(WebCore::GridTrackSize::setLength):
(WebCore::GridTrackSize::minTrackBreadth):
(WebCore::GridTrackSize::maxTrackBreadth):
(WebCore::GridTrackSize::setMinMax):
(WebCore::GridTrackSize::operator==):
Updated the class to handle minmax values. This means that we now always store
2 values (the <length> case being a subset of minmax, however we kept the distinction
to be able to reconstruct a <length> for getComputedStyle).

LayoutTests:

  • fast/css-grid-layout/grid-columns-rows-get-set-expected.txt:
  • fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt:
  • fast/css-grid-layout/grid-columns-rows-get-set-multiple.html:
  • fast/css-grid-layout/grid-columns-rows-get-set.html:
  • fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js:
  • fast/css-grid-layout/resources/grid-columns-rows-get-set.js:

Extended the following tests to cover the new grammar.

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r136586 r136588  
     12012-12-04  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        [CSS Grid Layout] Implement CSS parsing and handling for <track-minmax>
     4        https://bugs.webkit.org/show_bug.cgi?id=103799
     5
     6        Reviewed by Tony Chang.
     7
     8        * fast/css-grid-layout/grid-columns-rows-get-set-expected.txt:
     9        * fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt:
     10        * fast/css-grid-layout/grid-columns-rows-get-set-multiple.html:
     11        * fast/css-grid-layout/grid-columns-rows-get-set.html:
     12        * fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js:
     13        * fast/css-grid-layout/resources/grid-columns-rows-get-set.js:
     14        Extended the following tests to cover the new grammar.
     15
    1162012-12-04  Florin Malita  <fmalita@chromium.org>
    217
  • trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt

    r136440 r136588  
    1717PASS getComputedStyle(gridWithViewPortPercentageElement, '').getPropertyValue('-webkit-grid-columns') is '64px'
    1818PASS getComputedStyle(gridWithViewPortPercentageElement, '').getPropertyValue('-webkit-grid-rows') is '60px'
     19PASS getComputedStyle(gridWithMinMax, '').getPropertyValue('-webkit-grid-columns') is 'minmax(10%, 15px)'
     20PASS getComputedStyle(gridWithMinMax, '').getPropertyValue('-webkit-grid-rows') is 'minmax(20px, 50%)'
     21
    1922Test getting wrong values for -webkit-grid-columns and -webkit-grid-rows through CSS (they should resolve to the default: 'none')
    2023PASS getComputedStyle(gridWithFitContentElement, '').getPropertyValue('-webkit-grid-columns') is 'none'
     
    3639PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is '80px'
    3740PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is '150px'
     41PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'minmax(55%, 45px)'
     42PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'minmax(30px, 40%)'
     43PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'minmax(220px, 48px)'
     44PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'minmax(80px, 50px)'
     45
     46Test setting grid-columns and grid-rows to bad minmax value through JS
     47PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'none'
     48PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'none'
     49PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'none'
     50PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'none'
     51PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'none'
     52PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'none'
     53PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'none'
     54PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'none'
    3855
    3956Test setting grid-columns and grid-rows back to 'none' through JS
  • trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt

    r136432 r136588  
    1919PASS getComputedStyle(gridWithFitContentAndFitAvailable, '').getPropertyValue('-webkit-grid-columns') is 'none'
    2020PASS getComputedStyle(gridWithFitContentAndFitAvailable, '').getPropertyValue('-webkit-grid-rows') is 'none'
     21PASS getComputedStyle(gridWithMinMaxAndFixed, '').getPropertyValue('-webkit-grid-columns') is 'minmax(45px, 30%) 15px'
     22PASS getComputedStyle(gridWithMinMaxAndFixed, '').getPropertyValue('-webkit-grid-rows') is '120px minmax(35%, 10px)'
    2123
    2224Test the initial value
     
    3335PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'auto 160px 22px'
    3436PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is '56% 100px auto'
     37PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is '160px minmax(16px, 20px)'
     38PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'minmax(10%, 15%) auto'
    3539
    3640Test getting wrong values set from CSS
     
    5559PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'none'
    5660PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'none'
     61PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'none'
     62PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'none'
    5763PASS successfullyParsed is true
    5864
  • trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple.html

    r136432 r136588  
    5555    -webkit-grid-rows: -webkit-fitcontent -webkit-fit-available;
    5656}
     57.gridWithMinMaxAndFixed {
     58    display: -webkit-grid;
     59    -webkit-grid-columns: minmax(45px, 30%) 15px;
     60    -webkit-grid-rows: 12em minmax(35%, 10px);
     61    font: 10px Ahem;
     62}
    5763</style>
    5864<script src="../js/resources/js-test-pre.js"></script>
     
    6874<div class="gridWithPercentAndViewportPercent" id="gridWithPercentAndViewportPercent"></div>
    6975<div class="gridWithFitContentAndFitAvailable" id="gridWithFitContentAndFitAvailable"></div>
     76<div class="gridWithMinMaxAndFixed" id="gridWithMinMaxAndFixed"></div>
    7077<script src="resources/grid-columns-rows-get-set-multiple.js"></script>
    7178<script src="../js/resources/js-test-post.js"></script>
  • trunk/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set.html

    r136432 r136588  
    4343    -webkit-grid-rows: -webkit-fit-available;
    4444}
     45.gridWithMinMax {
     46    -webkit-grid-columns: minmax(10%, 15px);
     47    -webkit-grid-rows: minmax(20px, 50%);
     48}
    4549</style>
    4650<script src="../js/resources/js-test-pre.js"></script>
     
    5559<div class="grid gridWithFitContent" id="gridWithFitContentElement"></div>
    5660<div class="grid gridWithFitAvailable" id="gridWithFitAvailableElement"></div>
     61<div class="grid gridWithMinMax" id="gridWithMinMax"></div>
    5762<script src="resources/grid-columns-rows-get-set.js"></script>
    5863<script src="../js/resources/js-test-post.js"></script>
  • trunk/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js

    r136432 r136588  
    2929shouldBe("getComputedStyle(gridWithFitContentAndFitAvailable, '').getPropertyValue('-webkit-grid-columns')", "'none'");
    3030shouldBe("getComputedStyle(gridWithFitContentAndFitAvailable, '').getPropertyValue('-webkit-grid-rows')", "'none'");
     31
     32var gridWithMinMaxAndFixed = document.getElementById("gridWithMinMaxAndFixed");
     33shouldBe("getComputedStyle(gridWithMinMaxAndFixed, '').getPropertyValue('-webkit-grid-columns')", "'minmax(45px, 30%) 15px'");
     34shouldBe("getComputedStyle(gridWithMinMaxAndFixed, '').getPropertyValue('-webkit-grid-rows')", "'120px minmax(35%, 10px)'");
    3135
    3236debug("");
     
    6569shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'auto 160px 22px'");
    6670shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'56% 100px auto'");
     71
     72element = document.createElement("div");
     73document.body.appendChild(element);
     74element.style.font = "10px Ahem";
     75element.style.webkitGridColumns = "16em minmax(16px, 20px)";
     76element.style.webkitGridRows = "minmax(10%, 15%) auto";
     77shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'160px minmax(16px, 20px)'");
     78shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'minmax(10%, 15%) auto'");
    6779
    6880debug("");
     
    126138shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'none'");
    127139shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'none'");
     140
     141element = document.createElement("div");
     142document.body.appendChild(element);
     143element.style.webkitGridColumns = "auto minmax(16px, auto)";
     144element.style.webkitGridRows = "minmax(auto, 15%) 10vw";
     145shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'none'");
     146shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'none'");
  • trunk/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js

    r136440 r136588  
    2626shouldBe("getComputedStyle(gridWithViewPortPercentageElement, '').getPropertyValue('-webkit-grid-rows')", "'60px'");
    2727
     28var gridWithMinMax = document.getElementById("gridWithMinMax");
     29shouldBe("getComputedStyle(gridWithMinMax, '').getPropertyValue('-webkit-grid-columns')", "'minmax(10%, 15px)'");
     30shouldBe("getComputedStyle(gridWithMinMax, '').getPropertyValue('-webkit-grid-rows')", "'minmax(20px, 50%)'");
     31
     32debug("");
    2833debug("Test getting wrong values for -webkit-grid-columns and -webkit-grid-rows through CSS (they should resolve to the default: 'none')");
    2934var gridWithFitContentElement = document.getElementById("gridWithFitContentElement");
     
    7075shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'150px'");
    7176
     77element = document.createElement("div");
     78document.body.appendChild(element);
     79element.style.webkitGridColumns = "minmax(55%, 45px)";
     80element.style.webkitGridRows = "minmax(30px, 40%)";
     81shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'minmax(55%, 45px)'");
     82shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'minmax(30px, 40%)'");
     83
     84element = document.createElement("div");
     85document.body.appendChild(element);
     86element.style.font = "10px Ahem";
     87element.style.webkitGridColumns = "minmax(22em, 8vh)";
     88element.style.webkitGridRows = "minmax(10vw, 5em)";
     89shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'minmax(220px, 48px)'");
     90shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'minmax(80px, 50px)'");
     91
     92debug("");
     93debug("Test setting grid-columns and grid-rows to bad minmax value through JS");
     94element = document.createElement("div");
     95document.body.appendChild(element);
     96// No comma.
     97element.style.webkitGridColumns = "minmax(10px 20px)";
     98// Only 1 argument provided.
     99element.style.webkitGridRows = "minmax(10px)";
     100shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'none'");
     101shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'none'");
     102
     103element = document.createElement("div");
     104document.body.appendChild(element);
     105// Nested minmax.
     106element.style.webkitGridColumns = "minmax(minmax(10px, 20px), 20px)";
     107// Only 2 arguments are allowed.
     108element.style.webkitGridRows = "minmax(10px, 20px, 30px)";
     109shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'none'");
     110shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'none'");
     111
     112element = document.createElement("div");
     113document.body.appendChild(element);
     114// No breadth value.
     115element.style.webkitGridColumns = "minmax()";
     116// No comma.
     117element.style.webkitGridRows = "minmax(30px 30% 30em)";
     118shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'none'");
     119shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'none'");
     120
     121element = document.createElement("div");
     122document.body.appendChild(element);
     123// Auto is not allowed inside minmax.
     124element.style.webkitGridColumns = "minmax(auto, 8vh)";
     125element.style.webkitGridRows = "minmax(10vw, auto)";
     126shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'none'");
     127shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'none'");
     128
    72129debug("");
    73130debug("Test setting grid-columns and grid-rows back to 'none' through JS");
  • trunk/Source/WebCore/ChangeLog

    r136584 r136588  
     12012-12-04  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        [CSS Grid Layout] Implement CSS parsing and handling for <track-minmax>
     4        https://bugs.webkit.org/show_bug.cgi?id=103799
     5
     6        Reviewed by Tony Chang.
     7
     8        This change adds support for:
     9        <track-minmax> => minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth>
     10        (note that we already supported auto | <track-breadth>).
     11
     12        The change is mostly mechanical, the only newness is that GridTrackSize was updated to
     13        hold 2 Lengths internally and we map the single Length case to 2 by duplicating the value
     14        as this matches the rendering algorithm in the spec.
     15
     16        Tests: fast/css-grid-layout/grid-columns-rows-get-set-multiple.html
     17               fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js
     18
     19        * css/CSSComputedStyleDeclaration.cpp:
     20        (WebCore::valueForGridTrackBreadth):
     21        Changed the function to do the conversion of one track breadth (one Length).
     22        This was forgotten in the preparatory change in bug 103703.
     23
     24        (WebCore::valueForGridTrackMinMax):
     25        Convert the value back using valueForGridTrackBreadth.
     26
     27        * css/CSSFunctionValue.cpp:
     28        (WebCore::CSSFunctionValue::CSSFunctionValue):
     29        * css/CSSFunctionValue.h:
     30        (WebCore::CSSFunctionValue::create):
     31        (CSSFunctionValue):
     32        Added a new constructor. This enables us to return minmax(..., ...) when queried
     33        from JavaScript. I couldn't find a better way to serialize inside CSSComputedStyleDeclaration
     34        so that it properly match the function output.
     35
     36        * css/CSSParser.cpp:
     37        (WebCore::CSSParser::parseGridTrackMinMax):
     38        Added parsing for the new syntax. We convert the 2 values into a Pair if we manage to
     39        parse both values correctly.
     40
     41        * css/StyleResolver.cpp:
     42        (WebCore::createGridTrackMinMax):
     43        Updated to handle a Pair - for minmax - and set the 2 values on GridTrackSize.
     44
     45        * rendering/RenderGrid.cpp:
     46        (WebCore::RenderGrid::computedUsedBreadthOfGridTracks):
     47        Updated to check the style. For now, we don't handle minmax values.
     48
     49        * rendering/style/GridTrackSize.h:
     50        (WebCore::GridTrackSize::GridTrackSize):
     51        (WebCore::GridTrackSize::length):
     52        (WebCore::GridTrackSize::setLength):
     53        (WebCore::GridTrackSize::minTrackBreadth):
     54        (WebCore::GridTrackSize::maxTrackBreadth):
     55        (WebCore::GridTrackSize::setMinMax):
     56        (WebCore::GridTrackSize::operator==):
     57        Updated the class to handle minmax values. This means that we now always store
     58        2 values (the <length> case being a subset of minmax, however we kept the distinction
     59        to be able to reconstruct a <length> for getComputedStyle).
     60
    1612012-12-04  Elliott Sprehn  <esprehn@chromium.org>
    262
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r136432 r136588  
    3131#include "CSSBasicShapes.h"
    3232#include "CSSBorderImage.h"
     33#include "CSSFunctionValue.h"
    3334#include "CSSLineBoxContainValue.h"
    3435#include "CSSParser.h"
     
    10001001#endif
    10011002
    1002 static PassRefPtr<CSSValue> valueForGridTrackBreadth(const GridTrackSize& trackSize, const RenderStyle* style, RenderView *renderView)
    1003 {
    1004     if (trackSize.length().isAuto())
     1003static PassRefPtr<CSSValue> valueForGridTrackBreadth(const Length& trackBreadth, const RenderStyle* style, RenderView *renderView)
     1004{
     1005    if (trackBreadth.isAuto())
    10051006        return cssValuePool().createIdentifierValue(CSSValueAuto);
    1006     if (trackSize.length().isViewportPercentage())
    1007         return zoomAdjustedPixelValue(valueForLength(trackSize.length(), 0, renderView), style);
    1008     return zoomAdjustedPixelValueForLength(trackSize.length(), style);
     1007    if (trackBreadth.isViewportPercentage())
     1008        return zoomAdjustedPixelValue(valueForLength(trackBreadth, 0, renderView), style);
     1009    return zoomAdjustedPixelValueForLength(trackBreadth, style);
    10091010}
    10101011
    10111012static PassRefPtr<CSSValue> valueForGridTrackMinMax(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
    10121013{
    1013     return valueForGridTrackBreadth(trackSize, style, renderView);
     1014    switch (trackSize.type()) {
     1015    case LengthTrackSizing:
     1016        return valueForGridTrackBreadth(trackSize.length(), style, renderView);
     1017    case MinMaxTrackSizing:
     1018        RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
     1019        minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackBreadth(), style, renderView));
     1020        minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, renderView));
     1021        return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
     1022    }
     1023    ASSERT_NOT_REACHED();
     1024    return 0;
    10141025}
    10151026
  • trunk/Source/WebCore/css/CSSFunctionValue.cpp

    r128762 r136588  
    4343}
    4444
     45CSSFunctionValue::CSSFunctionValue(String name, PassRefPtr<CSSValueList> args)
     46    : CSSValue(FunctionClass)
     47    , m_name(name)
     48    , m_args(args)
     49{
     50}
     51
    4552String CSSFunctionValue::customCssText() const
    4653{
  • trunk/Source/WebCore/css/CSSFunctionValue.h

    r124768 r136588  
    4141    }
    4242
     43    static PassRefPtr<CSSFunctionValue> create(String name, PassRefPtr<CSSValueList> args)
     44    {
     45        return adoptRef(new CSSFunctionValue(name, args));
     46    }
     47
    4348    String customCssText() const;
    4449
     
    4752private:
    4853    explicit CSSFunctionValue(CSSParserFunction*);
     54    CSSFunctionValue(String, PassRefPtr<CSSValueList>);
    4955
    5056    String m_name;
  • trunk/Source/WebCore/css/CSSParser.cpp

    r136540 r136588  
    45384538    CSSParserValue* currentValue = m_valueList->current();
    45394539    if (currentValue->id == CSSValueAuto) {
    4540         RefPtr<CSSPrimitiveValue> autoValue = cssValuePool().createIdentifierValue(CSSValueAuto);
    4541         values->append(autoValue.release());
     4540        values->append(cssValuePool().createIdentifierValue(CSSValueAuto));
     4541        return true;
     4542    }
     4543
     4544    if (currentValue->unit == CSSParserValue::Function && equalIgnoringCase(currentValue->function->name, "minmax(")) {
     4545        // The spec defines the following grammar: minmax( <track-breadth> , <track-breadth> )
     4546        CSSParserValueList* arguments = currentValue->function->args.get();
     4547        if (!arguments || arguments->size() != 3 || !isComma(arguments->valueAt(1)))
     4548            return false;
     4549
     4550        RefPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth(arguments->valueAt(0));
     4551        if (!minTrackBreadth)
     4552            return false;
     4553
     4554        RefPtr<CSSPrimitiveValue> maxTrackBreadth = parseGridBreadth(arguments->valueAt(2));
     4555        if (!maxTrackBreadth)
     4556            return false;
     4557
     4558        values->append(createPrimitiveValuePair(minTrackBreadth, maxTrackBreadth));
    45424559        return true;
    45434560    }
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r136449 r136588  
    26892689static bool createGridTrackMinMax(CSSPrimitiveValue* primitiveValue, StyleResolver* selector, GridTrackSize& trackSize)
    26902690{
    2691     Length workingLength;
    2692     if (!createGridTrackBreadth(primitiveValue, selector, workingLength))
    2693         return false;
    2694 
    2695     trackSize.setLength(workingLength);
     2691    Pair* minMaxTrackBreadth = primitiveValue->getPairValue();
     2692    if (!minMaxTrackBreadth) {
     2693        Length workingLength;
     2694        if (!createGridTrackBreadth(primitiveValue, selector, workingLength))
     2695            return false;
     2696
     2697        trackSize.setLength(workingLength);
     2698        return true;
     2699    }
     2700
     2701    Length minTrackBreadth;
     2702    Length maxTrackBreadth;
     2703    if (!createGridTrackBreadth(minMaxTrackBreadth->first(), selector, minTrackBreadth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), selector, maxTrackBreadth))
     2704        return false;
     2705
     2706    trackSize.setMinMax(minTrackBreadth, maxTrackBreadth);
    26962707    return true;
    26972708}
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r136432 r136588  
    142142    for (size_t i = 0; i < trackStyles.size(); ++i) {
    143143        GridTrack track;
    144         Length trackLength = trackStyles[i].length();
    145         // FIXME: we stil need to support calc() here (bug 103761)
    146         if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewportPercentage())
    147             track.m_usedBreadth = valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(MainOrPreferredSize, style()->logicalHeight()), view());
    148         else
     144        switch (trackStyles[i].type()) {
     145        case LengthTrackSizing: {
     146            Length trackLength = trackStyles[i].length();
     147            // FIXME: We stil need to support calc() here (bug 103761).
     148            if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewportPercentage())
     149                track.m_usedBreadth = valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(MainOrPreferredSize, style()->logicalHeight()), view());
     150            else
     151                notImplemented();
     152
     153            break;
     154        }
     155        case MinMaxTrackSizing:
     156            // FIXME: Implement support for minmax track sizing (bug 103311).
    149157            notImplemented();
    150 
     158        }
    151159        tracks.append(track);
    152160    }
  • trunk/Source/WebCore/rendering/style/GridTrackSize.h

    r136150 r136588  
    3737
    3838enum GridTrackSizeType {
    39     LengthTrackSizing
     39    LengthTrackSizing,
     40    MinMaxTrackSizing
    4041};
    4142
     
    4445    GridTrackSize()
    4546        : m_type(LengthTrackSizing)
    46         , m_length(Undefined)
     47        , m_minTrackBreadth(Undefined)
     48        , m_maxTrackBreadth(Undefined)
    4749    {
    4850    }
     
    5153    {
    5254        ASSERT(m_type == LengthTrackSizing);
    53         ASSERT(!m_length.isUndefined());
    54         return m_length;
     55        ASSERT(!m_minTrackBreadth.isUndefined());
     56        ASSERT(m_minTrackBreadth == m_maxTrackBreadth);
     57        return m_minTrackBreadth;
    5558    }
    5659
     
    5861    {
    5962        m_type = LengthTrackSizing;
    60         m_length = length;
     63        m_minTrackBreadth = length;
     64        m_maxTrackBreadth = length;
     65    }
     66
     67    const Length& minTrackBreadth() const
     68    {
     69        ASSERT(m_type == MinMaxTrackSizing);
     70        ASSERT(!m_minTrackBreadth.isUndefined());
     71        return m_minTrackBreadth;
     72    }
     73
     74    const Length& maxTrackBreadth() const
     75    {
     76        ASSERT(m_type == MinMaxTrackSizing);
     77        ASSERT(!m_maxTrackBreadth.isUndefined());
     78        return m_maxTrackBreadth;
     79    }
     80
     81    void setMinMax(const Length& minTrackBreadth, const Length& maxTrackBreadth)
     82    {
     83        m_type = MinMaxTrackSizing;
     84        m_minTrackBreadth = minTrackBreadth;
     85        m_maxTrackBreadth = maxTrackBreadth;
    6186    }
    6287
     
    6590    bool operator==(const GridTrackSize& other) const
    6691    {
    67         return m_type == other.m_type && m_length == other.m_length;
     92        return m_type == other.m_type && m_minTrackBreadth == other.m_minTrackBreadth && m_maxTrackBreadth == m_maxTrackBreadth;
    6893    }
    6994
    7095private:
    7196    GridTrackSizeType m_type;
    72     Length m_length;
     97    Length m_minTrackBreadth;
     98    Length m_maxTrackBreadth;
    7399};
    74100
Note: See TracChangeset for help on using the changeset viewer.