Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1451)

Unified Diff: Source/core/platform/mac/ScrollbarThemeMac.h

Issue 21296003: Split ScrollbarThemeMac into Overlay and NonOverlay subclasses (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@composited_scrollbar_after_refactor
Patch Set: Clean up Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/mac/ScrollbarThemeMac.h
diff --git a/Source/core/platform/mac/ScrollbarThemeMac.h b/Source/core/platform/mac/ScrollbarThemeMac.h
index 409d17a2e3f1a9fd4cee85aa0a3868662b64c438..29c19ed52e5c244d6ea73abc5ad6e8063ff38577 100644
--- a/Source/core/platform/mac/ScrollbarThemeMac.h
+++ b/Source/core/platform/mac/ScrollbarThemeMac.h
@@ -32,24 +32,48 @@ typedef id ScrollbarPainter;
namespace WebCore {
-class ScrollbarThemeMac : public ScrollbarThemeComposite {
+class ScrollbarThemeMacCommon : public ScrollbarThemeComposite {
public:
- ScrollbarThemeMac();
- virtual ~ScrollbarThemeMac();
+ ScrollbarThemeMacCommon();
+ virtual ~ScrollbarThemeMacCommon();
+ virtual void registerScrollbar(ScrollbarThemeClient*);
+ virtual void unregisterScrollbar(ScrollbarThemeClient*);
void preferencesChanged();
- virtual void updateEnabledState(ScrollbarThemeClient*);
-
- virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
-
virtual bool supportsControlTints() const { return true; }
- virtual bool usesOverlayScrollbars() const;
- virtual void updateScrollbarOverlayStyle(ScrollbarThemeClient*);
virtual double initialAutoscrollTimerDelay();
virtual double autoscrollTimerDelay();
+ virtual void paintOverhangAreas(ScrollView*, GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
+ virtual void paintTickmarks(GraphicsContext*, ScrollbarThemeClient*, const IntRect&) OVERRIDE;
+
+protected:
+ virtual int maxOverlapBetweenPages() { return 40; }
+
+ virtual bool shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent&);
+ virtual bool shouldDragDocumentInsteadOfThumb(ScrollbarThemeClient*, const PlatformMouseEvent&);
+ int scrollbarPartToHIPressedState(ScrollbarPart);
+
+ virtual void updateButtonPlacement() { }
+
+ void paintGivenTickmarks(GraphicsContext*, ScrollbarThemeClient*, const IntRect&, const Vector<IntRect>&);
+
+ RefPtr<Pattern> m_overhangPattern;
+
+private:
+ static float gInitialButtonDelay;
+ static float gAutoscrollButtonDelay;
+ static bool gJumpOnTrackClick;
+};
+
+class ScrollbarThemeMacOverlay : public ScrollbarThemeMacCommon {
+public:
+ virtual void updateEnabledState(ScrollbarThemeClient*);
+ virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
+ virtual bool usesOverlayScrollbars() const;
+ virtual void updateScrollbarOverlayStyle(ScrollbarThemeClient*);
virtual ScrollbarButtonsPlacement buttonsPlacement() const;
virtual void registerScrollbar(ScrollbarThemeClient*);
@@ -58,32 +82,59 @@ public:
void setNewPainterForScrollbar(ScrollbarThemeClient*, ScrollbarPainter);
ScrollbarPainter painterForScrollbar(ScrollbarThemeClient*);
- virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& damageRect);
- virtual void paintOverhangAreas(ScrollView*, GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
- virtual void paintTickmarks(GraphicsContext*, ScrollbarThemeClient*, const IntRect&) OVERRIDE;
virtual void paintTrackBackground(GraphicsContext*, ScrollbarThemeClient*, const IntRect&);
virtual void paintThumb(GraphicsContext*, ScrollbarThemeClient*, const IntRect&);
protected:
+ virtual IntRect trackRect(ScrollbarThemeClient*, bool painting = false);
+ virtual IntRect backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false);
+ virtual IntRect forwardButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false);
- virtual bool hasButtons(ScrollbarThemeClient*);
+ virtual bool hasButtons(ScrollbarThemeClient*) { return false; }
virtual bool hasThumb(ScrollbarThemeClient*);
+ virtual int minimumThumbLength(ScrollbarThemeClient*);
+
+private:
+ typedef HashMap<ScrollbarThemeClient*, RetainPtr<ScrollbarPainter> > ScrollbarPainterMap;
+ static ScrollbarPainterMap* scrollbarPainterMap();
+};
+
+class ScrollbarThemeMacNonOverlay : public ScrollbarThemeMacCommon {
+public:
+ virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
+ virtual bool usesOverlayScrollbars() const { return false; }
+ virtual ScrollbarButtonsPlacement buttonsPlacement() const;
+
+ virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& damageRect);
+
+protected:
+ virtual IntRect trackRect(ScrollbarThemeClient*, bool painting = false);
virtual IntRect backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false);
virtual IntRect forwardButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false);
- virtual IntRect trackRect(ScrollbarThemeClient*, bool painting = false);
- virtual int maxOverlapBetweenPages() { return 40; }
-
- virtual int minimumThumbLength(ScrollbarThemeClient*);
+ virtual void updateButtonPlacement();
- virtual bool shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent&);
- virtual bool shouldDragDocumentInsteadOfThumb(ScrollbarThemeClient*, const PlatformMouseEvent&);
- int scrollbarPartToHIPressedState(ScrollbarPart);
+ virtual bool hasButtons(ScrollbarThemeClient*);
+ virtual bool hasThumb(ScrollbarThemeClient*);
- void paintGivenTickmarks(GraphicsContext*, ScrollbarThemeClient*, const IntRect&, const Vector<IntRect>&);
+ virtual int minimumThumbLength(ScrollbarThemeClient*);
- RefPtr<Pattern> m_overhangPattern;
+ static IntRect buttonRepaintRect(const IntRect&, ScrollbarOrientation, ScrollbarControlSize, bool start);
+
+private:
+ enum {
+ ScrollbarControlSizeCount = 2
+ };
+ static int cRealButtonLength[ScrollbarControlSizeCount];
+ static int cButtonHitInset[ScrollbarControlSizeCount];
+ static int cButtonLength[ScrollbarControlSizeCount];
+ static int cScrollbarThickness[ScrollbarControlSizeCount];
+ static int cButtonInset[ScrollbarControlSizeCount];
+ static int cThumbMinLength[ScrollbarControlSizeCount];
+ static int cOuterButtonLength[ScrollbarControlSizeCount];
+ static int cOuterButtonOverlap;
+ static ScrollbarButtonsPlacement gButtonPlacement;
};
}

Powered by Google App Engine
This is Rietveld 408576698