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

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

Issue 1215973002: Oilpan: improve ScrollableArea handling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove too conservative null check Created 5 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 unified diff | Download patch | Annotate | Revision Log
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 28 matching lines...) Expand all
39 39
40 class GraphicsContext; 40 class GraphicsContext;
41 class IntRect; 41 class IntRect;
42 class PlatformGestureEvent; 42 class PlatformGestureEvent;
43 class PlatformMouseEvent; 43 class PlatformMouseEvent;
44 class ScrollAnimator; 44 class ScrollAnimator;
45 class ScrollableArea; 45 class ScrollableArea;
46 class ScrollbarTheme; 46 class ScrollbarTheme;
47 47
48 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient { 48 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient {
49
50 public: 49 public:
51 static PassRefPtrWillBeRawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOr ientation, ScrollbarControlSize); 50 static PassRefPtrWillBeRawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOr ientation, ScrollbarControlSize);
52 51
53 virtual ~Scrollbar(); 52 virtual ~Scrollbar();
54 53
55 // ScrollbarThemeClient implementation. 54 // ScrollbarThemeClient implementation.
56 virtual int x() const override { return Widget::x(); } 55 virtual int x() const override { return Widget::x(); }
57 virtual int y() const override { return Widget::y(); } 56 virtual int y() const override { return Widget::y(); }
58 virtual int width() const override { return Widget::width(); } 57 virtual int width() const override { return Widget::width(); }
59 virtual int height() const override { return Widget::height(); } 58 virtual int height() const override { return Widget::height(); }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 145
147 virtual float elasticOverscroll() const override { return m_elasticOverscrol l; } 146 virtual float elasticOverscroll() const override { return m_elasticOverscrol l; }
148 virtual void setElasticOverscroll(float elasticOverscroll) override { m_elas ticOverscroll = elasticOverscroll; } 147 virtual void setElasticOverscroll(float elasticOverscroll) override { m_elas ticOverscroll = elasticOverscroll; }
149 148
150 bool overlapsResizer() const { return m_overlapsResizer; } 149 bool overlapsResizer() const { return m_overlapsResizer; }
151 void setOverlapsResizer(bool overlapsResizer) { m_overlapsResizer = overlaps Resizer; } 150 void setOverlapsResizer(bool overlapsResizer) { m_overlapsResizer = overlaps Resizer; }
152 151
153 virtual DisplayItemClient displayItemClient() const override { return toDisp layItemClient(this); } 152 virtual DisplayItemClient displayItemClient() const override { return toDisp layItemClient(this); }
154 virtual String debugName() const override { return m_orientation == Horizont alScrollbar ? "HorizontalScrollbar" : "VerticalScrollbar"; } 153 virtual String debugName() const override { return m_orientation == Horizont alScrollbar ? "HorizontalScrollbar" : "VerticalScrollbar"; }
155 154
155 EAGERLY_FINALIZE();
haraken 2015/06/29 15:20:22 Would you elaborate on why this needs to be eagerl
sof 2015/06/29 15:59:42 Unregistration from the ScrollbarTheme 'manager',
haraken 2015/06/30 10:30:35 ok, let's add some comment anyway :)
sof 2015/06/30 11:34:09 Done.
156 #if ENABLE(OILPAN)
157 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW();
haraken 2015/06/29 15:20:22 I'd prefer using pre-finalizers though. It wouldn'
sof 2015/06/29 15:59:42 I don't understand that argument about risk; could
haraken 2015/06/30 10:30:35 A pre-finalizer is allowed to touch any other on-h
sof 2015/06/30 11:34:08 Thanks for spelling those out; some comments..
158 #endif
159 DECLARE_VIRTUAL_TRACE();
160
156 protected: 161 protected:
157 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol lbarTheme* = 0); 162 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol lbarTheme* = 0);
158 163
159 void updateThumb(); 164 void updateThumb();
160 virtual void updateThumbPosition(); 165 virtual void updateThumbPosition();
161 virtual void updateThumbProportion(); 166 virtual void updateThumbProportion();
162 167
163 void autoscrollTimerFired(Timer<Scrollbar>*); 168 void autoscrollTimerFired(Timer<Scrollbar>*);
164 void startTimerIfNeeded(double delay); 169 void startTimerIfNeeded(double delay);
165 void stopTimerIfNeeded(); 170 void stopTimerIfNeeded();
166 void autoscrollPressedPart(double delay); 171 void autoscrollPressedPart(double delay);
167 ScrollDirectionPhysical pressedPartScrollDirectionPhysical(); 172 ScrollDirectionPhysical pressedPartScrollDirectionPhysical();
168 ScrollGranularity pressedPartScrollGranularity(); 173 ScrollGranularity pressedPartScrollGranularity();
169 174
170 ScrollableArea* m_scrollableArea; 175 RawPtrWillBeMember<ScrollableArea> m_scrollableArea;
171 ScrollbarOrientation m_orientation; 176 ScrollbarOrientation m_orientation;
172 ScrollbarControlSize m_controlSize; 177 ScrollbarControlSize m_controlSize;
173 ScrollbarTheme* m_theme; 178 ScrollbarTheme* m_theme;
haraken 2015/06/29 15:20:22 This raw pointer looks safe because the ScrollbarT
174 179
175 #if ENABLE(OILPAN)
176 // To simplify Oilpan finalization, keep a copy of the ScrollableArea's
177 // scroll animator. Scrollbar is responsible for notifying the animator
178 // when it is destructed.
179 RefPtr<ScrollAnimator> m_animator;
180 #endif
181
182 int m_visibleSize; 180 int m_visibleSize;
183 int m_totalSize; 181 int m_totalSize;
184 float m_currentPos; 182 float m_currentPos;
185 float m_dragOrigin; 183 float m_dragOrigin;
186 184
187 ScrollbarPart m_hoveredPart; 185 ScrollbarPart m_hoveredPart;
188 ScrollbarPart m_pressedPart; 186 ScrollbarPart m_pressedPart;
189 int m_pressedPos; 187 int m_pressedPos;
190 float m_scrollPos; 188 float m_scrollPos;
191 bool m_draggingDocument; 189 bool m_draggingDocument;
(...skipping 14 matching lines...) Expand all
206 virtual bool isScrollbar() const override { return true; } 204 virtual bool isScrollbar() const override { return true; }
207 205
208 float scrollableAreaCurrentPos() const; 206 float scrollableAreaCurrentPos() const;
209 }; 207 };
210 208
211 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr ollbar()); 209 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr ollbar());
212 210
213 } // namespace blink 211 } // namespace blink
214 212
215 #endif // Scrollbar_h 213 #endif // Scrollbar_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698