chromium/third_party/blink/renderer/platform/fonts/font_selection_types.h

/*
 * Copyright (C) 2017 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.
 */

#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_SELECTION_TYPES_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_SELECTION_TYPES_H_

#include <algorithm>

#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/hash_table_deleted_value_type.h"
#include "third_party/blink/renderer/platform/wtf/hash_traits.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

namespace blink {

// Unclamped, unchecked, signed fixed-point number representing a value used for
// font variations. Sixteen bits in total, one sign bit, two fractional bits,
// means the smallest positive representable value is 0.25, the maximum
// representable value is 8191.75, and the minimum representable value is -8192.
class PLATFORM_EXPORT FontSelectionValue {};

inline constexpr FontSelectionValue FontSelectionValue::operator+(
    const FontSelectionValue& other) const {}

inline constexpr FontSelectionValue FontSelectionValue::operator-(
    const FontSelectionValue& other) const {}

inline constexpr FontSelectionValue FontSelectionValue::operator*(
    const FontSelectionValue& other) const {}

inline constexpr FontSelectionValue FontSelectionValue::operator/(
    const FontSelectionValue& other) const {}

inline constexpr FontSelectionValue FontSelectionValue::operator-() const {}

inline constexpr bool FontSelectionValue::operator==(
    const FontSelectionValue& other) const {}

inline constexpr bool FontSelectionValue::operator!=(
    const FontSelectionValue& other) const {}

inline constexpr bool FontSelectionValue::operator<(
    const FontSelectionValue& other) const {}

inline constexpr bool FontSelectionValue::operator<=(
    const FontSelectionValue& other) const {}

inline constexpr bool FontSelectionValue::operator>(
    const FontSelectionValue& other) const {}

inline constexpr bool FontSelectionValue::operator>=(
    const FontSelectionValue& other) const {}

inline constexpr FontSelectionValue kItalicThreshold =;

static constexpr inline bool isItalic(FontSelectionValue fontStyle) {}

inline constexpr FontSelectionValue kFontSelectionZeroValue =;

inline constexpr FontSelectionValue kNormalSlopeValue =;

inline constexpr FontSelectionValue kItalicSlopeValue =;

inline constexpr FontSelectionValue kMaxObliqueValue =;

inline constexpr FontSelectionValue kMinObliqueValue =;

inline constexpr FontSelectionValue kBoldThreshold =;

inline constexpr FontSelectionValue kMinWeightValue =;

inline constexpr FontSelectionValue kMaxWeightValue =;

inline constexpr FontSelectionValue kBlackWeightValue =;

inline constexpr FontSelectionValue kExtraBoldWeightValue =;

inline constexpr FontSelectionValue kBoldWeightValue =;

inline constexpr FontSelectionValue kSemiBoldWeightValue =;

inline constexpr FontSelectionValue kMediumWeightValue =;

inline constexpr FontSelectionValue kNormalWeightValue =;

inline constexpr FontSelectionValue kLightWeightValue =;

inline constexpr FontSelectionValue kExtraLightWeightValue =;

inline constexpr FontSelectionValue kThinWeightValue =;

static constexpr inline bool isFontWeightBold(FontSelectionValue fontWeight) {}

inline constexpr FontSelectionValue kUpperWeightSearchThreshold =;

inline constexpr FontSelectionValue kLowerWeightSearchThreshold =;

inline constexpr FontSelectionValue kUltraCondensedWidthValue =;

inline constexpr FontSelectionValue kExtraCondensedWidthValue =;

inline constexpr FontSelectionValue kCondensedWidthValue =;

inline constexpr FontSelectionValue kSemiCondensedWidthValue =;

inline constexpr FontSelectionValue kNormalWidthValue =;

inline constexpr FontSelectionValue kSemiExpandedWidthValue =;

inline constexpr FontSelectionValue kExpandedWidthValue =;

inline constexpr FontSelectionValue kExtraExpandedWidthValue =;

inline constexpr FontSelectionValue kUltraExpandedWidthValue =;

struct FontSelectionRange {};

struct PLATFORM_EXPORT FontSelectionRequest {};

// Only used for HashMaps. We don't want to put the bool into
// FontSelectionRequest because FontSelectionRequest needs to be as small as
// possible because it's inside every FontDescription.
struct FontSelectionRequestKey {};

struct PLATFORM_EXPORT FontSelectionRequestKeyHashTraits
    : SimpleClassHashTraits<FontSelectionRequestKey> {};

struct FontSelectionCapabilities {};

struct PLATFORM_EXPORT FontSelectionCapabilitiesHashTraits
    : SimpleClassHashTraits<FontSelectionCapabilities> {};

}  // namespace blink

namespace WTF {

template <>
struct HashTraits<blink::FontSelectionRequestKey>
    : blink::FontSelectionRequestKeyHashTraits {};

template <>
struct HashTraits<blink::FontSelectionCapabilities>
    : blink::FontSelectionCapabilitiesHashTraits {};

}  // namespace WTF

// Used for ClampTo for example in StyleBuilderConverter
template <>
inline blink::FontSelectionValue
DefaultMinimumForClamp<blink::FontSelectionValue>() {}

template <>
inline blink::FontSelectionValue
DefaultMaximumForClamp<blink::FontSelectionValue>() {}

#endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_SELECTION_TYPES_H_