| OLD | NEW |
| 1 {% from 'macros.tmpl' import trie_length_switch %} | 1 {% from 'macros.tmpl' import trie_length_switch %} |
| 2 // Copyright 2016 The Chromium Authors. All rights reserved. | 2 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include "core/css/CSSPrimitiveValue.h" | 6 #include "core/css/CSSPrimitiveValue.h" |
| 7 | 7 |
| 8 namespace blink { | 8 namespace blink { |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 template<typename CharacterType> | 12 template<typename CharacterType> |
| 13 CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie( | 13 CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie( |
| 14 const CharacterType* data, unsigned length) { | 14 const CharacterType* data, unsigned length) { |
| 15 DCHECK(data); | 15 DCHECK(data); |
| 16 DCHECK(length); | 16 DCHECK(length); |
| 17 {% macro trie_return_statement(unit_name) %}CSSPrimitiveValue::UnitType::{{uni
t_name}}{% endmacro %} | 17 {% macro trie_return_statement(unit_name) %}CSSPrimitiveValue::UnitType::{{uni
t_name}}{% endmacro %} |
| 18 {{ trie_length_switch(length_tries, trie_return_statement, True) | indent(4) }
} | 18 {{ trie_length_switch(length_tries, trie_return_statement, True) | indent(4) }
} |
| 19 return CSSPrimitiveValue::UnitType::Unknown; | 19 return CSSPrimitiveValue::UnitType::kUnknown; |
| 20 } | 20 } |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 CSSPrimitiveValue::UnitType CSSPrimitiveValue::stringToUnitType( | 24 CSSPrimitiveValue::UnitType CSSPrimitiveValue::stringToUnitType( |
| 25 const LChar* characters8, unsigned length) { | 25 const LChar* characters8, unsigned length) { |
| 26 return cssPrimitiveValueUnitFromTrie(characters8, length); | 26 return cssPrimitiveValueUnitFromTrie(characters8, length); |
| 27 } | 27 } |
| 28 | 28 |
| 29 CSSPrimitiveValue::UnitType CSSPrimitiveValue::stringToUnitType( | 29 CSSPrimitiveValue::UnitType CSSPrimitiveValue::stringToUnitType( |
| 30 const UChar* characters16, unsigned length) { | 30 const UChar* characters16, unsigned length) { |
| 31 return cssPrimitiveValueUnitFromTrie(characters16, length); | 31 return cssPrimitiveValueUnitFromTrie(characters16, length); |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace blink | 34 } // namespace blink |
| 35 | 35 |
| OLD | NEW |