Changeset 118044 in webkit


Ignore:
Timestamp:
May 22, 2012 1:50:04 PM (12 years ago)
Author:
tony@chromium.org
Message:

REGRESSION(r117613): Dromaeo/jslib-style-prototype regressed by 20%
https://bugs.webkit.org/show_bug.cgi?id=87142

Reviewed by Alexis Menard.

Move CSSPropertyDisplay back into isValidKeywordPropertyAndValue.
Pass in the parser context so we can check whether we're grid or not.

No new tests. Covered by Dromaeo/jslib-style-prototype perf test.

  • css/CSSParser.cpp:

(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::parseKeywordValue):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFont):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r118041 r118044  
     12012-05-22  Tony Chang  <tony@chromium.org>
     2
     3        REGRESSION(r117613): Dromaeo/jslib-style-prototype regressed by 20%
     4        https://bugs.webkit.org/show_bug.cgi?id=87142
     5
     6        Reviewed by Alexis Menard.
     7
     8        Move CSSPropertyDisplay back into isValidKeywordPropertyAndValue.
     9        Pass in the parser context so we can check whether we're grid or not.
     10
     11        No new tests. Covered by Dromaeo/jslib-style-prototype perf test.
     12
     13        * css/CSSParser.cpp:
     14        (WebCore::isValidKeywordPropertyAndValue):
     15        (WebCore::isKeywordPropertyID):
     16        (WebCore::parseKeywordValue):
     17        (WebCore::CSSParser::parseValue):
     18        (WebCore::CSSParser::parseFont):
     19
    120== Rolled over to ChangeLog-2012-05-22 ==
  • trunk/Source/WebCore/css/CSSParser.cpp

    r117809 r118044  
    495495}
    496496
    497 static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int valueID)
     497static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int valueID, const CSSParserContext& parserContext)
    498498{
    499499    if (!valueID)
     
    533533            return true;
    534534        break;
     535    case CSSPropertyDisplay:
     536        // inline | block | list-item | run-in | inline-block | table |
     537        // inline-table | table-row-group | table-header-group | table-footer-group | table-row |
     538        // table-column-group | table-column | table-cell | table-caption | -webkit-box | -webkit-inline-box | none | inherit
     539        // -webkit-flex | -webkit-inline-flex | -webkit-grid | -webkit-inline-grid
     540        if ((valueID >= CSSValueInline && valueID <= CSSValueWebkitInlineFlex) || valueID == CSSValueNone)
     541            return true;
     542        if (parserContext.isCSSGridLayoutEnabled && (valueID == CSSValueWebkitGrid || valueID == CSSValueWebkitInlineGrid))
     543            return true;
     544        break;
     545
    535546    case CSSPropertyEmptyCells: // show | hide | inherit
    536547        if (valueID == CSSValueShow || valueID == CSSValueHide)
     
    820831    case CSSPropertyClear:
    821832    case CSSPropertyDirection:
     833    case CSSPropertyDisplay:
    822834    case CSSPropertyEmptyCells:
    823835    case CSSPropertyFloat:
     
    903915}
    904916
    905 static bool parseKeywordValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important)
     917static bool parseKeywordValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, const CSSParserContext& parserContext)
    906918{
    907919    ASSERT(!string.isEmpty());
     
    923935    else if (valueID == CSSValueInitial)
    924936        value = cssValuePool().createExplicitInitialValue();
    925     else if (isValidKeywordPropertyAndValue(propertyId, valueID))
     937    else if (isValidKeywordPropertyAndValue(propertyId, valueID, parserContext))
    926938        value = cssValuePool().createIdentifierValue(valueID);
    927939    else
     
    949961    if (parseColorValue(declaration, propertyID, string, important, cssParserMode))
    950962        return true;
    951     if (parseKeywordValue(declaration, propertyID, string, important))
     963    if (parseKeywordValue(declaration, propertyID, string, important, contextStyleSheet->parserContext()))
    952964        return true;
    953965
     
    14461458
    14471459    if (isKeywordPropertyID(propId)) {
    1448         if (!isValidKeywordPropertyAndValue(propId, id))
     1460        if (!isValidKeywordPropertyAndValue(propId, id, m_context))
    14491461            return false;
    14501462        if (m_valueList->next() && !inShorthand())
     
    14581470
    14591471    switch (propId) {
    1460     case CSSPropertyDisplay:
    1461         // inline | block | list-item | run-in | inline-block | table |
    1462         // inline-table | table-row-group | table-header-group | table-footer-group | table-row |
    1463         // table-column-group | table-column | table-cell | table-caption | -webkit-box | -webkit-inline-box | none | inherit
    1464         // -webkit-flex | -webkit-inline-flex | -webkit-grid | -webkit-inline-grid
    1465         if ((id >= CSSValueInline && id <= CSSValueWebkitInlineFlex) || id == CSSValueNone)
    1466             validPrimitive = true;
    1467         else if (cssGridLayoutEnabled() && (id == CSSValueWebkitGrid || id == CSSValueWebkitInlineGrid))
    1468             validPrimitive = true;
    1469         break;
    1470 
    14711472    case CSSPropertySize:                 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
    14721473        return parseSize(propId, important);
     
    24752476    case CSSPropertyClear:
    24762477    case CSSPropertyDirection:
     2478    case CSSPropertyDisplay:
    24772479    case CSSPropertyEmptyCells:
    24782480    case CSSPropertyFloat:
     
    43894391    CSSParserValue* value;
    43904392    while ((value = m_valueList->current())) {
    4391         if (!fontStyleParsed && isValidKeywordPropertyAndValue(CSSPropertyFontStyle, value->id)) {
     4393        if (!fontStyleParsed && isValidKeywordPropertyAndValue(CSSPropertyFontStyle, value->id, m_context)) {
    43924394            addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(value->id), important);
    43934395            fontStyleParsed = true;
Note: See TracChangeset for help on using the changeset viewer.