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

Unified Diff: Source/core/css/parser/CSSParserFastPaths.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: Created 5 years, 7 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
Index: Source/core/css/parser/CSSParserFastPaths.cpp
diff --git a/Source/core/css/parser/CSSParserFastPaths.cpp b/Source/core/css/parser/CSSParserFastPaths.cpp
index 396eefebe85ee14abd4230e61d1c7672839855af..62b1947330b39a1d87b2c0a8705d5760dc5de58b 100644
--- a/Source/core/css/parser/CSSParserFastPaths.cpp
+++ b/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -84,7 +84,7 @@ static inline bool parseSimpleLength(const CharacterType* characters, unsigned l
return ok;
}
-static PassRefPtrWillBeRawPtr<CSSValue> parseSimpleLengthValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode)
+static NullableCSSValue parseSimpleLengthValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode)
{
ASSERT(!string.isEmpty());
bool acceptsNegativeNumbers = false;
@@ -142,7 +142,7 @@ static inline bool isColorPropertyID(CSSPropertyID propertyId)
}
}
-static PassRefPtrWillBeRawPtr<CSSValue> parseColorValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode)
+static NullableCSSValue parseColorValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode)
{
ASSERT(!string.isEmpty());
bool quirksMode = isQuirksModeBehavior(cssParserMode);
@@ -459,7 +459,7 @@ bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId)
}
}
-static PassRefPtrWillBeRawPtr<CSSValue> parseKeywordValue(CSSPropertyID propertyId, const String& string)
+static NullableCSSValue parseKeywordValue(CSSPropertyID propertyId, const String& string)
{
ASSERT(!string.isEmpty());
@@ -636,7 +636,7 @@ static PassRefPtrWillBeRawPtr<CSSValueList> parseSimpleTransformList(CharType*&
return transformList.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> parseSimpleTransform(CSSPropertyID propertyID, const String& string)
+static NullableCSSValue parseSimpleTransform(CSSPropertyID propertyID, const String& string)
{
ASSERT(!string.isEmpty());
@@ -652,16 +652,16 @@ static PassRefPtrWillBeRawPtr<CSSValue> parseSimpleTransform(CSSPropertyID prope
return parseSimpleTransformList(pos, end);
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID, const String& string, CSSParserMode parserMode)
+NullableCSSValue CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID, const String& string, CSSParserMode parserMode)
{
- if (RefPtrWillBeRawPtr<CSSValue> length = parseSimpleLengthValue(propertyID, string, parserMode))
- return length.release();
- if (RefPtrWillBeRawPtr<CSSValue> color = parseColorValue(propertyID, string, parserMode))
- return color.release();
- if (RefPtrWillBeRawPtr<CSSValue> keyword = parseKeywordValue(propertyID, string))
- return keyword.release();
- if (RefPtrWillBeRawPtr<CSSValue> transform = parseSimpleTransform(propertyID, string))
- return transform.release();
+ if (NullableCSSValue length = parseSimpleLengthValue(propertyID, string, parserMode))
+ return *length;
+ if (NullableCSSValue color = parseColorValue(propertyID, string, parserMode))
+ return *color;
+ if (NullableCSSValue keyword = parseKeywordValue(propertyID, string))
+ return *keyword;
+ if (NullableCSSValue transform = parseSimpleTransform(propertyID, string))
+ return *transform;
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698