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

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: (Hopefully) Builds with oilpan now Created 5 years, 6 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 85143c11097a2e08d49ada99964fea49d4d9bfc8..248cff44b9787bd062233c638a7059a988637a78 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);
@@ -463,7 +463,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());
@@ -640,7 +640,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());
@@ -656,16 +656,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