X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fcore%2Fcss%2Fparser%2FBisonCSSParser-in.cpp;h=6376586c1e11b19d6cbf1c9c0d74d64d47b98c9c;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=8e8ea8b2749f27b3c3a1f962abeded7ddd85b6bf;hpb=d482483c7e386df3f789b1cb1845b73bfcaae2bd;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/core/css/parser/BisonCSSParser-in.cpp b/src/third_party/WebKit/Source/core/css/parser/BisonCSSParser-in.cpp index 8e8ea8b..6376586 100644 --- a/src/third_party/WebKit/Source/core/css/parser/BisonCSSParser-in.cpp +++ b/src/third_party/WebKit/Source/core/css/parser/BisonCSSParser-in.cpp @@ -42,7 +42,7 @@ #include "core/css/CSSFunctionValue.h" #include "core/css/CSSGradientValue.h" #include "core/css/CSSGridLineNamesValue.h" -#include "core/css/CSSGridTemplateValue.h" +#include "core/css/CSSGridTemplateAreasValue.h" #include "core/css/CSSImageSetValue.h" #include "core/css/CSSImageValue.h" #include "core/css/CSSInheritedValue.h" @@ -62,7 +62,6 @@ #include "core/css/CSSUnicodeRangeValue.h" #include "core/css/CSSValueList.h" #include "core/css/CSSValuePool.h" -#include "core/css/CSSVariableValue.h" #include "core/css/Counter.h" #include "core/css/HashTools.h" #include "core/css/MediaList.h" @@ -134,7 +133,7 @@ static bool equalIgnoringCase(CSSParserValue* value, const char (&b)[N]) return equalIgnoringCase(value->string, b); } -static PassRefPtr createPrimitiveValuePair(PassRefPtr first, PassRefPtr second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdenticalValues) +static PassRefPtrWillBeRawPtr createPrimitiveValuePair(PassRefPtrWillBeRawPtr first, PassRefPtrWillBeRawPtr second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdenticalValues) { return cssValuePool().createValue(Pair::create(first, second, identicalValuesPolicy)); } @@ -184,7 +183,7 @@ private: bool m_hasSeenAnimationPropertyKeyword; }; -BisonCSSParser::BisonCSSParser(const CSSParserContext& context, UseCounter* counter) +BisonCSSParser::BisonCSSParser(const CSSParserContext& context) : m_context(context) , m_important(false) , m_id(CSSPropertyInvalid) @@ -206,7 +205,6 @@ BisonCSSParser::BisonCSSParser(const CSSParserContext& context, UseCounter* coun , m_allowImportRules(true) , m_allowNamespaceDeclarations(true) , m_inViewport(false) - , m_useCounter(counter) , m_tokenizer(*this) { #if YYDEBUG > 0 @@ -723,18 +721,10 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int if (valueID == CSSValueNone || valueID == CSSValueRow || valueID == CSSValueColumn) return RuntimeEnabledFeatures::cssGridLayoutEnabled(); break; - case CSSPropertyWebkitLineAlign: - if (valueID == CSSValueNone || valueID == CSSValueEdges) - return true; - break; case CSSPropertyWebkitLineBreak: // auto | loose | normal | strict | after-white-space if (valueID == CSSValueAuto || valueID == CSSValueLoose || valueID == CSSValueNormal || valueID == CSSValueStrict || valueID == CSSValueAfterWhiteSpace) return true; break; - case CSSPropertyWebkitLineSnap: - if (valueID == CSSValueNone || valueID == CSSValueBaseline || valueID == CSSValueContain) - return true; - break; case CSSPropertyWebkitMarginAfterCollapse: case CSSPropertyWebkitMarginBeforeCollapse: case CSSPropertyWebkitMarginBottomCollapse: @@ -755,19 +745,6 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int if (valueID == CSSValueExact || valueID == CSSValueEconomy) return true; break; - case CSSPropertyWebkitRegionBreakAfter: - case CSSPropertyWebkitRegionBreakBefore: - if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueAuto || valueID == CSSValueAlways || valueID == CSSValueAvoid || valueID == CSSValueLeft || valueID == CSSValueRight)) - return true; - break; - case CSSPropertyWebkitRegionBreakInside: - if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueAuto || valueID == CSSValueAvoid)) - return true; - break; - case CSSPropertyWebkitRegionFragment: - if (RuntimeEnabledFeatures::cssRegionsEnabled() && (valueID == CSSValueAuto || valueID == CSSValueBreak)) - return true; - break; case CSSPropertyWebkitRtlOrdering: if (valueID == CSSValueLogical || valueID == CSSValueVisual) return true; @@ -912,9 +889,7 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId) case CSSPropertyFontKerning: case CSSPropertyWebkitFontSmoothing: case CSSPropertyGridAutoFlow: - case CSSPropertyWebkitLineAlign: case CSSPropertyWebkitLineBreak: - case CSSPropertyWebkitLineSnap: case CSSPropertyWebkitMarginAfterCollapse: case CSSPropertyWebkitMarginBeforeCollapse: case CSSPropertyWebkitMarginBottomCollapse: @@ -922,10 +897,6 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId) case CSSPropertyInternalMarqueeDirection: case CSSPropertyInternalMarqueeStyle: case CSSPropertyWebkitPrintColorAdjust: - case CSSPropertyWebkitRegionBreakAfter: - case CSSPropertyWebkitRegionBreakBefore: - case CSSPropertyWebkitRegionBreakInside: - case CSSPropertyWebkitRegionFragment: case CSSPropertyWebkitRtlOrdering: case CSSPropertyWebkitRubyPosition: case CSSPropertyWebkitTextCombine: @@ -1008,7 +979,7 @@ static bool parseTransformTranslateArguments(CharType*& pos, CharType* end, unsi } template -static PassRefPtr parseTranslateTransformValue(CharType*& pos, CharType* end) +static PassRefPtrWillBeRawPtr parseTranslateTransformValue(CharType*& pos, CharType* end) { static const int shortestValidTransformStringLength = 12; @@ -1048,20 +1019,20 @@ static PassRefPtr parseTranslateTransformValue(CharType*& pos } pos += argumentStart; - RefPtr transformValue = CSSTransformValue::create(transformType); + RefPtrWillBeRawPtr transformValue = CSSTransformValue::create(transformType); if (!parseTransformTranslateArguments(pos, end, expectedArgumentCount, transformValue.get())) return 0; return transformValue.release(); } template -static PassRefPtr parseTranslateTransformList(CharType*& pos, CharType* end) +static PassRefPtrWillBeRawPtr parseTranslateTransformList(CharType*& pos, CharType* end) { - RefPtr transformList; + RefPtrWillBeRawPtr transformList; while (pos < end) { while (pos < end && isCSSSpace(*pos)) ++pos; - RefPtr transformValue = parseTranslateTransformValue(pos, end); + RefPtrWillBeRawPtr transformValue = parseTranslateTransformValue(pos, end); if (!transformValue) return 0; if (!transformList) @@ -1081,7 +1052,7 @@ static bool parseTranslateTransform(MutableStylePropertySet* properties, CSSProp return false; if (string.isEmpty()) return false; - RefPtr transformList; + RefPtrWillBeRawPtr transformList; if (string.is8Bit()) { const LChar* pos = string.characters8(); const LChar* end = pos + string.length(); @@ -1099,7 +1070,7 @@ static bool parseTranslateTransform(MutableStylePropertySet* properties, CSSProp return true; } -PassRefPtr BisonCSSParser::parseFontFaceValue(const AtomicString& string) +PassRefPtrWillBeRawPtr BisonCSSParser::parseFontFaceValue(const AtomicString& string) { if (string.isEmpty()) return 0; @@ -1114,11 +1085,22 @@ PassRefPtr BisonCSSParser::parseFontFaceValue(const AtomicString& return toCSSValueList(dummyStyle->getPropertyCSSValue(CSSPropertyFontFamily).get()); } +PassRefPtr BisonCSSParser::parseAnimationTimingFunctionValue(const String& string) +{ + if (string.isEmpty()) + return 0; + RefPtr style = MutableStylePropertySet::create(); + if (!parseValue(style.get(), CSSPropertyAnimationTimingFunction, string, false, HTMLStandardMode, 0)) + return 0; + + return style->getPropertyCSSValue(CSSPropertyAnimationTimingFunction); +} + bool BisonCSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, const Document& document) { ASSERT(!string.isEmpty()); - CSSParserContext context(document); + CSSParserContext context(document, UseCounter::getFrom(&document)); if (parseSimpleLengthValue(declaration, propertyID, string, important, context.mode())) return true; @@ -1127,7 +1109,7 @@ bool BisonCSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropert if (parseKeywordValue(declaration, propertyID, string, important, context)) return true; - BisonCSSParser parser(context, UseCounter::getFrom(&document)); + BisonCSSParser parser(context); return parser.parseValue(declaration, propertyID, string, important, static_cast(0)); } @@ -1139,7 +1121,7 @@ bool BisonCSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropert if (parseColorValue(declaration, propertyID, string, important, cssParserMode)) return true; - CSSParserContext context(cssParserMode); + CSSParserContext context(cssParserMode, 0); if (contextStyleSheet) { context = contextStyleSheet->parserContext(); context.setMode(cssParserMode); @@ -1158,8 +1140,8 @@ bool BisonCSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropert { // FIXME: Check RuntimeCSSEnabled::isPropertyEnabled or isValueEnabledForProperty. - if (m_useCounter) - m_useCounter->count(m_context, propertyID); + if (m_context.useCounter()) + m_context.useCounter()->count(m_context, propertyID); setStyleSheet(contextStyleSheet); @@ -1196,7 +1178,7 @@ bool BisonCSSParser::parseColor(RGBA32& color, const String& string, bool strict if (fastParseColor(color, string, strict)) return true; - BisonCSSParser parser(HTMLStandardMode); + BisonCSSParser parser(strictCSSParserContext()); // In case the fast-path parser didn't understand the color, try the full parser. if (!parser.parseColor(string)) @@ -1259,9 +1241,9 @@ void BisonCSSParser::parseSelector(const String& string, CSSSelectorList& select PassRefPtr BisonCSSParser::parseInlineStyleDeclaration(const String& string, Element* element) { Document& document = element->document(); - CSSParserContext context = document.elementSheet()->contents()->parserContext(); + CSSParserContext context = CSSParserContext(document.elementSheet()->contents()->parserContext(), UseCounter::getFrom(&document)); context.setMode((element->isHTMLElement() && !document.inQuirksMode()) ? HTMLStandardMode : HTMLQuirksMode); - return BisonCSSParser(context, UseCounter::getFrom(&document)).parseDeclaration(string, document.elementSheet()->contents()); + return BisonCSSParser(context).parseDeclaration(string, document.elementSheet()->contents()); } PassRefPtr BisonCSSParser::parseDeclaration(const String& string, StyleSheetContents* contextStyleSheet) @@ -1329,20 +1311,13 @@ PassRefPtr BisonCSSParser::parseMediaQueryList(const String& stri return m_mediaList.release(); } -static inline void filterProperties(bool important, const BisonCSSParser::ParsedPropertyVector& input, Vector& output, size_t& unusedEntries, BitArray& seenProperties, HashSet& seenVariables) +static inline void filterProperties(bool important, const BisonCSSParser::ParsedPropertyVector& input, Vector& output, size_t& unusedEntries, BitArray& seenProperties) { // Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found. for (int i = input.size() - 1; i >= 0; --i) { const CSSProperty& property = input[i]; if (property.isImportant() != important) continue; - if (property.id() == CSSPropertyVariable) { - const AtomicString& name = toCSSVariableValue(property.value())->name(); - if (!seenVariables.add(name).isNewEntry) - continue; - output[--unusedEntries] = property; - continue; - } const unsigned propertyIDIndex = property.id() - firstCSSProperty; if (seenProperties.get(propertyIDIndex)) continue; @@ -1358,9 +1333,8 @@ PassRefPtr BisonCSSParser::createStylePropertySet() Vector results(unusedEntries); // Important properties have higher priority, so add them first. Duplicate definitions can then be ignored when found. - HashSet seenVariables; - filterProperties(true, m_parsedProperties, results, unusedEntries, seenProperties, seenVariables); - filterProperties(false, m_parsedProperties, results, unusedEntries, seenProperties, seenVariables); + filterProperties(true, m_parsedProperties, results, unusedEntries, seenProperties); + filterProperties(false, m_parsedProperties, results, unusedEntries, seenProperties); if (unusedEntries) results.remove(0, unusedEntries); @@ -1390,9 +1364,8 @@ void BisonCSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassR void BisonCSSParser::addProperty(CSSPropertyID propId, PassRefPtr value, bool important, bool implicit) { - CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimitiveValue(value.get()) : 0; - // This property doesn't belong to a shorthand or is a CSS variable (which will be resolved later). - if (!m_currentShorthand || (primitiveValue && primitiveValue->isVariableReference())) { + // This property doesn't belong to a shorthand. + if (!m_currentShorthand) { m_parsedProperties.append(CSSProperty(propId, value, important, false, CSSPropertyInvalid, m_implicitShorthand || implicit)); return; } @@ -1455,9 +1428,6 @@ bool BisonCSSParser::validCalculationUnit(CSSParserValue* value, Units unitflags case CalcPercentNumber: b = (unitflags & FPercent) && (unitflags & FNumber); break; - case CalcVariable: - b = true; - break; case CalcOther: break; } @@ -1466,11 +1436,6 @@ bool BisonCSSParser::validCalculationUnit(CSSParserValue* value, Units unitflags return b; } -static bool isVariableReference(CSSParserValue* value) -{ - return value->unit == CSSParserValue::Function && equal(value->function->name, "var("); -} - inline bool BisonCSSParser::shouldAcceptUnitLessValues(CSSParserValue* value, Units unitflags, CSSParserMode cssParserMode) { // Quirks mode and presentation attributes accept unit less values. @@ -1482,10 +1447,6 @@ bool BisonCSSParser::validUnit(CSSParserValue* value, Units unitflags, CSSParser if (isCalculation(value)) return validCalculationUnit(value, unitflags, releaseCalc); - // Variables are checked at the point they are dereferenced because unit type is not available here. - if (isVariableReference(value)) - return true; - bool b = false; switch (value->unit) { case CSSPrimitiveValue::CSS_NUMBER: @@ -1546,11 +1507,8 @@ bool BisonCSSParser::validUnit(CSSParserValue* value, Units unitflags, CSSParser return b; } -inline PassRefPtr BisonCSSParser::createPrimitiveNumericValue(CSSParserValue* value) +inline PassRefPtrWillBeRawPtr BisonCSSParser::createPrimitiveNumericValue(CSSParserValue* value) { - if (isVariableReference(value)) - return createPrimitiveVariableReferenceValue(value); - if (m_parsedCalculation) { ASSERT(isCalculation(value)); return CSSPrimitiveValue::create(m_parsedCalculation.release()); @@ -1563,18 +1521,12 @@ inline PassRefPtr BisonCSSParser::createPrimitiveNumericValue return cssValuePool().createValue(value->fValue, static_cast(value->unit)); } -inline PassRefPtr BisonCSSParser::createPrimitiveStringValue(CSSParserValue* value) +inline PassRefPtrWillBeRawPtr BisonCSSParser::createPrimitiveStringValue(CSSParserValue* value) { ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPrimitiveValue::CSS_IDENT); return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING); } -inline PassRefPtr BisonCSSParser::createPrimitiveVariableReferenceValue(CSSParserValue* value) -{ - ASSERT(value->unit == CSSParserValue::Function && value->function->args->size() == 1); - return CSSPrimitiveValue::create(value->function->args->valueAt(0)->string, CSSPrimitiveValue::CSS_VARIABLE_REFERENCE); -} - static inline bool isComma(CSSParserValue* value) { return value && value->unit == CSSParserValue::Operator && value->iValue == ','; @@ -1612,7 +1564,7 @@ bool BisonCSSParser::validWidthOrHeight(CSSParserValue* value) return !id && validUnit(value, FLength | FPercent | FNonNeg); } -inline PassRefPtr BisonCSSParser::parseValidPrimitive(CSSValueID identifier, CSSParserValue* value) +inline PassRefPtrWillBeRawPtr BisonCSSParser::parseValidPrimitive(CSSValueID identifier, CSSParserValue* value) { if (identifier) return cssValuePool().createIdentifierValue(identifier); @@ -1630,8 +1582,6 @@ inline PassRefPtr BisonCSSParser::parseValidPrimitive(CSSValu return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPrimitiveValue::CSS_EMS); if (isCalculation(value)) return CSSPrimitiveValue::create(m_parsedCalculation.release()); - if (isVariableReference(value)) - return createPrimitiveVariableReferenceValue(value); return 0; } @@ -1663,8 +1613,8 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) return false; // We don't count the UA style sheet in our statistics. - if (m_useCounter) - m_useCounter->count(m_context, propId); + if (m_context.useCounter()) + m_context.useCounter()->count(m_context, propId); if (!m_valueList) return false; @@ -1703,13 +1653,6 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) return true; } - if (!id && num == 1 && isVariableReference(value)) { - addProperty(propId, createPrimitiveVariableReferenceValue(value), important); - m_valueList->next(); - return true; - } - ASSERT(propId != CSSPropertyVariable); - if (isKeywordPropertyID(propId)) { if (!isValidKeywordPropertyAndValue(propId, id, m_context)) return false; @@ -1856,7 +1799,7 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | text | wait | help | // vertical-text | cell | context-menu | alias | copy | no-drop | not-allowed | -webkit-zoom-in // -webkit-zoom-out | all-scroll | -webkit-grab | -webkit-grabbing ] ] | inherit - RefPtr list; + RefPtrWillBeRawPtr list; while (value) { RefPtr image = 0; if (value->unit == CSSPrimitiveValue::CSS_URI) { @@ -2176,7 +2119,7 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyBorderImageOutset: case CSSPropertyWebkitMaskBoxImageOutset: { - RefPtr result; + RefPtrWillBeRawPtr result; if (parseBorderImageOutset(result)) { addProperty(propId, result, important); return true; @@ -2194,7 +2137,7 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) } case CSSPropertyBorderImageSlice: case CSSPropertyWebkitMaskBoxImageSlice: { - RefPtr result; + RefPtrWillBeRawPtr result; if (parseBorderImageSlice(propId, result)) { addProperty(propId, result, important); return true; @@ -2203,7 +2146,7 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) } case CSSPropertyBorderImageWidth: case CSSPropertyWebkitMaskBoxImageWidth: { - RefPtr result; + RefPtrWillBeRawPtr result; if (parseBorderImageWidth(result)) { addProperty(propId, result, important); return true; @@ -2219,8 +2162,8 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); if (!validPrimitive) return false; - RefPtr parsedValue1 = createPrimitiveNumericValue(value); - RefPtr parsedValue2; + RefPtrWillBeRawPtr parsedValue1 = createPrimitiveNumericValue(value); + RefPtrWillBeRawPtr parsedValue2; if (num == 2) { value = m_valueList->next(); validPrimitive = validUnit(value, FLength | FPercent | FNonNeg); @@ -2250,7 +2193,7 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) if (id == CSSValueNone) validPrimitive = true; else { - RefPtr shadowValueList = parseShadow(m_valueList.get(), propId); + RefPtrWillBeRawPtr shadowValueList = parseShadow(m_valueList.get(), propId); if (shadowValueList) { addProperty(propId, shadowValueList.release(), important); m_valueList->next(); @@ -2311,16 +2254,7 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) validPrimitive = validUnit(value, FNumber | FNonNeg); break; case CSSPropertyOrder: - if (validUnit(value, FInteger, HTMLStandardMode)) { - if (!isVariableReference(value)) { - // We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set. - parsedValue = cssValuePool().createValue(max(static_cast(std::numeric_limits::min() + 2), value->fValue), - static_cast(value->unit)); - m_valueList->next(); - } else { - validPrimitive = true; - } - } + validPrimitive = validUnit(value, FInteger, HTMLStandardMode); break; case CSSPropertyInternalMarqueeIncrement: if (id == CSSValueSmall || id == CSSValueLarge || id == CSSValueMedium) @@ -2340,14 +2274,6 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) else validPrimitive = validUnit(value, FTime | FInteger | FNonNeg); break; - case CSSPropertyWebkitFlowInto: - if (!RuntimeEnabledFeatures::cssRegionsEnabled()) - return false; - return parseFlowThread(propId, important); - case CSSPropertyWebkitFlowFrom: - if (!RuntimeEnabledFeatures::cssRegionsEnabled()) - return false; - return parseRegionThread(propId, important); case CSSPropertyWebkitTransform: if (id == CSSValueNone) validPrimitive = true; @@ -2454,8 +2380,8 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) parsedValue = parseGridTrackSize(*m_valueList); break; - case CSSPropertyGridDefinitionColumns: - case CSSPropertyGridDefinitionRows: + case CSSPropertyGridTemplateColumns: + case CSSPropertyGridTemplateRows: if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) return false; return parseGridTrackList(propId, important); @@ -2480,10 +2406,10 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) return false; return parseGridAreaShorthand(important); - case CSSPropertyGridTemplate: + case CSSPropertyGridTemplateAreas: if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) return false; - parsedValue = parseGridTemplate(); + parsedValue = parseGridTemplateAreas(); break; case CSSPropertyWebkitMarginCollapse: { @@ -2562,17 +2488,6 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) validPrimitive = true; break; - case CSSPropertyWebkitLineGrid: - if (id == CSSValueNone) - validPrimitive = true; - else if (value->unit == CSSPrimitiveValue::CSS_IDENT) { - String lineGridValue = String(value->string); - if (!lineGridValue.isEmpty()) { - addProperty(propId, cssValuePool().createValue(lineGridValue, CSSPrimitiveValue::CSS_STRING), important); - return true; - } - } - break; case CSSPropertyWebkitLocale: if (id == CSSValueAuto || value->unit == CSSPrimitiveValue::CSS_STRING) validPrimitive = true; @@ -2717,7 +2632,7 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) return parseFontFeatureSettings(important); break; - case CSSPropertyWebkitFontVariantLigatures: + case CSSPropertyFontVariantLigatures: if (id == CSSValueNormal) validPrimitive = true; else @@ -2799,7 +2714,6 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyTextUnderlineMode: case CSSPropertyTextUnderlineStyle: case CSSPropertyTouchActionDelay: - case CSSPropertyVariable: case CSSPropertyVisibility: case CSSPropertyWebkitAppearance: case CSSPropertyWebkitBackfaceVisibility: @@ -2827,9 +2741,7 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyFontKerning: case CSSPropertyWebkitFontSmoothing: case CSSPropertyGridAutoFlow: - case CSSPropertyWebkitLineAlign: case CSSPropertyWebkitLineBreak: - case CSSPropertyWebkitLineSnap: case CSSPropertyWebkitMarginAfterCollapse: case CSSPropertyWebkitMarginBeforeCollapse: case CSSPropertyWebkitMarginBottomCollapse: @@ -2837,10 +2749,6 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyInternalMarqueeDirection: case CSSPropertyInternalMarqueeStyle: case CSSPropertyWebkitPrintColorAdjust: - case CSSPropertyWebkitRegionBreakAfter: - case CSSPropertyWebkitRegionBreakBefore: - case CSSPropertyWebkitRegionBreakInside: - case CSSPropertyWebkitRegionFragment: case CSSPropertyWebkitRtlOrdering: case CSSPropertyWebkitRubyPosition: case CSSPropertyWebkitTextCombine: @@ -2895,7 +2803,7 @@ void BisonCSSParser::addFillValue(RefPtr& lval, PassRefPtr r toCSSValueList(lval.get())->append(rval); else { PassRefPtr oldlVal(lval.release()); - PassRefPtr list = CSSValueList::createCommaSeparated(); + PassRefPtrWillBeRawPtr list = CSSValueList::createCommaSeparated(); list->append(oldlVal); list->append(rval); lval = list; @@ -3071,30 +2979,6 @@ bool BisonCSSParser::parseFillShorthand(CSSPropertyID propId, const CSSPropertyI return true; } -void BisonCSSParser::storeVariableDeclaration(const CSSParserString& name, PassOwnPtr value, bool important) -{ - // When CSSGrammar.y encounters an invalid declaration it passes null for the CSSParserValueList, just bail. - if (!value) - return; - - static const unsigned prefixLength = sizeof("var-") - 1; - - ASSERT(name.length() > prefixLength); - AtomicString variableReference = name.atomicSubstring(prefixLength, name.length() - prefixLength); - - StringBuilder builder; - for (unsigned i = 0, size = value->size(); i < size; i++) { - if (i) - builder.append(' '); - RefPtr cssValue = value->valueAt(i)->createCSSValue(); - if (!cssValue) - return; - builder.append(cssValue->cssText()); - } - - addProperty(CSSPropertyVariable, CSSVariableValue::create(variableReference, builder.toString()), important, false); -} - void BisonCSSParser::addAnimationValue(RefPtr& lval, PassRefPtr rval) { if (lval) { @@ -3102,7 +2986,7 @@ void BisonCSSParser::addAnimationValue(RefPtr& lval, PassRefPtrappend(rval); else { PassRefPtr oldVal(lval.release()); - PassRefPtr list = CSSValueList::createCommaSeparated(); + PassRefPtrWillBeRawPtr list = CSSValueList::createCommaSeparated(); list->append(oldVal); list->append(rval); lval = list; @@ -3456,7 +3340,7 @@ bool BisonCSSParser::parseSize(CSSPropertyID propId, bool important) if (!value) return false; - RefPtr parsedValues = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr parsedValues = CSSValueList::createSpaceSeparated(); // First parameter. SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value, None); @@ -3521,7 +3405,7 @@ BisonCSSParser::SizeParameterType BisonCSSParser::parseSizeParameter(CSSValueLis // inherit and none are handled in parseValue. bool BisonCSSParser::parseQuotes(CSSPropertyID propId, bool important) { - RefPtr values = CSSValueList::createCommaSeparated(); + RefPtrWillBeRawPtr values = CSSValueList::createCommaSeparated(); while (CSSParserValue* val = m_valueList->current()) { RefPtr parsedValue; if (val->unit == CSSPrimitiveValue::CSS_STRING) @@ -3544,7 +3428,7 @@ bool BisonCSSParser::parseQuotes(CSSPropertyID propId, bool important) // [ | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit bool BisonCSSParser::parseContent(CSSPropertyID propId, bool important) { - RefPtr values = CSSValueList::createCommaSeparated(); + RefPtrWillBeRawPtr values = CSSValueList::createCommaSeparated(); while (CSSParserValue* val = m_valueList->current()) { RefPtr parsedValue; @@ -3702,7 +3586,7 @@ PassRefPtr BisonCSSParser::parseFillPositionY(CSSParserValueList* valu return 0; } -PassRefPtr BisonCSSParser::parseFillPositionComponent(CSSParserValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillPositionParsingMode parsingMode) +PassRefPtrWillBeRawPtr BisonCSSParser::parseFillPositionComponent(CSSParserValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillPositionParsingMode parsingMode) { CSSValueID id = valueList->current()->id; if (id == CSSValueLeft || id == CSSValueTop || id == CSSValueRight || id == CSSValueBottom || id == CSSValueCenter) { @@ -3767,7 +3651,7 @@ static bool isFillPositionKeyword(CSSValueID value) return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBottom || value == CSSValueRight || value == CSSValueCenter; } -void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, RefPtr& value1, RefPtr& value2, PassRefPtr parsedValue1, PassRefPtr parsedValue2) +void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, RefPtr& value1, RefPtr& value2, PassRefPtrWillBeRawPtr parsedValue1, PassRefPtrWillBeRawPtr parsedValue2) { // [ left | right ] [ ] && [ top | bottom ] [ | ] // In the case of 4 values requires the second value to be a length or a percentage. @@ -3776,7 +3660,7 @@ void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, Ref unsigned cumulativeFlags = 0; FillPositionFlag value3Flag = InvalidFillPosition; - RefPtr value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword); + RefPtrWillBeRawPtr value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword); if (!value3) return; @@ -3799,7 +3683,7 @@ void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, Ref cumulativeFlags = 0; FillPositionFlag value4Flag = InvalidFillPosition; - RefPtr value4 = parseFillPositionComponent(valueList, cumulativeFlags, value4Flag, ResolveValuesAsKeyword); + RefPtrWillBeRawPtr value4 = parseFillPositionComponent(valueList, cumulativeFlags, value4Flag, ResolveValuesAsKeyword); if (!value4) return; @@ -3815,11 +3699,11 @@ void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, Ref valueList->next(); } -void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, RefPtr& value1, RefPtr& value2, PassRefPtr parsedValue1, PassRefPtr parsedValue2) +void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, RefPtr& value1, RefPtr& value2, PassRefPtrWillBeRawPtr parsedValue1, PassRefPtrWillBeRawPtr parsedValue2) { unsigned cumulativeFlags = 0; FillPositionFlag value3Flag = InvalidFillPosition; - RefPtr value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword); + RefPtrWillBeRawPtr value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword); // value3 is not an expected value, we return. if (!value3) @@ -3863,8 +3747,8 @@ void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, Ref value1 = createPrimitiveValuePair(parsedValue1, parsedValue2); value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(secondPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PERCENTAGE)); } else { - RefPtr firstPositionValue; - RefPtr secondPositionValue; + RefPtrWillBeRawPtr firstPositionValue; + RefPtrWillBeRawPtr secondPositionValue; if (isFillPositionKeyword(ident2)) { // To match CSS grammar, we should only accept: [ center | left | right | bottom | top ] [ left | right | top | bottom ] [ | ]. @@ -3958,8 +3842,8 @@ void BisonCSSParser::parseFillPosition(CSSParserValueList* valueList, RefPtr parsedValue1 = toCSSPrimitiveValue(value1.get()); - RefPtr parsedValue2 = toCSSPrimitiveValue(value2.get()); + RefPtrWillBeRawPtr parsedValue1 = toCSSPrimitiveValue(value1.get()); + RefPtrWillBeRawPtr parsedValue2 = toCSSPrimitiveValue(value2.get()); value1.clear(); value2.clear(); @@ -4067,7 +3951,7 @@ PassRefPtr BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a if (value->id == CSSValueContain || value->id == CSSValueCover) return cssValuePool().createIdentifierValue(value->id); - RefPtr parsedValue1; + RefPtrWillBeRawPtr parsedValue1; if (value->id == CSSValueAuto) parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto); @@ -4077,7 +3961,7 @@ PassRefPtr BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a parsedValue1 = createPrimitiveNumericValue(value); } - RefPtr parsedValue2; + RefPtrWillBeRawPtr parsedValue2; if ((value = m_valueList->next())) { if (value->unit == CSSParserValue::Operator && value->iValue == ',') allowComma = false; @@ -4105,8 +3989,8 @@ PassRefPtr BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a bool BisonCSSParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, RefPtr& retValue1, RefPtr& retValue2) { - RefPtr values; - RefPtr values2; + RefPtrWillBeRawPtr values; + RefPtrWillBeRawPtr values2; CSSParserValue* val; RefPtr value; RefPtr value2; @@ -4479,7 +4363,7 @@ PassRefPtr BisonCSSParser::parseAnimationTimingFunction() bool BisonCSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr& result, AnimationParseContext& context) { - RefPtr values; + RefPtrWillBeRawPtr values; CSSParserValue* val; RefPtr value; bool allowComma = false; @@ -4597,7 +4481,7 @@ bool BisonCSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr || ] in (which can be stand alone or with 'span'). -bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtr& numericValue, RefPtr& gridLineName) +bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtrWillBeRawPtr& numericValue, RefPtrWillBeRawPtr& gridLineName) { CSSParserValue* value = m_valueList->current(); if (validUnit(value, FInteger) && value->fValue) { @@ -4638,8 +4522,8 @@ PassRefPtr BisonCSSParser::parseGridPosition() return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING); } - RefPtr numericValue; - RefPtr gridLineName; + RefPtrWillBeRawPtr numericValue; + RefPtrWillBeRawPtr gridLineName; bool hasSeenSpanKeyword = false; if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) { @@ -4667,7 +4551,7 @@ PassRefPtr BisonCSSParser::parseGridPosition() if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0) return 0; - RefPtr values = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr values = CSSValueList::createSpaceSeparated(); if (hasSeenSpanKeyword) values->append(cssValuePool().createIdentifierValue(CSSValueSpan)); if (numericValue) @@ -4781,10 +4665,10 @@ void BisonCSSParser::parseGridLineNames(CSSParserValueList* parserValueList, CSS return; } - RefPtr lineNames = CSSGridLineNamesValue::create(); + RefPtrWillBeRawPtr lineNames = CSSGridLineNamesValue::create(); while (CSSParserValue* identValue = identList->current()) { ASSERT(identValue->unit == CSSPrimitiveValue::CSS_IDENT); - RefPtr lineName = createPrimitiveStringValue(identValue); + RefPtrWillBeRawPtr lineName = createPrimitiveStringValue(identValue); lineNames->append(lineName.release()); identList->next(); } @@ -4806,7 +4690,7 @@ bool BisonCSSParser::parseGridTrackList(CSSPropertyID propId, bool important) return true; } - RefPtr values = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr values = CSSValueList::createSpaceSeparated(); // Handle leading *. value = m_valueList->current(); if (value && value->unit == CSSParserValue::ValueList) @@ -4847,7 +4731,7 @@ bool BisonCSSParser::parseGridTrackRepeatFunction(CSSValueList& list) ASSERT_WITH_SECURITY_IMPLICATION(arguments->valueAt(0)->fValue > 0); size_t repetitions = arguments->valueAt(0)->fValue; - RefPtr repeatedValues = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr repeatedValues = CSSValueList::createSpaceSeparated(); arguments->next(); // Skip the repetition count. arguments->next(); // Skip the comma. @@ -4895,15 +4779,15 @@ PassRefPtr BisonCSSParser::parseGridTrackSize(CSSParserValueList& inpu if (!arguments || arguments->size() != 3 || !isComma(arguments->valueAt(1))) return 0; - RefPtr minTrackBreadth = parseGridBreadth(arguments->valueAt(0)); + RefPtrWillBeRawPtr minTrackBreadth = parseGridBreadth(arguments->valueAt(0)); if (!minTrackBreadth) return 0; - RefPtr maxTrackBreadth = parseGridBreadth(arguments->valueAt(2)); + RefPtrWillBeRawPtr maxTrackBreadth = parseGridBreadth(arguments->valueAt(2)); if (!maxTrackBreadth) return 0; - RefPtr parsedArguments = CSSValueList::createCommaSeparated(); + RefPtrWillBeRawPtr parsedArguments = CSSValueList::createCommaSeparated(); parsedArguments->append(minTrackBreadth); parsedArguments->append(maxTrackBreadth); return CSSFunctionValue::create("minmax(", parsedArguments); @@ -4912,7 +4796,7 @@ PassRefPtr BisonCSSParser::parseGridTrackSize(CSSParserValueList& inpu return parseGridBreadth(currentValue); } -PassRefPtr BisonCSSParser::parseGridBreadth(CSSParserValue* currentValue) +PassRefPtrWillBeRawPtr BisonCSSParser::parseGridBreadth(CSSParserValue* currentValue) { if (currentValue->id == CSSValueMinContent || currentValue->id == CSSValueMaxContent) return cssValuePool().createIdentifierValue(currentValue->id); @@ -4933,7 +4817,7 @@ PassRefPtr BisonCSSParser::parseGridBreadth(CSSParserValue* c return createPrimitiveNumericValue(currentValue); } -PassRefPtr BisonCSSParser::parseGridTemplate() +PassRefPtr BisonCSSParser::parseGridTemplateAreas() { NamedGridAreaMap gridAreaMap; size_t rowCount = 0; @@ -5003,7 +4887,7 @@ PassRefPtr BisonCSSParser::parseGridTemplate() if (!rowCount || !columnCount) return 0; - return CSSGridTemplateValue::create(gridAreaMap, rowCount, columnCount); + return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount); } PassRefPtr BisonCSSParser::parseCounterContent(CSSParserValueList* args, bool counters) @@ -5017,9 +4901,9 @@ PassRefPtr BisonCSSParser::parseCounterContent(CSSParserValueList* arg CSSParserValue* i = args->current(); if (i->unit != CSSPrimitiveValue::CSS_IDENT) return 0; - RefPtr identifier = createPrimitiveStringValue(i); + RefPtrWillBeRawPtr identifier = createPrimitiveStringValue(i); - RefPtr separator; + RefPtrWillBeRawPtr separator; if (!counters) separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_STRING); else { @@ -5034,7 +4918,7 @@ PassRefPtr BisonCSSParser::parseCounterContent(CSSParserValueList* arg separator = createPrimitiveStringValue(i); } - RefPtr listStyle; + RefPtrWillBeRawPtr listStyle; i = args->next(); if (!i) // Make the list style default decimal listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); @@ -5077,7 +4961,7 @@ bool BisonCSSParser::parseClipShape(CSSPropertyID propId, bool important) valid = a->id == CSSValueAuto || validUnit(a, FLength); if (!valid) break; - RefPtr length = a->id == CSSValueAuto ? + RefPtrWillBeRawPtr length = a->id == CSSValueAuto ? cssValuePool().createIdentifierValue(CSSValueAuto) : createPrimitiveNumericValue(a); if (i == 0) @@ -5107,6 +4991,134 @@ bool BisonCSSParser::parseClipShape(CSSPropertyID propId, bool important) return false; } +static void completeBorderRadii(RefPtrWillBeRawPtr radii[4]) +{ + if (radii[3]) + return; + if (!radii[2]) { + if (!radii[1]) + radii[1] = radii[0]; + radii[2] = radii[0]; + } + radii[3] = radii[1]; +} + +// FIXME: This should be refactored with CSSParser::parseBorderRadius. +// CSSParser::parseBorderRadius contains support for some legacy radius construction. +PassRefPtr BisonCSSParser::parseInsetRoundedCorners(PassRefPtr shape, CSSParserValueList* args) +{ + CSSParserValue* argument = args->next(); + + if (!argument) + return 0; + + CSSParserValueList radiusArguments; + while (argument) { + radiusArguments.addValue(*argument); + argument = args->next(); + } + + unsigned num = radiusArguments.size(); + if (!num || num > 9) + return 0; + + // FIXME: Refactor completeBorderRadii and the array + RefPtrWillBeRawPtr radii[2][4]; + + unsigned indexAfterSlash = 0; + for (unsigned i = 0; i < num; ++i) { + CSSParserValue* value = radiusArguments.valueAt(i); + if (value->unit == CSSParserValue::Operator) { + if (value->iValue != '/') + return 0; + + if (!i || indexAfterSlash || i + 1 == num) + return 0; + + indexAfterSlash = i + 1; + completeBorderRadii(radii[0]); + continue; + } + + if (i - indexAfterSlash >= 4) + return 0; + + if (!validUnit(value, FLength | FPercent | FNonNeg)) + return 0; + + RefPtrWillBeRawPtr radius = createPrimitiveNumericValue(value); + + if (!indexAfterSlash) + radii[0][i] = radius; + else + radii[1][i - indexAfterSlash] = radius.release(); + } + + if (!indexAfterSlash) { + completeBorderRadii(radii[0]); + for (unsigned i = 0; i < 4; ++i) + radii[1][i] = radii[0][i]; + } else { + completeBorderRadii(radii[1]); + } + shape->setTopLeftRadius(createPrimitiveValuePair(radii[0][0].release(), radii[1][0].release())); + shape->setTopRightRadius(createPrimitiveValuePair(radii[0][1].release(), radii[1][1].release())); + shape->setBottomRightRadius(createPrimitiveValuePair(radii[0][2].release(), radii[1][2].release())); + shape->setBottomLeftRadius(createPrimitiveValuePair(radii[0][3].release(), radii[1][3].release())); + + return shape; +} + +PassRefPtr BisonCSSParser::parseBasicShapeInset(CSSParserValueList* args) +{ + ASSERT(args); + + RefPtr shape = CSSBasicShapeInset::create(); + + CSSParserValue* argument = args->current(); + WillBeHeapVector > widthArguments; + bool hasRoundedInset = false; + + while (argument) { + if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(argument->string, "round")) { + hasRoundedInset = true; + break; + } + + Units unitFlags = FLength | FPercent; + if (!validUnit(argument, unitFlags) || widthArguments.size() > 4) + return 0; + + widthArguments.append(createPrimitiveNumericValue(argument)); + argument = args->next(); + } + + switch (widthArguments.size()) { + case 1: { + shape->updateShapeSize1Value(widthArguments[0].get()); + break; + } + case 2: { + shape->updateShapeSize2Values(widthArguments[0].get(), widthArguments[1].get()); + break; + } + case 3: { + shape->updateShapeSize3Values(widthArguments[0].get(), widthArguments[1].get(), widthArguments[2].get()); + break; + } + case 4: { + shape->updateShapeSize4Values(widthArguments[0].get(), widthArguments[1].get(), widthArguments[2].get(), widthArguments[3].get()); + break; + } + default: + return 0; + } + + if (hasRoundedInset) + return parseInsetRoundedCorners(shape, args); + return shape; +} + static bool isItemPositionKeyword(CSSValueID id) { return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter @@ -5130,8 +5142,8 @@ bool BisonCSSParser::parseItemPositionOverflowPosition(CSSPropertyID propId, boo return true; } - RefPtr position = 0; - RefPtr overflowAlignmentKeyword = 0; + RefPtrWillBeRawPtr position = 0; + RefPtrWillBeRawPtr overflowAlignmentKeyword = 0; if (isItemPositionKeyword(value->id)) { position = cssValuePool().createIdentifierValue(value->id); value = m_valueList->next(); @@ -5187,7 +5199,7 @@ PassRefPtr BisonCSSParser::parseBasicShapeRectangle(CSSParserValu if (!validUnit(argument, unitFlags)) return 0; - RefPtr length = createPrimitiveNumericValue(argument); + RefPtrWillBeRawPtr length = createPrimitiveNumericValue(argument); ASSERT(argumentNumber < 6); switch (argumentNumber) { case 0: @@ -5241,7 +5253,7 @@ PassRefPtr BisonCSSParser::parseBasicShapeInsetRectangle(CSSParse if (!validUnit(argument, unitFlags)) return 0; - RefPtr length = createPrimitiveNumericValue(argument); + RefPtrWillBeRawPtr length = createPrimitiveNumericValue(argument); ASSERT(argumentNumber < 6); switch (argumentNumber) { case 0: @@ -5278,7 +5290,7 @@ PassRefPtr BisonCSSParser::parseBasicShapeInsetRectangle(CSSParse return shape; } -PassRefPtr BisonCSSParser::parseShapeRadius(CSSParserValue* value) +PassRefPtrWillBeRawPtr BisonCSSParser::parseShapeRadius(CSSParserValue* value) { if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide) return cssValuePool().createIdentifierValue(value->id); @@ -5307,7 +5319,7 @@ PassRefPtr BisonCSSParser::parseBasicShapeCircle(CSSParserValueLi return 0; if (!args->currentIndex() && argument->id != CSSValueAt) { - if (RefPtr radius = parseShapeRadius(argument)) { + if (RefPtrWillBeRawPtr radius = parseShapeRadius(argument)) { shape->setRadius(radius); continue; } @@ -5358,7 +5370,7 @@ PassRefPtr BisonCSSParser::parseDeprecatedBasicShapeCircle(CSSPar if (!validUnit(argument, unitFlags)) return 0; - RefPtr length = createPrimitiveNumericValue(argument); + RefPtrWillBeRawPtr length = createPrimitiveNumericValue(argument); ASSERT(argumentNumber < 3); switch (argumentNumber) { case 0: @@ -5406,7 +5418,7 @@ PassRefPtr BisonCSSParser::parseBasicShapeEllipse(CSSParserValueL return 0; if (args->currentIndex() < 2 && argument->id != CSSValueAt) { - if (RefPtr radius = parseShapeRadius(argument)) { + if (RefPtrWillBeRawPtr radius = parseShapeRadius(argument)) { if (!shape->radiusX()) shape->setRadiusX(radius); else @@ -5455,7 +5467,7 @@ PassRefPtr BisonCSSParser::parseDeprecatedBasicShapeEllipse(CSSPa if (!validUnit(argument, unitFlags)) return 0; - RefPtr length = createPrimitiveNumericValue(argument); + RefPtrWillBeRawPtr length = createPrimitiveNumericValue(argument); ASSERT(argumentNumber < 4); switch (argumentNumber) { case 0: @@ -5520,8 +5532,8 @@ PassRefPtr BisonCSSParser::parseBasicShapePolygon(CSSParserValueL if (!argumentY || !validUnit(argumentY, FLength | FPercent)) return 0; - RefPtr xLength = createPrimitiveNumericValue(argumentX); - RefPtr yLength = createPrimitiveNumericValue(argumentY); + RefPtrWillBeRawPtr xLength = createPrimitiveNumericValue(argumentX); + RefPtrWillBeRawPtr yLength = createPrimitiveNumericValue(argumentY); shape->appendPoint(xLength.release(), yLength.release()); @@ -5573,12 +5585,12 @@ PassRefPtr BisonCSSParser::parseShapeProperty(CSSPropertyID propId) CSSParserValue* value = m_valueList->current(); CSSValueID valueId = value->id; - RefPtr boxValue; - RefPtr shapeValue; + RefPtrWillBeRawPtr boxValue; + RefPtrWillBeRawPtr shapeValue; if (valueId == CSSValueNone || (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside)) { - RefPtr keywordValue = parseValidPrimitive(valueId, value); + RefPtrWillBeRawPtr keywordValue = parseValidPrimitive(valueId, value); m_valueList->next(); return keywordValue.release(); } @@ -5625,7 +5637,7 @@ PassRefPtr BisonCSSParser::parseShapeProperty(CSSPropertyID propId) return boxValue.release(); } -PassRefPtr BisonCSSParser::parseBasicShape() +PassRefPtrWillBeRawPtr BisonCSSParser::parseBasicShape() { CSSParserValue* value = m_valueList->current(); ASSERT(value->unit == CSSParserValue::Function); @@ -5651,6 +5663,8 @@ PassRefPtr BisonCSSParser::parseBasicShape() shape = parseBasicShapePolygon(args); else if (equalIgnoringCase(value->function->name, "inset-rectangle(")) shape = parseBasicShapeInsetRectangle(args); + else if (equalIgnoringCase(value->function->name, "inset(")) + shape = parseBasicShapeInset(args); if (!shape) return 0; @@ -5767,9 +5781,9 @@ private: CSSValueList* m_list; }; -PassRefPtr BisonCSSParser::parseFontFamily() +PassRefPtrWillBeRawPtr BisonCSSParser::parseFontFamily() { - RefPtr list = CSSValueList::createCommaSeparated(); + RefPtrWillBeRawPtr list = CSSValueList::createCommaSeparated(); CSSParserValue* value = m_valueList->current(); FontFamilyValueBuilder familyBuilder(list.get()); @@ -5873,13 +5887,13 @@ bool BisonCSSParser::parseFontSize(bool important) bool BisonCSSParser::parseFontVariant(bool important) { - RefPtr values; + RefPtrWillBeRawPtr values; if (m_valueList->size() > 1) values = CSSValueList::createCommaSeparated(); CSSParserValue* val; bool expectComma = false; while ((val = m_valueList->current())) { - RefPtr parsedValue; + RefPtrWillBeRawPtr parsedValue; if (!expectComma) { expectComma = true; if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps) @@ -5937,7 +5951,7 @@ bool BisonCSSParser::parseFontWeight(bool important) bool BisonCSSParser::parseFontFaceSrcURI(CSSValueList* valueList) { - RefPtr uriValue(CSSFontFaceSrcValue::create(completeURL(m_valueList->current()->string))); + RefPtrWillBeRawPtr uriValue(CSSFontFaceSrcValue::create(completeURL(m_valueList->current()->string))); CSSParserValue* value = m_valueList->next(); if (!value) { @@ -5996,7 +6010,7 @@ bool BisonCSSParser::parseFontFaceSrcLocal(CSSValueList* valueList) bool BisonCSSParser::parseFontFaceSrc() { - RefPtr values(CSSValueList::createCommaSeparated()); + RefPtrWillBeRawPtr values(CSSValueList::createCommaSeparated()); while (CSSParserValue* value = m_valueList->current()) { if (value->unit == CSSPrimitiveValue::CSS_URI) { @@ -6018,7 +6032,7 @@ bool BisonCSSParser::parseFontFaceSrc() bool BisonCSSParser::parseFontFaceUnicodeRange() { - RefPtr values = CSSValueList::createCommaSeparated(); + RefPtrWillBeRawPtr values = CSSValueList::createCommaSeparated(); bool failed = false; bool operatorExpected = false; for (; m_valueList->current(); m_valueList->next(), operatorExpected = !operatorExpected) { @@ -6535,7 +6549,7 @@ bool BisonCSSParser::parseHSLParameters(CSSParserValue* value, double* colorArra return true; } -PassRefPtr BisonCSSParser::parseColor(CSSParserValue* value) +PassRefPtrWillBeRawPtr BisonCSSParser::parseColor(CSSParserValue* value) { RGBA32 c = Color::transparent; if (!parseColorFromValue(value ? value : m_valueList->current(), c)) @@ -6599,6 +6613,8 @@ bool BisonCSSParser::parseColorFromValue(CSSParserValue* value, RGBA32& c) // This class tracks parsing state for shadow values. If it goes out of scope (e.g., due to an early return) // without the allowBreak bit being set, then it will clean up all of the objects and destroy them. struct ShadowParseContext { + DISALLOW_ALLOCATION(); +public: ShadowParseContext(CSSPropertyID prop, BisonCSSParser* parser) : property(prop) , m_parser(parser) @@ -6644,7 +6660,7 @@ struct ShadowParseContext { void commitLength(CSSParserValue* v) { - RefPtr val = m_parser->createPrimitiveNumericValue(v); + RefPtrWillBeRawPtr val = m_parser->createPrimitiveNumericValue(v); if (allowX) { x = val.release(); @@ -6670,7 +6686,7 @@ struct ShadowParseContext { } } - void commitColor(PassRefPtr val) + void commitColor(PassRefPtrWillBeRawPtr val) { color = val; allowColor = false; @@ -6700,13 +6716,13 @@ struct ShadowParseContext { CSSPropertyID property; BisonCSSParser* m_parser; - RefPtr values; - RefPtr x; - RefPtr y; - RefPtr blur; - RefPtr spread; - RefPtr style; - RefPtr color; + RefPtrWillBeRawPtr values; + RefPtrWillBeRawPtr x; + RefPtrWillBeRawPtr y; + RefPtrWillBeRawPtr blur; + RefPtrWillBeRawPtr spread; + RefPtrWillBeRawPtr style; + RefPtrWillBeRawPtr color; bool allowX; bool allowY; @@ -6717,7 +6733,7 @@ struct ShadowParseContext { bool allowBreak; }; -PassRefPtr BisonCSSParser::parseShadow(CSSParserValueList* valueList, CSSPropertyID propId) +PassRefPtrWillBeRawPtr BisonCSSParser::parseShadow(CSSParserValueList* valueList, CSSPropertyID propId) { ShadowParseContext context(propId, this); CSSParserValue* val; @@ -6748,7 +6764,7 @@ PassRefPtr BisonCSSParser::parseShadow(CSSParserValueList* valueLi context.commitStyle(val); } else { // The only other type of value that's ok is a color value. - RefPtr parsedColor; + RefPtrWillBeRawPtr parsedColor; bool isColor = ((val->id >= CSSValueAqua && val->id <= CSSValueWindowtext) || val->id == CSSValueMenu || (val->id >= CSSValueWebkitFocusRingColor && val->id <= CSSValueWebkitText && inQuirksMode()) || val->id == CSSValueCurrentcolor); @@ -6787,25 +6803,21 @@ bool BisonCSSParser::parseReflect(CSSPropertyID propId, bool important) // Direction comes first. CSSParserValue* val = m_valueList->current(); - RefPtr direction; - if (isVariableReference(val)) { - direction = createPrimitiveVariableReferenceValue(val); - } else { - switch (val->id) { - case CSSValueAbove: - case CSSValueBelow: - case CSSValueLeft: - case CSSValueRight: - direction = cssValuePool().createIdentifierValue(val->id); - break; - default: - return false; - } + RefPtrWillBeRawPtr direction; + switch (val->id) { + case CSSValueAbove: + case CSSValueBelow: + case CSSValueLeft: + case CSSValueRight: + direction = cssValuePool().createIdentifierValue(val->id); + break; + default: + return false; } // The offset comes next. val = m_valueList->next(); - RefPtr offset; + RefPtrWillBeRawPtr offset; if (!val) offset = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); else { @@ -6823,7 +6835,7 @@ bool BisonCSSParser::parseReflect(CSSPropertyID propId, bool important) return false; } - RefPtr reflectValue = CSSReflectValue::create(direction.release(), offset.release(), mask.release()); + RefPtrWillBeRawPtr reflectValue = CSSReflectValue::create(direction.release(), offset.release(), mask.release()); addProperty(propId, reflectValue.release(), important); m_valueList->next(); return true; @@ -6836,7 +6848,7 @@ bool BisonCSSParser::parseFlex(CSSParserValueList* args, bool important) static const double unsetValue = -1; double flexGrow = unsetValue; double flexShrink = unsetValue; - RefPtr flexBasis; + RefPtrWillBeRawPtr flexBasis; while (CSSParserValue* arg = args->current()) { if (validUnit(arg, FNumber | FNonNeg)) { @@ -6888,6 +6900,8 @@ bool BisonCSSParser::parseObjectPosition(bool important) } struct BorderImageParseContext { + DISALLOW_ALLOCATION(); +public: BorderImageParseContext() : m_canAdvance(false) , m_allowCommit(true) @@ -6920,7 +6934,7 @@ struct BorderImageParseContext { m_allowImageSlice = !m_imageSlice; m_allowRepeat = !m_repeat; } - void commitImageSlice(PassRefPtr slice) + void commitImageSlice(PassRefPtrWillBeRawPtr slice) { m_imageSlice = slice; m_canAdvance = true; @@ -6941,7 +6955,7 @@ struct BorderImageParseContext { m_requireWidth = false; } } - void commitBorderWidth(PassRefPtr slice) + void commitBorderWidth(PassRefPtrWillBeRawPtr slice) { m_borderSlice = slice; m_canAdvance = true; @@ -6950,7 +6964,7 @@ struct BorderImageParseContext { m_allowImage = !m_image; m_allowRepeat = !m_repeat; } - void commitBorderOutset(PassRefPtr outset) + void commitBorderOutset(PassRefPtrWillBeRawPtr outset) { m_outset = outset; m_canAdvance = true; @@ -7012,9 +7026,9 @@ struct BorderImageParseContext { bool m_requireOutset; RefPtr m_image; - RefPtr m_imageSlice; - RefPtr m_borderSlice; - RefPtr m_outset; + RefPtrWillBeRawPtr m_imageSlice; + RefPtrWillBeRawPtr m_borderSlice; + RefPtrWillBeRawPtr m_outset; RefPtr m_repeat; }; @@ -7048,7 +7062,7 @@ static bool buildBorderImageParseContext(BisonCSSParser& parser, CSSPropertyID p } if (!context.canAdvance() && context.allowImageSlice()) { - RefPtr imageSlice; + RefPtrWillBeRawPtr imageSlice; if (parser.parseBorderImageSlice(propId, imageSlice)) context.commitImageSlice(imageSlice.release()); } @@ -7060,13 +7074,13 @@ static bool buildBorderImageParseContext(BisonCSSParser& parser, CSSPropertyID p } if (!context.canAdvance() && context.requireWidth()) { - RefPtr borderSlice; + RefPtrWillBeRawPtr borderSlice; if (parser.parseBorderImageWidth(borderSlice)) context.commitBorderWidth(borderSlice.release()); } if (!context.canAdvance() && context.requireOutset()) { - RefPtr borderOutset; + RefPtrWillBeRawPtr borderOutset; if (parser.parseBorderImageOutset(borderOutset)) context.commitBorderOutset(borderOutset.release()); } @@ -7115,8 +7129,8 @@ static bool isBorderImageRepeatKeyword(int id) bool BisonCSSParser::parseBorderImageRepeat(RefPtr& result) { - RefPtr firstValue; - RefPtr secondValue; + RefPtrWillBeRawPtr firstValue; + RefPtrWillBeRawPtr secondValue; CSSParserValue* val = m_valueList->current(); if (!val) return false; @@ -7146,6 +7160,7 @@ bool BisonCSSParser::parseBorderImageRepeat(RefPtr& result) } class BorderImageSliceParseContext { + DISALLOW_ALLOCATION(); public: BorderImageSliceParseContext(BisonCSSParser* parser) : m_parser(parser) @@ -7162,7 +7177,7 @@ public: void commitNumber(CSSParserValue* v) { - RefPtr val = m_parser->createPrimitiveNumericValue(v); + RefPtrWillBeRawPtr val = m_parser->createPrimitiveNumericValue(v); if (!m_top) m_top = val; else if (!m_right) @@ -7180,7 +7195,7 @@ public: void commitFill() { m_fill = true; m_allowFill = false; m_allowNumber = !m_top; } - PassRefPtr commitBorderImageSlice() + PassRefPtrWillBeRawPtr commitBorderImageSlice() { // We need to clone and repeat values for any omissions. ASSERT(m_top); @@ -7214,15 +7229,15 @@ private: bool m_allowFill; bool m_allowFinalCommit; - RefPtr m_top; - RefPtr m_right; - RefPtr m_bottom; - RefPtr m_left; + RefPtrWillBeRawPtr m_top; + RefPtrWillBeRawPtr m_right; + RefPtrWillBeRawPtr m_bottom; + RefPtrWillBeRawPtr m_left; bool m_fill; }; -bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtr& result) +bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtrWillBeRawPtr& result) { BorderImageSliceParseContext context(this); CSSParserValue* val; @@ -7273,7 +7288,7 @@ public: void commitNumber(CSSParserValue* v) { - RefPtr val; + RefPtrWillBeRawPtr val; if (v->id == CSSValueAuto) val = cssValuePool().createIdentifierValue(v->id); else @@ -7295,9 +7310,9 @@ public: } void setAllowFinalCommit() { m_allowFinalCommit = true; } - void setTop(PassRefPtr val) { m_top = val; } + void setTop(PassRefPtrWillBeRawPtr val) { m_top = val; } - PassRefPtr commitBorderImageQuad() + PassRefPtrWillBeRawPtr commitBorderImageQuad() { // We need to clone and repeat values for any omissions. ASSERT(m_top); @@ -7330,13 +7345,13 @@ private: bool m_allowNumber; bool m_allowFinalCommit; - RefPtr m_top; - RefPtr m_right; - RefPtr m_bottom; - RefPtr m_left; + RefPtrWillBeRawPtr m_top; + RefPtrWillBeRawPtr m_right; + RefPtrWillBeRawPtr m_bottom; + RefPtrWillBeRawPtr m_left; }; -bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtr& result) +bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPtr& result) { BorderImageQuadParseContext context(this); CSSParserValue* val; @@ -7362,28 +7377,16 @@ bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtr& result) +bool BisonCSSParser::parseBorderImageWidth(RefPtrWillBeRawPtr& result) { return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); } -bool BisonCSSParser::parseBorderImageOutset(RefPtr& result) +bool BisonCSSParser::parseBorderImageOutset(RefPtrWillBeRawPtr& result) { return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); } -static void completeBorderRadii(RefPtr radii[4]) -{ - if (radii[3]) - return; - if (!radii[2]) { - if (!radii[1]) - radii[1] = radii[0]; - radii[2] = radii[0]; - } - radii[3] = radii[1]; -} - bool BisonCSSParser::parseBorderRadius(CSSPropertyID propId, bool important) { unsigned num = m_valueList->size(); @@ -7391,7 +7394,7 @@ bool BisonCSSParser::parseBorderRadius(CSSPropertyID propId, bool important) return false; ShorthandScope scope(this, propId); - RefPtr radii[2][4]; + RefPtrWillBeRawPtr radii[2][4]; unsigned indexAfterSlash = 0; for (unsigned i = 0; i < num; ++i) { @@ -7414,7 +7417,7 @@ bool BisonCSSParser::parseBorderRadius(CSSPropertyID propId, bool important) if (!validUnit(value, FLength | FPercent | FNonNeg)) return false; - RefPtr radius = createPrimitiveNumericValue(value); + RefPtrWillBeRawPtr radius = createPrimitiveNumericValue(value); if (!indexAfterSlash) { radii[0][i] = radius; @@ -7476,8 +7479,8 @@ bool BisonCSSParser::parseCounter(CSSPropertyID propId, int defaultValue, bool i { enum { ID, VAL } state = ID; - RefPtr list = CSSValueList::createCommaSeparated(); - RefPtr counterName; + RefPtrWillBeRawPtr list = CSSValueList::createCommaSeparated(); + RefPtrWillBeRawPtr counterName; while (true) { CSSParserValue* val = m_valueList->current(); @@ -7515,9 +7518,9 @@ bool BisonCSSParser::parseCounter(CSSPropertyID propId, int defaultValue, bool i } // This should go away once we drop support for -webkit-gradient -static PassRefPtr parseDeprecatedGradientPoint(CSSParserValue* a, bool horizontal) +static PassRefPtrWillBeRawPtr parseDeprecatedGradientPoint(CSSParserValue* a, bool horizontal) { - RefPtr result; + RefPtrWillBeRawPtr result; if (a->unit == CSSPrimitiveValue::CSS_IDENT) { if ((equalIgnoringCase(a, "left") && horizontal) || (equalIgnoringCase(a, "top") && !horizontal)) @@ -7639,7 +7642,7 @@ bool BisonCSSParser::parseDeprecatedGradient(CSSParserValueList* valueList, RefP a = args->next(); if (!a) return false; - RefPtr point = parseDeprecatedGradientPoint(a, true); + RefPtrWillBeRawPtr point = parseDeprecatedGradientPoint(a, true); if (!point) return false; result->setFirstX(point.release()); @@ -7729,7 +7732,7 @@ bool BisonCSSParser::parseDeprecatedGradient(CSSParserValueList* valueList, RefP return true; } -static PassRefPtr valueFromSideKeyword(CSSParserValue* a, bool& isHorizontal) +static PassRefPtrWillBeRawPtr valueFromSideKeyword(CSSParserValue* a, bool& isHorizontal) { if (a->unit != CSSPrimitiveValue::CSS_IDENT) return 0; @@ -7749,7 +7752,7 @@ static PassRefPtr valueFromSideKeyword(CSSParserValue* a, boo return cssValuePool().createIdentifierValue(a->id); } -static PassRefPtr parseGradientColorOrKeyword(BisonCSSParser* p, CSSParserValue* value) +static PassRefPtrWillBeRawPtr parseGradientColorOrKeyword(BisonCSSParser* p, CSSParserValue* value) { CSSValueID id = value->id; if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu || id == CSSValueCurrentcolor) @@ -7760,7 +7763,7 @@ static PassRefPtr parseGradientColorOrKeyword(BisonCSSParser* bool BisonCSSParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList, RefPtr& gradient, CSSGradientRepeat repeating) { - RefPtr result = CSSLinearGradientValue::create(repeating, CSSPrefixedLinearGradient); + RefPtrWillBeRawPtr result = CSSLinearGradientValue::create(repeating, CSSPrefixedLinearGradient); // Walk the arguments. CSSParserValueList* args = valueList->current()->function->args.get(); @@ -7780,9 +7783,9 @@ bool BisonCSSParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList expectComma = true; } else { // Look one or two optional keywords that indicate a side or corner. - RefPtr startX, startY; + RefPtrWillBeRawPtr startX, startY; - RefPtr location; + RefPtrWillBeRawPtr location; bool isHorizontal = false; if ((location = valueFromSideKeyword(a, isHorizontal))) { if (isHorizontal) @@ -7828,7 +7831,7 @@ bool BisonCSSParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList bool BisonCSSParser::parseDeprecatedRadialGradient(CSSParserValueList* valueList, RefPtr& gradient, CSSGradientRepeat repeating) { - RefPtr result = CSSRadialGradientValue::create(repeating, CSSPrefixedRadialGradient); + RefPtrWillBeRawPtr result = CSSRadialGradientValue::create(repeating, CSSPrefixedRadialGradient); // Walk the arguments. CSSParserValueList* args = valueList->current()->function->args.get(); @@ -7866,8 +7869,8 @@ bool BisonCSSParser::parseDeprecatedRadialGradient(CSSParserValueList* valueList result->setFirstY(toCSSPrimitiveValue(centerY.get())); result->setSecondY(toCSSPrimitiveValue(centerY.get())); - RefPtr shapeValue; - RefPtr sizeValue; + RefPtrWillBeRawPtr shapeValue; + RefPtrWillBeRawPtr sizeValue; // Optional shape and/or size in any order. for (int i = 0; i < 2; ++i) { @@ -7907,8 +7910,8 @@ bool BisonCSSParser::parseDeprecatedRadialGradient(CSSParserValueList* valueList result->setSizingBehavior(sizeValue); // Or, two lengths or percentages - RefPtr horizontalSize; - RefPtr verticalSize; + RefPtrWillBeRawPtr horizontalSize; + RefPtrWillBeRawPtr verticalSize; if (!shapeValue && !sizeValue) { if (validUnit(a, FLength | FPercent)) { @@ -7946,7 +7949,7 @@ bool BisonCSSParser::parseDeprecatedRadialGradient(CSSParserValueList* valueList bool BisonCSSParser::parseLinearGradient(CSSParserValueList* valueList, RefPtr& gradient, CSSGradientRepeat repeating) { - RefPtr result = CSSLinearGradientValue::create(repeating, CSSLinearGradient); + RefPtrWillBeRawPtr result = CSSLinearGradientValue::create(repeating, CSSLinearGradient); CSSParserValueList* args = valueList->current()->function->args.get(); if (!args || !args->size()) @@ -7969,8 +7972,8 @@ bool BisonCSSParser::parseLinearGradient(CSSParserValueList* valueList, RefPtr endX, endY; - RefPtr location; + RefPtrWillBeRawPtr endX, endY; + RefPtrWillBeRawPtr location; bool isHorizontal = false; location = valueFromSideKeyword(a, isHorizontal); @@ -8018,7 +8021,7 @@ bool BisonCSSParser::parseLinearGradient(CSSParserValueList* valueList, RefPtr& gradient, CSSGradientRepeat repeating) { - RefPtr result = CSSRadialGradientValue::create(repeating, CSSRadialGradient); + RefPtrWillBeRawPtr result = CSSRadialGradientValue::create(repeating, CSSRadialGradient); CSSParserValueList* args = valueList->current()->function->args.get(); if (!args || !args->size()) @@ -8030,10 +8033,10 @@ bool BisonCSSParser::parseRadialGradient(CSSParserValueList* valueList, RefPtr shapeValue; - RefPtr sizeValue; - RefPtr horizontalSize; - RefPtr verticalSize; + RefPtrWillBeRawPtr shapeValue; + RefPtrWillBeRawPtr sizeValue; + RefPtrWillBeRawPtr horizontalSize; + RefPtrWillBeRawPtr verticalSize; // First part of grammar, the size/shape clause: // [ circle || ] | @@ -8184,29 +8187,48 @@ bool BisonCSSParser::parseGeneratedImage(CSSParserValueList* valueList, RefPtrunit != CSSParserValue::Function) return false; - if (equalIgnoringCase(val->function->name, "-webkit-gradient(")) + if (equalIgnoringCase(val->function->name, "-webkit-gradient(")) { + // FIXME: This should send a deprecation message. + if (m_context.useCounter()) + m_context.useCounter()->count(UseCounter::DeprecatedWebKitGradient); return parseDeprecatedGradient(valueList, value); + } - if (equalIgnoringCase(val->function->name, "-webkit-linear-gradient(")) + if (equalIgnoringCase(val->function->name, "-webkit-linear-gradient(")) { + // FIXME: This should send a deprecation message. + if (m_context.useCounter()) + m_context.useCounter()->count(UseCounter::DeprecatedWebKitLinearGradient); return parseDeprecatedLinearGradient(valueList, value, NonRepeating); + } if (equalIgnoringCase(val->function->name, "linear-gradient(")) return parseLinearGradient(valueList, value, NonRepeating); - if (equalIgnoringCase(val->function->name, "-webkit-repeating-linear-gradient(")) + if (equalIgnoringCase(val->function->name, "-webkit-repeating-linear-gradient(")) { + // FIXME: This should send a deprecation message. + if (m_context.useCounter()) + m_context.useCounter()->count(UseCounter::DeprecatedWebKitRepeatingLinearGradient); return parseDeprecatedLinearGradient(valueList, value, Repeating); + } if (equalIgnoringCase(val->function->name, "repeating-linear-gradient(")) return parseLinearGradient(valueList, value, Repeating); - if (equalIgnoringCase(val->function->name, "-webkit-radial-gradient(")) + if (equalIgnoringCase(val->function->name, "-webkit-radial-gradient(")) { + // FIXME: This should send a deprecation message. + if (m_context.useCounter()) + m_context.useCounter()->count(UseCounter::DeprecatedWebKitRadialGradient); return parseDeprecatedRadialGradient(valueList, value, NonRepeating); + } if (equalIgnoringCase(val->function->name, "radial-gradient(")) return parseRadialGradient(valueList, value, NonRepeating); - if (equalIgnoringCase(val->function->name, "-webkit-repeating-radial-gradient(")) + if (equalIgnoringCase(val->function->name, "-webkit-repeating-radial-gradient(")) { + if (m_context.useCounter()) + m_context.useCounter()->count(UseCounter::DeprecatedWebKitRepeatingRadialGradient); return parseDeprecatedRadialGradient(valueList, value, Repeating); + } if (equalIgnoringCase(val->function->name, "repeating-radial-gradient(")) return parseRadialGradient(valueList, value, Repeating); @@ -8222,8 +8244,6 @@ bool BisonCSSParser::parseGeneratedImage(CSSParserValueList* valueList, RefPtr& crossfade) { - RefPtr result; - // Walk the arguments. CSSParserValueList* args = valueList->current()->function->args.get(); if (!args || args->size() != 5) @@ -8253,7 +8273,7 @@ bool BisonCSSParser::parseCrossfade(CSSParserValueList* valueList, RefPtrnext(); // The third argument is the crossfade value. It is a percentage or a fractional number. - RefPtr percentage; + RefPtrWillBeRawPtr percentage; if (!a) return false; @@ -8264,7 +8284,7 @@ bool BisonCSSParser::parseCrossfade(CSSParserValueList* valueList, RefPtr result = CSSCrossfadeValue::create(fromImageValue, toImageValue); result->setPercentage(percentage); crossfade = result; @@ -8299,7 +8319,7 @@ PassRefPtr BisonCSSParser::parseImageSet(CSSParserValueList* valueList if (!functionArgs || !functionArgs->size() || !functionArgs->current()) return 0; - RefPtr imageSet = CSSImageSetValue::create(); + RefPtrWillBeRawPtr imageSet = CSSImageSetValue::create(); CSSParserValue* arg = functionArgs->current(); while (arg) { @@ -8480,12 +8500,12 @@ private: BisonCSSParser::Units m_unit; }; -PassRefPtr BisonCSSParser::parseTransform() +PassRefPtrWillBeRawPtr BisonCSSParser::parseTransform() { if (!m_valueList) return 0; - RefPtr list = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr list = CSSValueList::createSpaceSeparated(); for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) { RefPtr parsedTransformValue = parseTransformValue(value); if (!parsedTransformValue) @@ -8519,7 +8539,7 @@ PassRefPtr BisonCSSParser::parseTransformValue(CSSParserValue *value) // We collect a list of CSSTransformValues, where each value specifies a single operation. // Create the new CSSTransformValue for this operation and add it to our list. - RefPtr transformValue = CSSTransformValue::create(info.type()); + RefPtrWillBeRawPtr transformValue = CSSTransformValue::create(info.type()); // Snag our values. CSSParserValue* a = args->current(); @@ -8601,9 +8621,9 @@ static void filterInfoForName(const CSSParserString& name, CSSFilterValue::Filte } } -PassRefPtr BisonCSSParser::parseBuiltinFilterArguments(CSSParserValueList* args, CSSFilterValue::FilterOperationType filterType) +PassRefPtrWillBeRawPtr BisonCSSParser::parseBuiltinFilterArguments(CSSParserValueList* args, CSSFilterValue::FilterOperationType filterType) { - RefPtr filterValue = CSSFilterValue::create(filterType); + RefPtrWillBeRawPtr filterValue = CSSFilterValue::create(filterType); ASSERT(args); switch (filterType) { @@ -8680,7 +8700,7 @@ PassRefPtr BisonCSSParser::parseBuiltinFilterArguments(CSSParser } case CSSFilterValue::DropShadowFilterOperation: { // drop-shadow() takes a single shadow. - RefPtr shadowValueList = parseShadow(args, CSSPropertyWebkitFilter); + RefPtrWillBeRawPtr shadowValueList = parseShadow(args, CSSPropertyWebkitFilter); if (!shadowValueList || shadowValueList->length() != 1) return 0; @@ -8693,13 +8713,13 @@ PassRefPtr BisonCSSParser::parseBuiltinFilterArguments(CSSParser return filterValue.release(); } -PassRefPtr BisonCSSParser::parseFilter() +PassRefPtrWillBeRawPtr BisonCSSParser::parseFilter() { if (!m_valueList) return 0; // The filter is a list of functional primitives that specify individual operations. - RefPtr list = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr list = CSSValueList::createSpaceSeparated(); for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) { if (value->unit != CSSPrimitiveValue::CSS_URI && (value->unit != CSSParserValue::Function || !value->function)) return 0; @@ -8708,7 +8728,7 @@ PassRefPtr BisonCSSParser::parseFilter() // See if the specified primitive is one we understand. if (value->unit == CSSPrimitiveValue::CSS_URI) { - RefPtr referenceFilterValue = CSSFilterValue::create(CSSFilterValue::ReferenceFilterOperation); + RefPtrWillBeRawPtr referenceFilterValue = CSSFilterValue::create(CSSFilterValue::ReferenceFilterOperation); list->append(referenceFilterValue); referenceFilterValue->append(CSSSVGDocumentValue::create(value->string)); } else { @@ -8724,7 +8744,7 @@ PassRefPtr BisonCSSParser::parseFilter() if (!args) return 0; - RefPtr filterValue = parseBuiltinFilterArguments(args, filterType); + RefPtrWillBeRawPtr filterValue = parseBuiltinFilterArguments(args, filterType); if (!filterValue) return 0; @@ -8735,78 +8755,6 @@ PassRefPtr BisonCSSParser::parseFilter() return list.release(); } -static bool validFlowName(const String& flowName) -{ - return !(equalIgnoringCase(flowName, "auto") - || equalIgnoringCase(flowName, "default") - || equalIgnoringCase(flowName, "inherit") - || equalIgnoringCase(flowName, "initial") - || equalIgnoringCase(flowName, "none")); -} - -// none | -bool BisonCSSParser::parseFlowThread(CSSPropertyID propId, bool important) -{ - ASSERT(propId == CSSPropertyWebkitFlowInto); - ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); - - if (m_valueList->size() != 1) - return false; - - CSSParserValue* value = m_valueList->current(); - if (!value) - return false; - - if (value->unit != CSSPrimitiveValue::CSS_IDENT) - return false; - - if (value->id == CSSValueNone) { - addProperty(propId, cssValuePool().createIdentifierValue(value->id), important); - return true; - } - - String inputProperty = String(value->string); - if (!inputProperty.isEmpty()) { - if (!validFlowName(inputProperty)) - return false; - addProperty(propId, cssValuePool().createValue(inputProperty, CSSPrimitiveValue::CSS_STRING), important); - } else - addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNone), important); - - return true; -} - -// -webkit-flow-from: none | -bool BisonCSSParser::parseRegionThread(CSSPropertyID propId, bool important) -{ - ASSERT(propId == CSSPropertyWebkitFlowFrom); - ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); - - if (m_valueList->size() != 1) - return false; - - CSSParserValue* value = m_valueList->current(); - if (!value) - return false; - - if (value->unit != CSSPrimitiveValue::CSS_IDENT) - return false; - - if (value->id == CSSValueNone) - addProperty(propId, cssValuePool().createIdentifierValue(value->id), important); - else { - String inputProperty = String(value->string); - if (!inputProperty.isEmpty()) { - if (!validFlowName(inputProperty)) - return false; - addProperty(propId, cssValuePool().createValue(inputProperty, CSSPrimitiveValue::CSS_STRING), important); - } else - addProperty(propId, cssValuePool().createIdentifierValue(CSSValueNone), important); - } - - return true; -} - bool BisonCSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr& value, RefPtr& value2, RefPtr& value3) { propId1 = propId; @@ -8892,7 +8840,7 @@ bool BisonCSSParser::parseTouchAction(bool important) return false; CSSParserValue* value = m_valueList->current(); - RefPtr list = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr list = CSSValueList::createSpaceSeparated(); if (m_valueList->size() == 1 && value && (value->id == CSSValueAuto || value->id == CSSValueNone)) { list->append(cssValuePool().createIdentifierValue(value->id)); addProperty(CSSPropertyTouchAction, list.release(), important); @@ -8954,7 +8902,7 @@ bool BisonCSSParser::parseTextDecoration(CSSPropertyID propId, bool important) return true; } - RefPtr list = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr list = CSSValueList::createSpaceSeparated(); bool isValid = true; while (isValid && value) { switch (value->id) { @@ -9003,8 +8951,8 @@ bool BisonCSSParser::parseTextEmphasisStyle(bool important) { unsigned valueListSize = m_valueList->size(); - RefPtr fill; - RefPtr shape; + RefPtrWillBeRawPtr fill; + RefPtrWillBeRawPtr shape; for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) { if (value->unit == CSSPrimitiveValue::CSS_STRING) { @@ -9038,7 +8986,7 @@ bool BisonCSSParser::parseTextEmphasisStyle(bool important) } if (fill && shape) { - RefPtr parsedValues = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr parsedValues = CSSValueList::createSpaceSeparated(); parsedValues->append(fill.release()); parsedValues->append(shape.release()); addProperty(CSSPropertyWebkitTextEmphasisStyle, parsedValues.release(), important); @@ -9058,7 +9006,7 @@ bool BisonCSSParser::parseTextEmphasisStyle(bool important) PassRefPtr BisonCSSParser::parseTextIndent() { - RefPtr list = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr list = CSSValueList::createSpaceSeparated(); // | | inherit if (m_valueList->size() == 1) { @@ -9181,13 +9129,13 @@ bool BisonCSSParser::parseFontFeatureTag(CSSValueList* settings) bool BisonCSSParser::parseFontFeatureSettings(bool important) { if (m_valueList->size() == 1 && m_valueList->current()->id == CSSValueNormal) { - RefPtr normalValue = cssValuePool().createIdentifierValue(CSSValueNormal); + RefPtrWillBeRawPtr normalValue = cssValuePool().createIdentifierValue(CSSValueNormal); m_valueList->next(); addProperty(CSSPropertyWebkitFontFeatureSettings, normalValue.release(), important); return true; } - RefPtr settings = CSSValueList::createCommaSeparated(); + RefPtrWillBeRawPtr settings = CSSValueList::createCommaSeparated(); for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) { if (!parseFontFeatureTag(settings.get())) return false; @@ -9206,7 +9154,7 @@ bool BisonCSSParser::parseFontFeatureSettings(bool important) bool BisonCSSParser::parseFontVariantLigatures(bool important) { - RefPtr ligatureValues = CSSValueList::createSpaceSeparated(); + RefPtrWillBeRawPtr ligatureValues = CSSValueList::createSpaceSeparated(); bool sawCommonLigaturesValue = false; bool sawDiscretionaryLigaturesValue = false; bool sawHistoricalLigaturesValue = false; @@ -9245,7 +9193,7 @@ bool BisonCSSParser::parseFontVariantLigatures(bool important) if (!ligatureValues->length()) return false; - addProperty(CSSPropertyWebkitFontVariantLigatures, ligatureValues.release(), important); + addProperty(CSSPropertyFontVariantLigatures, ligatureValues.release(), important); return true; } @@ -9717,8 +9665,8 @@ CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementName(const Atomic CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForCustomPseudoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* specifiers, bool tagIsForNamespaceRule) { - if (m_useCounter && specifiers->pseudoType() == CSSSelector::PseudoUserAgentCustomElement) - m_useCounter->count(UseCounter::CSSPseudoElementUserAgentCustomPseudo); + if (m_context.useCounter() && specifiers->pseudoType() == CSSSelector::PseudoUserAgentCustomElement) + m_context.useCounter()->count(UseCounter::CSSPseudoElementUserAgentCustomPseudo); CSSParserSelector* lastShadowPseudo = specifiers; CSSParserSelector* history = specifiers; @@ -9768,8 +9716,8 @@ CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForContentPse CSSParserSelector* BisonCSSParser::rewriteSpecifiersForShadowDistributed(CSSParserSelector* specifiers, CSSParserSelector* distributedPseudoElementSelector) { - if (m_useCounter) - m_useCounter->count(UseCounter::CSSPseudoElementPrefixedDistributed); + if (m_context.useCounter()) + m_context.useCounter()->count(UseCounter::CSSPseudoElementPrefixedDistributed); CSSParserSelector* argumentSelector = distributedPseudoElementSelector->functionArgumentSelector(); ASSERT(argumentSelector); ASSERT(!specifiers->isDistributedPseudoElement()); @@ -9836,32 +9784,6 @@ StyleRuleBase* BisonCSSParser::createPageRule(PassOwnPtr page return pageRule; } -void BisonCSSParser::setReusableRegionSelectorVector(Vector >* selectors) -{ - if (selectors) - m_reusableRegionSelectorVector.swap(*selectors); -} - -StyleRuleBase* BisonCSSParser::createRegionRule(Vector >* regionSelector, RuleList* rules) -{ - if (m_useCounter) - m_useCounter->count(UseCounter::CSSWebkitRegionAtRule); - - if (!RuntimeEnabledFeatures::cssRegionsEnabled() || !regionSelector || !rules) - return 0; - - m_allowImportRules = m_allowNamespaceDeclarations = false; - - RefPtr regionRule = StyleRuleRegion::create(regionSelector, *rules); - - StyleRuleRegion* result = regionRule.get(); - m_parsedRules.append(regionRule.release()); - if (m_observer) - m_observer->startEndUnknownRule(); - - return result; -} - StyleRuleBase* BisonCSSParser::createMarginAtRule(CSSSelector::MarginBoxType /* marginBox */) { // FIXME: Implement margin at-rule here, using: