chromium/third_party/blink/renderer/core/css/counter_style.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/*
 * Copyright (C) 1999 Lars Knoll ([email protected])
 *           (C) 1999 Antti Koivisto ([email protected])
 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
 * reserved.
 * Copyright (C) 2006 Andrew Wellington ([email protected])
 * Copyright (C) 2010 Daniel Bates ([email protected])
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#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/css/counter_style.h"

#include "base/auto_reset.h"
#include "third_party/blink/renderer/core/css/counter_style_map.h"
#include "third_party/blink/renderer/core/css/css_custom_ident_value.h"
#include "third_party/blink/renderer/core/css/css_identifier_value.h"
#include "third_party/blink/renderer/core/css/css_string_value.h"
#include "third_party/blink/renderer/core/css/css_value_list.h"
#include "third_party/blink/renderer/core/css/css_value_pair.h"
#include "third_party/blink/renderer/core/css/style_rule_counter_style.h"
#include "third_party/blink/renderer/core/css_value_keywords.h"
#include "third_party/blink/renderer/core/keywords.h"
#include "third_party/blink/renderer/platform/text/text_break_iterator.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"

namespace blink {

namespace {

// User agents must support representations at least 60 Unicode codepoints long,
// but they may choose to instead use the fallback style for representations
// that would be longer than 60 codepoints. Since WTF::String may use UTF-16, we
// limit string length at 120.
const wtf_size_t kCounterLengthLimit =;

const CounterStyle& GetDisc() {}

bool HasSymbols(CounterStyleSystem system) {}

String SymbolToString(const CSSValue& value) {}

std::pair<int, int> BoundsToIntegerPair(const CSSValuePair& bounds) {}

// https://drafts.csswg.org/css-counter-styles/#cyclic-system
Vector<wtf_size_t> CyclicAlgorithm(int value, wtf_size_t num_symbols) {}

// https://drafts.csswg.org/css-counter-styles/#fixed-system
Vector<wtf_size_t> FixedAlgorithm(int value,
                                  int first_symbol_value,
                                  wtf_size_t num_symbols) {}

// https://drafts.csswg.org/css-counter-styles/#symbolic-system
Vector<wtf_size_t> SymbolicAlgorithm(unsigned value, wtf_size_t num_symbols) {}

// https://drafts.csswg.org/css-counter-styles/#alphabetic-system
Vector<wtf_size_t> AlphabeticAlgorithm(unsigned value, wtf_size_t num_symbols) {}

// https://drafts.csswg.org/css-counter-styles/#numeric-system
Vector<wtf_size_t> NumericAlgorithm(unsigned value, wtf_size_t num_symbols) {}

// https://drafts.csswg.org/css-counter-styles/#additive-system
Vector<wtf_size_t> AdditiveAlgorithm(unsigned value,
                                     const Vector<unsigned>& weights) {}

enum CJKLang {};

enum CJKStyle {};

// The table uses the order from the CSS3 specification:
// first 3 group markers, then 3 digit markers, then ten digits.
String CJKIdeoGraphicAlgorithm(unsigned number,
                               const UChar table[21],
                               CJKStyle cjk_style) {}

String SimpChineseInformalAlgorithm(unsigned value) {}

String SimpChineseFormalAlgorithm(unsigned value) {}

String TradChineseInformalAlgorithm(unsigned value) {}

String TradChineseFormalAlgorithm(unsigned value) {}

String KoreanHangulFormalAlgorithm(unsigned value) {}

String KoreanHanjaInformalAlgorithm(unsigned value) {}

String KoreanHanjaFormalAlgorithm(unsigned value) {}

String HebrewAlgorithmUnder1000(unsigned number) {}

String HebrewAlgorithm(unsigned number) {}

String ArmenianAlgorithmUnder10000(unsigned number,
                                   bool upper,
                                   bool add_circumflex) {}

String ArmenianAlgorithm(unsigned number, bool upper) {}

// https://drafts.csswg.org/css-counter-styles-3/#ethiopic-numeric-counter-style
String EthiopicNumericAlgorithm(unsigned value) {}

}  // namespace

// static
CounterStyle& CounterStyle::GetDecimal() {}

// static
CounterStyleSystem CounterStyle::ToCounterStyleSystemEnum(
    const CSSValue* value) {}

// static
CounterStyleSpeakAs ToCounterStyleSpeakAsEnum(
    const CSSIdentifierValue& keyword) {}

CounterStyle::~CounterStyle() = default;

AtomicString CounterStyle::GetName() const {}

// static
CounterStyle* CounterStyle::Create(const StyleRuleCounterStyle& rule) {}

CounterStyle::CounterStyle(const StyleRuleCounterStyle& rule)
    :{}

void CounterStyle::ResolveExtends(CounterStyle& extended) {}

bool CounterStyle::RangeContains(int value) const {}

bool CounterStyle::NeedsNegativeSign(int value) const {}

String CounterStyle::GenerateFallbackRepresentation(int value) const {}

String CounterStyle::GenerateRepresentation(int value) const {}

String CounterStyle::GenerateInitialRepresentation(int value) const {}

String CounterStyle::IndexesToString(
    const Vector<wtf_size_t>& symbol_indexes) const {}

void CounterStyle::TraverseAndMarkDirtyIfNeeded(
    HeapHashSet<Member<CounterStyle>>& visited_counter_styles) {}

CounterStyleSpeakAs CounterStyle::EffectiveSpeakAs() const {}

String CounterStyle::GenerateTextAlternative(int value) const {}

String CounterStyle::GenerateTextAlternativeWithoutPrefixSuffix(
    int value) const {}

void CounterStyle::Trace(Visitor* visitor) const {}

}  // namespace blink