#include "ui/views/controls/scrollbar/scroll_bar.h"
#include <algorithm>
#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/containers/flat_map.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/no_destructor.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/canvas.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/menu/menu_item_view.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h"
#include "ui/views/widget/widget.h"
namespace views {
ScrollBar::~ScrollBar() = default;
ScrollBar::Orientation ScrollBar::GetOrientation() const { … }
void ScrollBar::SetThumb(BaseScrollBarThumb* thumb) { … }
bool ScrollBar::ScrollByAmount(ScrollAmount amount) { … }
void ScrollBar::ScrollToThumbPosition(int thumb_position,
bool scroll_to_middle) { … }
bool ScrollBar::ScrollByContentsOffset(int contents_offset) { … }
int ScrollBar::GetMaxPosition() const { … }
int ScrollBar::GetMinPosition() const { … }
int ScrollBar::GetPosition() const { … }
bool ScrollBar::OnMousePressed(const ui::MouseEvent& event) { … }
void ScrollBar::OnMouseReleased(const ui::MouseEvent& event) { … }
void ScrollBar::OnMouseCaptureLost() { … }
bool ScrollBar::OnKeyPressed(const ui::KeyEvent& event) { … }
bool ScrollBar::OnMouseWheel(const ui::MouseWheelEvent& event) { … }
void ScrollBar::OnGestureEvent(ui::GestureEvent* event) { … }
bool ScrollBar::OnScroll(float dx, float dy) { … }
void ScrollBar::OnFlingScrollEnded() { … }
enum ScrollBarContextMenuCommands { … };
void ScrollBar::ShowContextMenuForViewImpl(View* source,
const gfx::Point& p,
ui::MenuSourceType source_type) { … }
bool ScrollBar::IsCommandIdEnabled(int id) const { … }
bool ScrollBar::IsCommandIdChecked(int id) const { … }
void ScrollBar::ExecuteCommand(int id, int event_flags) { … }
bool ScrollBar::OverlapsContent() const { … }
void ScrollBar::Update(int viewport_size,
int content_size,
int contents_scroll_offset) { … }
BaseScrollBarThumb* ScrollBar::GetThumb() const { … }
void ScrollBar::ScrollToPosition(int position) { … }
int ScrollBar::GetScrollIncrement(bool is_page, bool is_positive) { … }
void ScrollBar::ObserveScrollEvent(const ui::ScrollEvent& event) { … }
ScrollAnimator* ScrollBar::GetOrCreateScrollAnimator() { … }
void ScrollBar::SetFlingMultiplier(float fling_multiplier) { … }
ScrollBar::ScrollBar(Orientation orientation)
: … { … }
#if !BUILDFLAG(IS_MAC)
base::RetainingOneShotTimer* ScrollBar::GetHideTimerForTesting(
ScrollBar* scroll_bar) { … }
#endif
int ScrollBar::GetThumbLengthForTesting() { … }
void ScrollBar::ProcessPressEvent(const ui::LocatedEvent& event) { … }
void ScrollBar::TrackClicked() { … }
void ScrollBar::ScrollContentsToOffset() { … }
int ScrollBar::GetTrackSize() const { … }
int ScrollBar::CalculateThumbPosition(int contents_scroll_offset) const { … }
int ScrollBar::CalculateContentsOffset(float thumb_position,
bool scroll_to_middle) const { … }
void ScrollBar::SetContentsScrollOffset(int contents_scroll_offset) { … }
ScrollBar::ScrollAmount ScrollBar::DetermineScrollAmountByKeyCode(
const ui::KeyboardCode& keycode) const { … }
std::optional<int> ScrollBar::GetDesiredScrollOffset(ScrollAmount amount) { … }
BEGIN_METADATA(…)
}