Commit 9e976aa3 authored by Jeremy Roman's avatar Jeremy Roman Committed by Commit Bot

Squash ScrollbarThemeClient into Scrollbar.

Bug: 841751
Change-Id: I6913fa775c3783f10d98a701479e403ca6fc92fc
Reviewed-on: https://chromium-review.googlesource.com/1054146
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559318}
parent c2a8a1ed
...@@ -99,7 +99,7 @@ class LayoutScrollbar final : public Scrollbar { ...@@ -99,7 +99,7 @@ class LayoutScrollbar final : public Scrollbar {
}; };
DEFINE_TYPE_CASTS(LayoutScrollbar, DEFINE_TYPE_CASTS(LayoutScrollbar,
ScrollbarThemeClient, Scrollbar,
scrollbar, scrollbar,
scrollbar->IsCustomScrollbar(), scrollbar->IsCustomScrollbar(),
scrollbar.IsCustomScrollbar()); scrollbar.IsCustomScrollbar());
......
...@@ -39,10 +39,9 @@ LayoutScrollbarTheme* LayoutScrollbarTheme::GetLayoutScrollbarTheme() { ...@@ -39,10 +39,9 @@ LayoutScrollbarTheme* LayoutScrollbarTheme::GetLayoutScrollbarTheme() {
return &theme; return &theme;
} }
void LayoutScrollbarTheme::ButtonSizesAlongTrackAxis( void LayoutScrollbarTheme::ButtonSizesAlongTrackAxis(const Scrollbar& scrollbar,
const ScrollbarThemeClient& scrollbar, int& before_size,
int& before_size, int& after_size) {
int& after_size) {
IntRect first_button = BackButtonRect(scrollbar, kBackButtonStartPart); IntRect first_button = BackButtonRect(scrollbar, kBackButtonStartPart);
IntRect second_button = ForwardButtonRect(scrollbar, kForwardButtonStartPart); IntRect second_button = ForwardButtonRect(scrollbar, kForwardButtonStartPart);
IntRect third_button = BackButtonRect(scrollbar, kBackButtonEndPart); IntRect third_button = BackButtonRect(scrollbar, kBackButtonEndPart);
...@@ -56,7 +55,7 @@ void LayoutScrollbarTheme::ButtonSizesAlongTrackAxis( ...@@ -56,7 +55,7 @@ void LayoutScrollbarTheme::ButtonSizesAlongTrackAxis(
} }
} }
bool LayoutScrollbarTheme::HasButtons(const ScrollbarThemeClient& scrollbar) { bool LayoutScrollbarTheme::HasButtons(const Scrollbar& scrollbar) {
int start_size; int start_size;
int end_size; int end_size;
ButtonSizesAlongTrackAxis(scrollbar, start_size, end_size); ButtonSizesAlongTrackAxis(scrollbar, start_size, end_size);
...@@ -65,31 +64,27 @@ bool LayoutScrollbarTheme::HasButtons(const ScrollbarThemeClient& scrollbar) { ...@@ -65,31 +64,27 @@ bool LayoutScrollbarTheme::HasButtons(const ScrollbarThemeClient& scrollbar) {
: scrollbar.Height()); : scrollbar.Height());
} }
bool LayoutScrollbarTheme::HasThumb(const ScrollbarThemeClient& scrollbar) { bool LayoutScrollbarTheme::HasThumb(const Scrollbar& scrollbar) {
return TrackLength(scrollbar) - ThumbLength(scrollbar) >= 0; return TrackLength(scrollbar) - ThumbLength(scrollbar) >= 0;
} }
int LayoutScrollbarTheme::MinimumThumbLength( int LayoutScrollbarTheme::MinimumThumbLength(const Scrollbar& scrollbar) {
const ScrollbarThemeClient& scrollbar) {
return ToLayoutScrollbar(scrollbar).MinimumThumbLength(); return ToLayoutScrollbar(scrollbar).MinimumThumbLength();
} }
IntRect LayoutScrollbarTheme::BackButtonRect( IntRect LayoutScrollbarTheme::BackButtonRect(const Scrollbar& scrollbar,
const ScrollbarThemeClient& scrollbar, ScrollbarPart part_type,
ScrollbarPart part_type, bool) {
bool) {
return ToLayoutScrollbar(scrollbar).ButtonRect(part_type); return ToLayoutScrollbar(scrollbar).ButtonRect(part_type);
} }
IntRect LayoutScrollbarTheme::ForwardButtonRect( IntRect LayoutScrollbarTheme::ForwardButtonRect(const Scrollbar& scrollbar,
const ScrollbarThemeClient& scrollbar, ScrollbarPart part_type,
ScrollbarPart part_type, bool) {
bool) {
return ToLayoutScrollbar(scrollbar).ButtonRect(part_type); return ToLayoutScrollbar(scrollbar).ButtonRect(part_type);
} }
IntRect LayoutScrollbarTheme::TrackRect(const ScrollbarThemeClient& scrollbar, IntRect LayoutScrollbarTheme::TrackRect(const Scrollbar& scrollbar, bool) {
bool) {
if (!HasButtons(scrollbar)) if (!HasButtons(scrollbar))
return scrollbar.FrameRect(); return scrollbar.FrameRect();
...@@ -101,7 +96,7 @@ IntRect LayoutScrollbarTheme::TrackRect(const ScrollbarThemeClient& scrollbar, ...@@ -101,7 +96,7 @@ IntRect LayoutScrollbarTheme::TrackRect(const ScrollbarThemeClient& scrollbar,
} }
IntRect LayoutScrollbarTheme::ConstrainTrackRectToTrackPieces( IntRect LayoutScrollbarTheme::ConstrainTrackRectToTrackPieces(
const ScrollbarThemeClient& scrollbar, const Scrollbar& scrollbar,
const IntRect& rect) { const IntRect& rect) {
IntRect back_rect = ToLayoutScrollbar(scrollbar).TrackPieceRectWithMargins( IntRect back_rect = ToLayoutScrollbar(scrollbar).TrackPieceRectWithMargins(
kBackTrackPart, rect); kBackTrackPart, rect);
......
...@@ -49,12 +49,12 @@ class LayoutScrollbarTheme final : public ScrollbarTheme { ...@@ -49,12 +49,12 @@ class LayoutScrollbarTheme final : public ScrollbarTheme {
const DisplayItemClient&, const DisplayItemClient&,
const IntRect& corner_rect) override; const IntRect& corner_rect) override;
bool ShouldCenterOnThumb(const ScrollbarThemeClient& scrollbar, bool ShouldCenterOnThumb(const Scrollbar& scrollbar,
const WebMouseEvent& event) override { const WebMouseEvent& event) override {
return ScrollbarTheme::DeprecatedStaticGetTheme().ShouldCenterOnThumb( return ScrollbarTheme::DeprecatedStaticGetTheme().ShouldCenterOnThumb(
scrollbar, event); scrollbar, event);
} }
bool ShouldSnapBackToDragOrigin(const ScrollbarThemeClient& scrollbar, bool ShouldSnapBackToDragOrigin(const Scrollbar& scrollbar,
const WebMouseEvent& event) override { const WebMouseEvent& event) override {
return ScrollbarTheme::DeprecatedStaticGetTheme() return ScrollbarTheme::DeprecatedStaticGetTheme()
.ShouldSnapBackToDragOrigin(scrollbar, event); .ShouldSnapBackToDragOrigin(scrollbar, event);
...@@ -68,35 +68,34 @@ class LayoutScrollbarTheme final : public ScrollbarTheme { ...@@ -68,35 +68,34 @@ class LayoutScrollbarTheme final : public ScrollbarTheme {
return ScrollbarTheme::DeprecatedStaticGetTheme().AutoscrollTimerDelay(); return ScrollbarTheme::DeprecatedStaticGetTheme().AutoscrollTimerDelay();
} }
void RegisterScrollbar(ScrollbarThemeClient& scrollbar) override { void RegisterScrollbar(Scrollbar& scrollbar) override {
return ScrollbarTheme::DeprecatedStaticGetTheme().RegisterScrollbar( return ScrollbarTheme::DeprecatedStaticGetTheme().RegisterScrollbar(
scrollbar); scrollbar);
} }
void UnregisterScrollbar(ScrollbarThemeClient& scrollbar) override { void UnregisterScrollbar(Scrollbar& scrollbar) override {
return ScrollbarTheme::DeprecatedStaticGetTheme().UnregisterScrollbar( return ScrollbarTheme::DeprecatedStaticGetTheme().UnregisterScrollbar(
scrollbar); scrollbar);
} }
int MinimumThumbLength(const ScrollbarThemeClient&) override; int MinimumThumbLength(const Scrollbar&) override;
void ButtonSizesAlongTrackAxis(const ScrollbarThemeClient&, void ButtonSizesAlongTrackAxis(const Scrollbar&,
int& before_size, int& before_size,
int& after_size); int& after_size);
static LayoutScrollbarTheme* GetLayoutScrollbarTheme(); static LayoutScrollbarTheme* GetLayoutScrollbarTheme();
protected: protected:
bool HasButtons(const ScrollbarThemeClient&) override; bool HasButtons(const Scrollbar&) override;
bool HasThumb(const ScrollbarThemeClient&) override; bool HasThumb(const Scrollbar&) override;
IntRect BackButtonRect(const ScrollbarThemeClient&, IntRect BackButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool painting = false) override; bool painting = false) override;
IntRect ForwardButtonRect(const ScrollbarThemeClient&, IntRect ForwardButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool painting = false) override; bool painting = false) override;
IntRect TrackRect(const ScrollbarThemeClient&, IntRect TrackRect(const Scrollbar&, bool painting = false) override;
bool painting = false) override;
void PaintScrollbarBackground(GraphicsContext&, const Scrollbar&) override; void PaintScrollbarBackground(GraphicsContext&, const Scrollbar&) override;
void PaintTrackBackground(GraphicsContext&, void PaintTrackBackground(GraphicsContext&,
...@@ -115,7 +114,7 @@ class LayoutScrollbarTheme final : public ScrollbarTheme { ...@@ -115,7 +114,7 @@ class LayoutScrollbarTheme final : public ScrollbarTheme {
const Scrollbar&, const Scrollbar&,
const IntRect&) override; const IntRect&) override;
IntRect ConstrainTrackRectToTrackPieces(const ScrollbarThemeClient&, IntRect ConstrainTrackRectToTrackPieces(const Scrollbar&,
const IntRect&) override; const IntRect&) override;
}; };
......
...@@ -1317,7 +1317,6 @@ jumbo_component("platform") { ...@@ -1317,7 +1317,6 @@ jumbo_component("platform") {
"scroll/scrollbar_theme_android.cc", "scroll/scrollbar_theme_android.cc",
"scroll/scrollbar_theme_aura.cc", "scroll/scrollbar_theme_aura.cc",
"scroll/scrollbar_theme_aura.h", "scroll/scrollbar_theme_aura.h",
"scroll/scrollbar_theme_client.h",
"scroll/scrollbar_theme_mac.h", "scroll/scrollbar_theme_mac.h",
"scroll/scrollbar_theme_mac.mm", "scroll/scrollbar_theme_mac.mm",
"scroll/scrollbar_theme_mock.cc", "scroll/scrollbar_theme_mock.cc",
......
...@@ -30,7 +30,7 @@ class ScrollbarThemeWithMockInvalidation : public ScrollbarThemeMock { ...@@ -30,7 +30,7 @@ class ScrollbarThemeWithMockInvalidation : public ScrollbarThemeMock {
public: public:
MOCK_CONST_METHOD0(ShouldRepaintAllPartsOnInvalidation, bool()); MOCK_CONST_METHOD0(ShouldRepaintAllPartsOnInvalidation, bool());
MOCK_CONST_METHOD3(InvalidateOnThumbPositionChange, MOCK_CONST_METHOD3(InvalidateOnThumbPositionChange,
ScrollbarPart(const ScrollbarThemeClient&, float, float)); ScrollbarPart(const Scrollbar&, float, float));
}; };
} // namespace } // namespace
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "third_party/blink/renderer/platform/graphics/paint/display_item.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/scroll/scroll_types.h" #include "third_party/blink/renderer/platform/scroll/scroll_types.h"
#include "third_party/blink/renderer/platform/scroll/scrollbar_theme_client.h"
#include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/timer.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h"
...@@ -45,7 +44,6 @@ class WebGestureEvent; ...@@ -45,7 +44,6 @@ class WebGestureEvent;
class WebMouseEvent; class WebMouseEvent;
class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>, class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>,
public ScrollbarThemeClient,
public DisplayItemClient { public DisplayItemClient {
public: public:
static Scrollbar* Create(ScrollableArea* scrollable_area, static Scrollbar* Create(ScrollableArea* scrollable_area,
...@@ -66,41 +64,40 @@ class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>, ...@@ -66,41 +64,40 @@ class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>,
~Scrollbar() override; ~Scrollbar() override;
// ScrollbarThemeClient implementation. int X() const { return frame_rect_.X(); }
int X() const override { return frame_rect_.X(); } int Y() const { return frame_rect_.Y(); }
int Y() const override { return frame_rect_.Y(); } int Width() const { return frame_rect_.Width(); }
int Width() const override { return frame_rect_.Width(); } int Height() const { return frame_rect_.Height(); }
int Height() const override { return frame_rect_.Height(); } IntSize Size() const { return frame_rect_.Size(); }
IntSize Size() const override { return frame_rect_.Size(); } IntPoint Location() const { return frame_rect_.Location(); }
IntPoint Location() const override { return frame_rect_.Location(); }
void SetFrameRect(const IntRect&) override; void SetFrameRect(const IntRect&);
IntRect FrameRect() const override { return frame_rect_; } const IntRect& FrameRect() const { return frame_rect_; }
ScrollbarOverlayColorTheme GetScrollbarOverlayColorTheme() const override; ScrollbarOverlayColorTheme GetScrollbarOverlayColorTheme() const;
void GetTickmarks(Vector<IntRect>&) const override; void GetTickmarks(Vector<IntRect>&) const;
bool IsScrollableAreaActive() const override; bool IsScrollableAreaActive() const;
IntPoint ConvertFromRootFrame(const IntPoint&) const override; IntPoint ConvertFromRootFrame(const IntPoint&) const;
bool IsCustomScrollbar() const override { return false; } virtual bool IsCustomScrollbar() const { return false; }
ScrollbarOrientation Orientation() const override { return orientation_; } ScrollbarOrientation Orientation() const { return orientation_; }
bool IsLeftSideVerticalScrollbar() const override; bool IsLeftSideVerticalScrollbar() const;
int Value() const override { return lroundf(current_pos_); } int Value() const { return lroundf(current_pos_); }
float CurrentPos() const override { return current_pos_; } float CurrentPos() const { return current_pos_; }
int VisibleSize() const override { return visible_size_; } int VisibleSize() const { return visible_size_; }
int TotalSize() const override { return total_size_; } int TotalSize() const { return total_size_; }
int Maximum() const override { return total_size_ - visible_size_; } int Maximum() const { return total_size_ - visible_size_; }
ScrollbarControlSize GetControlSize() const override { return control_size_; } ScrollbarControlSize GetControlSize() const { return control_size_; }
ScrollbarPart PressedPart() const override { return pressed_part_; } ScrollbarPart PressedPart() const { return pressed_part_; }
ScrollbarPart HoveredPart() const override { return hovered_part_; } ScrollbarPart HoveredPart() const { return hovered_part_; }
void StyleChanged() override {} virtual void StyleChanged() {}
void SetScrollbarsHiddenIfOverlay(bool) override; void SetScrollbarsHiddenIfOverlay(bool);
bool Enabled() const override { return enabled_; } bool Enabled() const { return enabled_; }
void SetEnabled(bool) override; virtual void SetEnabled(bool);
// This returns device-scale-factor-aware pixel value. // This returns device-scale-factor-aware pixel value.
// e.g. 15 in dsf=1.0, 30 in dsf=2.0. // e.g. 15 in dsf=1.0, 30 in dsf=2.0.
...@@ -125,7 +122,7 @@ class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>, ...@@ -125,7 +122,7 @@ class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>,
void Paint(GraphicsContext&, const CullRect&) const; void Paint(GraphicsContext&, const CullRect&) const;
bool IsOverlayScrollbar() const override; virtual bool IsOverlayScrollbar() const;
bool ShouldParticipateInHitTesting(); bool ShouldParticipateInHitTesting();
bool IsWindowActive() const; bool IsWindowActive() const;
...@@ -155,8 +152,8 @@ class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>, ...@@ -155,8 +152,8 @@ class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>,
void MoveThumb(int pos, bool dragging_document = false); void MoveThumb(int pos, bool dragging_document = false);
float ElasticOverscroll() const override { return elastic_overscroll_; } float ElasticOverscroll() const { return elastic_overscroll_; }
void SetElasticOverscroll(float elastic_overscroll) override { void SetElasticOverscroll(float elastic_overscroll) {
elastic_overscroll_ = elastic_overscroll; elastic_overscroll_ = elastic_overscroll;
} }
...@@ -234,11 +231,6 @@ class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>, ...@@ -234,11 +231,6 @@ class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>,
float elastic_overscroll_; float elastic_overscroll_;
private: private:
void Invalidate() override { SetNeedsPaintInvalidation(kAllParts); }
void InvalidateRect(const IntRect&) override {
SetNeedsPaintInvalidation(kAllParts);
}
float ScrollableAreaCurrentPos() const; float ScrollableAreaCurrentPos() const;
float ScrollableAreaTargetPos() const; float ScrollableAreaTargetPos() const;
bool ThumbWillBeUnderMouse() const; bool ThumbWillBeUnderMouse() const;
......
...@@ -141,7 +141,7 @@ bool ScrollbarTheme::Paint(const Scrollbar& scrollbar, ...@@ -141,7 +141,7 @@ bool ScrollbarTheme::Paint(const Scrollbar& scrollbar,
return true; return true;
} }
ScrollbarPart ScrollbarTheme::HitTest(const ScrollbarThemeClient& scrollbar, ScrollbarPart ScrollbarTheme::HitTest(const Scrollbar& scrollbar,
const IntPoint& position_in_root_frame) { const IntPoint& position_in_root_frame) {
ScrollbarPart result = kNoPart; ScrollbarPart result = kNoPart;
if (!scrollbar.Enabled()) if (!scrollbar.Enabled())
...@@ -209,7 +209,7 @@ void ScrollbarTheme::PaintScrollCorner( ...@@ -209,7 +209,7 @@ void ScrollbarTheme::PaintScrollCorner(
#endif #endif
} }
bool ScrollbarTheme::ShouldCenterOnThumb(const ScrollbarThemeClient& scrollbar, bool ScrollbarTheme::ShouldCenterOnThumb(const Scrollbar& scrollbar,
const WebMouseEvent& evt) { const WebMouseEvent& evt) {
return Platform::Current()->ScrollbarBehavior()->ShouldCenterOnThumb( return Platform::Current()->ScrollbarBehavior()->ShouldCenterOnThumb(
evt.button, evt.GetModifiers() & WebInputEvent::kShiftKey, evt.button, evt.GetModifiers() & WebInputEvent::kShiftKey,
...@@ -260,9 +260,8 @@ void ScrollbarTheme::PaintTickmarks(GraphicsContext& context, ...@@ -260,9 +260,8 @@ void ScrollbarTheme::PaintTickmarks(GraphicsContext& context,
#endif #endif
} }
bool ScrollbarTheme::ShouldSnapBackToDragOrigin( bool ScrollbarTheme::ShouldSnapBackToDragOrigin(const Scrollbar& scrollbar,
const ScrollbarThemeClient& scrollbar, const WebMouseEvent& evt) {
const WebMouseEvent& evt) {
IntPoint mouse_position = scrollbar.ConvertFromRootFrame( IntPoint mouse_position = scrollbar.ConvertFromRootFrame(
FlooredIntPoint(evt.PositionInRootFrame())); FlooredIntPoint(evt.PositionInRootFrame()));
mouse_position.Move(scrollbar.X(), scrollbar.Y()); mouse_position.Move(scrollbar.X(), scrollbar.Y());
...@@ -281,7 +280,7 @@ double ScrollbarTheme::OverlayScrollbarFadeOutDurationSeconds() const { ...@@ -281,7 +280,7 @@ double ScrollbarTheme::OverlayScrollbarFadeOutDurationSeconds() const {
return 0.0; return 0.0;
} }
int ScrollbarTheme::ThumbPosition(const ScrollbarThemeClient& scrollbar, int ScrollbarTheme::ThumbPosition(const Scrollbar& scrollbar,
float scroll_position) { float scroll_position) {
if (scrollbar.Enabled()) { if (scrollbar.Enabled()) {
float size = scrollbar.TotalSize() - scrollbar.VisibleSize(); float size = scrollbar.TotalSize() - scrollbar.VisibleSize();
...@@ -296,7 +295,7 @@ int ScrollbarTheme::ThumbPosition(const ScrollbarThemeClient& scrollbar, ...@@ -296,7 +295,7 @@ int ScrollbarTheme::ThumbPosition(const ScrollbarThemeClient& scrollbar,
return 0; return 0;
} }
int ScrollbarTheme::ThumbLength(const ScrollbarThemeClient& scrollbar) { int ScrollbarTheme::ThumbLength(const Scrollbar& scrollbar) {
if (!scrollbar.Enabled()) if (!scrollbar.Enabled())
return 0; return 0;
...@@ -315,7 +314,7 @@ int ScrollbarTheme::ThumbLength(const ScrollbarThemeClient& scrollbar) { ...@@ -315,7 +314,7 @@ int ScrollbarTheme::ThumbLength(const ScrollbarThemeClient& scrollbar) {
return length; return length;
} }
int ScrollbarTheme::TrackPosition(const ScrollbarThemeClient& scrollbar) { int ScrollbarTheme::TrackPosition(const Scrollbar& scrollbar) {
IntRect constrained_track_rect = IntRect constrained_track_rect =
ConstrainTrackRectToTrackPieces(scrollbar, TrackRect(scrollbar)); ConstrainTrackRectToTrackPieces(scrollbar, TrackRect(scrollbar));
return (scrollbar.Orientation() == kHorizontalScrollbar) return (scrollbar.Orientation() == kHorizontalScrollbar)
...@@ -323,7 +322,7 @@ int ScrollbarTheme::TrackPosition(const ScrollbarThemeClient& scrollbar) { ...@@ -323,7 +322,7 @@ int ScrollbarTheme::TrackPosition(const ScrollbarThemeClient& scrollbar) {
: constrained_track_rect.Y() - scrollbar.Y(); : constrained_track_rect.Y() - scrollbar.Y();
} }
int ScrollbarTheme::TrackLength(const ScrollbarThemeClient& scrollbar) { int ScrollbarTheme::TrackLength(const Scrollbar& scrollbar) {
IntRect constrained_track_rect = IntRect constrained_track_rect =
ConstrainTrackRectToTrackPieces(scrollbar, TrackRect(scrollbar)); ConstrainTrackRectToTrackPieces(scrollbar, TrackRect(scrollbar));
return (scrollbar.Orientation() == kHorizontalScrollbar) return (scrollbar.Orientation() == kHorizontalScrollbar)
...@@ -331,7 +330,7 @@ int ScrollbarTheme::TrackLength(const ScrollbarThemeClient& scrollbar) { ...@@ -331,7 +330,7 @@ int ScrollbarTheme::TrackLength(const ScrollbarThemeClient& scrollbar) {
: constrained_track_rect.Height(); : constrained_track_rect.Height();
} }
IntRect ScrollbarTheme::ThumbRect(const ScrollbarThemeClient& scrollbar) { IntRect ScrollbarTheme::ThumbRect(const Scrollbar& scrollbar) {
if (!HasThumb(scrollbar)) if (!HasThumb(scrollbar))
return IntRect(); return IntRect();
...@@ -344,13 +343,13 @@ IntRect ScrollbarTheme::ThumbRect(const ScrollbarThemeClient& scrollbar) { ...@@ -344,13 +343,13 @@ IntRect ScrollbarTheme::ThumbRect(const ScrollbarThemeClient& scrollbar) {
return thumb_rect; return thumb_rect;
} }
int ScrollbarTheme::ThumbThickness(const ScrollbarThemeClient& scrollbar) { int ScrollbarTheme::ThumbThickness(const Scrollbar& scrollbar) {
IntRect track = TrackRect(scrollbar); IntRect track = TrackRect(scrollbar);
return scrollbar.Orientation() == kHorizontalScrollbar ? track.Height() return scrollbar.Orientation() == kHorizontalScrollbar ? track.Height()
: track.Width(); : track.Width();
} }
void ScrollbarTheme::SplitTrack(const ScrollbarThemeClient& scrollbar, void ScrollbarTheme::SplitTrack(const Scrollbar& scrollbar,
const IntRect& unconstrained_track_rect, const IntRect& unconstrained_track_rect,
IntRect& before_thumb_rect, IntRect& before_thumb_rect,
IntRect& thumb_rect, IntRect& thumb_rect,
......
...@@ -52,11 +52,11 @@ class PLATFORM_EXPORT ScrollbarTheme { ...@@ -52,11 +52,11 @@ class PLATFORM_EXPORT ScrollbarTheme {
// which are explicitly invalidated will be repainted. // which are explicitly invalidated will be repainted.
virtual bool ShouldRepaintAllPartsOnInvalidation() const { return true; } virtual bool ShouldRepaintAllPartsOnInvalidation() const { return true; }
virtual void UpdateEnabledState(const ScrollbarThemeClient&) {} virtual void UpdateEnabledState(const Scrollbar&) {}
virtual bool Paint(const Scrollbar&, GraphicsContext&, const CullRect&); virtual bool Paint(const Scrollbar&, GraphicsContext&, const CullRect&);
virtual ScrollbarPart HitTest(const ScrollbarThemeClient&, const IntPoint&); virtual ScrollbarPart HitTest(const Scrollbar&, const IntPoint&);
// This returns a fixed value regardless of device-scale-factor. // This returns a fixed value regardless of device-scale-factor.
// This returns thickness when scrollbar is painted. i.e. It's not 0 even in // This returns thickness when scrollbar is painted. i.e. It's not 0 even in
...@@ -73,7 +73,7 @@ class PLATFORM_EXPORT ScrollbarTheme { ...@@ -73,7 +73,7 @@ class PLATFORM_EXPORT ScrollbarTheme {
virtual bool SupportsControlTints() const { return false; } virtual bool SupportsControlTints() const { return false; }
virtual bool UsesOverlayScrollbars() const { return false; } virtual bool UsesOverlayScrollbars() const { return false; }
virtual void UpdateScrollbarOverlayColorTheme(const ScrollbarThemeClient&) {} virtual void UpdateScrollbarOverlayColorTheme(const Scrollbar&) {}
// If true, scrollbars that become invisible (i.e. overlay scrollbars that // If true, scrollbars that become invisible (i.e. overlay scrollbars that
// fade out) should be marked as disabled. This option exists since Mac and // fade out) should be marked as disabled. This option exists since Mac and
...@@ -88,7 +88,7 @@ class PLATFORM_EXPORT ScrollbarTheme { ...@@ -88,7 +88,7 @@ class PLATFORM_EXPORT ScrollbarTheme {
// Returns parts of the scrollbar which must be repainted following a change // Returns parts of the scrollbar which must be repainted following a change
// in the thumb position, given scroll positions before and after. // in the thumb position, given scroll positions before and after.
virtual ScrollbarPart InvalidateOnThumbPositionChange( virtual ScrollbarPart InvalidateOnThumbPositionChange(
const ScrollbarThemeClient&, const Scrollbar&,
float old_position, float old_position,
float new_position) const { float new_position) const {
return kAllParts; return kAllParts;
...@@ -101,51 +101,49 @@ class PLATFORM_EXPORT ScrollbarTheme { ...@@ -101,51 +101,49 @@ class PLATFORM_EXPORT ScrollbarTheme {
const Scrollbar&, const Scrollbar&,
const IntRect&); const IntRect&);
virtual bool ShouldCenterOnThumb(const ScrollbarThemeClient&, virtual bool ShouldCenterOnThumb(const Scrollbar&, const WebMouseEvent&);
const WebMouseEvent&); virtual bool ShouldSnapBackToDragOrigin(const Scrollbar&,
virtual bool ShouldSnapBackToDragOrigin(const ScrollbarThemeClient&,
const WebMouseEvent&); const WebMouseEvent&);
virtual bool ShouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient&, virtual bool ShouldDragDocumentInsteadOfThumb(const Scrollbar&,
const WebMouseEvent&) { const WebMouseEvent&) {
return false; return false;
} }
// The position of the thumb relative to the track. // The position of the thumb relative to the track.
int ThumbPosition(const ScrollbarThemeClient& scrollbar) { int ThumbPosition(const Scrollbar& scrollbar) {
return ThumbPosition(scrollbar, scrollbar.CurrentPos()); return ThumbPosition(scrollbar, scrollbar.CurrentPos());
} }
virtual double OverlayScrollbarFadeOutDelaySeconds() const; virtual double OverlayScrollbarFadeOutDelaySeconds() const;
virtual double OverlayScrollbarFadeOutDurationSeconds() const; virtual double OverlayScrollbarFadeOutDurationSeconds() const;
// The position the thumb would have, relative to the track, at the specified // The position the thumb would have, relative to the track, at the specified
// scroll position. // scroll position.
virtual int ThumbPosition(const ScrollbarThemeClient&, float scroll_position); virtual int ThumbPosition(const Scrollbar&, float scroll_position);
// The length of the thumb along the axis of the scrollbar. // The length of the thumb along the axis of the scrollbar.
virtual int ThumbLength(const ScrollbarThemeClient&); virtual int ThumbLength(const Scrollbar&);
// The position of the track relative to the scrollbar. // The position of the track relative to the scrollbar.
virtual int TrackPosition(const ScrollbarThemeClient&); virtual int TrackPosition(const Scrollbar&);
// The length of the track along the axis of the scrollbar. // The length of the track along the axis of the scrollbar.
virtual int TrackLength(const ScrollbarThemeClient&); virtual int TrackLength(const Scrollbar&);
// The opacity to be applied to the thumb. A theme overriding ThumbOpacity() // The opacity to be applied to the thumb. A theme overriding ThumbOpacity()
// should also override PaintThumbWithOpacity(). // should also override PaintThumbWithOpacity().
virtual float ThumbOpacity(const ScrollbarThemeClient&) const { return 1.0f; } virtual float ThumbOpacity(const Scrollbar&) const { return 1.0f; }
virtual bool HasButtons(const ScrollbarThemeClient&) = 0; virtual bool HasButtons(const Scrollbar&) = 0;
virtual bool HasThumb(const ScrollbarThemeClient&) = 0; virtual bool HasThumb(const Scrollbar&) = 0;
virtual IntRect BackButtonRect(const ScrollbarThemeClient&, virtual IntRect BackButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool painting = false) = 0; bool painting = false) = 0;
virtual IntRect ForwardButtonRect(const ScrollbarThemeClient&, virtual IntRect ForwardButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool painting = false) = 0; bool painting = false) = 0;
virtual IntRect TrackRect(const ScrollbarThemeClient&, virtual IntRect TrackRect(const Scrollbar&, bool painting = false) = 0;
bool painting = false) = 0; virtual IntRect ThumbRect(const Scrollbar&);
virtual IntRect ThumbRect(const ScrollbarThemeClient&); virtual int ThumbThickness(const Scrollbar&);
virtual int ThumbThickness(const ScrollbarThemeClient&);
virtual int MinimumThumbLength(const ScrollbarThemeClient&) = 0; virtual int MinimumThumbLength(const Scrollbar&) = 0;
virtual void SplitTrack(const ScrollbarThemeClient&, virtual void SplitTrack(const Scrollbar&,
const IntRect& track, const IntRect& track,
IntRect& start_track, IntRect& start_track,
IntRect& thumb, IntRect& thumb,
...@@ -182,13 +180,13 @@ class PLATFORM_EXPORT ScrollbarTheme { ...@@ -182,13 +180,13 @@ class PLATFORM_EXPORT ScrollbarTheme {
virtual double InitialAutoscrollTimerDelay() { return 0.25; } virtual double InitialAutoscrollTimerDelay() { return 0.25; }
virtual double AutoscrollTimerDelay() { return 0.05; } virtual double AutoscrollTimerDelay() { return 0.05; }
virtual IntRect ConstrainTrackRectToTrackPieces(const ScrollbarThemeClient&, virtual IntRect ConstrainTrackRectToTrackPieces(const Scrollbar&,
const IntRect& rect) { const IntRect& rect) {
return rect; return rect;
} }
virtual void RegisterScrollbar(ScrollbarThemeClient&) {} virtual void RegisterScrollbar(Scrollbar&) {}
virtual void UnregisterScrollbar(ScrollbarThemeClient&) {} virtual void UnregisterScrollbar(Scrollbar&) {}
virtual bool IsMockTheme() const { return false; } virtual bool IsMockTheme() const { return false; }
...@@ -198,14 +196,14 @@ class PLATFORM_EXPORT ScrollbarTheme { ...@@ -198,14 +196,14 @@ class PLATFORM_EXPORT ScrollbarTheme {
// painting code will use to paint the scrollbar into. The actual scrollbar // painting code will use to paint the scrollbar into. The actual scrollbar
// dimensions will be ignored for purposes of painting since the resource can // dimensions will be ignored for purposes of painting since the resource can
// be then resized without a repaint. // be then resized without a repaint.
virtual IntSize NinePatchThumbCanvasSize(const ScrollbarThemeClient&) const { virtual IntSize NinePatchThumbCanvasSize(const Scrollbar&) const {
NOTREACHED(); NOTREACHED();
return IntSize(); return IntSize();
} }
// For a nine-patch resource, the aperture defines the center patch that will // For a nine-patch resource, the aperture defines the center patch that will
// be stretched out. // be stretched out.
virtual IntRect NinePatchThumbAperture(const ScrollbarThemeClient&) const { virtual IntRect NinePatchThumbAperture(const Scrollbar&) const {
NOTREACHED(); NOTREACHED();
return IntRect(); return IntRect();
} }
......
...@@ -77,10 +77,9 @@ bool operator!=(const PartPaintingParams& a, const PartPaintingParams& b) { ...@@ -77,10 +77,9 @@ bool operator!=(const PartPaintingParams& a, const PartPaintingParams& b) {
return !(a == b); return !(a == b);
} }
PartPaintingParams ButtonPartPaintingParams( PartPaintingParams ButtonPartPaintingParams(const Scrollbar& scrollbar,
const ScrollbarThemeClient& scrollbar, float position,
float position, ScrollbarPart part) {
ScrollbarPart part) {
WebThemeEngine::Part paint_part; WebThemeEngine::Part paint_part;
WebThemeEngine::State state = WebThemeEngine::kStateNormal; WebThemeEngine::State state = WebThemeEngine::kStateNormal;
bool check_min = false; bool check_min = false;
...@@ -156,16 +155,15 @@ int ScrollbarThemeAura::ScrollbarThickness(ScrollbarControlSize control_size) { ...@@ -156,16 +155,15 @@ int ScrollbarThemeAura::ScrollbarThickness(ScrollbarControlSize control_size) {
return scrollbar_size.Width(); return scrollbar_size.Width();
} }
bool ScrollbarThemeAura::HasThumb(const ScrollbarThemeClient& scrollbar) { bool ScrollbarThemeAura::HasThumb(const Scrollbar& scrollbar) {
// This method is just called as a paint-time optimization to see if // This method is just called as a paint-time optimization to see if
// painting the thumb can be skipped. We don't have to be exact here. // painting the thumb can be skipped. We don't have to be exact here.
return ThumbLength(scrollbar) > 0; return ThumbLength(scrollbar) > 0;
} }
IntRect ScrollbarThemeAura::BackButtonRect( IntRect ScrollbarThemeAura::BackButtonRect(const Scrollbar& scrollbar,
const ScrollbarThemeClient& scrollbar, ScrollbarPart part,
ScrollbarPart part, bool) {
bool) {
// Windows and Linux just have single arrows. // Windows and Linux just have single arrows.
if (part == kBackButtonEndPart) if (part == kBackButtonEndPart)
return IntRect(); return IntRect();
...@@ -174,10 +172,9 @@ IntRect ScrollbarThemeAura::BackButtonRect( ...@@ -174,10 +172,9 @@ IntRect ScrollbarThemeAura::BackButtonRect(
return IntRect(scrollbar.X(), scrollbar.Y(), size.Width(), size.Height()); return IntRect(scrollbar.X(), scrollbar.Y(), size.Width(), size.Height());
} }
IntRect ScrollbarThemeAura::ForwardButtonRect( IntRect ScrollbarThemeAura::ForwardButtonRect(const Scrollbar& scrollbar,
const ScrollbarThemeClient& scrollbar, ScrollbarPart part,
ScrollbarPart part, bool) {
bool) {
// Windows and Linux just have single arrows. // Windows and Linux just have single arrows.
if (part == kForwardButtonStartPart) if (part == kForwardButtonStartPart)
return IntRect(); return IntRect();
...@@ -194,8 +191,7 @@ IntRect ScrollbarThemeAura::ForwardButtonRect( ...@@ -194,8 +191,7 @@ IntRect ScrollbarThemeAura::ForwardButtonRect(
return IntRect(x, y, size.Width(), size.Height()); return IntRect(x, y, size.Width(), size.Height());
} }
IntRect ScrollbarThemeAura::TrackRect(const ScrollbarThemeClient& scrollbar, IntRect ScrollbarThemeAura::TrackRect(const Scrollbar& scrollbar, bool) {
bool) {
// The track occupies all space between the two buttons. // The track occupies all space between the two buttons.
IntSize bs = ButtonSize(scrollbar); IntSize bs = ButtonSize(scrollbar);
if (scrollbar.Orientation() == kHorizontalScrollbar) { if (scrollbar.Orientation() == kHorizontalScrollbar) {
...@@ -210,8 +206,7 @@ IntRect ScrollbarThemeAura::TrackRect(const ScrollbarThemeClient& scrollbar, ...@@ -210,8 +206,7 @@ IntRect ScrollbarThemeAura::TrackRect(const ScrollbarThemeClient& scrollbar,
scrollbar.Height() - 2 * bs.Height()); scrollbar.Height() - 2 * bs.Height());
} }
int ScrollbarThemeAura::MinimumThumbLength( int ScrollbarThemeAura::MinimumThumbLength(const Scrollbar& scrollbar) {
const ScrollbarThemeClient& scrollbar) {
if (scrollbar.Orientation() == kVerticalScrollbar) { if (scrollbar.Orientation() == kVerticalScrollbar) {
return Platform::Current() return Platform::Current()
->ThemeEngine() ->ThemeEngine()
...@@ -317,7 +312,7 @@ bool ScrollbarThemeAura::ShouldRepaintAllPartsOnInvalidation() const { ...@@ -317,7 +312,7 @@ bool ScrollbarThemeAura::ShouldRepaintAllPartsOnInvalidation() const {
} }
ScrollbarPart ScrollbarThemeAura::InvalidateOnThumbPositionChange( ScrollbarPart ScrollbarThemeAura::InvalidateOnThumbPositionChange(
const ScrollbarThemeClient& scrollbar, const Scrollbar& scrollbar,
float old_position, float old_position,
float new_position) const { float new_position) const {
ScrollbarPart invalid_parts = kNoPart; ScrollbarPart invalid_parts = kNoPart;
...@@ -343,7 +338,7 @@ bool ScrollbarThemeAura::HasScrollbarButtons( ...@@ -343,7 +338,7 @@ bool ScrollbarThemeAura::HasScrollbarButtons(
.IsEmpty(); .IsEmpty();
}; };
IntSize ScrollbarThemeAura::ButtonSize(const ScrollbarThemeClient& scrollbar) { IntSize ScrollbarThemeAura::ButtonSize(const Scrollbar& scrollbar) {
if (!HasScrollbarButtons(scrollbar.Orientation())) if (!HasScrollbarButtons(scrollbar.Orientation()))
return IntSize(0, 0); return IntSize(0, 0);
......
...@@ -41,18 +41,17 @@ class PLATFORM_EXPORT ScrollbarThemeAura : public ScrollbarTheme { ...@@ -41,18 +41,17 @@ class PLATFORM_EXPORT ScrollbarThemeAura : public ScrollbarTheme {
int ScrollbarThickness(ScrollbarControlSize) override; int ScrollbarThickness(ScrollbarControlSize) override;
protected: protected:
bool HasButtons(const ScrollbarThemeClient&) override { return true; } bool HasButtons(const Scrollbar&) override { return true; }
bool HasThumb(const ScrollbarThemeClient&) override; bool HasThumb(const Scrollbar&) override;
IntRect BackButtonRect(const ScrollbarThemeClient&, IntRect BackButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool painting = false) override; bool painting = false) override;
IntRect ForwardButtonRect(const ScrollbarThemeClient&, IntRect ForwardButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool painting = false) override; bool painting = false) override;
IntRect TrackRect(const ScrollbarThemeClient&, IntRect TrackRect(const Scrollbar&, bool painting = false) override;
bool painting = false) override; int MinimumThumbLength(const Scrollbar&) override;
int MinimumThumbLength(const ScrollbarThemeClient&) override;
void PaintTrackBackground(GraphicsContext&, void PaintTrackBackground(GraphicsContext&,
const Scrollbar&, const Scrollbar&,
...@@ -69,7 +68,7 @@ class PLATFORM_EXPORT ScrollbarThemeAura : public ScrollbarTheme { ...@@ -69,7 +68,7 @@ class PLATFORM_EXPORT ScrollbarThemeAura : public ScrollbarTheme {
bool ShouldRepaintAllPartsOnInvalidation() const override; bool ShouldRepaintAllPartsOnInvalidation() const override;
ScrollbarPart InvalidateOnThumbPositionChange( ScrollbarPart InvalidateOnThumbPositionChange(
const ScrollbarThemeClient&, const Scrollbar&,
float old_position, float old_position,
float new_position) const override; float new_position) const override;
...@@ -79,7 +78,7 @@ class PLATFORM_EXPORT ScrollbarThemeAura : public ScrollbarTheme { ...@@ -79,7 +78,7 @@ class PLATFORM_EXPORT ScrollbarThemeAura : public ScrollbarTheme {
FRIEND_TEST_ALL_PREFIXES(ScrollbarThemeAuraTest, NoButtonsReturnsSize0); FRIEND_TEST_ALL_PREFIXES(ScrollbarThemeAuraTest, NoButtonsReturnsSize0);
virtual bool HasScrollbarButtons(ScrollbarOrientation) const; virtual bool HasScrollbarButtons(ScrollbarOrientation) const;
IntSize ButtonSize(const ScrollbarThemeClient&); IntSize ButtonSize(const Scrollbar&);
}; };
} // namespace blink } // namespace blink
......
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCROLL_SCROLLBAR_THEME_CLIENT_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCROLL_SCROLLBAR_THEME_CLIENT_H_
#include "third_party/blink/renderer/platform/geometry/int_point.h"
#include "third_party/blink/renderer/platform/geometry/int_rect.h"
#include "third_party/blink/renderer/platform/geometry/int_size.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/scroll/scroll_types.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
class PLATFORM_EXPORT ScrollbarThemeClient {
public:
virtual int X() const = 0;
virtual int Y() const = 0;
virtual int Width() const = 0;
virtual int Height() const = 0;
virtual IntSize Size() const = 0;
virtual IntPoint Location() const = 0;
virtual void SetFrameRect(const IntRect&) = 0;
virtual IntRect FrameRect() const = 0;
virtual void Invalidate() = 0;
virtual void InvalidateRect(const IntRect&) = 0;
virtual ScrollbarOverlayColorTheme GetScrollbarOverlayColorTheme() const = 0;
virtual void GetTickmarks(Vector<IntRect>&) const = 0;
virtual bool IsScrollableAreaActive() const = 0;
virtual IntPoint ConvertFromRootFrame(const IntPoint&) const = 0;
virtual bool IsCustomScrollbar() const = 0;
virtual ScrollbarOrientation Orientation() const = 0;
virtual bool IsLeftSideVerticalScrollbar() const = 0;
virtual int Value() const = 0;
virtual float CurrentPos() const = 0;
virtual int VisibleSize() const = 0;
virtual int TotalSize() const = 0;
virtual int Maximum() const = 0;
virtual ScrollbarControlSize GetControlSize() const = 0;
virtual ScrollbarPart PressedPart() const = 0;
virtual ScrollbarPart HoveredPart() const = 0;
virtual void StyleChanged() = 0;
virtual void SetScrollbarsHiddenIfOverlay(bool) = 0;
virtual bool Enabled() const = 0;
virtual void SetEnabled(bool) = 0;
virtual bool IsOverlayScrollbar() const = 0;
virtual float ElasticOverscroll() const = 0;
virtual void SetElasticOverscroll(float) = 0;
protected:
virtual ~ScrollbarThemeClient() = default;
};
} // namespace blink
#endif // ScollbarThemeClient_h
...@@ -41,8 +41,8 @@ class PLATFORM_EXPORT ScrollbarThemeMac : public ScrollbarTheme { ...@@ -41,8 +41,8 @@ class PLATFORM_EXPORT ScrollbarThemeMac : public ScrollbarTheme {
public: public:
~ScrollbarThemeMac() override; ~ScrollbarThemeMac() override;
void RegisterScrollbar(ScrollbarThemeClient&) override; void RegisterScrollbar(Scrollbar&) override;
void UnregisterScrollbar(ScrollbarThemeClient&) override; void UnregisterScrollbar(Scrollbar&) override;
void PreferencesChanged(float initial_button_delay, void PreferencesChanged(float initial_button_delay,
float autoscroll_button_delay, float autoscroll_button_delay,
NSScrollerStyle preferred_scroller_style, NSScrollerStyle preferred_scroller_style,
...@@ -66,17 +66,17 @@ class PLATFORM_EXPORT ScrollbarThemeMac : public ScrollbarTheme { ...@@ -66,17 +66,17 @@ class PLATFORM_EXPORT ScrollbarThemeMac : public ScrollbarTheme {
bool ShouldRepaintAllPartsOnInvalidation() const override { return false; } bool ShouldRepaintAllPartsOnInvalidation() const override { return false; }
ScrollbarPart InvalidateOnThumbPositionChange( ScrollbarPart InvalidateOnThumbPositionChange(
const ScrollbarThemeClient&, const Scrollbar&,
float old_position, float old_position,
float new_position) const override; float new_position) const override;
void UpdateEnabledState(const ScrollbarThemeClient&) override; void UpdateEnabledState(const Scrollbar&) override;
int ScrollbarThickness(ScrollbarControlSize = kRegularScrollbar) override; int ScrollbarThickness(ScrollbarControlSize = kRegularScrollbar) override;
bool UsesOverlayScrollbars() const override; bool UsesOverlayScrollbars() const override;
void UpdateScrollbarOverlayColorTheme(const ScrollbarThemeClient&) override; void UpdateScrollbarOverlayColorTheme(const Scrollbar&) override;
WebScrollbarButtonsPlacement ButtonsPlacement() const override; WebScrollbarButtonsPlacement ButtonsPlacement() const override;
void SetNewPainterForScrollbar(ScrollbarThemeClient&, ScrollbarPainter); void SetNewPainterForScrollbar(Scrollbar&, ScrollbarPainter);
ScrollbarPainter PainterForScrollbar(const ScrollbarThemeClient&) const; ScrollbarPainter PainterForScrollbar(const Scrollbar&) const;
void PaintTrackBackground(GraphicsContext&, void PaintTrackBackground(GraphicsContext&,
const Scrollbar&, const Scrollbar&,
...@@ -92,32 +92,31 @@ class PLATFORM_EXPORT ScrollbarThemeMac : public ScrollbarTheme { ...@@ -92,32 +92,31 @@ class PLATFORM_EXPORT ScrollbarThemeMac : public ScrollbarTheme {
PaintThumbInternal(context, scrollbar, rect, ThumbOpacity(scrollbar)); PaintThumbInternal(context, scrollbar, rect, ThumbOpacity(scrollbar));
} }
float ThumbOpacity(const ScrollbarThemeClient&) const override; float ThumbOpacity(const Scrollbar&) const override;
static NSScrollerStyle RecommendedScrollerStyle(); static NSScrollerStyle RecommendedScrollerStyle();
protected: protected:
int MaxOverlapBetweenPages() override { return 40; } int MaxOverlapBetweenPages() override { return 40; }
bool ShouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient&, bool ShouldDragDocumentInsteadOfThumb(const Scrollbar&,
const WebMouseEvent&) override; const WebMouseEvent&) override;
int ScrollbarPartToHIPressedState(ScrollbarPart); int ScrollbarPartToHIPressedState(ScrollbarPart);
virtual void UpdateButtonPlacement(WebScrollbarButtonsPlacement) {} virtual void UpdateButtonPlacement(WebScrollbarButtonsPlacement) {}
IntRect TrackRect(const ScrollbarThemeClient&, IntRect TrackRect(const Scrollbar&, bool painting = false) override;
bool painting = false) override; IntRect BackButtonRect(const Scrollbar&,
IntRect BackButtonRect(const ScrollbarThemeClient&,
ScrollbarPart, ScrollbarPart,
bool painting = false) override; bool painting = false) override;
IntRect ForwardButtonRect(const ScrollbarThemeClient&, IntRect ForwardButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool painting = false) override; bool painting = false) override;
bool HasButtons(const ScrollbarThemeClient&) override { return false; } bool HasButtons(const Scrollbar&) override { return false; }
bool HasThumb(const ScrollbarThemeClient&) override; bool HasThumb(const Scrollbar&) override;
int MinimumThumbLength(const ScrollbarThemeClient&) override; int MinimumThumbLength(const Scrollbar&) override;
int TickmarkBorderWidth() override { return 1; } int TickmarkBorderWidth() override { return 1; }
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "third_party/blink/renderer/platform/mac/ns_scroller_imp_details.h" #include "third_party/blink/renderer/platform/mac/ns_scroller_imp_details.h"
#include "third_party/blink/renderer/platform/mac/scroll_animator_mac.h" #include "third_party/blink/renderer/platform/mac/scroll_animator_mac.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/scroll/scrollbar_theme_client.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/retain_ptr.h" #include "third_party/blink/renderer/platform/wtf/retain_ptr.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
...@@ -52,16 +51,16 @@ ...@@ -52,16 +51,16 @@
@end @end
@interface BlinkScrollbarObserver : NSObject { @interface BlinkScrollbarObserver : NSObject {
blink::ScrollbarThemeClient* _scrollbar; blink::Scrollbar* _scrollbar;
RetainPtr<ScrollbarPainter> _scrollbarPainter; RetainPtr<ScrollbarPainter> _scrollbarPainter;
} }
- (id)initWithScrollbar:(blink::ScrollbarThemeClient*)scrollbar - (id)initWithScrollbar:(blink::Scrollbar*)scrollbar
painter:(const RetainPtr<ScrollbarPainter>&)painter; painter:(const RetainPtr<ScrollbarPainter>&)painter;
@end @end
@implementation BlinkScrollbarObserver @implementation BlinkScrollbarObserver
- (id)initWithScrollbar:(blink::ScrollbarThemeClient*)scrollbar - (id)initWithScrollbar:(blink::Scrollbar*)scrollbar
painter:(const RetainPtr<ScrollbarPainter>&)painter { painter:(const RetainPtr<ScrollbarPainter>&)painter {
if (!(self = [super init])) if (!(self = [super init]))
return nil; return nil;
...@@ -97,7 +96,7 @@ ...@@ -97,7 +96,7 @@
namespace blink { namespace blink {
typedef HashSet<ScrollbarThemeClient*> ScrollbarSet; typedef PersistentHeapHashSet<WeakMember<Scrollbar>> ScrollbarSet;
static ScrollbarSet& GetScrollbarSet() { static ScrollbarSet& GetScrollbarSet() {
DEFINE_STATIC_LOCAL(ScrollbarSet, set, ()); DEFINE_STATIC_LOCAL(ScrollbarSet, set, ());
...@@ -108,12 +107,13 @@ static float g_initial_button_delay = 0.5f; ...@@ -108,12 +107,13 @@ static float g_initial_button_delay = 0.5f;
static float g_autoscroll_button_delay = 0.05f; static float g_autoscroll_button_delay = 0.05f;
static NSScrollerStyle g_preferred_scroller_style = NSScrollerStyleLegacy; static NSScrollerStyle g_preferred_scroller_style = NSScrollerStyleLegacy;
typedef HashMap<ScrollbarThemeClient*, RetainPtr<BlinkScrollbarObserver>> typedef PersistentHeapHashMap<WeakMember<Scrollbar>,
RetainPtr<BlinkScrollbarObserver>>
ScrollbarPainterMap; ScrollbarPainterMap;
static ScrollbarPainterMap& GetScrollbarPainterMap() { static ScrollbarPainterMap& GetScrollbarPainterMap() {
static ScrollbarPainterMap* map = new ScrollbarPainterMap; DEFINE_STATIC_LOCAL(ScrollbarPainterMap, map, ());
return *map; return map;
} }
static bool SupportsExpandedScrollbars() { static bool SupportsExpandedScrollbars() {
...@@ -152,11 +152,9 @@ void ScrollbarThemeMac::PreferencesChanged( ...@@ -152,11 +152,9 @@ void ScrollbarThemeMac::PreferencesChanged(
g_autoscroll_button_delay = autoscroll_button_delay; g_autoscroll_button_delay = autoscroll_button_delay;
g_preferred_scroller_style = preferred_scroller_style; g_preferred_scroller_style = preferred_scroller_style;
if (redraw && !GetScrollbarSet().IsEmpty()) { if (redraw && !GetScrollbarSet().IsEmpty()) {
ScrollbarSet::iterator end = GetScrollbarSet().end(); for (const auto& scrollbar : GetScrollbarSet()) {
for (ScrollbarSet::iterator it = GetScrollbarSet().begin(); it != end; scrollbar->StyleChanged();
++it) { scrollbar->SetNeedsPaintInvalidation(kAllParts);
(*it)->StyleChanged();
(*it)->Invalidate();
} }
} }
} }
...@@ -170,7 +168,7 @@ double ScrollbarThemeMac::AutoscrollTimerDelay() { ...@@ -170,7 +168,7 @@ double ScrollbarThemeMac::AutoscrollTimerDelay() {
} }
bool ScrollbarThemeMac::ShouldDragDocumentInsteadOfThumb( bool ScrollbarThemeMac::ShouldDragDocumentInsteadOfThumb(
const ScrollbarThemeClient&, const Scrollbar&,
const WebMouseEvent& event) { const WebMouseEvent& event) {
return (event.GetModifiers() & WebInputEvent::Modifiers::kAltKey) != 0; return (event.GetModifiers() & WebInputEvent::Modifiers::kAltKey) != 0;
} }
...@@ -195,14 +193,14 @@ int ScrollbarThemeMac::ScrollbarPartToHIPressedState(ScrollbarPart part) { ...@@ -195,14 +193,14 @@ int ScrollbarThemeMac::ScrollbarPartToHIPressedState(ScrollbarPart part) {
} }
ScrollbarPart ScrollbarThemeMac::InvalidateOnThumbPositionChange( ScrollbarPart ScrollbarThemeMac::InvalidateOnThumbPositionChange(
const ScrollbarThemeClient& scrollbar, const Scrollbar& scrollbar,
float old_position, float old_position,
float new_position) const { float new_position) const {
// ScrollAnimatorMac will invalidate scrollbar parts if necessary. // ScrollAnimatorMac will invalidate scrollbar parts if necessary.
return kNoPart; return kNoPart;
} }
void ScrollbarThemeMac::RegisterScrollbar(ScrollbarThemeClient& scrollbar) { void ScrollbarThemeMac::RegisterScrollbar(Scrollbar& scrollbar) {
GetScrollbarSet().insert(&scrollbar); GetScrollbarSet().insert(&scrollbar);
bool is_horizontal = scrollbar.Orientation() == kHorizontalScrollbar; bool is_horizontal = scrollbar.Orientation() == kHorizontalScrollbar;
...@@ -223,13 +221,13 @@ void ScrollbarThemeMac::RegisterScrollbar(ScrollbarThemeClient& scrollbar) { ...@@ -223,13 +221,13 @@ void ScrollbarThemeMac::RegisterScrollbar(ScrollbarThemeClient& scrollbar) {
UpdateScrollbarOverlayColorTheme(scrollbar); UpdateScrollbarOverlayColorTheme(scrollbar);
} }
void ScrollbarThemeMac::UnregisterScrollbar(ScrollbarThemeClient& scrollbar) { void ScrollbarThemeMac::UnregisterScrollbar(Scrollbar& scrollbar) {
GetScrollbarPainterMap().erase(&scrollbar); GetScrollbarPainterMap().erase(&scrollbar);
GetScrollbarSet().erase(&scrollbar); GetScrollbarSet().erase(&scrollbar);
} }
void ScrollbarThemeMac::SetNewPainterForScrollbar( void ScrollbarThemeMac::SetNewPainterForScrollbar(
ScrollbarThemeClient& scrollbar, Scrollbar& scrollbar,
ScrollbarPainter new_painter) { ScrollbarPainter new_painter) {
RetainPtr<ScrollbarPainter> scrollbar_painter(kAdoptNS, [new_painter retain]); RetainPtr<ScrollbarPainter> scrollbar_painter(kAdoptNS, [new_painter retain]);
RetainPtr<BlinkScrollbarObserver> observer( RetainPtr<BlinkScrollbarObserver> observer(
...@@ -242,9 +240,9 @@ void ScrollbarThemeMac::SetNewPainterForScrollbar( ...@@ -242,9 +240,9 @@ void ScrollbarThemeMac::SetNewPainterForScrollbar(
} }
ScrollbarPainter ScrollbarThemeMac::PainterForScrollbar( ScrollbarPainter ScrollbarThemeMac::PainterForScrollbar(
const ScrollbarThemeClient& scrollbar) const { const Scrollbar& scrollbar) const {
return [GetScrollbarPainterMap() return [GetScrollbarPainterMap()
.at(const_cast<ScrollbarThemeClient*>(&scrollbar)) .at(const_cast<Scrollbar*>(&scrollbar))
.Get() painter]; .Get() painter];
} }
...@@ -350,7 +348,7 @@ bool ScrollbarThemeMac::UsesOverlayScrollbars() const { ...@@ -350,7 +348,7 @@ bool ScrollbarThemeMac::UsesOverlayScrollbars() const {
} }
void ScrollbarThemeMac::UpdateScrollbarOverlayColorTheme( void ScrollbarThemeMac::UpdateScrollbarOverlayColorTheme(
const ScrollbarThemeClient& scrollbar) { const Scrollbar& scrollbar) {
ScrollbarPainter painter = PainterForScrollbar(scrollbar); ScrollbarPainter painter = PainterForScrollbar(scrollbar);
switch (scrollbar.GetScrollbarOverlayColorTheme()) { switch (scrollbar.GetScrollbarOverlayColorTheme()) {
case kScrollbarOverlayColorThemeDark: case kScrollbarOverlayColorThemeDark:
...@@ -366,7 +364,7 @@ WebScrollbarButtonsPlacement ScrollbarThemeMac::ButtonsPlacement() const { ...@@ -366,7 +364,7 @@ WebScrollbarButtonsPlacement ScrollbarThemeMac::ButtonsPlacement() const {
return kWebScrollbarButtonsPlacementNone; return kWebScrollbarButtonsPlacementNone;
} }
bool ScrollbarThemeMac::HasThumb(const ScrollbarThemeClient& scrollbar) { bool ScrollbarThemeMac::HasThumb(const Scrollbar& scrollbar) {
ScrollbarPainter painter = PainterForScrollbar(scrollbar); ScrollbarPainter painter = PainterForScrollbar(scrollbar);
int min_length_for_thumb = int min_length_for_thumb =
[painter knobMinLength] + [painter trackOverlapEndInset] + [painter knobMinLength] + [painter trackOverlapEndInset] +
...@@ -378,39 +376,35 @@ bool ScrollbarThemeMac::HasThumb(const ScrollbarThemeClient& scrollbar) { ...@@ -378,39 +376,35 @@ bool ScrollbarThemeMac::HasThumb(const ScrollbarThemeClient& scrollbar) {
: scrollbar.Height()) >= min_length_for_thumb; : scrollbar.Height()) >= min_length_for_thumb;
} }
IntRect ScrollbarThemeMac::BackButtonRect(const ScrollbarThemeClient& scrollbar, IntRect ScrollbarThemeMac::BackButtonRect(const Scrollbar& scrollbar,
ScrollbarPart part, ScrollbarPart part,
bool painting) { bool painting) {
DCHECK_EQ(ButtonsPlacement(), kWebScrollbarButtonsPlacementNone); DCHECK_EQ(ButtonsPlacement(), kWebScrollbarButtonsPlacementNone);
return IntRect(); return IntRect();
} }
IntRect ScrollbarThemeMac::ForwardButtonRect( IntRect ScrollbarThemeMac::ForwardButtonRect(const Scrollbar& scrollbar,
const ScrollbarThemeClient& scrollbar, ScrollbarPart part,
ScrollbarPart part, bool painting) {
bool painting) {
DCHECK_EQ(ButtonsPlacement(), kWebScrollbarButtonsPlacementNone); DCHECK_EQ(ButtonsPlacement(), kWebScrollbarButtonsPlacementNone);
return IntRect(); return IntRect();
} }
IntRect ScrollbarThemeMac::TrackRect(const ScrollbarThemeClient& scrollbar, IntRect ScrollbarThemeMac::TrackRect(const Scrollbar& scrollbar,
bool painting) { bool painting) {
DCHECK(!HasButtons(scrollbar)); DCHECK(!HasButtons(scrollbar));
return scrollbar.FrameRect(); return scrollbar.FrameRect();
} }
int ScrollbarThemeMac::MinimumThumbLength( int ScrollbarThemeMac::MinimumThumbLength(const Scrollbar& scrollbar) {
const ScrollbarThemeClient& scrollbar) {
return [PainterForScrollbar(scrollbar) knobMinLength]; return [PainterForScrollbar(scrollbar) knobMinLength];
} }
void ScrollbarThemeMac::UpdateEnabledState( void ScrollbarThemeMac::UpdateEnabledState(const Scrollbar& scrollbar) {
const ScrollbarThemeClient& scrollbar) {
[PainterForScrollbar(scrollbar) setEnabled:scrollbar.Enabled()]; [PainterForScrollbar(scrollbar) setEnabled:scrollbar.Enabled()];
} }
float ScrollbarThemeMac::ThumbOpacity( float ScrollbarThemeMac::ThumbOpacity(const Scrollbar& scrollbar) const {
const ScrollbarThemeClient& scrollbar) const {
ScrollbarPainter scrollbar_painter = PainterForScrollbar(scrollbar); ScrollbarPainter scrollbar_painter = PainterForScrollbar(scrollbar);
return [scrollbar_painter knobAlpha]; return [scrollbar_painter knobAlpha];
} }
......
...@@ -42,8 +42,7 @@ bool ScrollbarThemeMock::UsesOverlayScrollbars() const { ...@@ -42,8 +42,7 @@ bool ScrollbarThemeMock::UsesOverlayScrollbars() const {
return RuntimeEnabledFeatures::OverlayScrollbarsEnabled(); return RuntimeEnabledFeatures::OverlayScrollbarsEnabled();
} }
IntRect ScrollbarThemeMock::TrackRect(const ScrollbarThemeClient& scrollbar, IntRect ScrollbarThemeMock::TrackRect(const Scrollbar& scrollbar, bool) {
bool) {
return scrollbar.FrameRect(); return scrollbar.FrameRect();
} }
...@@ -85,8 +84,7 @@ void ScrollbarThemeMock::PaintScrollCorner(GraphicsContext& context, ...@@ -85,8 +84,7 @@ void ScrollbarThemeMock::PaintScrollCorner(GraphicsContext& context,
context.FillRect(corner_rect, Color::kWhite); context.FillRect(corner_rect, Color::kWhite);
} }
int ScrollbarThemeMock::MinimumThumbLength( int ScrollbarThemeMock::MinimumThumbLength(const Scrollbar& scrollbar) {
const ScrollbarThemeClient& scrollbar) {
return ScrollbarThickness(scrollbar.GetControlSize()); return ScrollbarThickness(scrollbar.GetControlSize());
} }
......
...@@ -38,21 +38,20 @@ class PLATFORM_EXPORT ScrollbarThemeMock : public ScrollbarTheme { ...@@ -38,21 +38,20 @@ class PLATFORM_EXPORT ScrollbarThemeMock : public ScrollbarTheme {
bool UsesOverlayScrollbars() const override; bool UsesOverlayScrollbars() const override;
protected: protected:
bool HasButtons(const ScrollbarThemeClient&) override { return false; } bool HasButtons(const Scrollbar&) override { return false; }
bool HasThumb(const ScrollbarThemeClient&) override { return true; } bool HasThumb(const Scrollbar&) override { return true; }
IntRect BackButtonRect(const ScrollbarThemeClient&, IntRect BackButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool /*painting*/ = false) override { bool /*painting*/ = false) override {
return IntRect(); return IntRect();
} }
IntRect ForwardButtonRect(const ScrollbarThemeClient&, IntRect ForwardButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool /*painting*/ = false) override { bool /*painting*/ = false) override {
return IntRect(); return IntRect();
} }
IntRect TrackRect(const ScrollbarThemeClient&, IntRect TrackRect(const Scrollbar&, bool painting = false) override;
bool painting = false) override;
void PaintTrackBackground(GraphicsContext&, void PaintTrackBackground(GraphicsContext&,
const Scrollbar&, const Scrollbar&,
...@@ -63,7 +62,7 @@ class PLATFORM_EXPORT ScrollbarThemeMock : public ScrollbarTheme { ...@@ -63,7 +62,7 @@ class PLATFORM_EXPORT ScrollbarThemeMock : public ScrollbarTheme {
const DisplayItemClient&, const DisplayItemClient&,
const IntRect& corner_rect) override; const IntRect& corner_rect) override;
int MinimumThumbLength(const ScrollbarThemeClient&) override; int MinimumThumbLength(const Scrollbar&) override;
private: private:
bool IsMockTheme() const final { return true; } bool IsMockTheme() const final { return true; }
......
...@@ -63,7 +63,7 @@ bool ScrollbarThemeOverlay::ShouldRepaintAllPartsOnInvalidation() const { ...@@ -63,7 +63,7 @@ bool ScrollbarThemeOverlay::ShouldRepaintAllPartsOnInvalidation() const {
} }
ScrollbarPart ScrollbarThemeOverlay::InvalidateOnThumbPositionChange( ScrollbarPart ScrollbarThemeOverlay::InvalidateOnThumbPositionChange(
const ScrollbarThemeClient&, const Scrollbar&,
float old_position, float old_position,
float new_position) const { float new_position) const {
return kNoPart; return kNoPart;
...@@ -103,7 +103,7 @@ double ScrollbarThemeOverlay::OverlayScrollbarFadeOutDurationSeconds() const { ...@@ -103,7 +103,7 @@ double ScrollbarThemeOverlay::OverlayScrollbarFadeOutDurationSeconds() const {
return style.fade_out_duration_seconds; return style.fade_out_duration_seconds;
} }
int ScrollbarThemeOverlay::ThumbLength(const ScrollbarThemeClient& scrollbar) { int ScrollbarThemeOverlay::ThumbLength(const Scrollbar& scrollbar) {
int track_len = TrackLength(scrollbar); int track_len = TrackLength(scrollbar);
if (!scrollbar.TotalSize()) if (!scrollbar.TotalSize())
...@@ -117,24 +117,23 @@ int ScrollbarThemeOverlay::ThumbLength(const ScrollbarThemeClient& scrollbar) { ...@@ -117,24 +117,23 @@ int ScrollbarThemeOverlay::ThumbLength(const ScrollbarThemeClient& scrollbar) {
return length; return length;
} }
bool ScrollbarThemeOverlay::HasThumb(const ScrollbarThemeClient& scrollbar) { bool ScrollbarThemeOverlay::HasThumb(const Scrollbar& scrollbar) {
return true; return true;
} }
IntRect ScrollbarThemeOverlay::BackButtonRect(const ScrollbarThemeClient&, IntRect ScrollbarThemeOverlay::BackButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool) { bool) {
return IntRect(); return IntRect();
} }
IntRect ScrollbarThemeOverlay::ForwardButtonRect(const ScrollbarThemeClient&, IntRect ScrollbarThemeOverlay::ForwardButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool) { bool) {
return IntRect(); return IntRect();
} }
IntRect ScrollbarThemeOverlay::TrackRect(const ScrollbarThemeClient& scrollbar, IntRect ScrollbarThemeOverlay::TrackRect(const Scrollbar& scrollbar, bool) {
bool) {
IntRect rect = scrollbar.FrameRect(); IntRect rect = scrollbar.FrameRect();
if (scrollbar.Orientation() == kHorizontalScrollbar) if (scrollbar.Orientation() == kHorizontalScrollbar)
rect.InflateX(-scrollbar_margin_); rect.InflateX(-scrollbar_margin_);
...@@ -143,7 +142,7 @@ IntRect ScrollbarThemeOverlay::TrackRect(const ScrollbarThemeClient& scrollbar, ...@@ -143,7 +142,7 @@ IntRect ScrollbarThemeOverlay::TrackRect(const ScrollbarThemeClient& scrollbar,
return rect; return rect;
} }
int ScrollbarThemeOverlay::ThumbThickness(const ScrollbarThemeClient&) { int ScrollbarThemeOverlay::ThumbThickness(const Scrollbar&) {
return thumb_thickness_; return thumb_thickness_;
} }
...@@ -204,9 +203,8 @@ void ScrollbarThemeOverlay::PaintThumb(GraphicsContext& context, ...@@ -204,9 +203,8 @@ void ScrollbarThemeOverlay::PaintThumb(GraphicsContext& context,
canvas->restore(); canvas->restore();
} }
ScrollbarPart ScrollbarThemeOverlay::HitTest( ScrollbarPart ScrollbarThemeOverlay::HitTest(const Scrollbar& scrollbar,
const ScrollbarThemeClient& scrollbar, const IntPoint& position) {
const IntPoint& position) {
if (allow_hit_test_ == kDisallowHitTest) if (allow_hit_test_ == kDisallowHitTest)
return kNoPart; return kNoPart;
...@@ -247,7 +245,7 @@ bool ScrollbarThemeOverlay::UsesNinePatchThumbResource() const { ...@@ -247,7 +245,7 @@ bool ScrollbarThemeOverlay::UsesNinePatchThumbResource() const {
} }
IntSize ScrollbarThemeOverlay::NinePatchThumbCanvasSize( IntSize ScrollbarThemeOverlay::NinePatchThumbCanvasSize(
const ScrollbarThemeClient& scrollbar) const { const Scrollbar& scrollbar) const {
DCHECK(UsesNinePatchThumbResource()); DCHECK(UsesNinePatchThumbResource());
WebThemeEngine::Part part = WebThemeEngine::Part part =
...@@ -260,7 +258,7 @@ IntSize ScrollbarThemeOverlay::NinePatchThumbCanvasSize( ...@@ -260,7 +258,7 @@ IntSize ScrollbarThemeOverlay::NinePatchThumbCanvasSize(
} }
IntRect ScrollbarThemeOverlay::NinePatchThumbAperture( IntRect ScrollbarThemeOverlay::NinePatchThumbAperture(
const ScrollbarThemeClient& scrollbar) const { const Scrollbar& scrollbar) const {
DCHECK(UsesNinePatchThumbResource()); DCHECK(UsesNinePatchThumbResource());
WebThemeEngine::Part part = WebThemeEngine::kPartScrollbarHorizontalThumb; WebThemeEngine::Part part = WebThemeEngine::kPartScrollbarHorizontalThumb;
...@@ -271,8 +269,7 @@ IntRect ScrollbarThemeOverlay::NinePatchThumbAperture( ...@@ -271,8 +269,7 @@ IntRect ScrollbarThemeOverlay::NinePatchThumbAperture(
return Platform::Current()->ThemeEngine()->NinePatchAperture(part); return Platform::Current()->ThemeEngine()->NinePatchAperture(part);
} }
int ScrollbarThemeOverlay::MinimumThumbLength( int ScrollbarThemeOverlay::MinimumThumbLength(const Scrollbar& scrollbar) {
const ScrollbarThemeClient& scrollbar) {
if (scrollbar.Orientation() == kVerticalScrollbar) { if (scrollbar.Orientation() == kVerticalScrollbar) {
return Platform::Current() return Platform::Current()
->ThemeEngine() ->ThemeEngine()
......
...@@ -49,7 +49,7 @@ class PLATFORM_EXPORT ScrollbarThemeOverlay : public ScrollbarTheme { ...@@ -49,7 +49,7 @@ class PLATFORM_EXPORT ScrollbarThemeOverlay : public ScrollbarTheme {
bool ShouldRepaintAllPartsOnInvalidation() const override; bool ShouldRepaintAllPartsOnInvalidation() const override;
ScrollbarPart InvalidateOnThumbPositionChange( ScrollbarPart InvalidateOnThumbPositionChange(
const ScrollbarThemeClient&, const Scrollbar&,
float old_position, float old_position,
float new_position) const override; float new_position) const override;
...@@ -59,30 +59,29 @@ class PLATFORM_EXPORT ScrollbarThemeOverlay : public ScrollbarTheme { ...@@ -59,30 +59,29 @@ class PLATFORM_EXPORT ScrollbarThemeOverlay : public ScrollbarTheme {
double OverlayScrollbarFadeOutDelaySeconds() const override; double OverlayScrollbarFadeOutDelaySeconds() const override;
double OverlayScrollbarFadeOutDurationSeconds() const override; double OverlayScrollbarFadeOutDurationSeconds() const override;
int ThumbLength(const ScrollbarThemeClient&) override; int ThumbLength(const Scrollbar&) override;
bool HasButtons(const ScrollbarThemeClient&) override { return false; } bool HasButtons(const Scrollbar&) override { return false; }
bool HasThumb(const ScrollbarThemeClient&) override; bool HasThumb(const Scrollbar&) override;
IntRect BackButtonRect(const ScrollbarThemeClient&, IntRect BackButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool painting = false) override; bool painting = false) override;
IntRect ForwardButtonRect(const ScrollbarThemeClient&, IntRect ForwardButtonRect(const Scrollbar&,
ScrollbarPart, ScrollbarPart,
bool painting = false) override; bool painting = false) override;
IntRect TrackRect(const ScrollbarThemeClient&, IntRect TrackRect(const Scrollbar&, bool painting = false) override;
bool painting = false) override; int ThumbThickness(const Scrollbar&) override;
int ThumbThickness(const ScrollbarThemeClient&) override;
int ThumbThickness() { return thumb_thickness_; } int ThumbThickness() { return thumb_thickness_; }
void PaintThumb(GraphicsContext&, const Scrollbar&, const IntRect&) override; void PaintThumb(GraphicsContext&, const Scrollbar&, const IntRect&) override;
ScrollbarPart HitTest(const ScrollbarThemeClient&, const IntPoint&) override; ScrollbarPart HitTest(const Scrollbar&, const IntPoint&) override;
bool UsesNinePatchThumbResource() const override; bool UsesNinePatchThumbResource() const override;
IntSize NinePatchThumbCanvasSize(const ScrollbarThemeClient&) const override; IntSize NinePatchThumbCanvasSize(const Scrollbar&) const override;
IntRect NinePatchThumbAperture(const ScrollbarThemeClient&) const override; IntRect NinePatchThumbAperture(const Scrollbar&) const override;
int MinimumThumbLength(const ScrollbarThemeClient&) override; int MinimumThumbLength(const Scrollbar&) override;
bool IsMobileTheme() const; bool IsMobileTheme() const;
......
...@@ -58,12 +58,12 @@ class PLATFORM_EXPORT ScrollbarThemeOverlayMock : public ScrollbarThemeOverlay { ...@@ -58,12 +58,12 @@ class PLATFORM_EXPORT ScrollbarThemeOverlayMock : public ScrollbarThemeOverlay {
ScrollbarThemeOverlay::PaintThumb(gc, scrollbar, rect); ScrollbarThemeOverlay::PaintThumb(gc, scrollbar, rect);
} }
bool ShouldSnapBackToDragOrigin(const ScrollbarThemeClient& scrollbar, bool ShouldSnapBackToDragOrigin(const Scrollbar& scrollbar,
const WebMouseEvent& evt) override { const WebMouseEvent& evt) override {
return false; return false;
} }
int MinimumThumbLength(const ScrollbarThemeClient&) override { return 7; } int MinimumThumbLength(const Scrollbar&) override { return 7; }
private: private:
double delay_in_seconds_; double delay_in_seconds_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment