Chromium Code Reviews| Index: third_party/WebKit/Source/build/scripts/templates/CSSPrimitiveValueUnitTrie.cpp.tmpl |
| diff --git a/third_party/WebKit/Source/build/scripts/templates/CSSPrimitiveValueUnitTrie.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/CSSPrimitiveValueUnitTrie.cpp.tmpl |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7ad30295b0dd044cea86f96f5c01c8e736399d2a |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/build/scripts/templates/CSSPrimitiveValueUnitTrie.cpp.tmpl |
| @@ -0,0 +1,35 @@ |
| +{% from 'macros.tmpl' import trie_length_switch %} |
| +{% macro trie_return_statement(unit_name) %}CSSPrimitiveValue::UnitType::{{unit_name}}{% endmacro %} |
|
Timothy Loh
2016/05/12 07:03:14
can this line be right before calling trie_length_
meade_UTC10
2016/05/13 04:32:05
Done.
|
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "core/css/CSSPrimitiveValueUnitTrie.h" |
| +#include "core/css/CSSPrimitiveValue.h" |
| + |
| +namespace blink { |
| + |
| +namespace { |
| + |
| +template<typename CharacterType> |
| +CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* data, unsigned length) |
| +{ |
| + DCHECK(data); |
| + DCHECK(length); |
| + {{ trie_length_switch(trie_return_statement(empty_case), length_tries, trie_return_statement, trie_return_statement(default_value), True) | indent(4) }} |
| +} |
| + |
| +} // namespace |
| + |
| +CSSPrimitiveValue::UnitType lookupCSSPrimitiveValueUnit(const LChar* characters8, unsigned length) |
| +{ |
| + return cssPrimitiveValueUnitFromTrie(characters8, length); |
| +} |
| + |
| +CSSPrimitiveValue::UnitType lookupCSSPrimitiveValueUnit(const UChar* characters16, unsigned length) |
| +{ |
| + return cssPrimitiveValueUnitFromTrie(characters16, length); |
| +} |
| + |
| +} // namespace blink |
| + |