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/CSSPropertyAPIScrollSnapType.h" |
| 6 |
| 7 #include "core/css/CSSValuePair.h" |
| 8 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 const CSSValue* CSSPropertyAPIScrollSnapType::parseSingleValue( |
| 13 CSSParserTokenRange& range, |
| 14 const CSSParserContext& context, |
| 15 const CSSParserLocalContext&) { |
| 16 CSSValueID axis_id = range.Peek().Id(); |
| 17 if (axis_id != CSSValueNone && axis_id != CSSValueX && axis_id != CSSValueY && |
| 18 axis_id != CSSValueBlock && axis_id != CSSValueInline && |
| 19 axis_id != CSSValueBoth) |
| 20 return nullptr; |
| 21 CSSValue* axis_value = CSSPropertyParserHelpers::ConsumeIdent(range); |
| 22 if (range.AtEnd() || axis_id == CSSValueNone) |
| 23 return axis_value; |
| 24 |
| 25 CSSValueID strictness_id = range.Peek().Id(); |
| 26 if (strictness_id != CSSValueProximity && strictness_id != CSSValueMandatory) |
| 27 return axis_value; |
| 28 CSSValue* strictness_value = CSSPropertyParserHelpers::ConsumeIdent(range); |
| 29 CSSValuePair* pair = CSSValuePair::Create(axis_value, strictness_value, |
| 30 CSSValuePair::kDropIdenticalValues); |
| 31 return pair; |
| 32 } |
| 33 |
| 34 } // namespace blink |
OLD | NEW |