chromium/third_party/blink/renderer/core/css/properties/css_color_function_parser.cc

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

#include "third_party/blink/renderer/core/css/properties/css_color_function_parser.h"

#include <cmath>

#include "base/containers/fixed_flat_map.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-shared.h"
#include "third_party/blink/renderer/core/css/css_color.h"
#include "third_party/blink/renderer/core/css/css_color_mix_value.h"
#include "third_party/blink/renderer/core/css/css_identifier_value.h"
#include "third_party/blink/renderer/core/css/css_math_function_value.h"
#include "third_party/blink/renderer/core/css/css_relative_color_value.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_save_point.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h"
#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h"
#include "third_party/blink/renderer/core/css_value_keywords.h"

namespace blink {

struct ColorFunctionParser::FunctionMetadata {};

namespace {

// https://www.w3.org/TR/css-color-4/#typedef-color-function
bool IsValidColorFunction(CSSValueID id) {}

Color::ColorSpace ColorSpaceFromFunctionName(CSSValueID id) {}

// https://www.w3.org/TR/css-color-4/#color-function
Color::ColorSpace ColorSpaceFromColorSpaceArgument(CSSValueID id) {}

// Unique entries in kFunctionMetadataMap.
enum class FunctionMetadataEntry : uint8_t {};

constexpr double kPercentNotApplicable =;

constexpr auto kFunctionMetadataMap =;

constexpr auto kColorSpaceFunctionMap =;

bool ColorChannelIsHue(Color::ColorSpace color_space, int channel) {}

// If the CSSValue is an absolute color, return the corresponding Color.
std::optional<Color> TryResolveAtParseTime(const CSSValue& value) {}

CSSValue* ConsumeRelativeColorChannel(
    CSSParserTokenStream& stream,
    const CSSParserContext& context,
    const CSSColorChannelMap& color_channel_map,
    CalculationResultCategorySet expected_categories,
    const double percentage_base = 0) {}

// Returns true if, when converted to Rec2020 space, all components of `color`
// are in the interval [-1/255, 256/255].
bool IsInGamutRec2020(Color color) {}

}  // namespace

bool ColorFunctionParser::ConsumeColorSpaceAndOriginColor(
    CSSParserTokenStream& stream,
    CSSValueID function_id,
    const CSSParserContext& context) {}

bool ColorFunctionParser::ConsumeChannel(CSSParserTokenStream& stream,
                                         const CSSParserContext& context,
                                         int i) {}

bool ColorFunctionParser::ConsumeAlpha(CSSParserTokenStream& stream,
                                       const CSSParserContext& context) {}

void ColorFunctionParser::MakePerColorSpaceAdjustments() {}

double ColorFunctionParser::ResolveColorChannel(
    const CSSValue* value,
    ChannelType channel_type,
    double percentage_base,
    const CSSColorChannelMap& color_channel_map) {}

double ColorFunctionParser::ResolveAlpha(
    const CSSValue* value,
    ChannelType channel_type,
    const CSSColorChannelMap& color_channel_map) {}

double ColorFunctionParser::ResolveRelativeChannelValue(
    const CSSValue* value,
    ChannelType channel_type,
    double percentage_base,
    const CSSColorChannelMap& color_channel_map) {}

bool ColorFunctionParser::IsRelativeColor() const {}

CSSValue* ColorFunctionParser::ConsumeFunctionalSyntaxColor(
    CSSParserTokenStream& stream,
    const CSSParserContext& context) {}

}  // namespace blink