Changeset 158839 in webkit


Ignore:
Timestamp:
Nov 7, 2013 2:53:17 AM (10 years ago)
Author:
svillar@igalia.com
Message:

[CSS Grid Layout] CSSParser should reject <track-list> without a <track-size>
https://bugs.webkit.org/show_bug.cgi?id=118025

Reviewed by Andreas Kling.

Source/WebCore:

From Blink r152914 by <jchaffraix@chromium.org>

Make sure that we parse at least 1 <track-size> inside each
<track-list>. The old parser code allowed track-lists exclusively
made of <track-name>. The way it was implemented eases the future
addition of parsing for the repeat() function.

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseGridTrackList):

  • css/StyleResolver.cpp:

(WebCore::createGridTrackList): ASSERT if we don't find any
<track-size> now that we detect their absence in the parser.

LayoutTests:

Added a new test that verifies that <track-list> exclusively made
of <track-name> are not supported.

  • fast/css-grid-layout/named-grid-line-get-set-expected.txt:
  • fast/css-grid-layout/named-grid-line-get-set.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r158838 r158839  
     12013-11-06  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [CSS Grid Layout] CSSParser should reject <track-list> without a <track-size>
     4        https://bugs.webkit.org/show_bug.cgi?id=118025
     5
     6        Reviewed by Andreas Kling.
     7
     8        Added a new test that verifies that <track-list> exclusively made
     9        of <track-name> are not supported.
     10
     11        * fast/css-grid-layout/named-grid-line-get-set-expected.txt:
     12        * fast/css-grid-layout/named-grid-line-get-set.html:
     13
    1142013-11-06  Sergio Villar Senin  <svillar@igalia.com>
    215
  • trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expected.txt

    r153752 r158839  
    4747PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-definition-columns') is "none"
    4848PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-definition-rows') is "none"
     49PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-definition-columns') is "none"
     50PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-definition-rows') is "none"
    4951PASS successfullyParsed is true
    5052
  • trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set.html

    r155263 r158839  
    148148    element.style.webkitGridDefinitionRows = "'bar";
    149149    testValue(element, "none", "none");
     150
     151    element = document.createElement("div");
     152    document.body.appendChild(element);
     153    element.style.webkitGridDefinitionColumns = "'foo' 'bar'";
     154    element.style.webkitGridDefinitionRows = "'bar' 'foo'";
     155    testValue(element, "none", "none");
    150156</script>
    151157<script src="../../resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r158838 r158839  
     12013-11-06  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [CSS Grid Layout] CSSParser should reject <track-list> without a <track-size>
     4        https://bugs.webkit.org/show_bug.cgi?id=118025
     5
     6        Reviewed by Andreas Kling.
     7
     8        From Blink r152914 by <jchaffraix@chromium.org>
     9
     10        Make sure that we parse at least 1 <track-size> inside each
     11        <track-list>. The old parser code allowed track-lists exclusively
     12        made of <track-name>. The way it was implemented eases the future
     13        addition of parsing for the repeat() function.
     14
     15        * css/CSSParser.cpp:
     16        (WebCore::CSSParser::parseGridTrackList):
     17        * css/StyleResolver.cpp:
     18        (WebCore::createGridTrackList): ASSERT if we don't find any
     19        <track-size> now that we detect their absence in the parser.
     20
    1212013-11-06  Sergio Villar Senin  <svillar@igalia.com>
    222
  • trunk/Source/WebCore/css/CSSParser.cpp

    r158803 r158839  
    50245024
    50255025    RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
     5026    // Handle leading track names
     5027    while (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) {
     5028        RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueList->current());
     5029        values->append(name.release());
     5030        m_valueList->next();
     5031    }
     5032
     5033    bool seenTrackSize = false;
    50265034    while (m_valueList->current()) {
     5035        RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize();
     5036        if (!primitiveValue)
     5037            return false;
     5038
     5039        seenTrackSize = true;
     5040        values->append(primitiveValue.release());
     5041
    50275042        while (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) {
    50285043            RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueList->current());
    5029             values->append(name);
     5044            values->append(name.release());
    50305045            m_valueList->next();
    50315046        }
    5032 
    5033         // This allows trailing <string>* per the specification.
    5034         if (!m_valueList->current())
    5035             break;
    5036 
    5037         RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize();
    5038         if (!primitiveValue)
    5039             return false;
    5040 
    5041         values->append(primitiveValue.release());
    5042     }
     5047    }
     5048
     5049    if (!seenTrackSize)
     5050        return false;
     5051
    50435052    addProperty(propId, values.release(), important);
    50445053    return true;
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r158838 r158839  
    19931993    }
    19941994
    1995     if (trackSizes.isEmpty())
    1996         return false;
    1997 
     1995    // The parser should have rejected any <track-list> without any <track-size> as
     1996    // this is not conformant to the syntax.
     1997    ASSERT(!trackSizes.isEmpty());
    19981998    return true;
    19991999}
Note: See TracChangeset for help on using the changeset viewer.