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

Side by Side 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, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #ifndef ScrollbarThemeMac_h 26 #ifndef ScrollbarThemeMac_h
27 #define ScrollbarThemeMac_h 27 #define ScrollbarThemeMac_h
28 28
29 #include "core/platform/ScrollbarThemeComposite.h" 29 #include "core/platform/ScrollbarThemeComposite.h"
30 30
31 typedef id ScrollbarPainter; 31 typedef id ScrollbarPainter;
32 32
33 namespace WebCore { 33 namespace WebCore {
34 34
35 class ScrollbarThemeMac : public ScrollbarThemeComposite { 35 class ScrollbarThemeMacCommon : public ScrollbarThemeComposite {
36 public: 36 public:
37 ScrollbarThemeMac(); 37 ScrollbarThemeMacCommon();
38 virtual ~ScrollbarThemeMac(); 38 virtual ~ScrollbarThemeMacCommon();
39 39
40 virtual void registerScrollbar(ScrollbarThemeClient*);
41 virtual void unregisterScrollbar(ScrollbarThemeClient*);
40 void preferencesChanged(); 42 void preferencesChanged();
41 43
42 virtual void updateEnabledState(ScrollbarThemeClient*);
43
44 virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
45
46 virtual bool supportsControlTints() const { return true; } 44 virtual bool supportsControlTints() const { return true; }
47 virtual bool usesOverlayScrollbars() const;
48 virtual void updateScrollbarOverlayStyle(ScrollbarThemeClient*);
49 45
50 virtual double initialAutoscrollTimerDelay(); 46 virtual double initialAutoscrollTimerDelay();
51 virtual double autoscrollTimerDelay(); 47 virtual double autoscrollTimerDelay();
52 48
49 virtual void paintOverhangAreas(ScrollView*, GraphicsContext*, const IntRect & horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& di rtyRect);
50 virtual void paintTickmarks(GraphicsContext*, ScrollbarThemeClient*, const I ntRect&) OVERRIDE;
51
52 protected:
53 virtual int maxOverlapBetweenPages() { return 40; }
54
55 virtual bool shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseE vent&);
56 virtual bool shouldDragDocumentInsteadOfThumb(ScrollbarThemeClient*, const P latformMouseEvent&);
57 int scrollbarPartToHIPressedState(ScrollbarPart);
58
59 virtual void updateButtonPlacement() { }
60
61 void paintGivenTickmarks(GraphicsContext*, ScrollbarThemeClient*, const IntR ect&, const Vector<IntRect>&);
62
63 RefPtr<Pattern> m_overhangPattern;
64
65 private:
66 static float gInitialButtonDelay;
67 static float gAutoscrollButtonDelay;
68 static bool gJumpOnTrackClick;
69 };
70
71 class ScrollbarThemeMacOverlay : public ScrollbarThemeMacCommon {
72 public:
73 virtual void updateEnabledState(ScrollbarThemeClient*);
74 virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
75 virtual bool usesOverlayScrollbars() const;
76 virtual void updateScrollbarOverlayStyle(ScrollbarThemeClient*);
53 virtual ScrollbarButtonsPlacement buttonsPlacement() const; 77 virtual ScrollbarButtonsPlacement buttonsPlacement() const;
54 78
55 virtual void registerScrollbar(ScrollbarThemeClient*); 79 virtual void registerScrollbar(ScrollbarThemeClient*);
56 virtual void unregisterScrollbar(ScrollbarThemeClient*); 80 virtual void unregisterScrollbar(ScrollbarThemeClient*);
57 81
58 void setNewPainterForScrollbar(ScrollbarThemeClient*, ScrollbarPainter); 82 void setNewPainterForScrollbar(ScrollbarThemeClient*, ScrollbarPainter);
59 ScrollbarPainter painterForScrollbar(ScrollbarThemeClient*); 83 ScrollbarPainter painterForScrollbar(ScrollbarThemeClient*);
60 84
61 virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& d amageRect);
62 virtual void paintOverhangAreas(ScrollView*, GraphicsContext*, const IntRect & horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& di rtyRect);
63 virtual void paintTickmarks(GraphicsContext*, ScrollbarThemeClient*, const I ntRect&) OVERRIDE;
64 virtual void paintTrackBackground(GraphicsContext*, ScrollbarThemeClient*, c onst IntRect&); 85 virtual void paintTrackBackground(GraphicsContext*, ScrollbarThemeClient*, c onst IntRect&);
65 virtual void paintThumb(GraphicsContext*, ScrollbarThemeClient*, const IntRe ct&); 86 virtual void paintThumb(GraphicsContext*, ScrollbarThemeClient*, const IntRe ct&);
66 87
67 protected: 88 protected:
89 virtual IntRect trackRect(ScrollbarThemeClient*, bool painting = false);
90 virtual IntRect backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool pa inting = false);
91 virtual IntRect forwardButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false);
92
93 virtual bool hasButtons(ScrollbarThemeClient*) { return false; }
94 virtual bool hasThumb(ScrollbarThemeClient*);
95
96 virtual int minimumThumbLength(ScrollbarThemeClient*);
97
98 private:
99 typedef HashMap<ScrollbarThemeClient*, RetainPtr<ScrollbarPainter> > Scrollb arPainterMap;
100 static ScrollbarPainterMap* scrollbarPainterMap();
101 };
102
103 class ScrollbarThemeMacNonOverlay : public ScrollbarThemeMacCommon {
104 public:
105 virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
106 virtual bool usesOverlayScrollbars() const { return false; }
107 virtual ScrollbarButtonsPlacement buttonsPlacement() const;
108
109 virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& d amageRect);
110
111 protected:
112 virtual IntRect trackRect(ScrollbarThemeClient*, bool painting = false);
113 virtual IntRect backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool pa inting = false);
114 virtual IntRect forwardButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false);
115
116 virtual void updateButtonPlacement();
68 117
69 virtual bool hasButtons(ScrollbarThemeClient*); 118 virtual bool hasButtons(ScrollbarThemeClient*);
70 virtual bool hasThumb(ScrollbarThemeClient*); 119 virtual bool hasThumb(ScrollbarThemeClient*);
71 120
72 virtual IntRect backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool pa inting = false);
73 virtual IntRect forwardButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false);
74 virtual IntRect trackRect(ScrollbarThemeClient*, bool painting = false);
75
76 virtual int maxOverlapBetweenPages() { return 40; }
77
78 virtual int minimumThumbLength(ScrollbarThemeClient*); 121 virtual int minimumThumbLength(ScrollbarThemeClient*);
79 122
80 virtual bool shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseE vent&); 123 static IntRect buttonRepaintRect(const IntRect&, ScrollbarOrientation, Scrol lbarControlSize, bool start);
81 virtual bool shouldDragDocumentInsteadOfThumb(ScrollbarThemeClient*, const P latformMouseEvent&);
82 int scrollbarPartToHIPressedState(ScrollbarPart);
83 124
84 void paintGivenTickmarks(GraphicsContext*, ScrollbarThemeClient*, const IntR ect&, const Vector<IntRect>&); 125 private:
85 126 enum {
86 RefPtr<Pattern> m_overhangPattern; 127 ScrollbarControlSizeCount = 2
128 };
129 static int cRealButtonLength[ScrollbarControlSizeCount];
130 static int cButtonHitInset[ScrollbarControlSizeCount];
131 static int cButtonLength[ScrollbarControlSizeCount];
132 static int cScrollbarThickness[ScrollbarControlSizeCount];
133 static int cButtonInset[ScrollbarControlSizeCount];
134 static int cThumbMinLength[ScrollbarControlSizeCount];
135 static int cOuterButtonLength[ScrollbarControlSizeCount];
136 static int cOuterButtonOverlap;
137 static ScrollbarButtonsPlacement gButtonPlacement;
87 }; 138 };
88 139
89 } 140 }
90 141
91 #endif 142 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698