chromium/third_party/blink/renderer/core/paint/text_painter.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/paint/text_painter.h"

#include "base/auto_reset.h"
#include "base/types/optional_util.h"
#include "cc/paint/paint_flags.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/layout/layout_object_inlines.h"
#include "third_party/blink/renderer/core/layout/svg/layout_svg_inline_text.h"
#include "third_party/blink/renderer/core/layout/svg/svg_layout_support.h"
#include "third_party/blink/renderer/core/layout/svg/svg_resources.h"
#include "third_party/blink/renderer/core/paint/box_painter_base.h"
#include "third_party/blink/renderer/core/paint/decoration_line_painter.h"
#include "third_party/blink/renderer/core/paint/paint_info.h"
#include "third_party/blink/renderer/core/paint/svg_object_painter.h"
#include "third_party/blink/renderer/core/paint/text_paint_style.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing_detector.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style/paint_order_array.h"
#include "third_party/blink/renderer/core/style/shadow_list.h"
#include "third_party/blink/renderer/platform/fonts/font.h"
#include "third_party/blink/renderer/platform/fonts/text_fragment_paint_info.h"
#include "third_party/blink/renderer/platform/graphics/draw_looper_builder.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context_state_saver.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_controller.h"
#include "third_party/blink/renderer/platform/graphics/stroke_data.h"

namespace blink {

namespace {

// We usually use the text decoration thickness to determine how far
// ink-skipped text decorations should be away from the glyph
// contours. Cap this at 5 CSS px in each direction when thickness
// growths larger than that. A value of 13 closely matches FireFox'
// implementation.
constexpr float kDecorationClipMaxDilation =;

class SelectionStyleScope {};

SelectionStyleScope::SelectionStyleScope(const LayoutObject& layout_object,
                                         const ComputedStyle& style,
                                         const ComputedStyle& selection_style)
    :{}

SelectionStyleScope::~SelectionStyleScope() {}

sk_sp<cc::DrawLooper> CreateDrawLooper(
    const ShadowList* shadow_list,
    DrawLooperBuilder::ShadowAlphaMode alpha_mode,
    const Color& current_color,
    mojom::blink::ColorScheme color_scheme,
    TextPainter::ShadowMode shadow_mode) {}

void UpdateGraphicsContext(GraphicsContext& context,
                           const TextPaintStyle& text_style,
                           GraphicsContextStateSaver& state_saver,
                           TextPainter::ShadowMode shadow_mode) {}

enum class SvgPaintMode {};

void PrepareStrokeGeometry(const TextPainter::SvgTextPaintState& state,
                           const ComputedStyle& style,
                           const LayoutObject& layout_parent,
                           SvgPaintMode svg_paint_mode,
                           cc::PaintFlags& flags) {}

const ShadowList* GetTextShadows(const ComputedStyle& style,
                                 const LayoutObject& layout_parent) {}

void PrepareTextShadow(const ShadowList* text_shadows,
                       const ComputedStyle& style,
                       cc::PaintFlags& flags) {}

struct SvgPaints {};

void PrepareSvgPaints(const TextPainter::SvgTextPaintState& state,
                      const SvgContextPaints* context_paints,
                      SvgPaintMode paint_mode,
                      SvgPaints& paints) {}

OrderedPaints;

OrderedPaints OrderPaints(const SvgPaints& paints, EPaintOrder paint_order) {}

template <typename PassFunction>
void DrawPaintOrderPasses(const OrderedPaints& ordered_paints,
                          PassFunction pass) {}

}  // namespace

void TextPainter::Paint(const TextFragmentPaintInfo& fragment_paint_info,
                        const TextPaintStyle& text_style,
                        DOMNodeId node_id,
                        const AutoDarkMode& auto_dark_mode,
                        ShadowMode shadow_mode) {}

// This function paints text twice with different styles in order to:
// 1. Paint glyphs inside of |selection_rect| using |selection_style|, and
//    outside using |text_style|.
// 2. Paint parts of a ligature glyph.
void TextPainter::PaintSelectedText(
    const TextFragmentPaintInfo& fragment_paint_info,
    unsigned selection_start,
    unsigned selection_end,
    const TextPaintStyle& text_style,
    const TextPaintStyle& selection_style,
    const LineRelativeRect& selection_rect,
    DOMNodeId node_id,
    const AutoDarkMode& auto_dark_mode) {}

void TextPainter::SetEmphasisMark(const AtomicString& emphasis_mark,
                                  TextEmphasisPosition position) {}

void TextPainter::PaintDecorationLine(
    const TextDecorationInfo& decoration_info,
    const Color& line_color,
    const TextFragmentPaintInfo* fragment_paint_info) {}

void TextPainter::ClipDecorationsStripe(
    const TextFragmentPaintInfo& fragment_paint_info,
    float upper,
    float stripe_width,
    float dilation) {}

void TextPainter::PaintSvgTextFragment(
    const TextFragmentPaintInfo& fragment_paint_info,
    DOMNodeId node_id,
    const AutoDarkMode& auto_dark_mode) {}

TextPainter::SvgTextPaintState& TextPainter::SetSvgState(
    const LayoutSVGInlineText& svg_inline_text,
    const ComputedStyle& style,
    StyleVariant style_variant,
    PaintFlags paint_flags) {}

TextPainter::SvgTextPaintState& TextPainter::SetSvgState(
    const LayoutSVGInlineText& svg_inline_text,
    const ComputedStyle& style,
    Color text_match_color) {}

TextPainter::SvgTextPaintState* TextPainter::GetSvgState() {}

// static
Color TextPainter::TextColorForWhiteBackground(Color text_color) {}

// static
TextPaintStyle TextPainter::TextPaintingStyle(const Document& document,
                                              const ComputedStyle& style,
                                              const PaintInfo& paint_info) {}

TextPainter::SvgTextPaintState::SvgTextPaintState(
    const LayoutSVGInlineText& layout_svg_inline_text,
    const ComputedStyle& style,
    StyleVariant style_variant,
    PaintFlags paint_flags)
    :{}

TextPainter::SvgTextPaintState::SvgTextPaintState(
    const LayoutSVGInlineText& layout_svg_inline_text,
    const ComputedStyle& style,
    Color text_match_color)
    :{}

const LayoutSVGInlineText& TextPainter::SvgTextPaintState::InlineText() const {}

const LayoutObject& TextPainter::SvgTextPaintState::TextDecorationObject()
    const {}

const ComputedStyle& TextPainter::SvgTextPaintState::Style() const {}

bool TextPainter::SvgTextPaintState::IsPaintingSelection() const {}

PaintFlags TextPainter::SvgTextPaintState::GetPaintFlags() const {}

bool TextPainter::SvgTextPaintState::IsRenderingClipPathAsMaskImage() const {}

bool TextPainter::SvgTextPaintState::IsPaintingTextMatch() const {}

Color TextPainter::SvgTextPaintState::TextMatchColor() const {}

AffineTransform& TextPainter::SvgTextPaintState::EnsureShaderTransform() {}

const AffineTransform* TextPainter::SvgTextPaintState::GetShaderTransform()
    const {}

}  // namespace blink