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

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

Issue 2671173002: Change CSSParserContext to have a Document handle (vs UseCounter). (Closed)
Patch Set: fix todo style Created 3 years, 10 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: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index c4ad6da743148b6b84bb1f46db38a70c0d72d378..d58e11631a208c44649d4f8c306aaed6fa1b036c 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -126,8 +126,8 @@ bool CSSPropertyParser::parseValue(
}
// This doesn't count UA style sheets
- if (parseSuccess && context->isUseCounterRecordingEnabled())
- context->useCounter()->count(context->mode(), unresolvedProperty);
+ if (parseSuccess)
+ context->count(context->mode(), unresolvedProperty);
if (!parseSuccess)
parsedProperties.shrink(parsedPropertiesSize);
@@ -497,8 +497,7 @@ static CSSValue* consumeAnimationName(CSSParserTokenRange& range,
if (allowQuotedName && range.peek().type() == StringToken) {
// Legacy support for strings in prefixed animations.
- if (context->isUseCounterRecordingEnabled())
- context->useCounter()->count(UseCounter::QuotedAnimationName);
+ context->count(UseCounter::QuotedAnimationName);
const CSSParserToken& token = range.consumeIncludingWhitespace();
if (equalIgnoringASCIICase(token.value(), "none"))
@@ -793,8 +792,7 @@ static CSSFunctionValue* consumeFilterFunction(
parsedValue = parseSingleShadow(args, context->mode(), false, false);
} else {
if (args.atEnd()) {
- if (context->isUseCounterRecordingEnabled())
- context->useCounter()->count(UseCounter::CSSFilterFunctionNoArguments);
+ context->count(UseCounter::CSSFilterFunctionNoArguments);
return filterValue;
}
if (filterType == CSSValueBrightness) {
@@ -934,12 +932,11 @@ static CSSValue* consumeOffsetPath(CSSParserTokenRange& range,
CSSValue* value = consumePathOrNone(range);
// Count when we receive a valid path other than 'none'.
- if (context->isUseCounterRecordingEnabled() && value &&
- !value->isIdentifierValue()) {
+ if (value && !value->isIdentifierValue()) {
if (isMotionPath) {
- context->useCounter()->count(UseCounter::CSSMotionInEffect);
+ context->count(UseCounter::CSSMotionInEffect);
} else {
- context->useCounter()->count(UseCounter::CSSOffsetInEffect);
+ context->count(UseCounter::CSSOffsetInEffect);
}
}
return value;
@@ -1013,10 +1010,7 @@ static bool consumePerspective(CSSParserTokenRange& args,
double perspective;
if (!consumeNumberRaw(args, perspective) || perspective < 0)
return false;
- if (context->isUseCounterRecordingEnabled()) {
- context->useCounter()->count(
- UseCounter::UnitlessPerspectiveInTransformProperty);
- }
+ context->count(UseCounter::UnitlessPerspectiveInTransformProperty);
parsedValue = CSSPrimitiveValue::create(
perspective, CSSPrimitiveValue::UnitType::Pixels);
}
@@ -1162,10 +1156,7 @@ static CSSValue* consumePerspective(CSSParserTokenRange& range,
double perspective;
if (!consumeNumberRaw(range, perspective))
return nullptr;
- if (context->isUseCounterRecordingEnabled()) {
- context->useCounter()->count(
- UseCounter::UnitlessPerspectiveInPerspectiveProperty);
- }
+ context->count(UseCounter::UnitlessPerspectiveInPerspectiveProperty);
parsedValue = CSSPrimitiveValue::create(
perspective, CSSPrimitiveValue::UnitType::Pixels);
}
@@ -2016,21 +2007,20 @@ static void countKeywordOnlyPropertyUsage(CSSPropertyID property,
else
feature = UseCounter::CSSValueAppearanceOthers;
}
- context->useCounter()->count(feature);
+ context->count(feature);
break;
}
case CSSPropertyWebkitUserModify: {
switch (valueID) {
case CSSValueReadOnly:
- context->useCounter()->count(UseCounter::CSSValueUserModifyReadOnly);
+ context->count(UseCounter::CSSValueUserModifyReadOnly);
break;
case CSSValueReadWrite:
- context->useCounter()->count(UseCounter::CSSValueUserModifyReadWrite);
+ context->count(UseCounter::CSSValueUserModifyReadWrite);
break;
case CSSValueReadWritePlaintextOnly:
- context->useCounter()->count(
- UseCounter::CSSValueUserModifyReadWritePlaintextOnly);
+ context->count(UseCounter::CSSValueUserModifyReadWritePlaintextOnly);
break;
default:
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698