blob: b1b08799fea208b9ceb6bd1671e31c17fbe38f09 [file] [log] [blame]
{% from 'macros.tmpl' import 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.
#include "core/css/CSSPrimitiveValue.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::Unknown;
}
} // 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