summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_primitive_value_unit_trie.cc.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_primitive_value_unit_trie.cc.tmpl')
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_primitive_value_unit_trie.cc.tmpl37
1 files changed, 37 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_primitive_value_unit_trie.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_primitive_value_unit_trie.cc.tmpl
new file mode 100644
index 00000000000..84c3a5b6bfb
--- /dev/null
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_primitive_value_unit_trie.cc.tmpl
@@ -0,0 +1,37 @@
+{% from 'templates/macros.tmpl' import source_files_for_generated_file, trie_length_switch %}
+// 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.
+
+{{source_files_for_generated_file(template_file, input_files)}}
+
+#include "third_party/blink/renderer/core/css/css_primitive_value.h"
+
+namespace blink {
+
+namespace {
+
+template<typename CharacterType>
+CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(
+ const CharacterType* data, unsigned length) {
+ DCHECK(data);
+ DCHECK(length);
+ {% macro trie_return_statement(unit_name) %}CSSPrimitiveValue::UnitType::{{unit_name}}{% endmacro %}
+ {{ trie_length_switch(length_tries, trie_return_statement, True) | indent(4) }}
+ return CSSPrimitiveValue::UnitType::kUnknown;
+}
+
+} // namespace
+
+CSSPrimitiveValue::UnitType CSSPrimitiveValue::StringToUnitType(
+ const LChar* characters8, unsigned length) {
+ return cssPrimitiveValueUnitFromTrie(characters8, length);
+}
+
+CSSPrimitiveValue::UnitType CSSPrimitiveValue::StringToUnitType(
+ const UChar* characters16, unsigned length) {
+ return cssPrimitiveValueUnitFromTrie(characters16, length);
+}
+
+} // namespace blink
+