chromium/third_party/blink/renderer/core/html/parser/html_parser_idioms.cc

/*
 * Copyright (C) 2010 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"

#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
#include "third_party/blink/renderer/platform/wtf/text/character_visitor.h"
#include "third_party/blink/renderer/platform/wtf/text/parsing_utilities.h"
#include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
#include "third_party/blink/renderer/platform/wtf/text/string_to_number.h"
#include "third_party/blink/renderer/platform/wtf/text/text_encoding.h"

#include <limits>

namespace blink {

String StripLeadingAndTrailingHTMLSpaces(const String& string) {}

// TODO(iclelland): Consider refactoring this into a general
// String::Split(predicate) method
Vector<String> SplitOnASCIIWhitespace(const String& input) {}

String SerializeForNumberType(const Decimal& number) {}

String SerializeForNumberType(double number) {}

Decimal ParseToDecimalForNumberType(const String& string,
                                    const Decimal& fallback_value) {}

static double CheckDoubleValue(double value,
                               bool valid,
                               double fallback_value) {}

double ParseToDoubleForNumberType(const String& string, double fallback_value) {}

template <typename CharacterType>
static bool ParseHTMLIntegerInternal(const CharacterType* position,
                                     const CharacterType* end,
                                     int& value) {}

// http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers
bool ParseHTMLInteger(const String& input, int& value) {}

static WTF::NumberParsingResult ParseHTMLNonNegativeIntegerInternal(
    const String& input,
    unsigned& value) {}

// https://html.spec.whatwg.org/C/#rules-for-parsing-non-negative-integers
bool ParseHTMLNonNegativeInteger(const String& input, unsigned& value) {}

bool ParseHTMLClampedNonNegativeInteger(const String& input,
                                        unsigned min,
                                        unsigned max,
                                        unsigned& value) {}

template <typename CharacterType>
static bool IsSpaceOrDelimiter(CharacterType c) {}

template <typename CharacterType>
static bool IsNotSpaceDelimiterOrNumberStart(CharacterType c) {}

template <typename CharacterType>
static Vector<double> ParseHTMLListOfFloatingPointNumbersInternal(
    const CharacterType* position,
    const CharacterType* end) {}

// https://html.spec.whatwg.org/C/#rules-for-parsing-a-list-of-floating-point-numbers
Vector<double> ParseHTMLListOfFloatingPointNumbers(const String& input) {}

static const char kCharsetString[] =;
static const size_t kCharsetLength =;

// https://html.spec.whatwg.org/C/#extracting-character-encodings-from-meta-elements
String ExtractCharset(const String& value) {}

enum class MetaAttribute {};

WTF::TextEncoding EncodingFromMetaAttributes(
    const HTMLAttributeList& attributes) {}

static bool ThreadSafeEqual(const StringImpl* a, const StringImpl* b) {}

bool ThreadSafeMatch(const QualifiedName& a, const QualifiedName& b) {}

bool ThreadSafeMatch(const String& local_name, const QualifiedName& q_name) {}

template <typename CharType>
inline StringImpl* FindStringIfStatic(const CharType* characters,
                                      unsigned length) {}

String AttemptStaticStringCreation(const LChar* characters, wtf_size_t size) {}

String AttemptStaticStringCreation(const UChar* characters,
                                   wtf_size_t size,
                                   CharacterWidth width) {}

}  // namespace blink