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 DCHECK(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); | 17 DCHECK(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); |
18 CSSValueID id = range.peek().id(); | 18 CSSValueID id = range.peek().id(); |
19 if (id == CSSValueNone) | 19 if (id == CSSValueNone) |
20 return CSSPropertyParserHelpers::consumeIdent(range); | 20 return CSSPropertyParserHelpers::consumeIdent(range); |
21 | 21 |
22 CSSValue* translate = CSSPropertyParserHelpers::consumeLengthOrPercent( | 22 CSSValue* translate = CSSPropertyParserHelpers::consumeLengthOrPercent( |
23 range, context->mode(), ValueRangeAll); | 23 range, context.mode(), ValueRangeAll); |
24 if (!translate) | 24 if (!translate) |
25 return nullptr; | 25 return nullptr; |
26 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 26 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
27 list->append(*translate); | 27 list->append(*translate); |
28 translate = CSSPropertyParserHelpers::consumeLengthOrPercent( | 28 translate = CSSPropertyParserHelpers::consumeLengthOrPercent( |
29 range, context->mode(), ValueRangeAll); | 29 range, context.mode(), ValueRangeAll); |
30 if (translate) { | 30 if (translate) { |
31 list->append(*translate); | 31 list->append(*translate); |
32 translate = CSSPropertyParserHelpers::consumeLength(range, context->mode(), | 32 translate = CSSPropertyParserHelpers::consumeLength(range, context.mode(), |
33 ValueRangeAll); | 33 ValueRangeAll); |
34 if (translate) | 34 if (translate) |
35 list->append(*translate); | 35 list->append(*translate); |
36 } | 36 } |
37 | 37 |
38 return list; | 38 return list; |
39 } | 39 } |
40 | 40 |
41 } // namespace blink | 41 } // namespace blink |
OLD | NEW |