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 |