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

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

Issue 1176393005: Remove usage of CSSParserValue in MediaQueryParser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing 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
« no previous file with comments | « Source/core/css/parser/MediaQueryParser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/MediaQueryParser.cpp
diff --git a/Source/core/css/parser/MediaQueryParser.cpp b/Source/core/css/parser/MediaQueryParser.cpp
index f501da7c9d7fcde7796a9ac28903302ae136031a..34555039c031961f234211dbac6d96cce10ed48d 100644
--- a/Source/core/css/parser/MediaQueryParser.cpp
+++ b/Source/core/css/parser/MediaQueryParser.cpp
@@ -156,7 +156,7 @@ void MediaQueryParser::readFeatureValue(CSSParserTokenType type, const CSSParser
if (type == DimensionToken && token.unitType() == CSSPrimitiveValue::CSS_UNKNOWN) {
m_state = SkipUntilComma;
} else {
- if (m_mediaQueryData.tryAddParserValue(type, token))
+ if (m_mediaQueryData.tryAddParserToken(type, token))
m_state = ReadFeatureEnd;
else
m_state = SkipUntilBlockEnd;
@@ -171,7 +171,7 @@ void MediaQueryParser::readFeatureEnd(CSSParserTokenType type, const CSSParserTo
else
m_state = SkipUntilComma;
} else if (type == DelimiterToken && token.delimiter() == '/') {
- m_mediaQueryData.tryAddParserValue(type, token);
+ m_mediaQueryData.tryAddParserToken(type, token);
m_state = ReadFeatureValue;
} else {
m_state = SkipUntilBlockEnd;
@@ -246,7 +246,7 @@ void MediaQueryData::clear()
m_mediaType = MediaTypeNames::all;
m_mediaTypeSet = false;
m_mediaFeature = String();
- m_valueList.destroyAndClear();
+ m_valueList.clear();
m_expressions = adoptPtrWillBeNoop(new ExpressionHeapVector);
}
@@ -259,34 +259,22 @@ PassOwnPtrWillBeRawPtr<MediaQuery> MediaQueryData::takeMediaQuery()
bool MediaQueryData::addExpression()
{
- OwnPtrWillBeRawPtr<MediaQueryExp> expression = MediaQueryExp::createIfValid(m_mediaFeature, &m_valueList);
+ OwnPtrWillBeRawPtr<MediaQueryExp> expression = MediaQueryExp::createIfValid(m_mediaFeature, m_valueList);
bool isValid = !!expression;
m_expressions->append(expression.release());
- m_valueList.destroyAndClear();
+ m_valueList.clear();
return isValid;
}
-bool MediaQueryData::tryAddParserValue(CSSParserTokenType type, const CSSParserToken& token)
+bool MediaQueryData::tryAddParserToken(CSSParserTokenType type, const CSSParserToken& token)
{
- CSSParserValue value;
- if (type == NumberToken || type == PercentageToken || type == DimensionToken) {
- value.setFromNumber(token.numericValue(), token.unitType());
- value.isInt = (token.numericValueType() == IntegerValueType);
- } else if (type == DelimiterToken) {
- value.unit = CSSParserValue::Operator;
- value.iValue = token.delimiter();
- value.id = CSSValueInvalid;
- value.isInt = false;
- } else if (type == IdentToken) {
- value.unit = CSSPrimitiveValue::CSS_IDENT;
- value.string = token.value();
- value.id = cssValueKeywordID(token.value());
- value.isInt = false;
- } else {
- return false;
+ if (type == NumberToken || type == PercentageToken || type == DimensionToken
+ || type == DelimiterToken || type == IdentToken) {
+ m_valueList.append(token);
+ return true;
}
- m_valueList.addValue(value);
- return true;
+
+ return false;
}
void MediaQueryData::setMediaType(const String& mediaType)
« no previous file with comments | « Source/core/css/parser/MediaQueryParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698