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

/*
 * Copyright (C) 1999 Lars Knoll ([email protected])
 *           (C) 2004-2005 Allan Sandfeld Jensen ([email protected])
 * Copyright (C) 2006, 2007 Nicholas Shanks ([email protected])
 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
 * All rights reserved.
 * Copyright (C) 2007 Alexey Proskuryakov <[email protected]>
 * Copyright (C) 2007, 2008 Eric Seidel <[email protected]>
 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
 * (http://www.torchmobile.com/)
 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
 * Copyright (C) 2012 Google Inc. All rights reserved.
 *
 * 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/font_size_functions.h"

#include "third_party/blink/renderer/core/css_value_keywords.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/platform/fonts/font_description.h"
#include "third_party/blink/renderer/platform/fonts/simple_font_data.h"

namespace blink {

float FontSizeFunctions::GetComputedSizeFromSpecifiedSize(
    const Document* document,
    float zoom_factor,
    bool is_absolute_size,
    float specified_size,
    ApplyMinimumFontSize apply_minimum_font_size) {}

const int kFontSizeTableMax =;
const int kDefaultMediumFontSize =;
const int kFontSizeTableMin =;
const int kTotalKeywords =;

// WinIE/Nav4 table for font sizes. Designed to match the legacy font mapping
// system of HTML.
static const int kQuirksFontSizeTable[kFontSizeTableMax - kFontSizeTableMin +
                                      1][kTotalKeywords] =;
// HTML       1      2      3      4      5      6      7
// CSS  xxs   xs     s      m      l     xl     xxl
//                          |
//                      user pref

// Strict mode table matches MacIE and Mozilla's settings exactly.
static const int kStrictFontSizeTable[kFontSizeTableMax - kFontSizeTableMin +
                                      1][kTotalKeywords] =;
// HTML       1      2      3      4      5      6      7
// CSS  xxs   xs     s      m      l     xl     xxl
//                          |
//                      user pref

// For values outside the range of the table, we use Todd Fahrner's suggested
// scale factors for each keyword value.
static const float kFontSizeFactors[kTotalKeywords] =;

static int inline RowFromMediumFontSizeInRange(const Settings* settings,
                                               bool quirks_mode,
                                               bool is_monospace,
                                               int& medium_size) {}

float FontSizeFunctions::FontSizeForKeyword(const Document* document,
                                            unsigned keyword,
                                            bool is_monospace) {}

template <typename T>
static int FindNearestLegacyFontSize(int pixel_font_size,
                                     const T* table,
                                     int multiplier) {}

int FontSizeFunctions::LegacyFontSize(const Document* document,
                                      int pixel_font_size,
                                      bool is_monospace) {}

static float AspectValue(const SimpleFontData& font_data,
                         FontSizeAdjust::Metric metric,
                         float computed_size) {}

std::optional<float> FontSizeFunctions::FontAspectValue(
    const SimpleFontData* font_data,
    FontSizeAdjust::Metric metric,
    float computed_size) {}

std::optional<float> FontSizeFunctions::MetricsMultiplierAdjustedFontSize(
    const SimpleFontData* font_data,
    const FontDescription& font_description) {}

}  // namespace blink