Changeset 207513 in webkit


Ignore:
Timestamp:
Oct 18, 2016 6:06:45 PM (7 years ago)
Author:
hyatt@apple.com
Message:

[CSS Parser] Enable basic parser testing.
https://bugs.webkit.org/show_bug.cgi?id=163639

Reviewed by Dean Jackson.

  • css/SelectorChecker.cpp:

(WebCore::SelectorChecker::matchRecursively):
Remove the ASSERT_NOT_REACHED on the new shadow selectors. We need to implement this
eventually, but it's better to not assert on that for now.

  • css/parser/CSSParserValues.cpp:

(WebCore::CSSParserSelector::isHostPseudoSelector):
Make sure to check that we're a pseudoclass selector first, since otherwise we'll assert.

  • css/parser/CSSParserValues.h:

(WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching):
Make sure to check that we're a pseudoelement selector first, since otherwise we'll assert.

  • css/parser/CSSPropertyParser.cpp:

(WebCore::CSSPropertyParser::addExpandedPropertyForValue):
copyRef is needed here, since a singleton value is being propagated to all the expanded shorthand properties.

(WebCore::parseSingleShadow):
(WebCore::CSSPropertyParser::consumeFont):
Remove the font properties that aren't part of our shorthand. We will need to revisit this eventually as it seems
some of the font properties should be reset as part of this shorthand but aren't.

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207511 r207513  
     12016-10-18  Dave Hyatt  <hyatt@apple.com>
     2
     3        [CSS Parser] Enable basic parser testing.
     4        https://bugs.webkit.org/show_bug.cgi?id=163639
     5
     6        Reviewed by Dean Jackson.
     7
     8        * css/SelectorChecker.cpp:
     9        (WebCore::SelectorChecker::matchRecursively):
     10        Remove the ASSERT_NOT_REACHED on the new shadow selectors. We need to implement this
     11        eventually, but it's better to not assert on that for now.
     12
     13        * css/parser/CSSParserValues.cpp:
     14        (WebCore::CSSParserSelector::isHostPseudoSelector):
     15        Make sure to check that we're a pseudoclass selector first, since otherwise we'll assert.
     16
     17        * css/parser/CSSParserValues.h:
     18        (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching):
     19        Make sure to check that we're a pseudoelement selector first, since otherwise we'll assert.
     20
     21        * css/parser/CSSPropertyParser.cpp:
     22        (WebCore::CSSPropertyParser::addExpandedPropertyForValue):
     23        copyRef is needed here, since a singleton value is being propagated to all the expanded shorthand properties.
     24
     25        (WebCore::parseSingleShadow):
     26        (WebCore::CSSPropertyParser::consumeFont):
     27        Remove the font properties that aren't part of our shorthand. We will need to revisit this eventually as it seems
     28        some of the font properties should be reset as part of this shorthand but aren't.
     29'
     30        * css/parser/CSSPropertyParserHelpers.cpp:
     31        (WebCore::CSSPropertyParserHelpers::consumeInteger):
     32        Just return a number for now instead of the parser_integer type.
     33
     34        * css/parser/CSSSelectorParser.cpp:
     35        (WebCore::CSSSelectorParser::consumePseudo):
     36        Clean this up so that it doesn't assert by making sure to add qualifying checks for the appropriate match type.
     37
    1382016-10-18  Ryosuke Niwa  <rniwa@webkit.org>
    239
  • trunk/Source/WebCore/css/SelectorChecker.cpp

    r205660 r207513  
    458458    case CSSSelector::ShadowSlot:
    459459        // FIXME-NEWPARSER: Have to implement these.
    460         ASSERT_NOT_REACHED();
     460        // ASSERT_NOT_REACHED();
    461461        return MatchResult::fails(Match::SelectorFailsCompletely);
    462462    }
  • trunk/Source/WebCore/css/parser/CSSParserValues.cpp

    r207396 r207513  
    532532bool CSSParserSelector::isHostPseudoSelector() const
    533533{
    534     return pseudoClassType() == CSSSelector::PseudoClassHost;
    535 }
    536 
    537 }
    538 
     534    return match() == CSSSelector::PseudoClass && pseudoClassType() == CSSSelector::PseudoClassHost;
     535}
     536
     537}
     538
  • trunk/Source/WebCore/css/parser/CSSParserValues.h

    r205790 r207513  
    257257
    258258    // FIXME-NEWPARSER: Missing "shadow"
    259     bool needsImplicitShadowCombinatorForMatching() const { return pseudoElementType() == CSSSelector::PseudoElementWebKitCustom || pseudoElementType() == CSSSelector::PseudoElementUserAgentCustom || pseudoElementType() == CSSSelector::PseudoElementWebKitCustomLegacyPrefixed || pseudoElementType() == CSSSelector::PseudoElementCue || pseudoElementType() == CSSSelector::PseudoElementSlotted; }
     259    bool needsImplicitShadowCombinatorForMatching() const { return match() == CSSSelector::PseudoElement && (pseudoElementType() == CSSSelector::PseudoElementWebKitCustom || pseudoElementType() == CSSSelector::PseudoElementUserAgentCustom || pseudoElementType() == CSSSelector::PseudoElementWebKitCustomLegacyPrefixed || pseudoElementType() == CSSSelector::PseudoElementCue || pseudoElementType() == CSSSelector::PseudoElementSlotted); }
    260260
    261261    CSSParserSelector* tagHistory() const { return m_tagHistory.get(); }
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r207507 r207513  
    229229    const CSSPropertyID* longhands = shorthand.properties();
    230230    for (unsigned i = 0; i < shorthandLength; ++i)
    231         addProperty(longhands[i], property, WTFMove(value), important);
     231        addProperty(longhands[i], property, value.copyRef(), important);
    232232}
    233233   
     
    12931293        }
    12941294    }
    1295     return CSSShadowValue::create(horizontalOffset.releaseNonNull(), verticalOffset.releaseNonNull(), blurRadius.releaseNonNull(),
    1296         spreadDistance.releaseNonNull(), style.releaseNonNull(), color.releaseNonNull());
     1295   
     1296    // We pass RefPtrs, since they can actually be null.
     1297    return CSSShadowValue::create(WTFMove(horizontalOffset), WTFMove(verticalOffset), WTFMove(blurRadius), WTFMove(spreadDistance), WTFMove(style), WTFMove(color));
    12971298}
    12981299
     
    34723473    RefPtr<CSSPrimitiveValue> fontVariantCaps;
    34733474    RefPtr<CSSPrimitiveValue> fontWeight;
    3474     RefPtr<CSSPrimitiveValue> fontStretch;
     3475    // FIXME-NEWPARSER: Implement. RefPtr<CSSPrimitiveValue> fontStretch;
    34753476    while (!m_range.atEnd()) {
    34763477        CSSValueID id = m_range.peek().id();
     
    34913492                continue;
    34923493        }
    3493         if (!fontStretch && CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyFontStretch, id, m_context.mode))
     3494        /* FIXME-NEWPARSER: Implement
     3495         if (!fontStretch && CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyFontStretch, id, m_context.mode))
    34943496            fontStretch = consumeIdent(m_range);
    3495         else
    3496             break;
     3497        else*/
     3498        break;
    34973499    }
    34983500
     
    35023504    addProperty(CSSPropertyFontStyle, CSSPropertyFont, fontStyle ? fontStyle.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important);
    35033505    addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, fontVariantCaps ? fontVariantCaps.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important);
     3506/* 
     3507    // FIXME-NEWPARSER: What do we do with these? They aren't part of our fontShorthand().
    35043508    addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important);
    35053509    addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important);
    3506 
     3510*/
     3511   
    35073512    addProperty(CSSPropertyFontWeight, CSSPropertyFont, fontWeight ? fontWeight.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important);
     3513    /* FIXME-NEWPARSER: Implement.
    35083514    addProperty(CSSPropertyFontStretch, CSSPropertyFont, fontStretch ? fontStretch.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important);
     3515    */
    35093516
    35103517    // Now a font size _must_ come.
  • trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

    r207479 r207513  
    123123        if (token.numericValueType() == NumberValueType || token.numericValue() < minimumValue)
    124124            return nullptr;
    125         return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitTypes::CSS_PARSER_INTEGER);
     125        return CSSPrimitiveValue::create(range.consumeIncludingWhitespace().numericValue(), CSSPrimitiveValue::UnitTypes::CSS_NUMBER);
    126126    }
    127127    CalcParser calcParser(range);
  • trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp

    r205869 r207513  
    438438    std::unique_ptr<CSSParserSelector> selector;
    439439    StringView value = token.value();
    440     if (selector->match() == CSSSelector::PseudoClass)
     440    if (colons == 1)
    441441        selector = std::unique_ptr<CSSParserSelector>(CSSParserSelector::parsePseudoClassSelectorFromStringView(value));
    442442    else
     
    448448    if (token.type() == IdentToken) {
    449449        range.consume();
    450         if (selector->pseudoElementType() == CSSSelector::PseudoElementUnknown)
     450        if ((selector->match() == CSSSelector::PseudoElement && selector->pseudoElementType() == CSSSelector::PseudoElementUnknown) || (selector->match() == CSSSelector::PseudoClass && selector->pseudoClassType() == CSSSelector::PseudoClassUnknown))
    451451            return nullptr;
    452452        return selector;
Note: See TracChangeset for help on using the changeset viewer.