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

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

Issue 2051233003: Add use counter for parsing of filter functions with no arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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: 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 48cb58fb11206a810d85709f146b6597a3ed0241..cdfe75ff20c5f27efd7768bba1cde486d66d1067 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1384,7 +1384,7 @@ static CSSValue* consumeShadow(CSSParserTokenRange& range, CSSParserMode cssPars
return shadowValueList;
}
-static CSSFunctionValue* consumeFilterFunction(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+static CSSFunctionValue* consumeFilterFunction(CSSParserTokenRange& range, const CSSParserContext& context)
{
CSSValueID filterType = range.peek().functionId();
if (filterType < CSSValueInvert || filterType > CSSValueDropShadow)
@@ -1394,11 +1394,13 @@ static CSSFunctionValue* consumeFilterFunction(CSSParserTokenRange& range, CSSPa
CSSValue* parsedValue = nullptr;
if (filterType == CSSValueDropShadow) {
- parsedValue = parseSingleShadow(args, cssParserMode, false, false);
+ parsedValue = parseSingleShadow(args, context.mode(), false, false);
} else {
- // TODO(timloh): Add UseCounters for empty filter arguments.
- if (args.atEnd())
+ if (args.atEnd()) {
+ if (context.useCounter())
+ context.useCounter()->count(UseCounter::CSSFilterFunctionNoArguments);
return filterValue;
+ }
if (filterType == CSSValueBrightness) {
// FIXME (crbug.com/397061): Support calc expressions like calc(10% + 0.5)
parsedValue = consumePercent(args, ValueRangeAll);
@@ -1430,7 +1432,7 @@ static CSSFunctionValue* consumeFilterFunction(CSSParserTokenRange& range, CSSPa
return filterValue;
}
-static CSSValue* consumeFilter(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+static CSSValue* consumeFilter(CSSParserTokenRange& range, const CSSParserContext& context)
{
if (range.peek().id() == CSSValueNone)
return consumeIdent(range);
@@ -1443,7 +1445,7 @@ static CSSValue* consumeFilter(CSSParserTokenRange& range, CSSParserMode cssPars
filterValue = CSSFunctionValue::create(CSSValueUrl);
filterValue->append(*CSSSVGDocumentValue::create(url));
} else {
- filterValue = consumeFilterFunction(range, cssParserMode);
+ filterValue = consumeFilterFunction(range, context);
if (!filterValue)
return nullptr;
}
@@ -3755,7 +3757,7 @@ CSSValue* CSSPropertyParser::parseSingleValue(CSSPropertyID unresolvedProperty,
return consumeShadow(m_range, m_context.mode(), property == CSSPropertyBoxShadow);
case CSSPropertyWebkitFilter:
case CSSPropertyBackdropFilter:
- return consumeFilter(m_range, m_context.mode());
+ return consumeFilter(m_range, m_context);
case CSSPropertyTextDecoration:
ASSERT(!RuntimeEnabledFeatures::css3TextDecorationsEnabled());
// fallthrough

Powered by Google App Engine
This is Rietveld 408576698