Changeset 156638 in webkit


Ignore:
Timestamp:
Sep 30, 2013 1:14:41 AM (11 years ago)
Author:
svillar@igalia.com
Message:

[CSS Grid Layout] Implement the grid-area shorthand
https://bugs.webkit.org/show_bug.cgi?id=103334

Reviewed by Andreas Kling.

Source/WebCore:

Based on Blink r151684 by <jchaffraix@chromium.org>

Test: fast/css-grid-layout/grid-item-area-get-set.html

Added support to specify grid positions using the
'-webkit-grid-area' shorthand. Named grid areas are still not
allowed, to be done in a follow up patch as it likely requires
'-webkit-grid-template' support.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::propertyValue):

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseGridItemPositionShorthand):

  • css/CSSPropertyNames.in:
  • css/StylePropertySet.cpp:

(WebCore::StylePropertySet::getPropertyValue):

  • css/StylePropertyShorthand.cpp:

(WebCore::webkitGridAreaShorthand):
(WebCore::shorthandForProperty):

  • css/StylePropertyShorthand.h:
  • css/StyleResolver.cpp:

(WebCore::StyleResolver::applyProperty):

LayoutTests:

From Blink r151684 by <jchaffraix@chromium.org>

  • fast/css-grid-layout/grid-item-area-get-set-expected.txt: Added.
  • fast/css-grid-layout/grid-item-area-get-set.html: Added.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r156635 r156638  
     12013-09-18  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [CSS Grid Layout] Implement the grid-area shorthand
     4        https://bugs.webkit.org/show_bug.cgi?id=103334
     5
     6        Reviewed by Andreas Kling.
     7
     8        From Blink r151684 by <jchaffraix@chromium.org>
     9
     10        * fast/css-grid-layout/grid-item-area-get-set-expected.txt: Added.
     11        * fast/css-grid-layout/grid-item-area-get-set.html: Added.
     12
    1132013-09-30  Vani Hegde  <vani.hegde@samsung.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r156636 r156638  
     12013-09-18  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [CSS Grid Layout] Implement the grid-area shorthand
     4        https://bugs.webkit.org/show_bug.cgi?id=103334
     5
     6        Reviewed by Andreas Kling.
     7
     8        Based on Blink r151684 by <jchaffraix@chromium.org>
     9
     10        Test: fast/css-grid-layout/grid-item-area-get-set.html
     11
     12        Added support to specify grid positions using the
     13        '-webkit-grid-area' shorthand. Named grid areas are still not
     14        allowed, to be done in a follow up patch as it likely requires
     15        '-webkit-grid-template' support.
     16
     17        * css/CSSComputedStyleDeclaration.cpp:
     18        (WebCore::ComputedStyleExtractor::propertyValue):
     19        * css/CSSParser.cpp:
     20        (WebCore::CSSParser::parseValue):
     21        (WebCore::CSSParser::parseGridItemPositionShorthand):
     22        * css/CSSPropertyNames.in:
     23        * css/StylePropertySet.cpp:
     24        (WebCore::StylePropertySet::getPropertyValue):
     25        * css/StylePropertyShorthand.cpp:
     26        (WebCore::webkitGridAreaShorthand):
     27        (WebCore::shorthandForProperty):
     28        * css/StylePropertyShorthand.h:
     29        * css/StyleResolver.cpp:
     30        (WebCore::StyleResolver::applyProperty):
     31
    1322013-09-30  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    233
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r156622 r156638  
    21382138        case CSSPropertyWebkitGridRowEnd:
    21392139            return valueForGridPosition(style->gridItemRowEnd());
     2140        case CSSPropertyWebkitGridArea:
     2141            return getCSSPropertyValuesForGridShorthand(webkitGridAreaShorthand());
    21402142        case CSSPropertyWebkitGridColumn:
    21412143            return getCSSPropertyValuesForGridShorthand(webkitGridColumnShorthand());
  • trunk/Source/WebCore/css/CSSParser.cpp

    r156636 r156638  
    27032703        break;
    27042704
     2705    case CSSPropertyWebkitGridArea:
    27052706    case CSSPropertyWebkitGridColumn:
    27062707    case CSSPropertyWebkitGridRow: {
     
    48934894    ShorthandScope scope(this, shorthandId);
    48944895    const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId);
    4895     ASSERT(shorthand.length() == 2);
    48964896    if (!parseValue(shorthand.properties()[0], important))
    48974897        return false;
    48984898
    4899     if (!m_valueList->current()) {
    4900         // Only one value was specified, the opposite value should be set to 'auto'.
    4901         // FIXME: If the first property was <ident>, the opposite value should be the same <ident>.
    4902         addProperty(shorthand.properties()[1], cssValuePool().createIdentifierValue(CSSValueAuto), important);
    4903         return true;
    4904     }
    4905 
    4906     if (!isForwardSlashOperator(m_valueList->current()))
    4907         return false;
    4908 
    4909     if (!m_valueList->next())
    4910         return false;
    4911 
    4912     return parseValue(shorthand.properties()[1], important);
     4899    size_t index = 1;
     4900    for (; index < shorthand.length(); ++index) {
     4901        if (!m_valueList->current())
     4902            break;
     4903
     4904        if (!isForwardSlashOperator(m_valueList->current()))
     4905            return false;
     4906
     4907        if (!m_valueList->next())
     4908            return false;
     4909
     4910        if (!parseValue(shorthand.properties()[index], important))
     4911            return false;
     4912    }
     4913
     4914    // Only some values out of the {2|4} positions were specified, the other values should be set to 'auto'.
     4915    // FIXME: If the first property was <ident>, the opposite value should be the same <ident>.
     4916    for (; index < shorthand.length(); ++index)
     4917        addProperty(shorthand.properties()[index], cssValuePool().createIdentifierValue(CSSValueAuto), important);
     4918
     4919    return true;
    49134920}
    49144921
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r156347 r156638  
    304304-webkit-justify-content
    305305-webkit-font-size-delta
     306-webkit-grid-area
    306307-webkit-grid-auto-columns
    307308-webkit-grid-auto-rows
  • trunk/Source/WebCore/css/StylePropertySet.cpp

    r156550 r156638  
    166166    case CSSPropertyWebkitFlexFlow:
    167167        return getShorthandValue(webkitFlexFlowShorthand());
     168    case CSSPropertyWebkitGridArea:
     169        return getShorthandValue(webkitGridAreaShorthand());
    168170    case CSSPropertyWebkitGridColumn:
    169171        return getShorthandValue(webkitGridColumnShorthand());
  • trunk/Source/WebCore/css/StylePropertyShorthand.cpp

    r155352 r156638  
    352352    static const CSSPropertyID marginCollapseProperties[] = { CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginAfterCollapse };
    353353    return StylePropertyShorthand(CSSPropertyWebkitMarginCollapse, marginCollapseProperties, WTF_ARRAY_LENGTH(marginCollapseProperties));
     354}
     355
     356StylePropertyShorthand webkitGridAreaShorthand()
     357{
     358    static const CSSPropertyID webkitGridAreaProperties[] = {
     359        CSSPropertyWebkitGridRowStart,
     360        CSSPropertyWebkitGridColumnStart,
     361        CSSPropertyWebkitGridRowEnd,
     362        CSSPropertyWebkitGridColumnEnd
     363    };
     364    return StylePropertyShorthand(CSSPropertyWebkitGridArea, webkitGridAreaProperties, WTF_ARRAY_LENGTH(webkitGridAreaProperties));
    354365}
    355366
     
    546557    case CSSPropertyWebkitFlexFlow:
    547558        return webkitFlexFlowShorthand();
     559    case CSSPropertyWebkitGridArea:
     560        return webkitGridAreaShorthand();
    548561    case CSSPropertyWebkitGridColumn:
    549562        return webkitGridColumnShorthand();
  • trunk/Source/WebCore/css/StylePropertyShorthand.h

    r155352 r156638  
    100100StylePropertyShorthand webkitFlexFlowShorthand();
    101101StylePropertyShorthand webkitFlexShorthand();
     102StylePropertyShorthand webkitGridAreaShorthand();
    102103StylePropertyShorthand webkitGridColumnShorthand();
    103104StylePropertyShorthand webkitGridRowShorthand();
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r156636 r156638  
    23522352    case CSSPropertyWebkitFlex:
    23532353    case CSSPropertyWebkitFlexFlow:
     2354    case CSSPropertyWebkitGridArea:
    23542355    case CSSPropertyWebkitGridColumn:
    23552356    case CSSPropertyWebkitGridRow:
Note: See TracChangeset for help on using the changeset viewer.