Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / css / parser / BisonCSSParser-in.cpp
index 8e8ea8b..6376586 100644 (file)
@@ -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<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdenticalValues)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> 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 <typename CharType>
-static PassRefPtr<CSSTransformValue> parseTranslateTransformValue(CharType*& pos, CharType* end)
+static PassRefPtrWillBeRawPtr<CSSTransformValue> parseTranslateTransformValue(CharType*& pos, CharType* end)
 {
     static const int shortestValidTransformStringLength = 12;
 
@@ -1048,20 +1019,20 @@ static PassRefPtr<CSSTransformValue> parseTranslateTransformValue(CharType*& pos
     }
     pos += argumentStart;
 
-    RefPtr<CSSTransformValue> transformValue = CSSTransformValue::create(transformType);
+    RefPtrWillBeRawPtr<CSSTransformValue> transformValue = CSSTransformValue::create(transformType);
     if (!parseTransformTranslateArguments(pos, end, expectedArgumentCount, transformValue.get()))
         return 0;
     return transformValue.release();
 }
 
 template <typename CharType>
-static PassRefPtr<CSSValueList> parseTranslateTransformList(CharType*& pos, CharType* end)
+static PassRefPtrWillBeRawPtr<CSSValueList> parseTranslateTransformList(CharType*& pos, CharType* end)
 {
-    RefPtr<CSSValueList> transformList;
+    RefPtrWillBeRawPtr<CSSValueList> transformList;
     while (pos < end) {
         while (pos < end && isCSSSpace(*pos))
             ++pos;
-        RefPtr<CSSTransformValue> transformValue = parseTranslateTransformValue(pos, end);
+        RefPtrWillBeRawPtr<CSSTransformValue> 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<CSSValueList> transformList;
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSValueList> BisonCSSParser::parseFontFaceValue(const AtomicString& string)
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseFontFaceValue(const AtomicString& string)
 {
     if (string.isEmpty())
         return 0;
@@ -1114,11 +1085,22 @@ PassRefPtr<CSSValueList> BisonCSSParser::parseFontFaceValue(const AtomicString&
     return toCSSValueList(dummyStyle->getPropertyCSSValue(CSSPropertyFontFamily).get());
 }
 
+PassRefPtr<CSSValue> BisonCSSParser::parseAnimationTimingFunctionValue(const String& string)
+{
+    if (string.isEmpty())
+        return 0;
+    RefPtr<MutableStylePropertySet> 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<StyleSheetContents*>(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<ImmutableStylePropertySet> 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<ImmutableStylePropertySet> BisonCSSParser::parseDeclaration(const String& string, StyleSheetContents* contextStyleSheet)
@@ -1329,20 +1311,13 @@ PassRefPtr<MediaQuerySet> BisonCSSParser::parseMediaQueryList(const String& stri
     return m_mediaList.release();
 }
 
-static inline void filterProperties(bool important, const BisonCSSParser::ParsedPropertyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties, HashSet<AtomicString>& seenVariables)
+static inline void filterProperties(bool important, const BisonCSSParser::ParsedPropertyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& 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<ImmutableStylePropertySet> BisonCSSParser::createStylePropertySet()
     Vector<CSSProperty, 256> results(unusedEntries);
 
     // Important properties have higher priority, so add them first. Duplicate definitions can then be ignored when found.
-    HashSet<AtomicString> 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<CSSValue> 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<CSSPrimitiveValue> BisonCSSParser::createPrimitiveNumericValue(CSSParserValue* value)
+inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> BisonCSSParser::createPrimitiveNumericValue
     return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
 }
 
-inline PassRefPtr<CSSPrimitiveValue> BisonCSSParser::createPrimitiveStringValue(CSSParserValue* value)
+inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> 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<CSSPrimitiveValue> BisonCSSParser::parseValidPrimitive(CSSValueID identifier, CSSParserValue* value)
+inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseValidPrimitive(CSSValueID identifier, CSSParserValue* value)
 {
     if (identifier)
         return cssValuePool().createIdentifierValue(identifier);
@@ -1630,8 +1582,6 @@ inline PassRefPtr<CSSPrimitiveValue> 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<CSSValueList> list;
+        RefPtrWillBeRawPtr<CSSValueList> list;
         while (value) {
             RefPtr<CSSValue> image = 0;
             if (value->unit == CSSPrimitiveValue::CSS_URI) {
@@ -2176,7 +2119,7 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important)
 
     case CSSPropertyBorderImageOutset:
     case CSSPropertyWebkitMaskBoxImageOutset: {
-        RefPtr<CSSPrimitiveValue> result;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSBorderImageSliceValue> result;
+        RefPtrWillBeRawPtr<CSSBorderImageSliceValue> 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<CSSPrimitiveValue> result;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> parsedValue1 = createPrimitiveNumericValue(value);
-        RefPtr<CSSPrimitiveValue> parsedValue2;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNumericValue(value);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSValueList> shadowValueList = parseShadow(m_valueList.get(), propId);
+            RefPtrWillBeRawPtr<CSSValueList> 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<double>(std::numeric_limits<int>::min() + 2), value->fValue),
-                    static_cast<CSSPrimitiveValue::UnitTypes>(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<CSSValue>& lval, PassRefPtr<CSSValue> r
             toCSSValueList(lval.get())->append(rval);
         else {
             PassRefPtr<CSSValue> oldlVal(lval.release());
-            PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            PassRefPtrWillBeRawPtr<CSSValueList> 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<CSSParserValueList> 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> 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<CSSValue>& lval, PassRefPtr<CSSValue> rval)
 {
     if (lval) {
@@ -3102,7 +2986,7 @@ void BisonCSSParser::addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSVal
             toCSSValueList(lval.get())->append(rval);
         else {
             PassRefPtr<CSSValue> oldVal(lval.release());
-            PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            PassRefPtrWillBeRawPtr<CSSValueList> 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<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSValueList> values = CSSValueList::createCommaSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
     while (CSSParserValue* val = m_valueList->current()) {
         RefPtr<CSSValue> parsedValue;
         if (val->unit == CSSPrimitiveValue::CSS_STRING)
@@ -3544,7 +3428,7 @@ bool BisonCSSParser::parseQuotes(CSSPropertyID propId, bool important)
 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
 bool BisonCSSParser::parseContent(CSSPropertyID propId, bool important)
 {
-    RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
 
     while (CSSParserValue* val = m_valueList->current()) {
         RefPtr<CSSValue> parsedValue;
@@ -3702,7 +3586,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseFillPositionY(CSSParserValueList* valu
     return 0;
 }
 
-PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseFillPositionComponent(CSSParserValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillPositionParsingMode parsingMode)
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> parsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2)
+void BisonCSSParser::parse4ValuesFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2)
 {
     // [ left | right ] [ <percentage] | <length> ] && [ top | bottom ] [ <percentage> | <length> ]
     // In the case of 4 values <position> 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<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword);
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> value4 = parseFillPositionComponent(valueList, cumulativeFlags, value4Flag, ResolveValuesAsKeyword);
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> parsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2)
+void BisonCSSParser::parse3ValuesFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2)
 {
     unsigned cumulativeFlags = 0;
     FillPositionFlag value3Flag = InvalidFillPosition;
-    RefPtr<CSSPrimitiveValue> value3 = parseFillPositionComponent(valueList, cumulativeFlags, value3Flag, ResolveValuesAsKeyword);
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> firstPositionValue;
-        RefPtr<CSSPrimitiveValue> secondPositionValue;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPositionValue;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPositionValue;
 
         if (isFillPositionKeyword(ident2)) {
             // To match CSS grammar, we should only accept: [ center | left | right | bottom | top ] [ left | right | top | bottom ] [ <percentage> | <length> ].
@@ -3958,8 +3842,8 @@ void BisonCSSParser::parseFillPosition(CSSParserValueList* valueList, RefPtr<CSS
         return;
     }
 
-    RefPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(value1.get());
-    RefPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(value2.get());
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(value1.get());
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(value2.get());
 
     value1.clear();
     value2.clear();
@@ -4067,7 +3951,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a
     if (value->id == CSSValueContain || value->id == CSSValueCover)
         return cssValuePool().createIdentifierValue(value->id);
 
-    RefPtr<CSSPrimitiveValue> parsedValue1;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1;
 
     if (value->id == CSSValueAuto)
         parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto);
@@ -4077,7 +3961,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a
         parsedValue1 = createPrimitiveNumericValue(value);
     }
 
-    RefPtr<CSSPrimitiveValue> parsedValue2;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2;
     if ((value = m_valueList->next())) {
         if (value->unit == CSSParserValue::Operator && value->iValue == ',')
             allowComma = false;
@@ -4105,8 +3989,8 @@ PassRefPtr<CSSValue> BisonCSSParser::parseFillSize(CSSPropertyID propId, bool& a
 bool BisonCSSParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2,
                                   RefPtr<CSSValue>& retValue1, RefPtr<CSSValue>& retValue2)
 {
-    RefPtr<CSSValueList> values;
-    RefPtr<CSSValueList> values2;
+    RefPtrWillBeRawPtr<CSSValueList> values;
+    RefPtrWillBeRawPtr<CSSValueList> values2;
     CSSParserValue* val;
     RefPtr<CSSValue> value;
     RefPtr<CSSValue> value2;
@@ -4479,7 +4363,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseAnimationTimingFunction()
 
 bool BisonCSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>& result, AnimationParseContext& context)
 {
-    RefPtr<CSSValueList> values;
+    RefPtrWillBeRawPtr<CSSValueList> values;
     CSSParserValue* val;
     RefPtr<CSSValue> value;
     bool allowComma = false;
@@ -4597,7 +4481,7 @@ bool BisonCSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValu
 }
 
 // The function parses [ <integer> || <string> ] in <grid-line> (which can be stand alone or with 'span').
-bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtr<CSSPrimitiveValue>& numericValue, RefPtr<CSSPrimitiveValue>& gridLineName)
+bool BisonCSSParser::parseIntegerOrStringFromGridPosition(RefPtrWillBeRawPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSPrimitiveValue>& gridLineName)
 {
     CSSParserValue* value = m_valueList->current();
     if (validUnit(value, FInteger) && value->fValue) {
@@ -4638,8 +4522,8 @@ PassRefPtr<CSSValue> BisonCSSParser::parseGridPosition()
         return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING);
     }
 
-    RefPtr<CSSPrimitiveValue> numericValue;
-    RefPtr<CSSPrimitiveValue> gridLineName;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName;
     bool hasSeenSpanKeyword = false;
 
     if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) {
@@ -4667,7 +4551,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseGridPosition()
     if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0)
         return 0;
 
-    RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
     if (hasSeenSpanKeyword)
         values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
     if (numericValue)
@@ -4781,10 +4665,10 @@ void BisonCSSParser::parseGridLineNames(CSSParserValueList* parserValueList, CSS
         return;
     }
 
-    RefPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create();
+    RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create();
     while (CSSParserValue* identValue = identList->current()) {
         ASSERT(identValue->unit == CSSPrimitiveValue::CSS_IDENT);
-        RefPtr<CSSPrimitiveValue> lineName = createPrimitiveStringValue(identValue);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> lineName = createPrimitiveStringValue(identValue);
         lineNames->append(lineName.release());
         identList->next();
     }
@@ -4806,7 +4690,7 @@ bool BisonCSSParser::parseGridTrackList(CSSPropertyID propId, bool important)
         return true;
     }
 
-    RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
     // Handle leading  <ident>*.
     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<CSSValueList> repeatedValues = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> repeatedValues = CSSValueList::createSpaceSeparated();
     arguments->next(); // Skip the repetition count.
     arguments->next(); // Skip the comma.
 
@@ -4895,15 +4779,15 @@ PassRefPtr<CSSValue> BisonCSSParser::parseGridTrackSize(CSSParserValueList& inpu
         if (!arguments || arguments->size() != 3 || !isComma(arguments->valueAt(1)))
             return 0;
 
-        RefPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth(arguments->valueAt(0));
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth(arguments->valueAt(0));
         if (!minTrackBreadth)
             return 0;
 
-        RefPtr<CSSPrimitiveValue> maxTrackBreadth = parseGridBreadth(arguments->valueAt(2));
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> maxTrackBreadth = parseGridBreadth(arguments->valueAt(2));
         if (!maxTrackBreadth)
             return 0;
 
-        RefPtr<CSSValueList> parsedArguments = CSSValueList::createCommaSeparated();
+        RefPtrWillBeRawPtr<CSSValueList> parsedArguments = CSSValueList::createCommaSeparated();
         parsedArguments->append(minTrackBreadth);
         parsedArguments->append(maxTrackBreadth);
         return CSSFunctionValue::create("minmax(", parsedArguments);
@@ -4912,7 +4796,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseGridTrackSize(CSSParserValueList& inpu
     return parseGridBreadth(currentValue);
 }
 
-PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseGridBreadth(CSSParserValue* currentValue)
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseGridBreadth(CSSParserValue* currentValue)
 {
     if (currentValue->id == CSSValueMinContent || currentValue->id == CSSValueMaxContent)
         return cssValuePool().createIdentifierValue(currentValue->id);
@@ -4933,7 +4817,7 @@ PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseGridBreadth(CSSParserValue* c
     return createPrimitiveNumericValue(currentValue);
 }
 
-PassRefPtr<CSSValue> BisonCSSParser::parseGridTemplate()
+PassRefPtr<CSSValue> BisonCSSParser::parseGridTemplateAreas()
 {
     NamedGridAreaMap gridAreaMap;
     size_t rowCount = 0;
@@ -5003,7 +4887,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseGridTemplate()
     if (!rowCount || !columnCount)
         return 0;
 
-    return CSSGridTemplateValue::create(gridAreaMap, rowCount, columnCount);
+    return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount);
 }
 
 PassRefPtr<CSSValue> BisonCSSParser::parseCounterContent(CSSParserValueList* args, bool counters)
@@ -5017,9 +4901,9 @@ PassRefPtr<CSSValue> BisonCSSParser::parseCounterContent(CSSParserValueList* arg
     CSSParserValue* i = args->current();
     if (i->unit != CSSPrimitiveValue::CSS_IDENT)
         return 0;
-    RefPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValue(i);
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValue(i);
 
-    RefPtr<CSSPrimitiveValue> separator;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> separator;
     if (!counters)
         separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_STRING);
     else {
@@ -5034,7 +4918,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseCounterContent(CSSParserValueList* arg
         separator = createPrimitiveStringValue(i);
     }
 
-    RefPtr<CSSPrimitiveValue> listStyle;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> length = a->id == CSSValueAuto ?
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> 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<CSSBasicShape> BisonCSSParser::parseInsetRoundedCorners(PassRefPtr<CSSBasicShapeInset> 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<CSSPrimitiveValue> 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<CSSPrimitiveValue> 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<CSSBasicShape> BisonCSSParser::parseBasicShapeInset(CSSParserValueList* args)
+{
+    ASSERT(args);
+
+    RefPtr<CSSBasicShapeInset> shape = CSSBasicShapeInset::create();
+
+    CSSParserValue* argument = args->current();
+    WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue> > 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<CSSPrimitiveValue> position = 0;
-    RefPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> position = 0;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0;
     if (isItemPositionKeyword(value->id)) {
         position = cssValuePool().createIdentifierValue(value->id);
         value = m_valueList->next();
@@ -5187,7 +5199,7 @@ PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeRectangle(CSSParserValu
         if (!validUnit(argument, unitFlags))
             return 0;
 
-        RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
         ASSERT(argumentNumber < 6);
         switch (argumentNumber) {
         case 0:
@@ -5241,7 +5253,7 @@ PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeInsetRectangle(CSSParse
         if (!validUnit(argument, unitFlags))
             return 0;
 
-        RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
         ASSERT(argumentNumber < 6);
         switch (argumentNumber) {
         case 0:
@@ -5278,7 +5290,7 @@ PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeInsetRectangle(CSSParse
     return shape;
 }
 
-PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseShapeRadius(CSSParserValue* value)
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseShapeRadius(CSSParserValue* value)
 {
     if (value->id == CSSValueClosestSide || value->id == CSSValueFarthestSide)
         return cssValuePool().createIdentifierValue(value->id);
@@ -5307,7 +5319,7 @@ PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeCircle(CSSParserValueLi
             return 0;
 
         if (!args->currentIndex() && argument->id != CSSValueAt) {
-            if (RefPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) {
+            if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) {
                 shape->setRadius(radius);
                 continue;
             }
@@ -5358,7 +5370,7 @@ PassRefPtr<CSSBasicShape> BisonCSSParser::parseDeprecatedBasicShapeCircle(CSSPar
         if (!validUnit(argument, unitFlags))
             return 0;
 
-        RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
         ASSERT(argumentNumber < 3);
         switch (argumentNumber) {
         case 0:
@@ -5406,7 +5418,7 @@ PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapeEllipse(CSSParserValueL
             return 0;
 
         if (args->currentIndex() < 2 && argument->id != CSSValueAt) {
-            if (RefPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) {
+            if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(argument)) {
                 if (!shape->radiusX())
                     shape->setRadiusX(radius);
                 else
@@ -5455,7 +5467,7 @@ PassRefPtr<CSSBasicShape> BisonCSSParser::parseDeprecatedBasicShapeEllipse(CSSPa
         if (!validUnit(argument, unitFlags))
             return 0;
 
-        RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument);
         ASSERT(argumentNumber < 4);
         switch (argumentNumber) {
         case 0:
@@ -5520,8 +5532,8 @@ PassRefPtr<CSSBasicShape> BisonCSSParser::parseBasicShapePolygon(CSSParserValueL
         if (!argumentY || !validUnit(argumentY, FLength | FPercent))
             return 0;
 
-        RefPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericValue(argumentX);
-        RefPtr<CSSPrimitiveValue> yLength = createPrimitiveNumericValue(argumentY);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericValue(argumentX);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> yLength = createPrimitiveNumericValue(argumentY);
 
         shape->appendPoint(xLength.release(), yLength.release());
 
@@ -5573,12 +5585,12 @@ PassRefPtr<CSSValue> BisonCSSParser::parseShapeProperty(CSSPropertyID propId)
 
     CSSParserValue* value = m_valueList->current();
     CSSValueID valueId = value->id;
-    RefPtr<CSSPrimitiveValue> boxValue;
-    RefPtr<CSSPrimitiveValue> shapeValue;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> boxValue;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue;
 
     if (valueId == CSSValueNone
         || (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside)) {
-        RefPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive(valueId, value);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive(valueId, value);
         m_valueList->next();
         return keywordValue.release();
     }
@@ -5625,7 +5637,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseShapeProperty(CSSPropertyID propId)
     return boxValue.release();
 }
 
-PassRefPtr<CSSPrimitiveValue> BisonCSSParser::parseBasicShape()
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> BisonCSSParser::parseBasicShape()
 {
     CSSParserValue* value = m_valueList->current();
     ASSERT(value->unit == CSSParserValue::Function);
@@ -5651,6 +5663,8 @@ PassRefPtr<CSSPrimitiveValue> 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<CSSValueList> BisonCSSParser::parseFontFamily()
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseFontFamily()
 {
-    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSValueList> values;
+    RefPtrWillBeRawPtr<CSSValueList> values;
     if (m_valueList->size() > 1)
         values = CSSValueList::createCommaSeparated();
     CSSParserValue* val;
     bool expectComma = false;
     while ((val = m_valueList->current())) {
-        RefPtr<CSSPrimitiveValue> parsedValue;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create(completeURL(m_valueList->current()->string)));
+    RefPtrWillBeRawPtr<CSSFontFaceSrcValue> 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<CSSValueList> values(CSSValueList::createCommaSeparated());
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSValueList> values = CSSValueList::createCommaSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSPrimitiveValue> BisonCSSParser::parseColor(CSSParserValue* value)
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v);
 
         if (allowX) {
             x = val.release();
@@ -6670,7 +6686,7 @@ struct ShadowParseContext {
         }
     }
 
-    void commitColor(PassRefPtr<CSSPrimitiveValue> val)
+    void commitColor(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val)
     {
         color = val;
         allowColor = false;
@@ -6700,13 +6716,13 @@ struct ShadowParseContext {
     CSSPropertyID property;
     BisonCSSParser* m_parser;
 
-    RefPtr<CSSValueList> values;
-    RefPtr<CSSPrimitiveValue> x;
-    RefPtr<CSSPrimitiveValue> y;
-    RefPtr<CSSPrimitiveValue> blur;
-    RefPtr<CSSPrimitiveValue> spread;
-    RefPtr<CSSPrimitiveValue> style;
-    RefPtr<CSSPrimitiveValue> color;
+    RefPtrWillBeRawPtr<CSSValueList> values;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> x;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> y;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> blur;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> spread;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> style;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> color;
 
     bool allowX;
     bool allowY;
@@ -6717,7 +6733,7 @@ struct ShadowParseContext {
     bool allowBreak;
 };
 
-PassRefPtr<CSSValueList> BisonCSSParser::parseShadow(CSSParserValueList* valueList, CSSPropertyID propId)
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseShadow(CSSParserValueList* valueList, CSSPropertyID propId)
 {
     ShadowParseContext context(propId, this);
     CSSParserValue* val;
@@ -6748,7 +6764,7 @@ PassRefPtr<CSSValueList> BisonCSSParser::parseShadow(CSSParserValueList* valueLi
             context.commitStyle(val);
         } else {
             // The only other type of value that's ok is a color value.
-            RefPtr<CSSPrimitiveValue> parsedColor;
+            RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> 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<CSSPrimitiveValue> 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<CSSPrimitiveValue> offset;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSReflectValue> reflectValue = CSSReflectValue::create(direction.release(), offset.release(), mask.release());
+    RefPtrWillBeRawPtr<CSSReflectValue> 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<CSSPrimitiveValue> flexBasis;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSBorderImageSliceValue> slice)
+    void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice)
     {
         m_imageSlice = slice;
         m_canAdvance = true;
@@ -6941,7 +6955,7 @@ struct BorderImageParseContext {
             m_requireWidth = false;
         }
     }
-    void commitBorderWidth(PassRefPtr<CSSPrimitiveValue> slice)
+    void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> slice)
     {
         m_borderSlice = slice;
         m_canAdvance = true;
@@ -6950,7 +6964,7 @@ struct BorderImageParseContext {
         m_allowImage = !m_image;
         m_allowRepeat = !m_repeat;
     }
-    void commitBorderOutset(PassRefPtr<CSSPrimitiveValue> outset)
+    void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset)
     {
         m_outset = outset;
         m_canAdvance = true;
@@ -7012,9 +7026,9 @@ struct BorderImageParseContext {
     bool m_requireOutset;
 
     RefPtr<CSSValue> m_image;
-    RefPtr<CSSBorderImageSliceValue> m_imageSlice;
-    RefPtr<CSSPrimitiveValue> m_borderSlice;
-    RefPtr<CSSPrimitiveValue> m_outset;
+    RefPtrWillBeRawPtr<CSSBorderImageSliceValue> m_imageSlice;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_borderSlice;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_outset;
 
     RefPtr<CSSValue> m_repeat;
 };
@@ -7048,7 +7062,7 @@ static bool buildBorderImageParseContext(BisonCSSParser& parser, CSSPropertyID p
         }
 
         if (!context.canAdvance() && context.allowImageSlice()) {
-            RefPtr<CSSBorderImageSliceValue> imageSlice;
+            RefPtrWillBeRawPtr<CSSBorderImageSliceValue> 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<CSSPrimitiveValue> borderSlice;
+            RefPtrWillBeRawPtr<CSSPrimitiveValue> borderSlice;
             if (parser.parseBorderImageWidth(borderSlice))
                 context.commitBorderWidth(borderSlice.release());
         }
 
         if (!context.canAdvance() && context.requireOutset()) {
-            RefPtr<CSSPrimitiveValue> borderOutset;
+            RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset;
             if (parser.parseBorderImageOutset(borderOutset))
                 context.commitBorderOutset(borderOutset.release());
         }
@@ -7115,8 +7129,8 @@ static bool isBorderImageRepeatKeyword(int id)
 
 bool BisonCSSParser::parseBorderImageRepeat(RefPtr<CSSValue>& result)
 {
-    RefPtr<CSSPrimitiveValue> firstValue;
-    RefPtr<CSSPrimitiveValue> secondValue;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> firstValue;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> secondValue;
     CSSParserValue* val = m_valueList->current();
     if (!val)
         return false;
@@ -7146,6 +7160,7 @@ bool BisonCSSParser::parseBorderImageRepeat(RefPtr<CSSValue>& result)
 }
 
 class BorderImageSliceParseContext {
+    DISALLOW_ALLOCATION();
 public:
     BorderImageSliceParseContext(BisonCSSParser* parser)
     : m_parser(parser)
@@ -7162,7 +7177,7 @@ public:
 
     void commitNumber(CSSParserValue* v)
     {
-        RefPtr<CSSPrimitiveValue> val = m_parser->createPrimitiveNumericValue(v);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSBorderImageSliceValue> commitBorderImageSlice()
+    PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> 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<CSSPrimitiveValue> m_top;
-    RefPtr<CSSPrimitiveValue> m_right;
-    RefPtr<CSSPrimitiveValue> m_bottom;
-    RefPtr<CSSPrimitiveValue> m_left;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left;
 
     bool m_fill;
 };
 
-bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtr<CSSBorderImageSliceValue>& result)
+bool BisonCSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtrWillBeRawPtr<CSSBorderImageSliceValue>& result)
 {
     BorderImageSliceParseContext context(this);
     CSSParserValue* val;
@@ -7273,7 +7288,7 @@ public:
 
     void commitNumber(CSSParserValue* v)
     {
-        RefPtr<CSSPrimitiveValue> val;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> val;
         if (v->id == CSSValueAuto)
             val = cssValuePool().createIdentifierValue(v->id);
         else
@@ -7295,9 +7310,9 @@ public:
     }
 
     void setAllowFinalCommit() { m_allowFinalCommit = true; }
-    void setTop(PassRefPtr<CSSPrimitiveValue> val) { m_top = val; }
+    void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; }
 
-    PassRefPtr<CSSPrimitiveValue> commitBorderImageQuad()
+    PassRefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> m_top;
-    RefPtr<CSSPrimitiveValue> m_right;
-    RefPtr<CSSPrimitiveValue> m_bottom;
-    RefPtr<CSSPrimitiveValue> m_left;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left;
 };
 
-bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtr<CSSPrimitiveValue>& result)
+bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPtr<CSSPrimitiveValue>& result)
 {
     BorderImageQuadParseContext context(this);
     CSSParserValue* val;
@@ -7362,28 +7377,16 @@ bool BisonCSSParser::parseBorderImageQuad(Units validUnits, RefPtr<CSSPrimitiveV
     return false;
 }
 
-bool BisonCSSParser::parseBorderImageWidth(RefPtr<CSSPrimitiveValue>& result)
+bool BisonCSSParser::parseBorderImageWidth(RefPtrWillBeRawPtr<CSSPrimitiveValue>& result)
 {
     return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result);
 }
 
-bool BisonCSSParser::parseBorderImageOutset(RefPtr<CSSPrimitiveValue>& result)
+bool BisonCSSParser::parseBorderImageOutset(RefPtrWillBeRawPtr<CSSPrimitiveValue>& result)
 {
     return parseBorderImageQuad(FLength | FNumber | FNonNeg, result);
 }
 
-static void completeBorderRadii(RefPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> radii[2][4];
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> radius = createPrimitiveNumericValue(value);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSValueList> list = CSSValueList::createCommaSeparated();
-    RefPtr<CSSPrimitiveValue> counterName;
+    RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> parseDeprecatedGradientPoint(CSSParserValue* a, bool horizontal)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CSSParserValue* a, bool horizontal)
 {
-    RefPtr<CSSPrimitiveValue> result;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> point = parseDeprecatedGradientPoint(a, true);
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> valueFromSideKeyword(CSSParserValue* a, bool& isHorizontal)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueFromSideKeyword(CSSParserValue* a, bool& isHorizontal)
 {
     if (a->unit != CSSPrimitiveValue::CSS_IDENT)
         return 0;
@@ -7749,7 +7752,7 @@ static PassRefPtr<CSSPrimitiveValue> valueFromSideKeyword(CSSParserValue* a, boo
     return cssValuePool().createIdentifierValue(a->id);
 }
 
-static PassRefPtr<CSSPrimitiveValue> parseGradientColorOrKeyword(BisonCSSParser* p, CSSParserValue* value)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> parseGradientColorOrKeyword(BisonCSSParser*
 
 bool BisonCSSParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList, RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
 {
-    RefPtr<CSSLinearGradientValue> result = CSSLinearGradientValue::create(repeating, CSSPrefixedLinearGradient);
+    RefPtrWillBeRawPtr<CSSLinearGradientValue> 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<CSSPrimitiveValue> startX, startY;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> startX, startY;
 
-        RefPtr<CSSPrimitiveValue> location;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSValue>& gradient, CSSGradientRepeat repeating)
 {
-    RefPtr<CSSRadialGradientValue> result = CSSRadialGradientValue::create(repeating, CSSPrefixedRadialGradient);
+    RefPtrWillBeRawPtr<CSSRadialGradientValue> 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<CSSPrimitiveValue> shapeValue;
-    RefPtr<CSSPrimitiveValue> sizeValue;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSPrimitiveValue> horizontalSize;
-    RefPtr<CSSPrimitiveValue> verticalSize;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize;
 
     if (!shapeValue && !sizeValue) {
         if (validUnit(a, FLength | FPercent)) {
@@ -7946,7 +7949,7 @@ bool BisonCSSParser::parseDeprecatedRadialGradient(CSSParserValueList* valueList
 
 bool BisonCSSParser::parseLinearGradient(CSSParserValueList* valueList, RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
 {
-    RefPtr<CSSLinearGradientValue> result = CSSLinearGradientValue::create(repeating, CSSLinearGradient);
+    RefPtrWillBeRawPtr<CSSLinearGradientValue> 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<C
         if (!a)
             return false;
 
-        RefPtr<CSSPrimitiveValue> endX, endY;
-        RefPtr<CSSPrimitiveValue> location;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> endX, endY;
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> location;
         bool isHorizontal = false;
 
         location = valueFromSideKeyword(a, isHorizontal);
@@ -8018,7 +8021,7 @@ bool BisonCSSParser::parseLinearGradient(CSSParserValueList* valueList, RefPtr<C
 
 bool BisonCSSParser::parseRadialGradient(CSSParserValueList* valueList, RefPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
 {
-    RefPtr<CSSRadialGradientValue> result = CSSRadialGradientValue::create(repeating, CSSRadialGradient);
+    RefPtrWillBeRawPtr<CSSRadialGradientValue> 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<C
 
     bool expectComma = false;
 
-    RefPtr<CSSPrimitiveValue> shapeValue;
-    RefPtr<CSSPrimitiveValue> sizeValue;
-    RefPtr<CSSPrimitiveValue> horizontalSize;
-    RefPtr<CSSPrimitiveValue> verticalSize;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize;
 
     // First part of grammar, the size/shape clause:
     // [ circle || <length> ] |
@@ -8184,29 +8187,48 @@ bool BisonCSSParser::parseGeneratedImage(CSSParserValueList* valueList, RefPtr<C
     if (val->unit != 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<C
 
 bool BisonCSSParser::parseCrossfade(CSSParserValueList* valueList, RefPtr<CSSValue>& crossfade)
 {
-    RefPtr<CSSCrossfadeValue> 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, RefPtr<CSSVal
     a = args->next();
 
     // The third argument is the crossfade value. It is a percentage or a fractional number.
-    RefPtr<CSSPrimitiveValue> percentage;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> percentage;
     if (!a)
         return false;
 
@@ -8264,7 +8284,7 @@ bool BisonCSSParser::parseCrossfade(CSSParserValueList* valueList, RefPtr<CSSVal
     else
         return false;
 
-    result = CSSCrossfadeValue::create(fromImageValue, toImageValue);
+    RefPtrWillBeRawPtr<CSSCrossfadeValue> result = CSSCrossfadeValue::create(fromImageValue, toImageValue);
     result->setPercentage(percentage);
 
     crossfade = result;
@@ -8299,7 +8319,7 @@ PassRefPtr<CSSValue> BisonCSSParser::parseImageSet(CSSParserValueList* valueList
     if (!functionArgs || !functionArgs->size() || !functionArgs->current())
         return 0;
 
-    RefPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create();
+    RefPtrWillBeRawPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create();
 
     CSSParserValue* arg = functionArgs->current();
     while (arg) {
@@ -8480,12 +8500,12 @@ private:
     BisonCSSParser::Units m_unit;
 };
 
-PassRefPtr<CSSValueList> BisonCSSParser::parseTransform()
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseTransform()
 {
     if (!m_valueList)
         return 0;
 
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
         RefPtr<CSSValue> parsedTransformValue = parseTransformValue(value);
         if (!parsedTransformValue)
@@ -8519,7 +8539,7 @@ PassRefPtr<CSSValue> 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<CSSTransformValue> transformValue = CSSTransformValue::create(info.type());
+    RefPtrWillBeRawPtr<CSSTransformValue> 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<CSSFilterValue> BisonCSSParser::parseBuiltinFilterArguments(CSSParserValueList* args, CSSFilterValue::FilterOperationType filterType)
+PassRefPtrWillBeRawPtr<CSSFilterValue> BisonCSSParser::parseBuiltinFilterArguments(CSSParserValueList* args, CSSFilterValue::FilterOperationType filterType)
 {
-    RefPtr<CSSFilterValue> filterValue = CSSFilterValue::create(filterType);
+    RefPtrWillBeRawPtr<CSSFilterValue> filterValue = CSSFilterValue::create(filterType);
     ASSERT(args);
 
     switch (filterType) {
@@ -8680,7 +8700,7 @@ PassRefPtr<CSSFilterValue> BisonCSSParser::parseBuiltinFilterArguments(CSSParser
     }
     case CSSFilterValue::DropShadowFilterOperation: {
         // drop-shadow() takes a single shadow.
-        RefPtr<CSSValueList> shadowValueList = parseShadow(args, CSSPropertyWebkitFilter);
+        RefPtrWillBeRawPtr<CSSValueList> shadowValueList = parseShadow(args, CSSPropertyWebkitFilter);
         if (!shadowValueList || shadowValueList->length() != 1)
             return 0;
 
@@ -8693,13 +8713,13 @@ PassRefPtr<CSSFilterValue> BisonCSSParser::parseBuiltinFilterArguments(CSSParser
     return filterValue.release();
 }
 
-PassRefPtr<CSSValueList> BisonCSSParser::parseFilter()
+PassRefPtrWillBeRawPtr<CSSValueList> BisonCSSParser::parseFilter()
 {
     if (!m_valueList)
         return 0;
 
     // The filter is a list of functional primitives that specify individual operations.
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSValueList> BisonCSSParser::parseFilter()
 
         // See if the specified primitive is one we understand.
         if (value->unit == CSSPrimitiveValue::CSS_URI) {
-            RefPtr<CSSFilterValue> referenceFilterValue = CSSFilterValue::create(CSSFilterValue::ReferenceFilterOperation);
+            RefPtrWillBeRawPtr<CSSFilterValue> referenceFilterValue = CSSFilterValue::create(CSSFilterValue::ReferenceFilterOperation);
             list->append(referenceFilterValue);
             referenceFilterValue->append(CSSSVGDocumentValue::create(value->string));
         } else {
@@ -8724,7 +8744,7 @@ PassRefPtr<CSSValueList> BisonCSSParser::parseFilter()
             if (!args)
                 return 0;
 
-            RefPtr<CSSFilterValue> filterValue = parseBuiltinFilterArguments(args, filterType);
+            RefPtrWillBeRawPtr<CSSFilterValue> filterValue = parseBuiltinFilterArguments(args, filterType);
             if (!filterValue)
                 return 0;
 
@@ -8735,78 +8755,6 @@ PassRefPtr<CSSValueList> 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 | <ident>
-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 | <ident>
-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<CSSValue>& value, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3)
 {
     propId1 = propId;
@@ -8892,7 +8840,7 @@ bool BisonCSSParser::parseTouchAction(bool important)
         return false;
 
     CSSParserValue* value = m_valueList->current();
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSPrimitiveValue> fill;
-    RefPtr<CSSPrimitiveValue> shape;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> fill;
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> 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<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
+        RefPtrWillBeRawPtr<CSSValueList> 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<CSSValue> BisonCSSParser::parseTextIndent()
 {
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
 
     // <length> | <percentage> | 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<CSSPrimitiveValue> normalValue = cssValuePool().createIdentifierValue(CSSValueNormal);
+        RefPtrWillBeRawPtr<CSSPrimitiveValue> normalValue = cssValuePool().createIdentifierValue(CSSValueNormal);
         m_valueList->next();
         addProperty(CSSPropertyWebkitFontFeatureSettings, normalValue.release(), important);
         return true;
     }
 
-    RefPtr<CSSValueList> settings = CSSValueList::createCommaSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSValueList> ligatureValues = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSValueList> 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<CSSParserSelector> page
     return pageRule;
 }
 
-void BisonCSSParser::setReusableRegionSelectorVector(Vector<OwnPtr<CSSParserSelector> >* selectors)
-{
-    if (selectors)
-        m_reusableRegionSelectorVector.swap(*selectors);
-}
-
-StyleRuleBase* BisonCSSParser::createRegionRule(Vector<OwnPtr<CSSParserSelector> >* regionSelector, RuleList* rules)
-{
-    if (m_useCounter)
-        m_useCounter->count(UseCounter::CSSWebkitRegionAtRule);
-
-    if (!RuntimeEnabledFeatures::cssRegionsEnabled() || !regionSelector || !rules)
-        return 0;
-
-    m_allowImportRules = m_allowNamespaceDeclarations = false;
-
-    RefPtr<StyleRuleRegion> 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: