#include "chrome/browser/ui/views/tabs/tab_style_views.h"
#include <algorithm>
#include <utility>
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/strcat.h"
#include "cc/paint/paint_record.h"
#include "cc/paint/paint_shader.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_style.h"
#include "chrome/browser/ui/tabs/tab_types.h"
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/top_container_background.h"
#include "chrome/browser/ui/views/tabs/glow_hover_controller.h"
#include "chrome/browser/ui/views/tabs/tab.h"
#include "chrome/browser/ui/views/tabs/tab_close_button.h"
#include "chrome/browser/ui/views/tabs/tab_group_underline.h"
#include "chrome/browser/ui/views/tabs/tab_slot_controller.h"
#include "chrome/browser/ui/views/tabs/tab_slot_view.h"
#include "chrome/grit/theme_resources.h"
#include "components/tab_groups/tab_group_visual_data.h"
#include "third_party/skia/include/core/SkRRect.h"
#include "third_party/skia/include/core/SkScalar.h"
#include "third_party/skia/include/pathops/SkPathOps.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/views/controls/focus_ring.h"
#include "ui/views/widget/widget.h"
namespace {
ShapeModifier;
constexpr ShapeModifier kNone = …;
constexpr ShapeModifier kNoLowerLeftArc = …;
constexpr ShapeModifier kNoLowerRightArc = …;
constexpr ShapeModifier kCompactLeftArc = …;
template <class T>
bool UpdateValue(T* dest, const T& src) { … }
class TabStyleViewsImpl : public TabStyleViews { … };
TabStyleViewsImpl::TabStyleViewsImpl(Tab* tab)
: … { … }
SkPath TabStyleViewsImpl::GetPath(TabStyle::PathType path_type,
float scale,
bool force_active,
TabStyle::RenderUnits render_units) const { … }
gfx::Insets TabStyleViewsImpl::GetContentsInsets() const { … }
float TabStyleViewsImpl::GetZValue() const { … }
float TabStyleViewsImpl::GetTargetActiveOpacity() const { … }
float TabStyleViewsImpl::GetCurrentActiveOpacity() const { … }
TabActive TabStyleViewsImpl::GetApparentActiveState() const { … }
TabStyle::TabColors TabStyleViewsImpl::CalculateTargetColors() const { … }
void TabStyleViewsImpl::PaintTab(gfx::Canvas* canvas) const { … }
void TabStyleViewsImpl::PaintTabBackgroundWithImages(
gfx::Canvas* canvas,
std::optional<int> active_tab_fill_id,
std::optional<int> inactive_tab_fill_id) const { … }
void TabStyleViewsImpl::SetHoverLocation(const gfx::Point& location) { … }
void TabStyleViewsImpl::ShowHover(TabStyle::ShowHoverStyle style) { … }
void TabStyleViewsImpl::HideHover(TabStyle::HideHoverStyle style) { … }
TabStyle::SeparatorBounds TabStyleViewsImpl::GetSeparatorBounds(
float scale) const { … }
TabStyle::SeparatorOpacities TabStyleViewsImpl::GetSeparatorOpacities(
bool for_layout) const { … }
float TabStyleViewsImpl::GetSeparatorOpacity(bool for_layout,
bool leading) const { … }
float TabStyleViewsImpl::GetHoverInterpolatedSeparatorOpacity(
bool for_layout,
const Tab* other_tab) const { … }
bool TabStyleViewsImpl::ShouldExtendHitTest() const { … }
bool TabStyleViewsImpl::IsHovering() const { … }
bool TabStyleViewsImpl::IsHoverAnimationActive() const { … }
double TabStyleViewsImpl::GetHoverAnimationValue() const { … }
float TabStyleViewsImpl::GetHoverOpacity() const { … }
int TabStyleViewsImpl::GetStrokeThickness(bool should_paint_as_active) const { … }
bool TabStyleViewsImpl::ShouldPaintTabBackgroundColor(
TabStyle::TabSelectionState selection_state,
bool has_custom_background) const { … }
SkColor TabStyleViewsImpl::GetTabSeparatorColor() const { … }
SkColor TabStyleViewsImpl::GetTargetTabBackgroundColor(
const TabStyle::TabSelectionState selection_state,
bool hovered) const { … }
SkColor TabStyleViewsImpl::GetCurrentTabBackgroundColor(
const TabStyle::TabSelectionState selection_state,
bool hovered) const { … }
TabStyle::TabSelectionState TabStyleViewsImpl::GetSelectionState() const { … }
ShapeModifier TabStyleViewsImpl::GetShapeModifier(
TabStyle::PathType path_type) const { … }
void TabStyleViewsImpl::PaintTabBackground(
gfx::Canvas* canvas,
TabStyle::TabSelectionState selection_state,
bool hovered,
std::optional<int> fill_id,
int y_inset) const { … }
void TabStyleViewsImpl::PaintTabBackgroundFill(
gfx::Canvas* canvas,
TabStyle::TabSelectionState selection_state,
bool hovered,
std::optional<int> fill_id,
int y_inset) const { … }
void TabStyleViewsImpl::PaintBackgroundHover(gfx::Canvas* canvas,
float scale) const { … }
void TabStyleViewsImpl::PaintBackgroundStroke(
gfx::Canvas* canvas,
TabStyle::TabSelectionState selection_state,
SkColor stroke_color) const { … }
void TabStyleViewsImpl::PaintSeparators(gfx::Canvas* canvas) const { … }
float TabStyleViewsImpl::GetTopCornerRadiusForWidth(int width) const { … }
gfx::RectF TabStyleViewsImpl::ScaleAndAlignBounds(const gfx::Rect& bounds,
float scale,
int stroke_thickness) const { … }
}
std::u16string ui::metadata::TypeConverter<TabStyle::TabColors>::ToString(
ui::metadata::ArgType<TabStyle::TabColors> source_value) { … }
std::optional<TabStyle::TabColors> ui::metadata::TypeConverter<
TabStyle::TabColors>::FromString(const std::u16string& source_value) { … }
ui::metadata::ValidStrings
ui::metadata::TypeConverter<TabStyle::TabColors>::GetValidStrings() { … }
TabStyleViews::TabStyleViews() : … { … }
TabStyleViews::~TabStyleViews() = default;
std::unique_ptr<TabStyleViews> TabStyleViews::CreateForTab(Tab* tab) { … }