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

Side by Side Diff: Source/platform/scroll/Scrollbar.h

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch LocalFrame::m_pluginElements rep to HashSet<HTMLPlugInElement*> Created 6 years, 2 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) 2004, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2006 Apple Computer, 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 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef Scrollbar_h 26 #ifndef Scrollbar_h
27 #define Scrollbar_h 27 #define Scrollbar_h
28 28
29 #include "platform/Timer.h" 29 #include "platform/Timer.h"
30 #include "platform/Widget.h" 30 #include "platform/Widget.h"
31 #include "platform/heap/Handle.h"
31 #include "platform/scroll/ScrollTypes.h" 32 #include "platform/scroll/ScrollTypes.h"
32 #include "platform/scroll/ScrollbarThemeClient.h" 33 #include "platform/scroll/ScrollbarThemeClient.h"
33 #include "wtf/MathExtras.h" 34 #include "wtf/MathExtras.h"
34 #include "wtf/PassRefPtr.h" 35 #include "wtf/PassRefPtr.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 class GraphicsContext; 39 class GraphicsContext;
39 class IntRect; 40 class IntRect;
40 class PlatformGestureEvent; 41 class PlatformGestureEvent;
41 class PlatformMouseEvent; 42 class PlatformMouseEvent;
43 class ScrollAnimator;
42 class ScrollableArea; 44 class ScrollableArea;
43 class ScrollbarTheme; 45 class ScrollbarTheme;
44 46
45 class PLATFORM_EXPORT Scrollbar : public Widget, 47 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient {
46 public ScrollbarThemeClient {
47 48
48 public: 49 public:
49 static PassRefPtr<Scrollbar> create(ScrollableArea*, ScrollbarOrientation, S crollbarControlSize); 50 static PassRefPtrWillBeRawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOr ientation, ScrollbarControlSize);
50 51
51 virtual ~Scrollbar(); 52 virtual ~Scrollbar();
52 53
53 // ScrollbarThemeClient implementation. 54 // ScrollbarThemeClient implementation.
54 virtual int x() const override { return Widget::x(); } 55 virtual int x() const override { return Widget::x(); }
55 virtual int y() const override { return Widget::y(); } 56 virtual int y() const override { return Widget::y(); }
56 virtual int width() const override { return Widget::width(); } 57 virtual int width() const override { return Widget::width(); }
57 virtual int height() const override { return Widget::height(); } 58 virtual int height() const override { return Widget::height(); }
58 virtual IntSize size() const override { return Widget::size(); } 59 virtual IntSize size() const override { return Widget::size(); }
59 virtual IntPoint location() const override { return Widget::location(); } 60 virtual IntPoint location() const override { return Widget::location(); }
(...skipping 28 matching lines...) Expand all
88 virtual ScrollbarPart hoveredPart() const override { return m_hoveredPart; } 89 virtual ScrollbarPart hoveredPart() const override { return m_hoveredPart; }
89 90
90 virtual void styleChanged() override { } 91 virtual void styleChanged() override { }
91 92
92 virtual bool enabled() const override { return m_enabled; } 93 virtual bool enabled() const override { return m_enabled; }
93 virtual void setEnabled(bool) override; 94 virtual void setEnabled(bool) override;
94 95
95 // Called by the ScrollableArea when the scroll offset changes. 96 // Called by the ScrollableArea when the scroll offset changes.
96 void offsetDidChange(); 97 void offsetDidChange();
97 98
98 void disconnectFromScrollableArea() { m_scrollableArea = 0; } 99 void disconnectFromScrollableArea();
99 ScrollableArea* scrollableArea() const { return m_scrollableArea; } 100 ScrollableArea* scrollableArea() const { return m_scrollableArea; }
100 101
101 int pressedPos() const { return m_pressedPos; } 102 int pressedPos() const { return m_pressedPos; }
102 103
103 virtual void setHoveredPart(ScrollbarPart); 104 virtual void setHoveredPart(ScrollbarPart);
104 virtual void setPressedPart(ScrollbarPart); 105 virtual void setPressedPart(ScrollbarPart);
105 106
106 void setProportion(int visibleSize, int totalSize); 107 void setProportion(int visibleSize, int totalSize);
107 void setPressedPos(int p) { m_pressedPos = p; } 108 void setPressedPos(int p) { m_pressedPos = p; }
108 109
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void stopTimerIfNeeded(); 158 void stopTimerIfNeeded();
158 void autoscrollPressedPart(double delay); 159 void autoscrollPressedPart(double delay);
159 ScrollDirection pressedPartScrollDirection(); 160 ScrollDirection pressedPartScrollDirection();
160 ScrollGranularity pressedPartScrollGranularity(); 161 ScrollGranularity pressedPartScrollGranularity();
161 162
162 ScrollableArea* m_scrollableArea; 163 ScrollableArea* m_scrollableArea;
163 ScrollbarOrientation m_orientation; 164 ScrollbarOrientation m_orientation;
164 ScrollbarControlSize m_controlSize; 165 ScrollbarControlSize m_controlSize;
165 ScrollbarTheme* m_theme; 166 ScrollbarTheme* m_theme;
166 167
168 #if ENABLE(OILPAN)
169 // To simplify Oilpan finalization, keep a copy of the ScrollableArea's
170 // scroll animator. Scrollbar is responsible for notifying the animator
171 // when it is destructed.
172 RefPtr<ScrollAnimator> m_animator;
173 #endif
174
167 int m_visibleSize; 175 int m_visibleSize;
168 int m_totalSize; 176 int m_totalSize;
169 float m_currentPos; 177 float m_currentPos;
170 float m_dragOrigin; 178 float m_dragOrigin;
171 179
172 ScrollbarPart m_hoveredPart; 180 ScrollbarPart m_hoveredPart;
173 ScrollbarPart m_pressedPart; 181 ScrollbarPart m_pressedPart;
174 int m_pressedPos; 182 int m_pressedPos;
175 float m_scrollPos; 183 float m_scrollPos;
176 bool m_draggingDocument; 184 bool m_draggingDocument;
(...skipping 12 matching lines...) Expand all
189 virtual bool isScrollbar() const override { return true; } 197 virtual bool isScrollbar() const override { return true; }
190 198
191 float scrollableAreaCurrentPos() const; 199 float scrollableAreaCurrentPos() const;
192 }; 200 };
193 201
194 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr ollbar()); 202 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr ollbar());
195 203
196 } // namespace blink 204 } // namespace blink
197 205
198 #endif // Scrollbar_h 206 #endif // Scrollbar_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698