chromium/third_party/blink/renderer/core/highlight/highlight_style_utils.cc

// Copyright 2017 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/highlight/highlight_style_utils.h"

#include "components/shared_highlighting/core/common/fragment_directives_constants.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/css/style_request.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/layout/layout_theme.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/paint/paint_info.h"
#include "third_party/blink/renderer/core/paint/text_paint_style.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"

namespace blink {

namespace {

bool NodeIsReplaced(Node* node) {}

mojom::blink::ColorScheme UsedColorScheme(
    const ComputedStyle& originating_style,
    const ComputedStyle* pseudo_style) {}

// Returns the forced foreground color for the given |pseudo|.
Color ForcedForegroundColor(PseudoId pseudo,
                            mojom::blink::ColorScheme color_scheme,
                            const ui::ColorProvider* color_provider,
                            bool is_in_web_app_scope) {}

// Returns the forced ‘background-color’ for the given |pseudo|.
Color ForcedBackgroundColor(PseudoId pseudo,
                            mojom::blink::ColorScheme color_scheme,
                            const ui::ColorProvider* color_provider,
                            bool is_in_web_app_scope) {}

// Returns the forced background color if |property| is ‘background-color’,
// or the forced foreground color for all other properties (e.g. ‘color’,
// ‘text-decoration-color’, ‘-webkit-text-fill-color’).
Color ForcedColor(const ComputedStyle& originating_style,
                  const ComputedStyle* pseudo_style,
                  PseudoId pseudo,
                  const CSSProperty& property,
                  const ui::ColorProvider* color_provider,
                  bool is_in_web_app_scope) {}

// Returns the UA default ‘color’ for the given |pseudo|.
std::optional<Color> DefaultForegroundColor(
    const Document& document,
    PseudoId pseudo,
    mojom::blink::ColorScheme color_scheme) {}

// Returns the UA default ‘background-color’ for the given |pseudo|.
Color DefaultBackgroundColor(const Document& document,
                             PseudoId pseudo,
                             mojom::blink::ColorScheme color_scheme) {}

// Returns the UA default highlight color for a paired cascade |property|,
// that is, ‘color’ or ‘background-color’. Paired cascade only applies to those
// properties, not ‘-webkit-text-fill-color’ or ‘-webkit-text-stroke-color’.
std::optional<Color> DefaultHighlightColor(
    const Document& document,
    const ComputedStyle& originating_style,
    const ComputedStyle* pseudo_style,
    PseudoId pseudo,
    const CSSProperty& property) {}

// Returns highlight styles for the given node, inheriting from the originating
// element only, like most impls did before highlights were added to css-pseudo.
const ComputedStyle* HighlightPseudoStyleWithOriginatingInheritance(
    Node* node,
    PseudoId pseudo,
    const AtomicString& pseudo_argument = g_null_atom) {}

bool UseForcedColors(const Document& document,
                     const ComputedStyle& originating_style,
                     const ComputedStyle* pseudo_style) {}

// Paired cascade: when we encounter any highlight colors, we make all other
// highlight color properties default to initial, rather than the UA default.
// https://drafts.csswg.org/css-pseudo-4/#paired-defaults
bool UseDefaultHighlightColors(const ComputedStyle* pseudo_style,
                               PseudoId pseudo,
                               const CSSProperty& property) {}

}  // anonymous namespace

Color HighlightStyleUtils::ResolveColor(const Document& document,
                                        const ComputedStyle& originating_style,
                                        const ComputedStyle* pseudo_style,
                                        PseudoId pseudo,
                                        const CSSProperty& property,
                                        std::optional<Color> current_color) {}

// Returns the used value of the given <color>-valued |property|, taking into
// account forced colors and default highlight colors. If the final result is
// ‘currentColor’, return nullopt so that the color may later be resolved
// against the previous layer.
std::optional<Color> HighlightStyleUtils::MaybeResolveColor(
    const Document& document,
    const ComputedStyle& originating_style,
    const ComputedStyle* pseudo_style,
    PseudoId pseudo,
    const CSSProperty& property) {}

// Returns highlight styles for the given node, inheriting through the “tree” of
// highlight pseudo styles mirroring the originating element tree. None of the
// returned styles are influenced by originating elements or pseudo-elements.
const ComputedStyle* HighlightStyleUtils::HighlightPseudoStyle(
    Node* node,
    const ComputedStyle& style,
    PseudoId pseudo,
    const AtomicString& pseudo_argument) {}

Color HighlightStyleUtils::HighlightBackgroundColor(
    const Document& document,
    const ComputedStyle& style,
    Node* node,
    std::optional<Color> current_layer_color,
    PseudoId pseudo,
    const AtomicString& pseudo_argument) {}

std::optional<AppliedTextDecoration>
HighlightStyleUtils::SelectionTextDecoration(
    const Document& document,
    const ComputedStyle& style,
    const ComputedStyle& pseudo_style) {}

HighlightStyleUtils::HighlightTextPaintStyle
HighlightStyleUtils::HighlightPaintingStyle(
    const Document& document,
    const ComputedStyle& style,
    Node* node,
    PseudoId pseudo,
    const TextPaintStyle& previous_layer_text_style,
    const PaintInfo& paint_info,
    const AtomicString& pseudo_argument) {}

void HighlightStyleUtils::ResolveColorsFromPreviousLayer(
    HighlightTextPaintStyle& text_style,
    const HighlightTextPaintStyle& previous_layer_style) {}

bool HighlightStyleUtils::ShouldInvalidateVisualOverflow(
    const Node& node,
    DocumentMarker::MarkerType type) {}

bool HighlightStyleUtils::CustomHighlightHasVisualOverflow(
    const Node& node,
    const AtomicString& pseudo_argument) {}

}  // namespace blink