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

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

Issue 2849363002: Refactored out property specific logic in animation list parsing. (Closed)
Patch Set: Fixed crashing layout tests 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..e1f2a5f6a246ddc69af242a03f058341d0602292 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,24 @@ CSSIdentifierValue* ConsumeIdent(CSSParserTokenRange& range) {
return CSSIdentifierValue::Create(range.ConsumeIncludingWhitespace().Id());
}
+// ConsumeCommaSeparatedList takes a callback function to call on each item in
+// the list, followed by the arguments to pass to this callback.
+// The first argument to the callback must be the CSSParserTokenRange
+template <typename Func, typename... Args>
+CSSValueList* ConsumeCommaSeparatedList(Func callback,
+ CSSParserTokenRange& range,
+ Args... args) {
+ CSSValueList* list = CSSValueList::CreateCommaSeparated();
+ do {
+ CSSValue* value = callback(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