#include "ui/views/border.h"
#include <memory>
#include <utility>
#include "base/check.h"
#include "base/memory/ptr_util.h"
#include "cc/paint/paint_flags.h"
#include "ui/color/color_provider.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/insets_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/views/painter.h"
#include "ui/views/view.h"
namespace views {
namespace {
class SolidSidedBorder : public Border { … };
SolidSidedBorder::SolidSidedBorder(const gfx::Insets& insets, SkColor color)
: … { … }
void SolidSidedBorder::Paint(const View& view, gfx::Canvas* canvas) { … }
gfx::Insets SolidSidedBorder::GetInsets() const { … }
gfx::Size SolidSidedBorder::GetMinimumSize() const { … }
class ThemedSolidSidedBorder : public SolidSidedBorder { … };
ThemedSolidSidedBorder::ThemedSolidSidedBorder(const gfx::Insets& insets,
ui::ColorId color_id)
: … { … }
void ThemedSolidSidedBorder::Paint(const View& view, gfx::Canvas* canvas) { … }
void ThemedSolidSidedBorder::OnViewThemeChanged(View* view) { … }
class RoundedRectBorder : public Border { … };
RoundedRectBorder::RoundedRectBorder(int thickness,
float corner_radius,
const gfx::Insets& paint_insets,
SkColor color)
: … { … }
void RoundedRectBorder::Paint(const View& view, gfx::Canvas* canvas) { … }
gfx::Insets RoundedRectBorder::GetInsets() const { … }
gfx::Size RoundedRectBorder::GetMinimumSize() const { … }
class EmptyBorder : public Border { … };
EmptyBorder::EmptyBorder(const gfx::Insets& insets) : … { … }
void EmptyBorder::Paint(const View& view, gfx::Canvas* canvas) { … }
gfx::Insets EmptyBorder::GetInsets() const { … }
gfx::Size EmptyBorder::GetMinimumSize() const { … }
class ExtraInsetsBorder : public Border { … };
ExtraInsetsBorder::ExtraInsetsBorder(std::unique_ptr<Border> border,
const gfx::Insets& insets)
: … { … }
void ExtraInsetsBorder::Paint(const View& view, gfx::Canvas* canvas) { … }
gfx::Insets ExtraInsetsBorder::GetInsets() const { … }
gfx::Size ExtraInsetsBorder::GetMinimumSize() const { … }
class BorderPainter : public Border { … };
BorderPainter::BorderPainter(std::unique_ptr<Painter> painter,
const gfx::Insets& insets)
: … { … }
void BorderPainter::Paint(const View& view, gfx::Canvas* canvas) { … }
gfx::Insets BorderPainter::GetInsets() const { … }
gfx::Size BorderPainter::GetMinimumSize() const { … }
class ThemedRoundedRectBorder : public RoundedRectBorder { … };
}
Border::Border() = default;
Border::Border(SkColor color) : … { … }
Border::~Border() = default;
void Border::OnViewThemeChanged(View* view) { … }
std::unique_ptr<Border> NullBorder() { … }
std::unique_ptr<Border> CreateSolidBorder(int thickness, SkColor color) { … }
std::unique_ptr<Border> CreateThemedSolidBorder(int thickness,
ui::ColorId color) { … }
std::unique_ptr<Border> CreateEmptyBorder(const gfx::Insets& insets) { … }
std::unique_ptr<Border> CreateEmptyBorder(int thickness) { … }
std::unique_ptr<Border> CreateRoundedRectBorder(int thickness,
float corner_radius,
SkColor color) { … }
std::unique_ptr<Border> CreateRoundedRectBorder(int thickness,
float corner_radius,
const gfx::Insets& paint_insets,
SkColor color) { … }
std::unique_ptr<Border> CreateThemedRoundedRectBorder(int thickness,
float corner_radius,
ui::ColorId color_id) { … }
std::unique_ptr<Border> CreateThemedRoundedRectBorder(
int thickness,
float corner_radius,
const gfx::Insets& paint_insets,
ui::ColorId color_id) { … }
std::unique_ptr<Border> CreateSolidSidedBorder(const gfx::Insets& insets,
SkColor color) { … }
std::unique_ptr<Border> CreateThemedSolidSidedBorder(const gfx::Insets& insets,
ui::ColorId color_id) { … }
std::unique_ptr<Border> CreatePaddedBorder(std::unique_ptr<Border> border,
const gfx::Insets& insets) { … }
std::unique_ptr<Border> CreateBorderPainter(std::unique_ptr<Painter> painter,
const gfx::Insets& insets) { … }
}