Changeset 148220 in webkit


Ignore:
Timestamp:
Apr 11, 2013 11:54:09 AM (11 years ago)
Author:
Michelangelo De Simone
Message:

[CSS Shaders] Parse the geometry descriptor
https://bugs.webkit.org/show_bug.cgi?id=110815

Source/WebCore:

Added initial parsing for the "geometry" descriptor, as per specification:
https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#geometry
This descriptor allows to specify the mesh geometry for custom filters.

Reviewed by Dirk Schulze.

Tests: css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-invalid.html

css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-valid.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseGeometry): New method that parses the geometry
descriptor (grid()).
(WebCore):

  • css/CSSParser.h:
  • css/CSSProperty.cpp:

(WebCore::CSSProperty::isInheritedProperty):

  • css/CSSPropertyNames.in: Added conditional "geometry" property.
  • css/CSSValueKeywords.in: Added conditional "attached" value keyword; detached

was already there.

LayoutTests:

Positive and negative parsing tests for the "geometry" descriptor as
per specification:
https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#geometry

Reviewed by Dirk Schulze.

  • css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-invalid-expected.txt: Added.
  • css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-invalid.html: Added.
  • css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-valid-expected.txt: Added.
  • css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-valid.html: Added.
  • css3/filters/custom-with-at-rule-syntax/script-tests/parsing-geometry-property-invalid.js: Added.

(testInvalidGeometryProperty):

  • css3/filters/custom-with-at-rule-syntax/script-tests/parsing-geometry-property-valid.js: Added.

(testGeometryProperty):

Location:
trunk
Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148217 r148220  
     12013-04-11  Michelangelo De Simone  <michelangelo@webkit.org>
     2
     3        [CSS Shaders] Parse the geometry descriptor
     4        https://bugs.webkit.org/show_bug.cgi?id=110815
     5
     6        Positive and negative parsing tests for the "geometry" descriptor as
     7        per specification:
     8        https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#geometry
     9
     10        Reviewed by Dirk Schulze.
     11
     12        * css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-invalid-expected.txt: Added.
     13        * css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-invalid.html: Added.
     14        * css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-valid-expected.txt: Added.
     15        * css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-valid.html: Added.
     16        * css3/filters/custom-with-at-rule-syntax/script-tests/parsing-geometry-property-invalid.js: Added.
     17        (testInvalidGeometryProperty):
     18        * css3/filters/custom-with-at-rule-syntax/script-tests/parsing-geometry-property-valid.js: Added.
     19        (testGeometryProperty):
     20
    1212013-04-11  Zan Dobersek  <zdobersek@igalia.com>
    222
  • trunk/Source/WebCore/ChangeLog

    r148219 r148220  
     12013-04-11  Michelangelo De Simone  <michelangelo@webkit.org>
     2
     3        [CSS Shaders] Parse the geometry descriptor
     4        https://bugs.webkit.org/show_bug.cgi?id=110815
     5
     6        Added initial parsing for the "geometry" descriptor, as per specification:
     7        https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#geometry
     8        This descriptor allows to specify the mesh geometry for custom filters.
     9
     10        Reviewed by Dirk Schulze.
     11
     12        Tests: css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-invalid.html
     13               css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-valid.html
     14
     15        * css/CSSComputedStyleDeclaration.cpp:
     16        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     17        * css/CSSParser.cpp:
     18        (WebCore::CSSParser::parseValue):
     19        (WebCore::CSSParser::parseGeometry): New method that parses the geometry
     20        descriptor (grid()).
     21        (WebCore):
     22        * css/CSSParser.h:
     23        * css/CSSProperty.cpp:
     24        (WebCore::CSSProperty::isInheritedProperty):
     25        * css/CSSPropertyNames.in: Added conditional "geometry" property.
     26        * css/CSSValueKeywords.in: Added conditional "attached" value keyword; detached
     27        was already there.
     28
    1292013-04-11  Anders Carlsson  <andersca@apple.com>
    230
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r148205 r148220  
    27922792
    27932793        /* Other unimplemented properties */
     2794#if ENABLE(CSS_SHADERS)
     2795        case CSSPropertyGeometry:
     2796#endif
    27942797        case CSSPropertyPage: // for @page
    27952798        case CSSPropertyQuotes: // FIXME: needs implementation
  • trunk/Source/WebCore/css/CSSParser.cpp

    r148208 r148220  
    29092909        return parsePage(propId, important);
    29102910    case CSSPropertyFontStretch:
     2911#if ENABLE(CSS_SHADERS)
     2912    case CSSPropertyGeometry:
     2913        return m_inFilterRule ? parseGeometry(propId, value, important) : false;
     2914#endif
    29112915    case CSSPropertyTextLineThrough:
    29122916    case CSSPropertyTextOverline:
     
    88488852}
    88498853
     8854bool CSSParser::parseGeometry(CSSPropertyID propId, CSSParserValue* value, bool important)
     8855{
     8856    ASSERT(propId == CSSPropertyGeometry);
     8857
     8858    // <geometry-shape> = grid(<integer>{1,2} || [ detached | attached ]?)
     8859    if (value->unit != CSSParserValue::Function || !equalIgnoringCase(value->function->name, "grid("))
     8860        return false;
     8861
     8862    ASSERT(value->function->args);
     8863
     8864    // grid() function should have from 1 to 3 arguments.
     8865    unsigned size = value->function->args->size();
     8866    if (!size || size > 3)
     8867        return false;
     8868
     8869    CSSParserValueList* gridParserValueList = value->function->args.get();
     8870    CSSParserValue* gridParserValue = gridParserValueList->current();
     8871    RefPtr<CSSValueList> geometryList = CSSValueList::createSpaceSeparated();
     8872
     8873    bool hasDimensions = false;
     8874    bool hasConnectivity = false;
     8875
     8876    while (gridParserValue) {
     8877        if (hasDimensions && hasConnectivity) {
     8878            geometryList.release();
     8879            return false;
     8880        }
     8881
     8882        if (gridParserValue->id == CSSValueAttached || gridParserValue->id == CSSValueDetached) {
     8883            hasConnectivity = true;
     8884            geometryList->append(cssValuePool().createIdentifierValue(gridParserValue->id));
     8885            gridParserValue = gridParserValueList->next();
     8886        } else if (!hasDimensions && parseGridDimensions(gridParserValueList, geometryList)) {
     8887            hasDimensions = true;
     8888            gridParserValue = gridParserValueList->current();
     8889        } else {
     8890            geometryList.release();
     8891            return false;
     8892        }
     8893    }
     8894
     8895    addProperty(propId, geometryList.release(), important);
     8896    return hasDimensions;
     8897}
     8898
     8899bool CSSParser::parseGridDimensions(CSSParserValueList* args, RefPtr<CSSValueList>& gridValueList)
     8900{
     8901    ASSERT(args);
     8902
     8903    // There must be at least one valid numeric value.
     8904    CSSParserValue* arg = args->current();
     8905    if (!arg || !validUnit(arg, FPositiveInteger))
     8906        return false;
     8907
     8908    // A valid numeric value is parsed and then we move on.
     8909    gridValueList->append(createPrimitiveNumericValue(arg));
     8910    arg = args->next();
     8911
     8912    // If the next argument is not numeric, we are done parsing the grid dimensions.
     8913    if (!arg || !validUnit(arg, FPositiveInteger))
     8914        return true;
     8915
     8916    // Commit the second numeric value we found.
     8917    gridValueList->append(createPrimitiveNumericValue(arg));
     8918    args->next();
     8919    return true;
     8920}
     8921
    88508922StyleRuleBase* CSSParser::createFilterRule(const CSSParserString& filterName)
    88518923{
  • trunk/Source/WebCore/css/CSSParser.h

    r148205 r148220  
    255255    bool parseFilterRuleSrc();
    256256    bool parseFilterRuleMix();
     257    bool parseGeometry(CSSPropertyID, CSSParserValue*, bool);
     258    bool parseGridDimensions(CSSParserValueList*, RefPtr<CSSValueList>&);
    257259    PassRefPtr<WebKitCSSShaderValue> parseFilterRuleSrcUriAndFormat(CSSParserValueList*);
    258260#endif
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r148205 r148220  
    442442    case CSSPropertyFloat:
    443443    case CSSPropertyFontStretch:
     444#if ENABLE(CSS_SHADERS)
     445    case CSSPropertyGeometry:
     446#endif
    444447    case CSSPropertyHeight:
    445448    case CSSPropertyLeft:
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r148205 r148220  
    106106float
    107107font-stretch
     108#if defined(ENABLE_CSS_SHADERS) && ENABLE_CSS_SHADERS
     109geometry
     110#endif
    108111height
    109112#if defined(ENABLE_CSS_IMAGE_ORIENTATION) && ENABLE_CSS_IMAGE_ORIENTATION
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r148208 r148220  
    987987// padding-box
    988988// content-box
     989attached
    989990filter-box
    990991detached
Note: See TracChangeset for help on using the changeset viewer.