| OLD | NEW |
| (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 |
| OLD | NEW |