#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 {
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) { … }
}
void TextPainter::Paint(const TextFragmentPaintInfo& fragment_paint_info,
const TextPaintStyle& text_style,
DOMNodeId node_id,
const AutoDarkMode& auto_dark_mode,
ShadowMode shadow_mode) { … }
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() { … }
Color TextPainter::TextColorForWhiteBackground(Color text_color) { … }
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 { … }
}