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

Unified Diff: third_party/WebKit/Source/core/css/properties/CSSPropertyTransitionPropertyUtils.cpp

Issue 2939883003: Added CSSPropertyTransitionPropertyUtils which holds shared parsing logic. (Closed)
Patch Set: Added ConsumeTransitinProperty method Created 3 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/properties/CSSPropertyTransitionPropertyUtils.cpp
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyTransitionPropertyUtils.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyTransitionPropertyUtils.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7ec446920f03e234ef0088c4dfc532cf914b16e2
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyTransitionPropertyUtils.cpp
@@ -0,0 +1,49 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/css/properties/CSSPropertyTransitionPropertyUtils.h"
+
+#include "core/CSSPropertyNames.h"
+#include "core/CSSValueKeywords.h"
+#include "core/css/CSSCustomIdentValue.h"
+#include "core/css/CSSIdentifierValue.h"
+#include "core/css/CSSPropertyMetadata.h"
+#include "core/css/CSSValue.h"
+#include "core/css/CSSValueList.h"
+#include "core/css/parser/CSSParserToken.h"
+#include "core/css/parser/CSSParserTokenRange.h"
+#include "core/css/parser/CSSPropertyParserHelpers.h"
+
+namespace blink {
+
+CSSValue* CSSPropertyTransitionPropertyUtils::ConsumeTransitionProperty(
+ CSSParserTokenRange& range) {
+ const CSSParserToken& token = range.Peek();
+ if (token.GetType() != kIdentToken)
+ return nullptr;
+ if (token.Id() == CSSValueNone)
+ return CSSPropertyParserHelpers::ConsumeIdent(range);
+ CSSPropertyID unresolved_property = token.ParseAsUnresolvedCSSPropertyID();
+ if (unresolved_property != CSSPropertyInvalid &&
+ unresolved_property != CSSPropertyVariable) {
+ DCHECK(CSSPropertyMetadata::IsEnabledProperty(unresolved_property));
+ range.ConsumeIncludingWhitespace();
+ return CSSCustomIdentValue::Create(unresolved_property);
+ }
+ return CSSPropertyParserHelpers::ConsumeCustomIdent(range);
+}
+
+bool CSSPropertyTransitionPropertyUtils::IsValidAnimationPropertyList(
+ const CSSValueList& value_list) {
+ if (value_list.length() < 2)
+ return true;
+ for (auto& value : value_list) {
+ if (value->IsIdentifierValue() &&
+ ToCSSIdentifierValue(*value).GetValueID() == CSSValueNone)
+ return false;
+ }
+ return true;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698