chromium/third_party/blink/renderer/core/paint/outline_painter.cc

// Copyright 2014 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/outline_painter.h"

#include <optional>

#include "build/build_config.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h"
#include "third_party/blink/renderer/core/paint/box_border_painter.h"
#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h"
#include "third_party/blink/renderer/core/paint/paint_info.h"
#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h"
#include "third_party/blink/renderer/core/style/border_edge.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/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context_state_saver.h"
#include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h"
#include "third_party/blink/renderer/platform/graphics/path.h"
#include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h"
#include "third_party/blink/renderer/platform/graphics/stroke_data.h"
#include "third_party/blink/renderer/platform/graphics/styled_stroke_data.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/native_theme/native_theme.h"

namespace blink {

namespace {

float FocusRingStrokeWidth(const ComputedStyle& style) {}

float FocusRingOuterStrokeWidth(const ComputedStyle& style) {}

float FocusRingInnerStrokeWidth(const ComputedStyle& style) {}

int FocusRingOffset(const ComputedStyle& style,
                    const LayoutObject::OutlineInfo& info) {}

// A negative outline-offset should not cause the rendered outline shape to
// become smaller than twice the computed value of the outline-width, in each
// direction separately. See: https://drafts.csswg.org/css-ui/#outline-offset
gfx::Outsets AdjustedOutlineOffset(const gfx::Rect& rect, int offset) {}

// Construct a clockwise path along the outer edge of the region covered by
// |rects| expanded by |outline_offset| (which can be negative and clamped by
// the rect size) and |additional_outset| (which should be non-negative).
bool ComputeRightAnglePath(SkPath& path,
                           const Vector<gfx::Rect>& rects,
                           int outline_offset,
                           int additional_outset) {}

Line;

// Merge line2 into line1 if they are in the same straight line.
bool MergeLineIfPossible(Line& line1, const Line& line2) {}

// Iterate a right angle |path| by running |contour_action| on each contour.
// The path contains one or more contours each of which is like (kMove_Verb,
// kLine_Verb, ..., kClose_Verb). Each line must be either horizontal or
// vertical. Each pair of adjacent lines (including the last and the first)
// should either create a right angle or be in the same straight line.
template <typename Action>
void IterateRightAnglePath(const SkPath& path, const Action& contour_action) {}

// Given 3 points defining a right angle corner, returns |p2| shifted to make
// the containing path shrunk by |inset|.
SkPoint ShrinkCorner(const SkPoint& p1,
                     const SkPoint& p2,
                     const SkPoint& p3,
                     int inset) {}

void ShrinkRightAnglePath(SkPath& path, int inset) {}

FloatRoundedRect::Radii ComputeCornerRadii(
    const ComputedStyle& style,
    const PhysicalRect& reference_border_rect,
    float offset) {}

// Given 3 points defining a right angle corner, returns the corresponding
// corner in |convex_radii| or |concave_radii|.
gfx::SizeF GetRadiiCorner(const FloatRoundedRect::Radii& convex_radii,
                          const FloatRoundedRect::Radii& concave_radii,
                          const SkPoint& p1,
                          const SkPoint& p2,
                          const SkPoint& p3) {}

// Shorten |line| between rounded corners.
void AdjustLineBetweenCorners(Line& line,
                              const FloatRoundedRect::Radii& convex_radii,
                              const FloatRoundedRect::Radii& concave_radii,
                              const SkPoint& prev_point,
                              const SkPoint& next_point) {}

// The weight of SkPath::conicTo() to create a 90deg rounded corner arc.
constexpr float kCornerConicWeight =;  // 1/sqrt(2)

// Create a rounded path from a right angle |path| by
// - inserting arc segments for corners;
// - adjusting length of the lines.
void AddCornerRadiiToPath(SkPath& path,
                          const FloatRoundedRect::Radii& convex_radii,
                          const FloatRoundedRect::Radii& concave_radii) {}

// Move |point| so that the length of the line to |other| will be extended by
// |offset|.
void ExtendLineAtEndpoint(SkPoint& point, const SkPoint& other, int offset) {}

// Iterates a rounded outline center path, and for each edge [1] returns the
// path that can be used to stroke the edge.
// [1] An "edge" means a segment of the path, including a horizontal or vertical
// line and approximate halves of its adjacent arcs if any.
class RoundedEdgePathIterator {};

class ComplexOutlinePainter {};

float DefaultFocusRingCornerRadius(const ComputedStyle& style) {}

FloatRoundedRect::Radii GetFocusRingCornerRadii(
    const ComputedStyle& style,
    const PhysicalRect& reference_border_rect,
    const LayoutObject::OutlineInfo& info) {}

void PaintSingleFocusRing(GraphicsContext& context,
                          const Vector<gfx::Rect>& rects,
                          float width,
                          int offset,
                          const FloatRoundedRect::Radii& corner_radii,
                          const Color& color,
                          const AutoDarkMode& auto_dark_mode) {}

void PaintFocusRing(GraphicsContext& context,
                    const Vector<gfx::Rect>& rects,
                    const ComputedStyle& style,
                    const FloatRoundedRect::Radii& corner_radii,
                    const LayoutObject::OutlineInfo& info) {}

}  // anonymous namespace

void OutlinePainter::PaintOutlineRects(
    const PaintInfo& paint_info,
    const DisplayItemClient& client,
    const Vector<PhysicalRect>& outline_rects,
    const LayoutObject::OutlineInfo& info,
    const ComputedStyle& style) {}

void OutlinePainter::PaintFocusRingPath(GraphicsContext& context,
                                        const Path& focus_ring_path,
                                        const ComputedStyle& style) {}

int OutlinePainter::OutlineOutsetExtent(const ComputedStyle& style,
                                        const LayoutObject::OutlineInfo& info) {}

void OutlinePainter::IterateRightAnglePathForTesting(
    const SkPath& path,
    const base::RepeatingCallback<void(const Vector<Line>&)>& contour_action) {}

}  // namespace blink