OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/properties/CSSPropertyAPITranslate.h" | 5 #include "core/css/properties/CSSPropertyAPITranslate.h" |
6 | 6 |
7 #include "core/css/CSSValueList.h" | 7 #include "core/css/CSSValueList.h" |
8 #include "core/css/parser/CSSParserTokenRange.h" | 8 #include "core/css/parser/CSSParserTokenRange.h" |
9 #include "core/css/parser/CSSPropertyParser.h" | 9 #include "core/css/parser/CSSPropertyParser.h" |
10 #include "core/css/parser/CSSPropertyParserHelpers.h" | 10 #include "core/css/parser/CSSPropertyParserHelpers.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 const CSSValue* CSSPropertyAPITranslate::parseSingleValue( | 14 const CSSValue* CSSPropertyAPITranslate::parseSingleValue( |
15 CSSParserTokenRange& range, | 15 CSSParserTokenRange& range, |
16 const CSSParserContext& context) { | 16 const CSSParserContext& context, |
| 17 CSSPropertyID) { |
17 DCHECK(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); | 18 DCHECK(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); |
18 CSSValueID id = range.Peek().Id(); | 19 CSSValueID id = range.Peek().Id(); |
19 if (id == CSSValueNone) | 20 if (id == CSSValueNone) |
20 return CSSPropertyParserHelpers::ConsumeIdent(range); | 21 return CSSPropertyParserHelpers::ConsumeIdent(range); |
21 | 22 |
22 CSSValue* translate = CSSPropertyParserHelpers::ConsumeLengthOrPercent( | 23 CSSValue* translate = CSSPropertyParserHelpers::ConsumeLengthOrPercent( |
23 range, context.Mode(), kValueRangeAll); | 24 range, context.Mode(), kValueRangeAll); |
24 if (!translate) | 25 if (!translate) |
25 return nullptr; | 26 return nullptr; |
26 CSSValueList* list = CSSValueList::CreateSpaceSeparated(); | 27 CSSValueList* list = CSSValueList::CreateSpaceSeparated(); |
27 list->Append(*translate); | 28 list->Append(*translate); |
28 translate = CSSPropertyParserHelpers::ConsumeLengthOrPercent( | 29 translate = CSSPropertyParserHelpers::ConsumeLengthOrPercent( |
29 range, context.Mode(), kValueRangeAll); | 30 range, context.Mode(), kValueRangeAll); |
30 if (translate) { | 31 if (translate) { |
31 list->Append(*translate); | 32 list->Append(*translate); |
32 translate = CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), | 33 translate = CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), |
33 kValueRangeAll); | 34 kValueRangeAll); |
34 if (translate) | 35 if (translate) |
35 list->Append(*translate); | 36 list->Append(*translate); |
36 } | 37 } |
37 | 38 |
38 return list; | 39 return list; |
39 } | 40 } |
40 | 41 |
41 } // namespace blink | 42 } // namespace blink |
OLD | NEW |