chromium/third_party/blink/renderer/core/animation/interpolable_color.cc

// Copyright 2022 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/animation/interpolable_color.h"

#include <cmath>
#include <memory>
#include "base/check_op.h"
#include "base/notreached.h"
#include "third_party/blink/renderer/core/animation/css_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/interpolable_value.h"
#include "third_party/blink/renderer/core/layout/layout_theme.h"

namespace blink {

namespace {
// InterpolableColors are stored premultiplied (scaled by alpha) during the
// blending process for efficiency and unpremultiplied during resolution. This
// works since restricted to rectangular color spaces. This optimization step
// would not work in polar color spaces. Fortunately, interpolation is currently
// restricted to srgb-legacy and oklab.

// Apply a color blend. The first color in the blend, expressed as doubles and a
// colorspace is expected to already be in premultiplied form (scaled by alpha).
// The result is left in premultiplied form for efficiency.
std::tuple<double, double, double, double> AddPremultipliedColor(
    double param0,
    double param1,
    double param2,
    double alpha,
    double fraction,
    Color color,
    Color::ColorSpace color_space) {}

// Convert color parameters back to unpremultiplied form (not scaled by alpha)
// suitable for the Color constructor.
std::tuple<double, double, double> UnpremultiplyColor(double param0,
                                                      double param1,
                                                      double param2,
                                                      double alpha) {}

}  // namespace

InterpolableColor* InterpolableColor::Create(Color color) {}

InterpolableColor* InterpolableColor::Create(ColorKeyword color_keyword) {}

InterpolableColor* InterpolableColor::Create(
    CSSValueID keyword,
    mojom::blink::ColorScheme color_scheme,
    const ui::ColorProvider* color_provider) {}

InterpolableColor::InterpolableColor(
    InlinedInterpolableDouble param0,
    InlinedInterpolableDouble param1,
    InlinedInterpolableDouble param2,
    InlinedInterpolableDouble alpha,
    InlinedInterpolableDouble current_color,
    InlinedInterpolableDouble webkit_active_link,
    InlinedInterpolableDouble webkit_link,
    InlinedInterpolableDouble quirk_inherit,
    Color::ColorSpace color_space)
    :{}

InterpolableColor* InterpolableColor::RawClone() const {}

InterpolableColor* InterpolableColor::RawCloneAndZero() const {}

Color InterpolableColor::GetColor() const {}

void InterpolableColor::AssertCanInterpolateWith(
    const InterpolableValue& other) const {}

bool InterpolableColor::IsKeywordColor() const {}

void InterpolableColor::ConvertToColorSpace(Color::ColorSpace color_space) {}

// static
void InterpolableColor::SetupColorInterpolationSpaces(InterpolableColor& to,
                                                      InterpolableColor& from) {}

void InterpolableColor::Scale(double scale) {}

void InterpolableColor::Add(const InterpolableValue& other) {}

Color InterpolableColor::Resolve(const Color& current_color,
                                 const Color& active_link_color,
                                 const Color& link_color,
                                 const Color& text_color,
                                 mojom::blink::ColorScheme color_scheme) const {}

void InterpolableColor::Interpolate(const InterpolableValue& to,
                                    const double progress,
                                    InterpolableValue& result) const {}

void InterpolableColor::Composite(const BaseInterpolableColor& value,
                                  double fraction) {}

}  // namespace blink