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

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

Issue 2772263004: Added CSSPropertyCounterUtils which holds shared counter parsing logic. (Closed)
Patch Set: addressed reviewer comment Created 3 years, 9 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 b35fda0aaa17b11f89f88d6c65c13c11e9eb877e..4fc675cefa91b3314a850185331c2a6e66f0eb78 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -43,6 +43,7 @@
#include "core/css/properties/CSSPropertyAPI.h"
#include "core/css/properties/CSSPropertyAlignmentUtils.h"
#include "core/css/properties/CSSPropertyColumnUtils.h"
+#include "core/css/properties/CSSPropertyCounterUtils.h"
#include "core/css/properties/CSSPropertyDescriptor.h"
#include "core/css/properties/CSSPropertyFontUtils.h"
#include "core/css/properties/CSSPropertyLengthUtils.h"
@@ -315,26 +316,6 @@ static CSSValue* consumeFontVariantList(CSSParserTokenRange& range) {
return nullptr;
}
-static CSSValue* consumeCounter(CSSParserTokenRange& range, int defaultValue) {
- if (range.peek().id() == CSSValueNone)
- return consumeIdent(range);
-
- CSSValueList* list = CSSValueList::createSpaceSeparated();
- do {
- CSSCustomIdentValue* counterName = consumeCustomIdent(range);
- if (!counterName)
- return nullptr;
- int i = defaultValue;
- if (CSSPrimitiveValue* counterValue = consumeInteger(range))
- i = clampTo<int>(counterValue->getDoubleValue());
- list->append(*CSSValuePair::create(
- counterName,
- CSSPrimitiveValue::create(i, CSSPrimitiveValue::UnitType::Integer),
- CSSValuePair::DropIdenticalValues));
- } while (!range.atEnd());
- return list;
-}
-
static CSSValue* consumeLocale(CSSParserTokenRange& range) {
if (range.peek().id() == CSSValueAuto)
return consumeIdent(range);
@@ -1864,9 +1845,11 @@ const CSSValue* CSSPropertyParser::parseSingleValue(
case CSSPropertyFontWeight:
return CSSPropertyFontUtils::consumeFontWeight(m_range);
case CSSPropertyCounterIncrement:
- return consumeCounter(m_range, 1);
+ return CSSPropertyCounterUtils::consumeCounter(
+ m_range, CSSPropertyCounterUtils::kIncrementDefaultValue);
case CSSPropertyCounterReset:
- return consumeCounter(m_range, 0);
+ return CSSPropertyCounterUtils::consumeCounter(
+ m_range, CSSPropertyCounterUtils::kResetDefaultValue);
case CSSPropertyMaxWidth:
case CSSPropertyMaxHeight:
return CSSPropertyLengthUtils::consumeMaxWidthOrHeight(
« no previous file with comments | « third_party/WebKit/Source/core/css/BUILD.gn ('k') | third_party/WebKit/Source/core/css/properties/CSSPropertyCounterUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698