Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(656)

Unified Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/css/parser/CSSPropertyParserTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index a6da2b57c606c105b0f29c2f68750b8523ccf03e..f4b04463235b9b7fac2cead8fdc56c6832f60cd0 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -122,7 +122,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
return parseSuccess;
}
-void CSSPropertyParser::addProperty(CSSPropertyID propId, PassRefPtrWillBeRawPtr<CSSValue> value, bool important, bool implicit)
+void CSSPropertyParser::addProperty(CSSPropertyID propId, CSSValue value, bool important, bool implicit)
{
ASSERT(!isPropertyAlias(propId));
@@ -314,10 +314,10 @@ inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit
return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_CUSTOM_IDENT);
}
-inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWithReferrer(const String& rawValue, const KURL& url)
+inline CSSValue CSSPropertyParser::createCSSImageValueWithReferrer(const String& rawValue, const KURL& url)
{
- RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, url);
- toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer());
+ CSSValue imageValue = CSSImageValue::create(rawValue, url);
+ toCSSImageValue(imageValue).setReferrer(m_context.referrer());
return imageValue;
}
@@ -396,7 +396,7 @@ inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseValidPr
return nullptr;
}
-void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtrWillBeRawPtr<CSSValue> prpValue, bool important)
+void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, CSSValue prpValue, bool important)
{
const StylePropertyShorthand& shorthand = shorthandForProperty(propId);
unsigned shorthandLength = shorthand.length();
@@ -405,7 +405,7 @@ void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, PassRe
return;
}
- RefPtrWillBeRawPtr<CSSValue> value = prpValue;
+ CSSValue value = prpValue;
ShorthandScope scope(this, propId);
const CSSPropertyID* longhands = shorthand.properties();
for (unsigned i = 0; i < shorthandLength; ++i)
@@ -454,7 +454,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
bool validPrimitive = false;
Units unitless = FUnknown;
- RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
+ NullableCSSValue parsedValue;
switch (propId) {
case CSSPropertySize: // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
@@ -486,17 +486,16 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
if (num != 1 || !parseValue(CSSPropertyOverflowY, important))
return false;
- RefPtrWillBeRawPtr<CSSValue> overflowXValue = nullptr;
-
// FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. If this value has been
// set using the shorthand, then for now overflow-x will default to auto, but once we implement
// pagination controls, it should default to hidden. If the overflow-y value is anything but
// paged-x or paged-y, then overflow-x and overflow-y should have the same value.
+ NullableCSSValue overflowXValue;
if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY)
overflowXValue = cssValuePool().createIdentifierValue(CSSValueAuto);
else
overflowXValue = m_parsedProperties.last().value();
- addProperty(CSSPropertyOverflowX, overflowXValue.release(), important);
+ addProperty(CSSPropertyOverflowX, *overflowXValue, important);
return true;
}
@@ -520,7 +519,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
ShorthandScope scope(this, CSSPropertyBorderSpacing);
if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing, important))
return false;
- CSSValue* value = m_parsedProperties.last().value();
+ CSSValue value = m_parsedProperties.last().value();
addProperty(CSSPropertyWebkitBorderVerticalSpacing, value, important);
return true;
}
@@ -578,7 +577,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
// zoom-in | zoom-out | -webkit-grab | -webkit-grabbing | -webkit-zoom-in | -webkit-zoom-out ] ] | inherit
RefPtrWillBeRawPtr<CSSValueList> list = nullptr;
while (value) {
- RefPtrWillBeRawPtr<CSSValue> image = nullptr;
+ NullableCSSValue image;
if (value->unit == CSSPrimitiveValue::CSS_URI) {
String uri = value->string;
if (!uri.isNull())
@@ -610,7 +609,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
list = CSSValueList::createCommaSeparated();
if (image)
- list->append(CSSCursorImageValue::create(image, hotSpotSpecified, hotSpot));
+ list->append(CSSCursorImageValue::create(*image, hotSpotSpecified, hotSpot));
if (!consumeComma(m_valueList))
return false;
@@ -672,8 +671,8 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
case CSSPropertyWebkitMaskRepeatX:
case CSSPropertyWebkitMaskRepeatY:
{
- RefPtrWillBeRawPtr<CSSValue> val1 = nullptr;
- RefPtrWillBeRawPtr<CSSValue> val2 = nullptr;
+ NullableCSSValue val1;
+ NullableCSSValue val2;
CSSPropertyID propId1, propId2;
bool result = false;
if (parseFillProperty(unresolvedProperty, propId1, propId2, val1, val2)) {
@@ -682,13 +681,13 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
propId == CSSPropertyWebkitMaskPosition ||
propId == CSSPropertyWebkitMaskRepeat) {
ShorthandScope scope(this, propId);
- addProperty(propId1, val1.release(), important);
+ addProperty(propId1, *val1, important);
if (val2)
- addProperty(propId2, val2.release(), important);
+ addProperty(propId2, *val2, important);
} else {
- addProperty(propId1, val1.release(), important);
+ addProperty(propId1, *val1, important);
if (val2)
- addProperty(propId2, val2.release(), important);
+ addProperty(propId2, *val2, important);
}
result = true;
}
@@ -903,8 +902,8 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
case CSSPropertyWebkitMaskBoxImage:
return parseBorderImageShorthand(propId, important);
case CSSPropertyWebkitBorderImage: {
- if (RefPtrWillBeRawPtr<CSSValue> result = parseBorderImage(propId)) {
- addProperty(propId, result, important);
+ if (NullableCSSValue result = parseBorderImage(propId)) {
+ addProperty(propId, *result, important);
return true;
}
return false;
@@ -921,9 +920,9 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
}
case CSSPropertyBorderImageRepeat:
case CSSPropertyWebkitMaskBoxImageRepeat: {
- RefPtrWillBeRawPtr<CSSValue> result = nullptr;
+ NullableCSSValue result;
if (parseBorderImageRepeat(result)) {
- addProperty(propId, result, important);
+ addProperty(propId, *result, important);
return true;
}
break;
@@ -1017,9 +1016,9 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
if (id == CSSValueNone)
validPrimitive = true;
else {
- RefPtrWillBeRawPtr<CSSValue> val = parseFilter();
+ NullableCSSValue val = parseFilter();
if (val) {
- addProperty(propId, val, important);
+ addProperty(propId, *val, important);
return true;
}
return false;
@@ -1277,7 +1276,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
ShorthandScope scope(this, CSSPropertyWebkitMarginCollapse);
if (!parseValue(webkitMarginCollapseShorthand().properties()[0], important))
return false;
- CSSValue* value = m_parsedProperties.last().value();
+ CSSValue value = m_parsedProperties.last().value();
addProperty(webkitMarginCollapseShorthand().properties()[1], value, important);
return true;
}
@@ -1483,7 +1482,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
parsedValue = parseBasicShape();
} else if (value->unit == CSSPrimitiveValue::CSS_URI) {
parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveValue::CSS_URI);
- addProperty(propId, parsedValue.release(), important);
+ addProperty(propId, *parsedValue, important);
return true;
}
break;
@@ -1555,22 +1554,21 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
ASSERT(!m_parsedCalculation);
if (parsedValue) {
if (!m_valueList->current() || inShorthand()) {
- addProperty(propId, parsedValue.release(), important);
+ addProperty(propId, *parsedValue, important);
return true;
}
}
return false;
}
-void CSSPropertyParser::addFillValue(RefPtrWillBeRawPtr<CSSValue>& lval, PassRefPtrWillBeRawPtr<CSSValue> rval)
+void CSSPropertyParser::addFillValue(NullableCSSValue& lval, CSSValue rval)
{
if (lval) {
if (lval->isBaseValueList())
- toCSSValueList(lval.get())->append(rval);
+ toCSSValueList(lval)->append(rval);
else {
- PassRefPtrWillBeRawPtr<CSSValue> oldlVal(lval.release());
PassRefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- list->append(oldlVal);
+ list->append(*lval);
list->append(rval);
lval = list;
}
@@ -1579,7 +1577,7 @@ void CSSPropertyParser::addFillValue(RefPtrWillBeRawPtr<CSSValue>& lval, PassRef
lval = rval;
}
-static bool parseBackgroundClip(CSSParserValue* parserValue, RefPtrWillBeRawPtr<CSSValue>& cssValue)
+static bool parseBackgroundClip(CSSParserValue* parserValue, NullableCSSValue& cssValue)
{
if (parserValue->id == CSSValueBorderBox || parserValue->id == CSSValuePaddingBox
|| parserValue->id == CSSValueContentBox || parserValue->id == CSSValueWebkitText) {
@@ -1600,14 +1598,14 @@ bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper
ShorthandScope scope(this, propId);
bool parsedProperty[cMaxFillProperties] = { false };
- RefPtrWillBeRawPtr<CSSValue> values[cMaxFillProperties];
+ NullableCSSValue values[cMaxFillProperties];
#if ENABLE(OILPAN)
// Zero initialize the array of raw pointers.
memset(&values, 0, sizeof(values));
#endif
- RefPtrWillBeRawPtr<CSSValue> clipValue = nullptr;
- RefPtrWillBeRawPtr<CSSValue> positionYValue = nullptr;
- RefPtrWillBeRawPtr<CSSValue> repeatYValue = nullptr;
+ NullableCSSValue clipValue;
+ NullableCSSValue positionYValue;
+ NullableCSSValue repeatYValue;
bool foundClip = false;
int i;
bool foundPositionCSSProperty = false;
@@ -1656,29 +1654,29 @@ bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper
continue;
if (!parsedProperty[i]) {
- RefPtrWillBeRawPtr<CSSValue> val1 = nullptr;
- RefPtrWillBeRawPtr<CSSValue> val2 = nullptr;
+ NullableCSSValue val1;
+ NullableCSSValue val2;
CSSPropertyID propId1, propId2;
CSSParserValue* parserValue = m_valueList->current();
// parseFillProperty() may modify m_implicitShorthand, so we MUST reset it
// before EACH return below.
if (parserValue && parseFillProperty(properties[i], propId1, propId2, val1, val2)) {
parsedProperty[i] = found = true;
- addFillValue(values[i], val1.release());
+ addFillValue(values[i], *val1);
if (properties[i] == CSSPropertyBackgroundPosition || properties[i] == CSSPropertyWebkitMaskPosition)
- addFillValue(positionYValue, val2.release());
+ addFillValue(positionYValue, *val2);
if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] == CSSPropertyWebkitMaskRepeat)
- addFillValue(repeatYValue, val2.release());
+ addFillValue(repeatYValue, *val2);
if (properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) {
// Reparse the value as a clip, and see if we succeed.
if (parseBackgroundClip(parserValue, val1))
- addFillValue(clipValue, val1.release()); // The property parsed successfully.
+ addFillValue(clipValue, *val1); // The property parsed successfully.
else
addFillValue(clipValue, cssValuePool().createImplicitInitialValue()); // Some value was used for origin that is not supported by clip. Just reset clip instead.
}
if (properties[i] == CSSPropertyBackgroundClip || properties[i] == CSSPropertyWebkitMaskClip) {
// Update clipValue
- addFillValue(clipValue, val1.release());
+ addFillValue(clipValue, *val1);
foundClip = true;
}
if (properties[i] == CSSPropertyBackgroundPosition || properties[i] == CSSPropertyWebkitMaskPosition)
@@ -1710,34 +1708,34 @@ bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper
}
}
if (properties[i] == CSSPropertyBackgroundPosition) {
- addProperty(CSSPropertyBackgroundPositionX, values[i].release(), important);
+ addProperty(CSSPropertyBackgroundPositionX, *values[i], important);
// it's OK to call positionYValue.release() since we only see CSSPropertyBackgroundPosition once
- addProperty(CSSPropertyBackgroundPositionY, positionYValue.release(), important);
+ addProperty(CSSPropertyBackgroundPositionY, *positionYValue, important);
} else if (properties[i] == CSSPropertyWebkitMaskPosition) {
- addProperty(CSSPropertyWebkitMaskPositionX, values[i].release(), important);
+ addProperty(CSSPropertyWebkitMaskPositionX, *values[i], important);
// it's OK to call positionYValue.release() since we only see CSSPropertyWebkitMaskPosition once
- addProperty(CSSPropertyWebkitMaskPositionY, positionYValue.release(), important);
+ addProperty(CSSPropertyWebkitMaskPositionY, *positionYValue, important);
} else if (properties[i] == CSSPropertyBackgroundRepeat) {
- addProperty(CSSPropertyBackgroundRepeatX, values[i].release(), important);
+ addProperty(CSSPropertyBackgroundRepeatX, *values[i], important);
// it's OK to call repeatYValue.release() since we only see CSSPropertyBackgroundPosition once
- addProperty(CSSPropertyBackgroundRepeatY, repeatYValue.release(), important);
+ addProperty(CSSPropertyBackgroundRepeatY, *repeatYValue, important);
} else if (properties[i] == CSSPropertyWebkitMaskRepeat) {
- addProperty(CSSPropertyWebkitMaskRepeatX, values[i].release(), important);
+ addProperty(CSSPropertyWebkitMaskRepeatX, *values[i], important);
// it's OK to call repeatYValue.release() since we only see CSSPropertyBackgroundPosition once
- addProperty(CSSPropertyWebkitMaskRepeatY, repeatYValue.release(), important);
+ addProperty(CSSPropertyWebkitMaskRepeatY, *repeatYValue, important);
} else if ((properties[i] == CSSPropertyBackgroundClip || properties[i] == CSSPropertyWebkitMaskClip) && !foundClip)
// Value is already set while updating origin
continue;
else if (properties[i] == CSSPropertyBackgroundSize && !parsedProperty[i] && m_context.useLegacyBackgroundSizeShorthandBehavior())
continue;
else
- addProperty(properties[i], values[i].release(), important);
+ addProperty(properties[i], *values[i], important);
// Add in clip values when we hit the corresponding origin property.
if (properties[i] == CSSPropertyBackgroundOrigin && !foundClip)
- addProperty(CSSPropertyBackgroundClip, clipValue.release(), important);
+ addProperty(CSSPropertyBackgroundClip, *clipValue, important);
else if (properties[i] == CSSPropertyWebkitMaskOrigin && !foundClip)
- addProperty(CSSPropertyWebkitMaskClip, clipValue.release(), important);
+ addProperty(CSSPropertyWebkitMaskClip, *clipValue, important);
}
m_implicitShorthand = false;
@@ -1750,10 +1748,10 @@ static bool isValidTransitionPropertyList(CSSValueList* value)
return true;
for (auto& property : *value) {
// FIXME: Shorthand parsing shouldn't add initial to the list since it won't round-trip
- if (property->isInitialValue())
+ if (property.isInitialValue())
continue;
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(property.get());
- if (primitiveValue->isValueID() && primitiveValue->getValueID() == CSSValueNone)
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(property);
+ if (primitiveValue.isValueID() && primitiveValue.getValueID() == CSSValueNone)
return false;
}
return true;
@@ -1793,9 +1791,9 @@ bool CSSPropertyParser::parseAnimationShorthand(bool useLegacyparsing, bool impo
for (size_t i = 0; i < numProperties; ++i) {
if (parsedProperty[i])
continue;
- if (RefPtrWillBeRawPtr<CSSValue> val = parseAnimationProperty(animationProperties.properties()[i], useLegacyparsing)) {
+ if (NullableCSSValue val = parseAnimationProperty(animationProperties.properties()[i], useLegacyparsing)) {
parsedProperty[i] = found = true;
- values[i]->append(val.release());
+ values[i]->append(*val);
break;
}
}
@@ -1846,9 +1844,9 @@ bool CSSPropertyParser::parseTransitionShorthand(bool important)
for (size_t i = 0; i < numProperties; ++i) {
if (parsedProperty[i])
continue;
- if (RefPtrWillBeRawPtr<CSSValue> val = parseAnimationProperty(shorthand.properties()[i], false)) {
+ if (NullableCSSValue val = parseAnimationProperty(shorthand.properties()[i], false)) {
parsedProperty[i] = found = true;
- values[i]->append(val.release());
+ values[i]->append(*val);
break;
}
}
@@ -1873,24 +1871,24 @@ bool CSSPropertyParser::parseTransitionShorthand(bool important)
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseColumnWidth()
+NullableCSSValue CSSPropertyParser::parseColumnWidth()
{
CSSParserValue* value = m_valueList->current();
// Always parse lengths in strict mode here, since it would be ambiguous otherwise when used in
// the 'columns' shorthand property.
if (value->id == CSSValueAuto || (validUnit(value, FLength | FNonNeg, HTMLStandardMode) && (m_parsedCalculation || value->fValue != 0))) {
- RefPtrWillBeRawPtr<CSSValue> parsedValue = parseValidPrimitive(value->id, value);
+ CSSValue parsedValue = parseValidPrimitive(value->id, value);
m_valueList->next();
return parsedValue;
}
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseColumnCount()
+NullableCSSValue CSSPropertyParser::parseColumnCount()
{
CSSParserValue* value = m_valueList->current();
if (value->id == CSSValueAuto || validUnit(value, FPositiveInteger)) {
- RefPtrWillBeRawPtr<CSSValue> parsedValue = parseValidPrimitive(value->id, value);
+ CSSValue parsedValue = parseValidPrimitive(value->id, value);
m_valueList->next();
return parsedValue;
}
@@ -1899,8 +1897,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseColumnCount()
bool CSSPropertyParser::parseColumnsShorthand(bool important)
{
- RefPtrWillBeRawPtr<CSSValue> columnWidth = nullptr;
- RefPtrWillBeRawPtr<CSSValue> columnCount = nullptr;
+ NullableCSSValue columnWidth;
+ NullableCSSValue columnCount;
bool hasPendingExplicitAuto = false;
for (unsigned propertiesParsed = 0; CSSParserValue* value = m_valueList->current(); propertiesParsed++) {
@@ -1942,11 +1940,11 @@ bool CSSPropertyParser::parseColumnsShorthand(bool important)
// Any unassigned property at this point will become implicit 'auto'.
if (columnWidth)
- addProperty(CSSPropertyWebkitColumnWidth, columnWidth, important);
+ addProperty(CSSPropertyWebkitColumnWidth, *columnWidth, important);
else
addProperty(CSSPropertyWebkitColumnWidth, cssValuePool().createIdentifierValue(CSSValueAuto), important, true /* implicit */);
if (columnCount)
- addProperty(CSSPropertyWebkitColumnCount, columnCount, important);
+ addProperty(CSSPropertyWebkitColumnCount, *columnCount, important);
else
addProperty(CSSPropertyWebkitColumnCount, cssValuePool().createIdentifierValue(CSSValueAuto), important, true /* implicit */);
return true;
@@ -2018,7 +2016,7 @@ bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *
case 1: {
if (!parseValue(properties[0], important))
return false;
- CSSValue* value = m_parsedProperties.last().value();
+ CSSValue value = m_parsedProperties.last().value();
ImplicitScope implicitScope(this);
addProperty(properties[1], value, important);
addProperty(properties[2], value, important);
@@ -2028,7 +2026,7 @@ bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *
case 2: {
if (!parseValue(properties[0], important) || !parseValue(properties[1], important))
return false;
- CSSValue* value = m_parsedProperties[m_parsedProperties.size() - 2].value();
+ CSSValue value = m_parsedProperties[m_parsedProperties.size() - 2].value();
ImplicitScope implicitScope(this);
addProperty(properties[2], value, important);
value = m_parsedProperties[m_parsedProperties.size() - 2].value();
@@ -2038,7 +2036,7 @@ bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *
case 3: {
if (!parseValue(properties[0], important) || !parseValue(properties[1], important) || !parseValue(properties[2], important))
return false;
- CSSValue* value = m_parsedProperties[m_parsedProperties.size() - 2].value();
+ CSSValue value = m_parsedProperties[m_parsedProperties.size() - 2].value();
ImplicitScope implicitScope(this);
addProperty(properties[3], value, important);
break;
@@ -2057,7 +2055,7 @@ bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapPoints()
+NullableCSSValue CSSPropertyParser::parseScrollSnapPoints()
{
CSSParserValue* value = m_valueList->current();
@@ -2084,7 +2082,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapPoints()
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate()
+NullableCSSValue CSSPropertyParser::parseScrollSnapCoordinate()
{
if (m_valueList->current()->id == CSSValueNone) {
m_valueList->next();
@@ -2174,15 +2172,15 @@ CSSPropertyParser::SizeParameterType CSSPropertyParser::parseSizeParameter(CSSVa
}
// [ <string> <string> ]+ | none, but none is handled in parseValue
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseQuotes()
+NullableCSSValue CSSPropertyParser::parseQuotes()
{
RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
while (CSSParserValue* val = m_valueList->current()) {
- RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
+ NullableCSSValue parsedValue;
if (val->unit != CSSPrimitiveValue::CSS_STRING)
return nullptr;
parsedValue = createPrimitiveStringValue(val);
- values->append(parsedValue.release());
+ values->append(*parsedValue);
m_valueList->next();
}
if (values->length() && values->length() % 2 == 0)
@@ -2198,7 +2196,7 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent()
RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
while (CSSParserValue* val = m_valueList->current()) {
- RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
+ NullableCSSValue parsedValue;
if (val->unit == CSSPrimitiveValue::CSS_URI) {
// url
parsedValue = createCSSImageValueWithReferrer(val->string, completeURL(val->string));
@@ -2236,14 +2234,14 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent()
}
if (!parsedValue)
return nullptr;
- values->append(parsedValue.release());
+ values->append(*parsedValue);
m_valueList->next();
}
return values.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAttr(CSSParserValueList* args)
+NullableCSSValue CSSPropertyParser::parseAttr(CSSParserValueList* args)
{
if (args->size() != 1)
return nullptr;
@@ -2365,7 +2363,7 @@ PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseDeprecatedGrad
return parseGradientStopColor(value);
}
-bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& value)
+bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, NullableCSSValue& value)
{
if (valueList->current()->id == CSSValueNone) {
value = cssValuePool().createIdentifierValue(CSSValueNone);
@@ -2388,7 +2386,7 @@ bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill
return false;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillPositionX(CSSParserValueList* valueList)
+NullableCSSValue CSSPropertyParser::parseFillPositionX(CSSParserValueList* valueList)
{
int id = valueList->current()->id;
if (id == CSSValueLeft || id == CSSValueRight || id == CSSValueCenter) {
@@ -2404,7 +2402,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillPositionX(CSSParser
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillPositionY(CSSParserValueList* valueList)
+NullableCSSValue CSSPropertyParser::parseFillPositionY(CSSParserValueList* valueList)
{
int id = valueList->current()->id;
if (id == CSSValueTop || id == CSSValueBottom || id == CSSValueCenter) {
@@ -2485,7 +2483,7 @@ static bool isFillPositionKeyword(CSSValueID value)
return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBottom || value == CSSValueRight || value == CSSValueCenter;
}
-void CSSPropertyParser::parse4ValuesFillPosition(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2)
+void CSSPropertyParser::parse4ValuesFillPosition(CSSParserValueList* valueList, NullableCSSValue& value1, NullableCSSValue& 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.
@@ -2533,7 +2531,7 @@ void CSSPropertyParser::parse4ValuesFillPosition(CSSParserValueList* valueList,
valueList->next();
}
-void CSSPropertyParser::parse3ValuesFillPosition(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2)
+void CSSPropertyParser::parse3ValuesFillPosition(CSSParserValueList* valueList, NullableCSSValue& value1, NullableCSSValue& value2, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2)
{
unsigned cumulativeFlags = 0;
FillPositionFlag value3Flag = InvalidFillPosition;
@@ -2615,8 +2613,8 @@ void CSSPropertyParser::parse3ValuesFillPosition(CSSParserValueList* valueList,
value1.swap(value2);
#if ENABLE(ASSERT)
- CSSPrimitiveValue* first = toCSSPrimitiveValue(value1.get());
- CSSPrimitiveValue* second = toCSSPrimitiveValue(value2.get());
+ CSSPrimitiveValue* first = toCSSPrimitiveValue(value1);
+ CSSPrimitiveValue* second = toCSSPrimitiveValue(value2);
ident1 = first->getPairValue()->first()->getValueID();
ident2 = second->getPairValue()->first()->getValueID();
ASSERT(ident1 == CSSValueLeft || ident1 == CSSValueRight);
@@ -2629,7 +2627,7 @@ inline bool CSSPropertyParser::isPotentialPositionValue(CSSParserValue* value)
return isFillPositionKeyword(value->id) || validUnit(value, FPercent | FLength, ReleaseParsedCalcValue);
}
-void CSSPropertyParser::parseFillPosition(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, Units unitless)
+void CSSPropertyParser::parseFillPosition(CSSParserValueList* valueList, NullableCSSValue& value1, NullableCSSValue& value2, Units unitless)
{
unsigned numberOfValues = 0;
for (unsigned i = valueList->currentIndex(); i < valueList->size(); ++i, ++numberOfValues) {
@@ -2672,27 +2670,27 @@ void CSSPropertyParser::parseFillPosition(CSSParserValueList* valueList, RefPtrW
if (value2)
valueList->next();
else {
- value1.clear();
+ value1 = nullptr;
return;
}
- RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(value1.get());
- RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(value2.get());
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = toCSSPrimitiveValue(value1);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = toCSSPrimitiveValue(value2);
- value1.clear();
- value2.clear();
+ value1 = nullptr;
+ value2 = nullptr;
// Per CSS3 syntax, <position> can't have 'center' as its second keyword as we have more arguments to follow.
if (parsedValue2->getValueID() == CSSValueCenter)
return;
if (numberOfValues == 3)
- parse3ValuesFillPosition(valueList, value1, value2, parsedValue1.release(), parsedValue2.release());
+ parse3ValuesFillPosition(valueList, value1, value2, parsedValue1, parsedValue2);
else
- parse4ValuesFillPosition(valueList, value1, value2, parsedValue1.release(), parsedValue2.release());
+ parse4ValuesFillPosition(valueList, value1, value2, parsedValue1, parsedValue2);
}
-void CSSPropertyParser::parse2ValuesFillPosition(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, Units unitless)
+void CSSPropertyParser::parse2ValuesFillPosition(CSSParserValueList* valueList, NullableCSSValue& value1, NullableCSSValue& value2, Units unitless)
{
// Parse the first value. We're just making sure that it is one of the valid keywords or a percentage/length.
unsigned cumulativeFlags = 0;
@@ -2717,7 +2715,7 @@ void CSSPropertyParser::parse2ValuesFillPosition(CSSParserValueList* valueList,
valueList->next();
else {
if (!inShorthand()) {
- value1.clear();
+ value1 = nullptr;
return;
}
}
@@ -2734,7 +2732,7 @@ void CSSPropertyParser::parse2ValuesFillPosition(CSSParserValueList* valueList,
value1.swap(value2);
}
-void CSSPropertyParser::parseFillRepeat(RefPtrWillBeRawPtr<CSSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2)
+void CSSPropertyParser::parseFillRepeat(NullableCSSValue& value1, NullableCSSValue& value2)
{
CSSValueID id = m_valueList->current()->id;
if (id == CSSValueRepeatX) {
@@ -2772,10 +2770,10 @@ void CSSPropertyParser::parseFillRepeat(RefPtrWillBeRawPtr<CSSValue>& value1, Re
// If only one value was specified, value2 is the same as value1.
m_implicitShorthand = true;
- value2 = cssValuePool().createIdentifierValue(toCSSPrimitiveValue(value1.get())->getValueID());
+ value2 = cssValuePool().createIdentifierValue(toCSSPrimitiveValue(value1)->getValueID());
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillSize(CSSPropertyID unresolvedProperty)
+NullableCSSValue CSSPropertyParser::parseFillSize(CSSPropertyID unresolvedProperty)
{
CSSParserValue* value = m_valueList->current();
m_valueList->next();
@@ -2817,16 +2815,17 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillSize(CSSPropertyID
}
bool CSSPropertyParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2,
- RefPtrWillBeRawPtr<CSSValue>& retValue1, RefPtrWillBeRawPtr<CSSValue>& retValue2)
+ NullableCSSValue& retValue1, NullableCSSValue& retValue2)
{
// We initially store the first value in value/value2, and only create
// CSSValueLists if we have more values.
RefPtrWillBeRawPtr<CSSValueList> values = nullptr;
RefPtrWillBeRawPtr<CSSValueList> values2 = nullptr;
- RefPtrWillBeRawPtr<CSSValue> value = nullptr;
- RefPtrWillBeRawPtr<CSSValue> value2 = nullptr;
+ NullableCSSValue value;
+ NullableCSSValue value2;
- retValue1 = retValue2 = nullptr;
+ retValue1 = nullptr;
+ retValue2 = nullptr;
propId1 = resolveCSSPropertyID(propId);
propId2 = propId1;
if (propId == CSSPropertyBackgroundPosition) {
@@ -2844,8 +2843,8 @@ bool CSSPropertyParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& p
}
while (true) {
- RefPtrWillBeRawPtr<CSSValue> currValue = nullptr;
- RefPtrWillBeRawPtr<CSSValue> currValue2 = nullptr;
+ NullableCSSValue currValue;
+ NullableCSSValue currValue2;
Units unitless = FUnknown;
CSSParserValue* val = m_valueList->current();
@@ -2961,23 +2960,23 @@ bool CSSPropertyParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& p
if (value && !values) {
values = CSSValueList::createCommaSeparated();
- values->append(value.release());
+ values->append(*value);
}
if (value2 && !values2) {
values2 = CSSValueList::createCommaSeparated();
- values2->append(value2.release());
+ values2->append(*value2);
}
if (values)
- values->append(currValue.release());
+ values->append(*currValue);
else
- value = currValue.release();
+ value = currValue;
if (currValue2) {
if (values2)
- values2->append(currValue2.release());
+ values2->append(*currValue2);
else
- value2 = currValue2.release();
+ value2 = currValue2;
}
// When parsing any fill shorthand property, we let it handle building up the lists for all
@@ -3000,14 +2999,14 @@ bool CSSPropertyParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& p
}
} else {
ASSERT(value);
- retValue1 = value.release();
- retValue2 = value2.release();
+ retValue1 = value;
+ retValue2 = value2;
}
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationDelay()
+NullableCSSValue CSSPropertyParser::parseAnimationDelay()
{
CSSParserValue* value = m_valueList->current();
if (validUnit(value, FTime))
@@ -3015,7 +3014,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationDelay()
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationDirection()
+NullableCSSValue CSSPropertyParser::parseAnimationDirection()
{
CSSParserValue* value = m_valueList->current();
if (value->id == CSSValueNormal || value->id == CSSValueAlternate || value->id == CSSValueReverse || value->id == CSSValueAlternateReverse)
@@ -3023,7 +3022,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationDirection()
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationDuration()
+NullableCSSValue CSSPropertyParser::parseAnimationDuration()
{
CSSParserValue* value = m_valueList->current();
if (validUnit(value, FTime | FNonNeg))
@@ -3031,7 +3030,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationDuration()
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationFillMode()
+NullableCSSValue CSSPropertyParser::parseAnimationFillMode()
{
CSSParserValue* value = m_valueList->current();
if (value->id == CSSValueNone || value->id == CSSValueForwards || value->id == CSSValueBackwards || value->id == CSSValueBoth)
@@ -3039,7 +3038,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationFillMode()
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationIterationCount()
+NullableCSSValue CSSPropertyParser::parseAnimationIterationCount()
{
CSSParserValue* value = m_valueList->current();
if (value->id == CSSValueInfinite)
@@ -3049,7 +3048,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationIterationCount
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allowQuotedName)
+NullableCSSValue CSSPropertyParser::parseAnimationName(bool allowQuotedName)
{
CSSParserValue* value = m_valueList->current();
@@ -3071,7 +3070,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allo
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationPlayState()
+NullableCSSValue CSSPropertyParser::parseAnimationPlayState()
{
CSSParserValue* value = m_valueList->current();
if (value->id == CSSValueRunning || value->id == CSSValuePaused)
@@ -3079,7 +3078,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationPlayState()
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty()
+NullableCSSValue CSSPropertyParser::parseAnimationProperty()
{
CSSParserValue* value = m_valueList->current();
if (value->unit != CSSPrimitiveValue::CSS_IDENT)
@@ -3114,7 +3113,7 @@ bool CSSPropertyParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*&
return consumeComma(args);
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationTimingFunction()
+NullableCSSValue CSSPropertyParser::parseAnimationTimingFunction()
{
CSSParserValue* value = m_valueList->current();
if (value->id == CSSValueEase || value->id == CSSValueLinear || value->id == CSSValueEaseIn || value->id == CSSValueEaseOut
@@ -3195,9 +3194,9 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationTimingFunction
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty(CSSPropertyID propId, bool useLegacyParsing)
+NullableCSSValue CSSPropertyParser::parseAnimationProperty(CSSPropertyID propId, bool useLegacyParsing)
{
- RefPtrWillBeRawPtr<CSSValue> value = nullptr;
+ NullableCSSValue value;
switch (propId) {
case CSSPropertyAnimationDelay:
case CSSPropertyTransitionDelay:
@@ -3236,17 +3235,17 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty(CSSPr
if (value)
m_valueList->next();
- return value.release();
+ return value;
}
PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseAnimationPropertyList(CSSPropertyID propId, bool useLegacyParsing)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
while (true) {
- RefPtrWillBeRawPtr<CSSValue> value = parseAnimationProperty(propId, useLegacyParsing);
+ NullableCSSValue value = parseAnimationProperty(propId, useLegacyParsing);
if (!value)
return nullptr;
- list->append(value.release());
+ list->append(*value);
if (!m_valueList->current())
break;
if (!consumeComma(m_valueList) || !m_valueList->current())
@@ -3296,7 +3295,7 @@ bool CSSPropertyParser::parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRa
return false;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridPosition()
+NullableCSSValue CSSPropertyParser::parseGridPosition()
{
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
@@ -3352,9 +3351,9 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridPosition()
return values.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> gridMissingGridPositionValue(CSSValue* value)
+static CSSValue gridMissingGridPositionValue(CSSValue value)
{
- if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->isCustomIdent())
+ if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).isCustomIdent())
return value;
return cssValuePool().createIdentifierValue(CSSValueAuto);
@@ -3366,11 +3365,11 @@ bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId
const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId);
ASSERT(shorthand.length() == 2);
- RefPtrWillBeRawPtr<CSSValue> startValue = parseGridPosition();
+ NullableCSSValue startValue = parseGridPosition();
if (!startValue)
return false;
- RefPtrWillBeRawPtr<CSSValue> endValue = nullptr;
+ NullableCSSValue endValue;
if (m_valueList->current()) {
if (!isForwardSlashOperator(m_valueList->current()))
return false;
@@ -3382,15 +3381,15 @@ bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId
if (!endValue || m_valueList->current())
return false;
} else {
- endValue = gridMissingGridPositionValue(startValue.get());
+ endValue = gridMissingGridPositionValue(*startValue);
}
- addProperty(shorthand.properties()[0], startValue, important);
- addProperty(shorthand.properties()[1], endValue, important);
+ addProperty(shorthand.properties()[0], *startValue, important);
+ addProperty(shorthand.properties()[1], *endValue, important);
return true;
}
-bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSSValue> templateColumns, bool important)
+bool CSSPropertyParser::parseGridTemplateRowsAndAreas(NullableCSSValue templateColumns, bool important)
{
NamedGridAreaMap gridAreaMap;
size_t rowCount = 0;
@@ -3404,7 +3403,7 @@ bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSS
while (m_valueList->current()) {
// Handle leading <custom-ident>*.
- if (!parseGridLineNames(*m_valueList, *templateRows, trailingIdentWasAdded ? toCSSGridLineNamesValue(templateRows->item(templateRows->length() - 1)) : nullptr))
+ if (!parseGridLineNames(*m_valueList, *templateRows, trailingIdentWasAdded ? toCSSGridLineNamesValue(NullableCSSValue(templateRows->item(templateRows->length() - 1))) : nullptr))
return false;
// Handle a template-area's row.
@@ -3414,10 +3413,10 @@ bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSS
// Handle template-rows's track-size.
if (m_valueList->current() && m_valueList->current()->unit != CSSPrimitiveValue::CSS_STRING) {
- RefPtrWillBeRawPtr<CSSValue> value = parseGridTrackSize(*m_valueList);
+ NullableCSSValue value = parseGridTrackSize(*m_valueList);
if (!value)
return false;
- templateRows->append(value);
+ templateRows->append(*value);
} else {
templateRows->append(cssValuePool().createIdentifierValue(CSSValueAuto));
}
@@ -3425,18 +3424,18 @@ bool CSSPropertyParser::parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSS
// This will handle the trailing/leading <custom-ident>* in the grammar.
if (!parseGridLineNames(*m_valueList, *templateRows))
return false;
- trailingIdentWasAdded = templateRows->item(templateRows->length() - 1)->isGridLineNamesValue();
+ trailingIdentWasAdded = templateRows->item(templateRows->length() - 1).isGridLineNamesValue();
}
// [<track-list> /]?
if (templateColumns)
- addProperty(CSSPropertyGridTemplateColumns, templateColumns, important);
+ addProperty(CSSPropertyGridTemplateColumns, *templateColumns, important);
else
addProperty(CSSPropertyGridTemplateColumns, cssValuePool().createIdentifierValue(CSSValueNone), important);
// [<line-names>? <string> [<track-size> <line-names>]? ]+
- RefPtrWillBeRawPtr<CSSValue> templateAreas = CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount);
- addProperty(CSSPropertyGridTemplateAreas, templateAreas.release(), important);
+ CSSValue templateAreas = CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount);
+ addProperty(CSSPropertyGridTemplateAreas, templateAreas, important);
addProperty(CSSPropertyGridTemplateRows, templateRows.release(), important);
return true;
@@ -3465,7 +3464,7 @@ bool CSSPropertyParser::parseGridTemplateShorthand(bool important)
}
unsigned index = 0;
- RefPtrWillBeRawPtr<CSSValue> columnsValue = nullptr;
+ NullableCSSValue columnsValue;
if (firstValueIsNone) {
columnsValue = cssValuePool().createIdentifierValue(CSSValueNone);
} else {
@@ -3477,11 +3476,11 @@ bool CSSPropertyParser::parseGridTemplateShorthand(bool important)
if (!(m_valueList->current() && isForwardSlashOperator(m_valueList->current()) && m_valueList->next()))
return false;
index = m_valueList->currentIndex();
- if (RefPtrWillBeRawPtr<CSSValue> rowsValue = parseGridTrackList()) {
+ if (NullableCSSValue rowsValue = parseGridTrackList()) {
if (m_valueList->current())
return false;
- addProperty(CSSPropertyGridTemplateColumns, columnsValue, important);
- addProperty(CSSPropertyGridTemplateRows, rowsValue, important);
+ addProperty(CSSPropertyGridTemplateColumns, *columnsValue, important);
+ addProperty(CSSPropertyGridTemplateRows, *rowsValue, important);
addProperty(CSSPropertyGridTemplateAreas, cssValuePool().createIdentifierValue(CSSValueNone), important);
return true;
}
@@ -3519,8 +3518,8 @@ bool CSSPropertyParser::parseGridShorthand(bool important)
if (!parseValue(CSSPropertyGridAutoFlow, important))
return false;
- RefPtrWillBeRawPtr<CSSValue> autoColumnsValue = nullptr;
- RefPtrWillBeRawPtr<CSSValue> autoRowsValue = nullptr;
+ NullableCSSValue autoColumnsValue;
+ NullableCSSValue autoRowsValue;
if (m_valueList->current()) {
autoColumnsValue = parseGridTrackSize(*m_valueList);
@@ -3545,8 +3544,8 @@ bool CSSPropertyParser::parseGridShorthand(bool important)
if (!autoRowsValue)
autoRowsValue = autoColumnsValue;
- addProperty(CSSPropertyGridAutoColumns, autoColumnsValue, important);
- addProperty(CSSPropertyGridAutoRows, autoRowsValue, important);
+ addProperty(CSSPropertyGridAutoColumns, *autoColumnsValue, important);
+ addProperty(CSSPropertyGridAutoRows, *autoRowsValue, important);
// It can only be specified the explicit or the implicit grid properties in a single grid declaration.
// The sub-properties not specified are set to their initial value, as normal for shorthands.
@@ -3565,39 +3564,39 @@ bool CSSPropertyParser::parseGridAreaShorthand(bool important)
const StylePropertyShorthand& shorthand = gridAreaShorthand();
ASSERT_UNUSED(shorthand, shorthand.length() == 4);
- RefPtrWillBeRawPtr<CSSValue> rowStartValue = parseGridPosition();
+ NullableCSSValue rowStartValue = parseGridPosition();
if (!rowStartValue)
return false;
- RefPtrWillBeRawPtr<CSSValue> columnStartValue = nullptr;
+ NullableCSSValue columnStartValue;
if (!parseSingleGridAreaLonghand(columnStartValue))
return false;
- RefPtrWillBeRawPtr<CSSValue> rowEndValue = nullptr;
+ NullableCSSValue rowEndValue;
if (!parseSingleGridAreaLonghand(rowEndValue))
return false;
- RefPtrWillBeRawPtr<CSSValue> columnEndValue = nullptr;
+ NullableCSSValue columnEndValue;
if (!parseSingleGridAreaLonghand(columnEndValue))
return false;
if (!columnStartValue)
- columnStartValue = gridMissingGridPositionValue(rowStartValue.get());
+ columnStartValue = gridMissingGridPositionValue(*rowStartValue);
if (!rowEndValue)
- rowEndValue = gridMissingGridPositionValue(rowStartValue.get());
+ rowEndValue = gridMissingGridPositionValue(*rowStartValue);
if (!columnEndValue)
- columnEndValue = gridMissingGridPositionValue(columnStartValue.get());
+ columnEndValue = gridMissingGridPositionValue(*columnStartValue);
- addProperty(CSSPropertyGridRowStart, rowStartValue, important);
- addProperty(CSSPropertyGridColumnStart, columnStartValue, important);
- addProperty(CSSPropertyGridRowEnd, rowEndValue, important);
- addProperty(CSSPropertyGridColumnEnd, columnEndValue, important);
+ addProperty(CSSPropertyGridRowStart, *rowStartValue, important);
+ addProperty(CSSPropertyGridColumnStart, *columnStartValue, important);
+ addProperty(CSSPropertyGridRowEnd, *rowEndValue, important);
+ addProperty(CSSPropertyGridColumnEnd, *columnEndValue, important);
return true;
}
-bool CSSPropertyParser::parseSingleGridAreaLonghand(RefPtrWillBeRawPtr<CSSValue>& property)
+bool CSSPropertyParser::parseSingleGridAreaLonghand(NullableCSSValue& property)
{
if (!m_valueList->current())
return true;
@@ -3617,7 +3616,7 @@ static inline bool isClosingBracket(const CSSParserValue& value)
return value.unit == CSSParserValue::Operator && value.iValue == ']';
}
-bool CSSPropertyParser::parseGridLineNames(CSSParserValueList& inputList, CSSValueList& valueList, CSSGridLineNamesValue* previousNamedAreaTrailingLineNames)
+bool CSSPropertyParser::parseGridLineNames(CSSParserValueList& inputList, CSSValueList& valueList, NullableCSSValue previousNamedAreaTrailingLineNames)
{
if (!inputList.current() || inputList.current()->unit != CSSParserValue::Operator || inputList.current()->iValue != '[')
return true;
@@ -3625,7 +3624,7 @@ bool CSSPropertyParser::parseGridLineNames(CSSParserValueList& inputList, CSSVal
// Skip '['
inputList.next();
- RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = previousNamedAreaTrailingLineNames;
+ RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = toCSSGridLineNamesValue(previousNamedAreaTrailingLineNames);
if (!lineNames)
lineNames = CSSGridLineNamesValue::create();
@@ -3652,7 +3651,7 @@ bool CSSPropertyParser::parseGridLineNames(CSSParserValueList& inputList, CSSVal
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTrackList()
+NullableCSSValue CSSPropertyParser::parseGridTrackList()
{
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
@@ -3676,10 +3675,10 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTrackList()
return nullptr;
seenTrackSizeOrRepeatFunction = true;
} else {
- RefPtrWillBeRawPtr<CSSValue> value = parseGridTrackSize(*m_valueList);
+ NullableCSSValue value = parseGridTrackSize(*m_valueList);
if (!value)
return nullptr;
- values->append(value);
+ values->append(*value);
seenTrackSizeOrRepeatFunction = true;
}
// This will handle the trailing <custom-ident>* in the grammar.
@@ -3713,11 +3712,11 @@ bool CSSPropertyParser::parseGridTrackRepeatFunction(CSSValueList& list)
size_t numberOfTracks = 0;
while (arguments->current()) {
- RefPtrWillBeRawPtr<CSSValue> trackSize = parseGridTrackSize(*arguments);
+ NullableCSSValue trackSize = parseGridTrackSize(*arguments);
if (!trackSize)
return false;
- repeatedValues->append(trackSize);
+ repeatedValues->append(*trackSize);
++numberOfTracks;
// This takes care of any trailing <custom-ident>* in the grammar.
@@ -3744,7 +3743,7 @@ bool CSSPropertyParser::parseGridTrackRepeatFunction(CSSValueList& list)
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTrackSize(CSSParserValueList& inputList)
+NullableCSSValue CSSPropertyParser::parseGridTrackSize(CSSParserValueList& inputList)
{
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
@@ -3898,7 +3897,7 @@ bool CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap,
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTemplateAreas()
+NullableCSSValue CSSPropertyParser::parseGridTemplateAreas()
{
if (m_valueList->current() && m_valueList->current()->id == CSSValueNone) {
m_valueList->next();
@@ -3921,7 +3920,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTemplateAreas()
return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount);
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridAutoFlow(CSSParserValueList& list)
+NullableCSSValue CSSPropertyParser::parseGridAutoFlow(CSSParserValueList& list)
{
// [ row | column ] || dense
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
@@ -3961,7 +3960,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridAutoFlow(CSSParserV
return parsedValues;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounterContent(CSSParserValueList* args, bool counters)
+NullableCSSValue CSSPropertyParser::parseCounterContent(CSSParserValueList* args, bool counters)
{
unsigned numArgs = args->size();
if (counters && numArgs != 3 && numArgs != 5)
@@ -4239,7 +4238,7 @@ bool CSSPropertyParser::parseLegacyPosition(CSSPropertyID propId, bool important
return !m_valueList->next();
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseContentDistributionOverflowPosition()
+NullableCSSValue CSSPropertyParser::parseContentDistributionOverflowPosition()
{
// auto | <baseline-position> | <content-distribution> || [ <overflow-position>? && <content-position> ]
// <baseline-position> = baseline | last-baseline;
@@ -4378,14 +4377,14 @@ PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeCircle(C
}
if (argument->id == CSSValueAt && args->next()) {
- RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
- RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
+ NullableCSSValue centerX;
+ NullableCSSValue centerY;
parseFillPosition(args, centerX, centerY);
if (centerX && centerY && !args->current()) {
ASSERT(centerX->isPrimitiveValue());
ASSERT(centerY->isPrimitiveValue());
- shape->setCenterX(toCSSPrimitiveValue(centerX.get()));
- shape->setCenterY(toCSSPrimitiveValue(centerY.get()));
+ shape->setCenterX(toCSSPrimitiveValue(centerX));
+ shape->setCenterY(toCSSPrimitiveValue(centerY));
} else {
return nullptr;
}
@@ -4430,16 +4429,16 @@ PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeEllipse(
if (argument->id != CSSValueAt || !args->next()) // expecting ellipse(.. at <position>)
return nullptr;
- RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
- RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
+ NullableCSSValue centerX;
+ NullableCSSValue centerY;
parseFillPosition(args, centerX, centerY);
if (!centerX || !centerY || args->current())
return nullptr;
ASSERT(centerX->isPrimitiveValue());
ASSERT(centerY->isPrimitiveValue());
- shape->setCenterX(toCSSPrimitiveValue(centerX.get()));
- shape->setCenterY(toCSSPrimitiveValue(centerY.get()));
+ shape->setCenterX(toCSSPrimitiveValue(centerX));
+ shape->setCenterY(toCSSPrimitiveValue(centerY));
}
return shape;
@@ -4507,18 +4506,18 @@ static bool isBoxValue(CSSValueID valueId)
return false;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseShapeProperty(CSSPropertyID propId)
+NullableCSSValue CSSPropertyParser::parseShapeProperty(CSSPropertyID propId)
{
- RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr;
+ NullableCSSValue imageValue;
if (parseFillImage(m_valueList, imageValue)) {
m_valueList->next();
- return imageValue.release();
+ return imageValue;
}
return parseBasicShapeAndOrBox();
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseBasicShapeAndOrBox()
+NullableCSSValue CSSPropertyParser::parseBasicShapeAndOrBox()
{
CSSParserValue* value = m_valueList->current();
@@ -4650,11 +4649,11 @@ bool CSSPropertyParser::parseFont(bool important)
}
// Font family must come now.
- RefPtrWillBeRawPtr<CSSValue> parsedFamilyValue = parseFontFamily();
+ NullableCSSValue parsedFamilyValue = parseFontFamily();
if (!parsedFamilyValue)
return false;
- addProperty(CSSPropertyFontFamily, parsedFamilyValue.release(), important);
+ addProperty(CSSPropertyFontFamily, *parsedFamilyValue, important);
// FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requires that
// "font-stretch", "font-size-adjust", and "font-kerning" be reset to their initial values
@@ -5343,7 +5342,7 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseShadow(CSSParserVal
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseReflect()
+NullableCSSValue CSSPropertyParser::parseReflect()
{
// box-reflect: <direction> <offset> <mask>
@@ -5373,7 +5372,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseReflect()
}
// Now for the mask.
- RefPtrWillBeRawPtr<CSSValue> mask = nullptr;
+ NullableCSSValue mask;
val = m_valueList->next();
if (val) {
mask = parseBorderImage(CSSPropertyWebkitBoxReflect);
@@ -5381,7 +5380,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseReflect()
return nullptr;
}
- return CSSReflectValue::create(direction.release(), offset.release(), mask.release());
+ return CSSReflectValue::create(direction.get(), offset.get(), mask);
}
static bool isFlexBasisMiddleArg(double flexGrow, double flexShrink, double unsetValue, int argSize)
@@ -5433,27 +5432,28 @@ bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important)
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePosition(CSSParserValueList* valueList)
+NullableCSSValue CSSPropertyParser::parsePosition(CSSParserValueList* valueList)
{
- RefPtrWillBeRawPtr<CSSValue> xValue = nullptr;
- RefPtrWillBeRawPtr<CSSValue> yValue = nullptr;
+ NullableCSSValue xValue;
+ NullableCSSValue yValue;
parseFillPosition(valueList, xValue, yValue);
+
if (!xValue || !yValue)
return nullptr;
- return createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimitiveValue(yValue.get()), Pair::KeepIdenticalValues);
+ return createPrimitiveValuePair(toCSSPrimitiveValue(xValue), toCSSPrimitiveValue(yValue), Pair::KeepIdenticalValues);
}
// Parses a list of comma separated positions. i.e., <position>#
-PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parsePositionList(CSSParserValueList* valueList)
+NullableCSSValue CSSPropertyParser::parsePositionList(CSSParserValueList* valueList)
{
RefPtrWillBeRawPtr<CSSValueList> positions = CSSValueList::createCommaSeparated();
while (true) {
// parsePosition consumes values until it reaches a separator [,/],
// an invalid token, or end of the list
- RefPtrWillBeRawPtr<CSSValue> position = parsePosition(valueList);
+ NullableCSSValue position = parsePosition(valueList);
if (!position)
return nullptr;
- positions->append(position);
+ positions->append(*position);
if (!valueList->current())
break;
@@ -5490,7 +5490,7 @@ public:
bool allowWidth() const { return m_allowWidth; }
bool requireOutset() const { return m_requireOutset; }
- void commitImage(PassRefPtrWillBeRawPtr<CSSValue> image)
+ void commitImage(CSSValue image)
{
m_image = image;
m_canAdvance = true;
@@ -5555,7 +5555,7 @@ public:
m_allowImage = !m_image;
m_allowRepeat = !m_repeat;
}
- void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat)
+ void commitRepeat(CSSValue repeat)
{
m_repeat = repeat;
m_canAdvance = true;
@@ -5568,9 +5568,9 @@ public:
m_allowImage = !m_image;
}
- PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue()
+ CSSValue commitCSSValue()
{
- return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth.get(), m_outset.get(), m_repeat.get());
+ return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth.get(), m_outset.get(), m_repeat);
}
bool m_canAdvance;
@@ -5584,12 +5584,12 @@ public:
bool m_allowWidth;
bool m_requireOutset;
- RefPtrWillBeMember<CSSValue> m_image;
+ NullableCSSValue m_image;
RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice;
RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth;
RefPtrWillBeMember<CSSPrimitiveValue> m_outset;
- RefPtrWillBeMember<CSSValue> m_repeat;
+ NullableCSSValue m_repeat;
};
bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, BorderImageParseContext& context)
@@ -5605,15 +5605,15 @@ bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
if (val->unit == CSSPrimitiveValue::CSS_URI) {
context.commitImage(createCSSImageValueWithReferrer(val->string, m_context.completeURL(val->string)));
} else if (isGeneratedImageValue(val)) {
- RefPtrWillBeRawPtr<CSSValue> value = nullptr;
+ NullableCSSValue value;
if (parseGeneratedImage(m_valueList, value))
- context.commitImage(value.release());
+ context.commitImage(*value);
else
return false;
} else if (val->unit == CSSParserValue::Function && val->function->id == CSSValueWebkitImageSet) {
- RefPtrWillBeRawPtr<CSSValue> value = parseImageSet(m_valueList);
+ NullableCSSValue value = parseImageSet(m_valueList);
if (value)
- context.commitImage(value.release());
+ context.commitImage(*value);
else
return false;
} else if (val->id == CSSValueNone)
@@ -5627,9 +5627,9 @@ bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
}
if (!context.canAdvance() && context.allowRepeat()) {
- RefPtrWillBeRawPtr<CSSValue> repeat = nullptr;
+ NullableCSSValue repeat;
if (parseBorderImageRepeat(repeat))
- context.commitRepeat(repeat.release());
+ context.commitRepeat(*repeat);
}
if (!context.canAdvance() && context.allowWidth()) {
@@ -5653,10 +5653,10 @@ bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
return context.allowCommit();
}
-void CSSPropertyParser::commitBorderImageProperty(CSSPropertyID propId, PassRefPtrWillBeRawPtr<CSSValue> value, bool important)
+void CSSPropertyParser::commitBorderImageProperty(CSSPropertyID propId, NullableCSSValue value, bool important)
{
if (value)
- addProperty(propId, value, important);
+ addProperty(propId, *value, important);
else
addProperty(propId, cssValuePool().createImplicitInitialValue(), important, true);
}
@@ -5671,7 +5671,7 @@ bool CSSPropertyParser::parseBorderImageShorthand(CSSPropertyID propId, bool imp
commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSlice, context.m_imageSlice.get(), important);
commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageWidth, context.m_borderWidth.get(), important);
commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageOutset, context.m_outset.get(), important);
- commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageRepeat, context.m_repeat.get(), important);
+ commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageRepeat, context.m_repeat, important);
return true;
case CSSPropertyBorderImage:
commitBorderImageProperty(CSSPropertyBorderImageSource, context.m_image, important);
@@ -5688,7 +5688,7 @@ bool CSSPropertyParser::parseBorderImageShorthand(CSSPropertyID propId, bool imp
return false;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseBorderImage(CSSPropertyID propId)
+NullableCSSValue CSSPropertyParser::parseBorderImage(CSSPropertyID propId)
{
BorderImageParseContext context;
if (buildBorderImageParseContext(propId, context)) {
@@ -5702,7 +5702,7 @@ static bool isBorderImageRepeatKeyword(int id)
return id == CSSValueStretch || id == CSSValueRepeat || id == CSSValueSpace || id == CSSValueRound;
}
-bool CSSPropertyParser::parseBorderImageRepeat(RefPtrWillBeRawPtr<CSSValue>& result)
+bool CSSPropertyParser::parseBorderImageRepeat(NullableCSSValue& result)
{
RefPtrWillBeRawPtr<CSSPrimitiveValue> firstValue = nullptr;
RefPtrWillBeRawPtr<CSSPrimitiveValue> secondValue = nullptr;
@@ -6011,7 +6011,7 @@ bool CSSPropertyParser::parseBorderRadius(CSSPropertyID unresolvedProperty, bool
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValue)
+NullableCSSValue CSSPropertyParser::parseCounter(int defaultValue)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
@@ -6111,7 +6111,7 @@ bool CSSPropertyParser::parseDeprecatedGradientColorStop(CSSParserValue* a, CSSG
return true;
}
-bool CSSPropertyParser::parseDeprecatedGradient(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& gradient)
+bool CSSPropertyParser::parseDeprecatedGradient(CSSParserValueList* valueList, NullableCSSValue& gradient)
{
// Walk the arguments.
CSSParserValueList* args = valueList->current()->function->args.get();
@@ -6264,7 +6264,7 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueFromSideKeyword(CSSParserV
return cssValuePool().createIdentifierValue(a->id);
}
-bool CSSPropertyParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
+bool CSSPropertyParser::parseDeprecatedLinearGradient(CSSParserValueList* valueList, NullableCSSValue& gradient, CSSGradientRepeat repeating)
{
RefPtrWillBeRawPtr<CSSLinearGradientValue> result = CSSLinearGradientValue::create(repeating, CSSPrefixedLinearGradient);
@@ -6334,7 +6334,7 @@ bool CSSPropertyParser::parseDeprecatedLinearGradient(CSSParserValueList* valueL
return true;
}
-bool CSSPropertyParser::parseDeprecatedRadialGradient(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
+bool CSSPropertyParser::parseDeprecatedRadialGradient(CSSParserValueList* valueList, NullableCSSValue& gradient, CSSGradientRepeat repeating)
{
RefPtrWillBeRawPtr<CSSRadialGradientValue> result = CSSRadialGradientValue::create(repeating, CSSPrefixedRadialGradient);
@@ -6350,8 +6350,8 @@ bool CSSPropertyParser::parseDeprecatedRadialGradient(CSSParserValueList* valueL
bool expectComma = false;
// Optional background-position
- RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
- RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
+ NullableCSSValue centerX;
+ NullableCSSValue centerY;
// parse2ValuesFillPosition advances the args next pointer.
parse2ValuesFillPosition(args, centerX, centerY);
@@ -6362,11 +6362,11 @@ bool CSSPropertyParser::parseDeprecatedRadialGradient(CSSParserValueList* valueL
if (!a)
return false;
- result->setFirstX(toCSSPrimitiveValue(centerX.get()));
- result->setSecondX(toCSSPrimitiveValue(centerX.get()));
+ result->setFirstX(toCSSPrimitiveValue(centerX));
+ result->setSecondX(toCSSPrimitiveValue(centerX));
// CSS3 radial gradients always share the same start and end point.
- result->setFirstY(toCSSPrimitiveValue(centerY.get()));
- result->setSecondY(toCSSPrimitiveValue(centerY.get()));
+ result->setFirstY(toCSSPrimitiveValue(centerY));
+ result->setSecondY(toCSSPrimitiveValue(centerY));
RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue = nullptr;
RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue = nullptr;
@@ -6446,7 +6446,7 @@ bool CSSPropertyParser::parseDeprecatedRadialGradient(CSSParserValueList* valueL
return true;
}
-bool CSSPropertyParser::parseLinearGradient(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
+bool CSSPropertyParser::parseLinearGradient(CSSParserValueList* valueList, NullableCSSValue& gradient, CSSGradientRepeat repeating)
{
RefPtrWillBeRawPtr<CSSLinearGradientValue> result = CSSLinearGradientValue::create(repeating, CSSLinearGradient);
@@ -6520,7 +6520,7 @@ bool CSSPropertyParser::parseLinearGradient(CSSParserValueList* valueList, RefPt
return true;
}
-bool CSSPropertyParser::parseRadialGradient(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& gradient, CSSGradientRepeat repeating)
+bool CSSPropertyParser::parseRadialGradient(CSSParserValueList* valueList, NullableCSSValue& gradient, CSSGradientRepeat repeating)
{
RefPtrWillBeRawPtr<CSSRadialGradientValue> result = CSSRadialGradientValue::create(repeating, CSSRadialGradient);
@@ -6612,8 +6612,8 @@ bool CSSPropertyParser::parseRadialGradient(CSSParserValueList* valueList, RefPt
// Second part of grammar, the center-position clause:
// at <position>
- RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
- RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
+ NullableCSSValue centerX;
+ NullableCSSValue centerY;
if (a->unit == CSSPrimitiveValue::CSS_IDENT && a->id == CSSValueAt) {
a = args->next();
if (!a)
@@ -6626,11 +6626,11 @@ bool CSSPropertyParser::parseRadialGradient(CSSParserValueList* valueList, RefPt
a = args->current();
if (!a)
return false;
- result->setFirstX(toCSSPrimitiveValue(centerX.get()));
- result->setFirstY(toCSSPrimitiveValue(centerY.get()));
+ result->setFirstX(toCSSPrimitiveValue(centerX));
+ result->setFirstY(toCSSPrimitiveValue(centerY));
// Right now, CSS radial gradients have the same start and end centers.
- result->setSecondX(toCSSPrimitiveValue(centerX.get()));
- result->setSecondY(toCSSPrimitiveValue(centerY.get()));
+ result->setSecondX(toCSSPrimitiveValue(centerX));
+ result->setSecondY(toCSSPrimitiveValue(centerY));
}
if (shapeValue || sizeValue || horizontalSize || centerX || centerY)
@@ -6700,7 +6700,7 @@ bool CSSPropertyParser::parseGradientColorStops(CSSParserValueList* valueList, C
return gradient->stopCount() >= 2;
}
-bool CSSPropertyParser::parseGeneratedImage(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& value)
+bool CSSPropertyParser::parseGeneratedImage(CSSParserValueList* valueList, NullableCSSValue& value)
{
CSSParserValue* val = valueList->current();
@@ -6762,14 +6762,14 @@ bool CSSPropertyParser::parseGeneratedImage(CSSParserValueList* valueList, RefPt
return false;
}
-bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& crossfade)
+bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, NullableCSSValue& crossfade)
{
// Walk the arguments.
CSSParserValueList* args = valueList->current()->function->args.get();
if (!args || args->size() != 5)
return false;
- RefPtrWillBeRawPtr<CSSValue> fromImageValue = nullptr;
- RefPtrWillBeRawPtr<CSSValue> toImageValue = nullptr;
+ NullableCSSValue fromImageValue;
+ NullableCSSValue toImageValue;
// The first argument is the "from" image. It is a fill image.
if (!args->current() || !parseFillImage(args, fromImageValue))
@@ -6800,7 +6800,7 @@ bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, RefPtrWill
else
return false;
- RefPtrWillBeRawPtr<CSSCrossfadeValue> result = CSSCrossfadeValue::create(fromImageValue, toImageValue);
+ RefPtrWillBeRawPtr<CSSCrossfadeValue> result = CSSCrossfadeValue::create(*fromImageValue, *toImageValue);
result->setPercentage(percentage);
crossfade = result;
@@ -6808,7 +6808,7 @@ bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, RefPtrWill
return true;
}
-bool CSSPropertyParser::parseCanvas(CSSParserValueList* valueList, RefPtrWillBeRawPtr<CSSValue>& canvas)
+bool CSSPropertyParser::parseCanvas(CSSParserValueList* valueList, NullableCSSValue& canvas)
{
// Walk the arguments.
CSSParserValueList* args = valueList->current()->function->args.get();
@@ -6824,7 +6824,7 @@ bool CSSPropertyParser::parseCanvas(CSSParserValueList* valueList, RefPtrWillBeR
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseImageSet(CSSParserValueList* valueList)
+NullableCSSValue CSSPropertyParser::parseImageSet(CSSParserValueList* valueList)
{
CSSParserValue* function = valueList->current();
@@ -6842,7 +6842,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseImageSet(CSSParserValue
if (arg->unit != CSSPrimitiveValue::CSS_URI)
return nullptr;
- RefPtrWillBeRawPtr<CSSValue> image = createCSSImageValueWithReferrer(arg->string, completeURL(arg->string));
+ CSSValue image = createCSSImageValueWithReferrer(arg->string, completeURL(arg->string));
imageSet->append(image);
arg = functionArgs->next();
@@ -6873,7 +6873,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseImageSet(CSSParserValue
return imageSet.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseWillChange()
+NullableCSSValue CSSPropertyParser::parseWillChange()
{
RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
if (m_valueList->current()->id == CSSValueAuto) {
@@ -7046,9 +7046,9 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseTransformOrigin()
{
CSSParserValue* value = m_valueList->current();
CSSValueID id = value->id;
- RefPtrWillBeRawPtr<CSSValue> xValue = nullptr;
- RefPtrWillBeRawPtr<CSSValue> yValue = nullptr;
- RefPtrWillBeRawPtr<CSSValue> zValue = nullptr;
+ NullableCSSValue xValue;
+ NullableCSSValue yValue;
+ NullableCSSValue zValue;
if (id == CSSValueLeft || id == CSSValueRight) {
xValue = cssValuePool().createIdentifierValue(id);
} else if (id == CSSValueTop || id == CSSValueBottom) {
@@ -7101,15 +7101,15 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseTransformOrigin()
}
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(xValue.release());
+ list->append(*xValue);
if (yValue)
- list->append(yValue.release());
+ list->append(*yValue);
if (zValue)
- list->append(zValue.release());
+ list->append(*zValue);
return list.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTouchAction()
+NullableCSSValue CSSPropertyParser::parseTouchAction()
{
CSSParserValue* value = m_valueList->current();
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
@@ -7132,8 +7132,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTouchAction()
if (value->id != CSSValuePanX && !RuntimeEnabledFeatures::cssTouchActionPanDirectionsEnabled())
return nullptr;
- RefPtrWillBeRawPtr<CSSValue> panValue = cssValuePool().createIdentifierValue(value->id);
- list->append(panValue.release());
+ CSSValue panValue = cssValuePool().createIdentifierValue(value->id);
+ list->append(panValue);
break;
}
case CSSValuePanY:
@@ -7144,8 +7144,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTouchAction()
ySet = true;
if (value->id != CSSValuePanY && !RuntimeEnabledFeatures::cssTouchActionPanDirectionsEnabled())
return nullptr;
- RefPtrWillBeRawPtr<CSSValue> panValue = cssValuePool().createIdentifierValue(value->id);
- list->append(panValue.release());
+ CSSValue panValue = cssValuePool().createIdentifierValue(value->id);
+ list->append(panValue);
break;
}
default:
@@ -7160,7 +7160,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTouchAction()
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollBlocksOn()
+NullableCSSValue CSSPropertyParser::parseScrollBlocksOn()
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
CSSParserValue* value = m_valueList->current();
@@ -7169,10 +7169,10 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollBlocksOn()
case CSSValueStartTouch:
case CSSValueWheelEvent:
case CSSValueScrollEvent: {
- RefPtrWillBeRawPtr<CSSValue> flagValue = cssValuePool().createIdentifierValue(value->id);
- if (list->hasValue(flagValue.get()))
+ CSSValue flagValue = cssValuePool().createIdentifierValue(value->id);
+ if (list->hasValue(flagValue))
return nullptr;
- list->append(flagValue.release());
+ list->append(flagValue);
break;
}
default:
@@ -7185,7 +7185,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollBlocksOn()
return list.release();
}
-void CSSPropertyParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtrWillBeRawPtr<CSSValue> value, bool important)
+void CSSPropertyParser::addTextDecorationProperty(CSSPropertyID propId, CSSValue value, bool important)
{
// The text-decoration-line property takes priority over text-decoration, unless the latter has important priority set.
if (propId == CSSPropertyTextDecoration && !important && !inShorthand()) {
@@ -7235,7 +7235,7 @@ bool CSSPropertyParser::parseTextDecoration(CSSPropertyID propId, bool important
return false;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle()
+NullableCSSValue CSSPropertyParser::parseTextEmphasisStyle()
{
RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr;
RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr;
@@ -7282,7 +7282,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle()
return nullptr;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextIndent()
+NullableCSSValue CSSPropertyParser::parseTextIndent()
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
@@ -7388,7 +7388,7 @@ bool CSSPropertyParser::parseFontFeatureTag(CSSValueList* settings)
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFontFeatureSettings()
+NullableCSSValue CSSPropertyParser::parseFontFeatureSettings()
{
RefPtrWillBeRawPtr<CSSValueList> settings = CSSValueList::createCommaSeparated();
while (true) {
@@ -7477,7 +7477,7 @@ bool CSSPropertyParser::parseFontFaceDescriptor(CSSPropertyID propId)
CSSParserValue* value = m_valueList->current();
ASSERT(value);
CSSValueID id = value->id;
- RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
+ NullableCSSValue parsedValue;
switch (propId) {
case CSSPropertyFontFamily:
@@ -7518,7 +7518,7 @@ bool CSSPropertyParser::parseFontFaceDescriptor(CSSPropertyID propId)
if (!parsedValue || m_valueList->current())
return false;
- addProperty(propId, parsedValue.release(), false);
+ addProperty(propId, *parsedValue, false);
return true;
}
@@ -7566,7 +7566,7 @@ bool CSSPropertyParser::parseViewportProperty(CSSPropertyID propId, bool importa
break;
}
- RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
+ NullableCSSValue parsedValue;
if (validPrimitive) {
parsedValue = parseValidPrimitive(id, value);
m_valueList->next();
@@ -7574,7 +7574,7 @@ bool CSSPropertyParser::parseViewportProperty(CSSPropertyID propId, bool importa
if (parsedValue) {
if (!m_valueList->current() || inShorthand()) {
- addProperty(propId, parsedValue.release(), important);
+ addProperty(propId, *parsedValue, important);
return true;
}
}
@@ -7691,7 +7691,7 @@ bool CSSPropertyParser::parseSVGValue(CSSPropertyID propId, bool important)
CSSValueID id = value->id;
bool validPrimitive = false;
- RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
+ NullableCSSValue parsedValue;
switch (propId) {
/* The comment to the right defines all valid value of these
@@ -7833,7 +7833,7 @@ bool CSSPropertyParser::parseSVGValue(CSSPropertyID propId, bool important)
else
parsedValue = parseColor(m_valueList->current());
if (parsedValue) {
- values->append(parsedValue);
+ values->append(*parsedValue);
parsedValue = values;
}
}
@@ -7908,7 +7908,7 @@ bool CSSPropertyParser::parseSVGValue(CSSPropertyID propId, bool important)
rollbackLastProperties(1);
return false;
}
- CSSValue* value = m_parsedProperties.last().value();
+ CSSValue value = m_parsedProperties.last().value();
addProperty(CSSPropertyMarkerMid, value, important);
addProperty(CSSPropertyMarkerEnd, value, important);
return true;
@@ -7942,11 +7942,11 @@ bool CSSPropertyParser::parseSVGValue(CSSPropertyID propId, bool important)
if (!parsedValue || (m_valueList->current() && !inShorthand()))
return false;
- addProperty(propId, parsedValue.release(), important);
+ addProperty(propId, *parsedValue, important);
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSVGStrokeDasharray()
+NullableCSSValue CSSPropertyParser::parseSVGStrokeDasharray()
{
RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated();
CSSParserValue* value = m_valueList->current();
@@ -7973,7 +7973,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSVGStrokeDasharray()
}
// normal | [ fill || stroke || markers ]
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const
+NullableCSSValue CSSPropertyParser::parsePaintOrder() const
{
if (m_valueList->size() > 3)
return nullptr;
@@ -8136,17 +8136,17 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseTransform(bool useL
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
- RefPtrWillBeRawPtr<CSSValue> parsedTransformValue = parseTransformValue(useLegacyParsing, value);
+ NullableCSSValue parsedTransformValue = parseTransformValue(useLegacyParsing, value);
if (!parsedTransformValue)
return nullptr;
- list->append(parsedTransformValue.release());
+ list->append(*parsedTransformValue);
}
return list.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTransformValue(bool useLegacyParsing, CSSParserValue *value)
+NullableCSSValue CSSPropertyParser::parseTransformValue(bool useLegacyParsing, CSSParserValue *value)
{
if (value->unit != CSSParserValue::Function || !value->function)
return nullptr;
@@ -8218,7 +8218,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTransformValue(bool use
return transformValue.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseMotionPath()
+NullableCSSValue CSSPropertyParser::parseMotionPath()
{
CSSParserValue* value = m_valueList->current();
@@ -8244,7 +8244,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseMotionPath()
return CSSPathValue::create(pathString);
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseMotionRotation()
+NullableCSSValue CSSPropertyParser::parseMotionRotation()
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
bool hasAutoOrReverse = false;
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/css/parser/CSSPropertyParserTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698