chromium/chrome/browser/ui/views/tabs/tab_style_views.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {
// How the tab shape path is modified for selected tabs.
ShapeModifier;
// No modification should be done.
constexpr ShapeModifier kNone =;
// Exclude the lower left arc.
constexpr ShapeModifier kNoLowerLeftArc =;
// Exclude the lower right arc.
constexpr ShapeModifier kNoLowerRightArc =;
// shrink the left arc to fit the reduced space without frame
// controls/tabsearch.
constexpr ShapeModifier kCompactLeftArc =;

// Updates a target value, returning true if it changed.
template <class T>
bool UpdateValue(T* dest, const T& src) {}

class TabStyleViewsImpl : public TabStyleViews {};

// TabStyleViewsImpl ----------------------------------------------------------

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 {}

}  // namespace

// static
std::u16string ui::metadata::TypeConverter<TabStyle::TabColors>::ToString(
    ui::metadata::ArgType<TabStyle::TabColors> source_value) {}

// static
std::optional<TabStyle::TabColors> ui::metadata::TypeConverter<
    TabStyle::TabColors>::FromString(const std::u16string& source_value) {}

// static
ui::metadata::ValidStrings
ui::metadata::TypeConverter<TabStyle::TabColors>::GetValidStrings() {}

// TabStyleViews ---------------------------------------------------------------

TabStyleViews::TabStyleViews() :{}

TabStyleViews::~TabStyleViews() = default;

// static
std::unique_ptr<TabStyleViews> TabStyleViews::CreateForTab(Tab* tab) {}