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

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

Issue 2939883003: Added CSSPropertyTransitionPropertyUtils which holds shared parsing logic. (Closed)
Patch Set: fixed build error 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/properties/CSSPropertyTransitionPropertyUtils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/css/properties/CSSPropertyTransitionPropertyUtils.h"
6
7 #include "core/CSSPropertyNames.h"
8 #include "core/CSSValueKeywords.h"
9 #include "core/css/CSSCustomIdentValue.h"
10 #include "core/css/CSSIdentifierValue.h"
11 #include "core/css/CSSPropertyMetadata.h"
12 #include "core/css/CSSValue.h"
13 #include "core/css/CSSValueList.h"
14 #include "core/css/parser/CSSParserToken.h"
15 #include "core/css/parser/CSSParserTokenRange.h"
16 #include "core/css/parser/CSSPropertyParserHelpers.h"
17
18 namespace blink {
19
20 CSSValue* CSSPropertyTransitionPropertyUtils::ConsumeTransitionProperty(
21 CSSParserTokenRange& range) {
22 const CSSParserToken& token = range.Peek();
23 if (token.GetType() != kIdentToken)
24 return nullptr;
25 if (token.Id() == CSSValueNone)
26 return CSSPropertyParserHelpers::ConsumeIdent(range);
27 CSSPropertyID unresolved_property = token.ParseAsUnresolvedCSSPropertyID();
28 if (unresolved_property != CSSPropertyInvalid &&
29 unresolved_property != CSSPropertyVariable) {
30 DCHECK(CSSPropertyMetadata::IsEnabledProperty(unresolved_property));
31 range.ConsumeIncludingWhitespace();
32 return CSSCustomIdentValue::Create(unresolved_property);
33 }
34 return CSSPropertyParserHelpers::ConsumeCustomIdent(range);
35 }
36
37 bool CSSPropertyTransitionPropertyUtils::IsValidPropertyList(
38 const CSSValueList& value_list) {
39 if (value_list.length() < 2)
40 return true;
41 for (auto& value : value_list) {
42 if (value->IsIdentifierValue() &&
43 ToCSSIdentifierValue(*value).GetValueID() == CSSValueNone)
44 return false;
45 }
46 return true;
47 }
48
49 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/properties/CSSPropertyTransitionPropertyUtils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698