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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h

Issue 2834433003: WIP CSSPropertyParserHelpers::ConsumeCommaSeparatedList template (Closed)
Patch Set: Removed extra isValidAnimationPropertyList checks Created 3 years, 8 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 | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h
index 9e56d2c0c7136ba910f39fb2babe458030ecda38..a542e3eb524b5348814438fb7e385fd07e1883b6 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h
@@ -8,6 +8,7 @@
#include "core/css/CSSCustomIdentValue.h"
#include "core/css/CSSIdentifierValue.h"
#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSValueList.h"
#include "core/css/parser/CSSParserMode.h"
#include "core/css/parser/CSSParserTokenRange.h"
#include "platform/Length.h" // For ValueRange
@@ -121,6 +122,22 @@ CSSIdentifierValue* ConsumeIdent(CSSParserTokenRange& range) {
return CSSIdentifierValue::Create(range.ConsumeIncludingWhitespace().Id());
}
+// TODO(bugsnash): add comment about callback requirements
+template <typename callback, typename... Args>
+CSSValueList* ConsumeCommaSeparatedList(CSSParserTokenRange& range,
+ callback f,
+ Args... args) {
+ CSSValueList* list = CSSValueList::CreateCommaSeparated();
+ do {
+ CSSValue* value = f(range, args...);
+ if (!value)
+ return nullptr;
+ list->Append(*value);
+ } while (ConsumeCommaIncludingWhitespace(range));
+ DCHECK(list->length());
+ return list;
+}
+
} // namespace CSSPropertyParserHelpers
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698