| Index: Source/core/css/parser/LegacyCSSPropertyParser.cpp
|
| diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/LegacyCSSPropertyParser.cpp
|
| similarity index 97%
|
| copy from Source/core/css/parser/CSSPropertyParser.cpp
|
| copy to Source/core/css/parser/LegacyCSSPropertyParser.cpp
|
| index d08862af53cf57c0a7509af8f5495f06444435a7..38fe11864b07f8d8df945590b0c3b88848388a3b 100644
|
| --- a/Source/core/css/parser/CSSPropertyParser.cpp
|
| +++ b/Source/core/css/parser/LegacyCSSPropertyParser.cpp
|
| @@ -74,48 +74,6 @@ static bool equalIgnoringCase(const CSSParserString& a, const char (&b)[N])
|
| return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF::equalIgnoringCase(b, a.characters16(), length);
|
| }
|
|
|
| -CSSPropertyParser::CSSPropertyParser(CSSParserValueList* valueList,
|
| - const CSSParserContext& context, WillBeHeapVector<CSSProperty, 256>& parsedProperties,
|
| - StyleRule::Type ruleType)
|
| - : m_valueList(valueList)
|
| - , m_context(context)
|
| - , m_parsedProperties(parsedProperties)
|
| - , m_ruleType(ruleType)
|
| - , m_inParseShorthand(0)
|
| - , m_currentShorthand(CSSPropertyInvalid)
|
| - , m_implicitShorthand(false)
|
| -{
|
| -}
|
| -
|
| -bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool important,
|
| - CSSParserValueList* valueList, const CSSParserContext& context,
|
| - WillBeHeapVector<CSSProperty, 256>& parsedProperties, StyleRule::Type ruleType)
|
| -{
|
| - int parsedPropertiesSize = parsedProperties.size();
|
| -
|
| - CSSPropertyParser parser(valueList, context, parsedProperties, ruleType);
|
| - CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty);
|
| - bool parseSuccess;
|
| -
|
| - if (ruleType == StyleRule::Viewport) {
|
| - parseSuccess = (RuntimeEnabledFeatures::cssViewportEnabled() || isUASheetBehavior(context.mode()))
|
| - && parser.parseViewportProperty(resolvedProperty, important);
|
| - } else if (ruleType == StyleRule::FontFace) {
|
| - parseSuccess = parser.parseFontFaceDescriptor(resolvedProperty);
|
| - } else {
|
| - parseSuccess = parser.parseValue(unresolvedProperty, important);
|
| - }
|
| -
|
| - // This doesn't count UA style sheets
|
| - if (parseSuccess && context.useCounter())
|
| - context.useCounter()->count(context, unresolvedProperty);
|
| -
|
| - if (!parseSuccess)
|
| - parser.rollbackLastProperties(parsedProperties.size() - parsedPropertiesSize);
|
| -
|
| - return parseSuccess;
|
| -}
|
| -
|
| void CSSPropertyParser::addProperty(CSSPropertyID propId, PassRefPtrWillBeRawPtr<CSSValue> value, bool important, bool implicit)
|
| {
|
| ASSERT(!isPropertyAlias(propId));
|
| @@ -469,20 +427,23 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| return true;
|
| }
|
|
|
| + RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
|
| + if ((parsedValue = parseSingleValue(propId))) {
|
| + if (!m_range.atEnd())
|
| + return false;
|
| + addProperty(propId, parsedValue.release(), important);
|
| + return true;
|
| + }
|
| + if (parseShorthand(propId, important))
|
| + return true;
|
| +
|
| bool validPrimitive = false;
|
| Units unitless = FUnknown;
|
| - RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
|
|
|
| switch (propId) {
|
| case CSSPropertySize: // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
|
| parsedValue = parseSize();
|
| break;
|
| - case CSSPropertyQuotes: // [<string> <string>]+ | none
|
| - if (id == CSSValueNone)
|
| - validPrimitive = true;
|
| - else
|
| - parsedValue = parseQuotes();
|
| - break;
|
|
|
| case CSSPropertyContent: // [ <string> | <uri> | <counter> | attr(X) | open-quote |
|
| // close-quote | no-open-quote | no-close-quote ]+ | inherit
|
| @@ -498,24 +459,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| /* Start of supported CSS properties with validation. This is needed for parseShorthand to work
|
| * correctly and allows optimization in blink::applyRule(..)
|
| */
|
| - case CSSPropertyOverflow: {
|
| - ShorthandScope scope(this, propId);
|
| - if (!parseValue(CSSPropertyOverflowY, important) || m_valueList->current())
|
| - return false;
|
| -
|
| - RefPtrWillBeRawPtr<CSSValue> overflowXValue = nullptr;
|
| -
|
| - // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. If this value has been
|
| - // set using the shorthand, then for now overflow-x will default to auto, but once we implement
|
| - // pagination controls, it should default to hidden. If the overflow-y value is anything but
|
| - // paged-x or paged-y, then overflow-x and overflow-y should have the same value.
|
| - if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY)
|
| - overflowXValue = cssValuePool().createIdentifierValue(CSSValueAuto);
|
| - else
|
| - overflowXValue = m_parsedProperties.last().value();
|
| - addProperty(CSSPropertyOverflowX, overflowXValue.release(), important);
|
| - return true;
|
| - }
|
|
|
| case CSSPropertyTextAlign:
|
| // left | right | center | justify | -webkit-left | -webkit-right | -webkit-center | -webkit-match-parent
|
| @@ -1281,19 +1224,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
|
| return parseGridShorthand(important);
|
|
|
| - case CSSPropertyWebkitMarginCollapse: {
|
| - ShorthandScope scope(this, CSSPropertyWebkitMarginCollapse);
|
| - if (!parseValue(webkitMarginCollapseShorthand().properties()[0], important))
|
| - return false;
|
| - if (!m_valueList->current()) {
|
| - CSSValue* value = m_parsedProperties.last().value();
|
| - addProperty(webkitMarginCollapseShorthand().properties()[1], value, important);
|
| - return true;
|
| - }
|
| - if (!parseValue(webkitMarginCollapseShorthand().properties()[1], important))
|
| - return false;
|
| - return !m_valueList->current();
|
| - }
|
| case CSSPropertyWebkitColumnCount:
|
| parsedValue = parseColumnCount();
|
| break;
|
| @@ -1309,9 +1239,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| case CSSPropertyWebkitColumnWidth: // auto | <length>
|
| parsedValue = parseColumnWidth();
|
| break;
|
| - case CSSPropertyWillChange:
|
| - parsedValue = parseWillChange();
|
| - break;
|
| // End of CSS3 properties
|
|
|
| // Apple specific properties. These will never be standardized and are purely to
|
| @@ -1326,15 +1253,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| validPrimitive = validUnit(value, FLength | FUnitlessQuirk);
|
| break;
|
|
|
| - case CSSPropertyWebkitHighlight:
|
| - if (id == CSSValueNone) {
|
| - validPrimitive = true;
|
| - } else if (value->unit() == CSSPrimitiveValue::UnitType::String) {
|
| - parsedValue = createPrimitiveStringValue(value);
|
| - m_valueList->next();
|
| - }
|
| - break;
|
| -
|
| case CSSPropertyWebkitHyphenateCharacter:
|
| case CSSPropertyWebkitLocale:
|
| if (id == CSSValueAuto) {
|
| @@ -1443,9 +1361,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| return parseTransitionShorthand(important);
|
| case CSSPropertyInvalid:
|
| return false;
|
| - case CSSPropertyPage:
|
| - parsedValue = parsePage();
|
| - break;
|
| // CSS Text Layout Module Level 3: Vertical writing support
|
| case CSSPropertyWebkitTextEmphasis:
|
| return parseShorthand(propId, webkitTextEmphasisShorthand(), important);
|
| @@ -1523,6 +1438,16 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
|
| validPrimitive = false;
|
| break;
|
|
|
| + // These were not accepted by the new path above so we should return false.
|
| + case CSSPropertyWebkitMarginCollapse:
|
| + case CSSPropertyWillChange:
|
| + case CSSPropertyPage:
|
| + case CSSPropertyOverflow:
|
| + case CSSPropertyQuotes:
|
| + case CSSPropertyWebkitHighlight:
|
| + validPrimitive = false;
|
| + break;
|
| +
|
| case CSSPropertyScrollSnapPointsX:
|
| case CSSPropertyScrollSnapPointsY:
|
| parsedValue = parseScrollSnapPoints();
|
| @@ -2064,19 +1989,6 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate()
|
| return parsePositionList(m_valueList);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parsePage()
|
| -{
|
| - CSSParserValue* value = m_valueList->current();
|
| - m_valueList->next();
|
| - ASSERT(value);
|
| -
|
| - if (value->id == CSSValueAuto)
|
| - return cssValuePool().createIdentifierValue(value->id);
|
| - if (value->m_unit == CSSParserValue::Identifier)
|
| - return createPrimitiveCustomIdentValue(value);
|
| - return nullptr;
|
| -}
|
| -
|
| // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
|
| PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseSize()
|
| {
|
| @@ -2143,23 +2055,6 @@ CSSPropertyParser::SizeParameterType CSSPropertyParser::parseSizeParameter(CSSVa
|
| }
|
| }
|
|
|
| -// [ <string> <string> ]+ | none, but none is handled in parseValue
|
| -PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseQuotes()
|
| -{
|
| - RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
|
| - while (CSSParserValue* val = m_valueList->current()) {
|
| - RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
|
| - if (val->unit() != CSSPrimitiveValue::UnitType::String)
|
| - return nullptr;
|
| - parsedValue = createPrimitiveStringValue(val);
|
| - values->append(parsedValue.release());
|
| - m_valueList->next();
|
| - }
|
| - if (values->length() && values->length() % 2 == 0)
|
| - return values.release();
|
| - return nullptr;
|
| -}
|
| -
|
| // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
|
| // in CSS 2.1 this got somewhat reduced:
|
| // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
|
| @@ -6716,56 +6611,6 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseImageSet(CSSParserValue
|
| return imageSet.release();
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseWillChange()
|
| -{
|
| - RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
|
| - if (m_valueList->current()->id == CSSValueAuto) {
|
| - // FIXME: This will be read back as an empty string instead of auto
|
| - return values.release();
|
| - }
|
| -
|
| - // Every comma-separated list of identifiers is a valid will-change value,
|
| - // unless the list includes an explicitly disallowed identifier.
|
| - while (true) {
|
| - CSSParserValue* currentValue = m_valueList->current();
|
| - if (!currentValue || currentValue->m_unit != CSSParserValue::Identifier)
|
| - return nullptr;
|
| -
|
| - CSSPropertyID unresolvedProperty = unresolvedCSSPropertyID(currentValue->string);
|
| - if (unresolvedProperty) {
|
| - ASSERT(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty));
|
| - // Now "all" is used by both CSSValue and CSSPropertyValue.
|
| - // Need to return nullptr when currentValue is CSSPropertyAll.
|
| - if (unresolvedProperty == CSSPropertyWillChange || unresolvedProperty == CSSPropertyAll)
|
| - return nullptr;
|
| - values->append(cssValuePool().createIdentifierValue(unresolvedProperty));
|
| - } else {
|
| - switch (currentValue->id) {
|
| - case CSSValueNone:
|
| - case CSSValueAll:
|
| - case CSSValueAuto:
|
| - case CSSValueDefault:
|
| - case CSSValueInitial:
|
| - case CSSValueInherit:
|
| - return nullptr;
|
| - case CSSValueContents:
|
| - case CSSValueScrollPosition:
|
| - values->append(cssValuePool().createIdentifierValue(currentValue->id));
|
| - break;
|
| - default:
|
| - break;
|
| - }
|
| - }
|
| -
|
| - if (!m_valueList->next())
|
| - break;
|
| - if (!consumeComma(m_valueList))
|
| - return nullptr;
|
| - }
|
| -
|
| - return values.release();
|
| -}
|
| -
|
| PassRefPtrWillBeRawPtr<CSSFunctionValue> CSSPropertyParser::parseBuiltinFilterArguments(CSSParserValueList* args, CSSValueID filterType)
|
| {
|
| RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = CSSFunctionValue::create(filterType);
|
|
|