{% from 'templates/macros.tmpl' import source_files_for_generated_file, trie_length_switch %}
// Copyright 2016 The Chromium Authors
// 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/{{namespace|lower}}_element_lookup_trie.h"
#include "third_party/blink/renderer/core/{{namespace|lower}}_names.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink {
{% macro trie_return_expression(tag) -%}
{% if runtimeEnabledWithoutOriginTrial[tag] -%}
(RuntimeEnabledFeatures::{{runtimeEnabledWithoutOriginTrial[tag]}}Enabled()
// If this code fails to compile because the
// RuntimeEnabledFeatures method requires an argument
// (because the feature can be affected by origin trials),
// this means you need to add runtimeFlagHasOriginTrial to
// the appropriate entry in html_tag_names.json5 . Also
// see the documentation in html_tag_names.json5 for
// additional things you should test when doing this.
? {{namespace|lower}}_names::HTMLTag::{{tag_symbols[tag]}}
: {{namespace|lower}}_names::HTMLTag::kUnknown)
{%- else -%}
{{namespace|lower}}_names::HTMLTag::{{tag_symbols[tag]}}
{%- endif %}
{%- endmacro %}
CORE_EXPORT {{namespace|lower}}_names::HTMLTag lookup{{namespace}}Tag(
const UChar* data,
unsigned length) {
DCHECK(data);
DCHECK(length);
{{ trie_length_switch(length_tries, trie_return_expression, false, false) | indent(2) }}
return {{namespace|lower}}_names::HTMLTag::kUnknown;
}
CORE_EXPORT {{namespace|lower}}_names::HTMLTag lookup{{namespace}}Tag(
const LChar* data,
unsigned length) {
DCHECK(data);
DCHECK(length);
{{ trie_length_switch(length_tries, trie_return_expression, false, true) | indent(2) }}
return {{namespace|lower}}_names::HTMLTag::kUnknown;
}
} // namespace blink