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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.h

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Created 4 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) 2008, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2011 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 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 ScrollableArea_h 26 #ifndef ScrollableArea_h
27 #define ScrollableArea_h 27 #define ScrollableArea_h
28 28
29 #include "platform/PlatformExport.h" 29 #include "platform/PlatformExport.h"
30 #include "platform/RuntimeEnabledFeatures.h" 30 #include "platform/RuntimeEnabledFeatures.h"
31 #include "platform/geometry/DoublePoint.h" 31 #include "platform/geometry/LayoutRect.h"
32 #include "platform/graphics/Color.h" 32 #include "platform/graphics/Color.h"
33 #include "platform/heap/Handle.h" 33 #include "platform/heap/Handle.h"
34 #include "platform/scroll/ScrollAnimatorBase.h" 34 #include "platform/scroll/ScrollAnimatorBase.h"
35 #include "platform/scroll/ScrollTypes.h" 35 #include "platform/scroll/ScrollTypes.h"
36 #include "platform/scroll/Scrollbar.h" 36 #include "platform/scroll/Scrollbar.h"
37 #include "wtf/MathExtras.h" 37 #include "wtf/MathExtras.h"
38 #include "wtf/Noncopyable.h" 38 #include "wtf/Noncopyable.h"
39 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 class DoubleRect;
44 class FloatPoint;
45 class GraphicsLayer; 43 class GraphicsLayer;
46 class HostWindow; 44 class HostWindow;
47 class LayoutBox; 45 class LayoutBox;
48 class PlatformWheelEvent;
49 class ProgrammaticScrollAnimator; 46 class ProgrammaticScrollAnimator;
50 struct ScrollAlignment; 47 struct ScrollAlignment;
51 class ScrollAnchor; 48 class ScrollAnchor;
52 class ScrollAnimatorBase; 49 class ScrollAnimatorBase;
53 class CompositorAnimationTimeline; 50 class CompositorAnimationTimeline;
54 class Widget;
55 51
56 enum IncludeScrollbarsInRect { 52 enum IncludeScrollbarsInRect {
57 ExcludeScrollbars, 53 ExcludeScrollbars,
58 IncludeScrollbars, 54 IncludeScrollbars,
59 }; 55 };
60 56
61 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin { 57 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
62 WTF_MAKE_NONCOPYABLE(ScrollableArea); 58 WTF_MAKE_NONCOPYABLE(ScrollableArea);
63 59
64 public: 60 public:
65 static int pixelsPerLineStep(HostWindow*); 61 static int pixelsPerLineStep(HostWindow*);
66 static float minFractionToStepWhenPaging(); 62 static float minFractionToStepWhenPaging();
67 static int maxOverlapBetweenPages(); 63 static int maxOverlapBetweenPages();
68 64
69 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as 65 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as
70 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. 66 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values.
71 static double normalizeNonFiniteScroll(double value) { 67 static float normalizeNonFiniteScroll(float value) {
72 return std::isfinite(value) ? value : 0.0; 68 return std::isfinite(value) ? value : 0.0;
73 } 69 }
74 70
75 // The window that hosts the ScrollableArea. The ScrollableArea will communica te scrolls and repaints to the 71 // The window that hosts the ScrollableArea. The ScrollableArea will communica te scrolls and repaints to the
76 // host window in the window's coordinate space. 72 // host window in the window's coordinate space.
77 virtual HostWindow* getHostWindow() const { return 0; } 73 virtual HostWindow* getHostWindow() const { return 0; }
78 74
79 virtual ScrollResult userScroll(ScrollGranularity, const FloatSize&); 75 virtual ScrollResult userScroll(ScrollGranularity, const ScrollOffset&);
80 76
81 virtual void setScrollPosition(const DoublePoint&, 77 virtual void setScrollOffset(const ScrollOffset&,
78 ScrollType,
79 ScrollBehavior = ScrollBehaviorInstant);
80 virtual void scrollBy(const ScrollOffset&,
81 ScrollType,
82 ScrollBehavior = ScrollBehaviorInstant);
83 void setScrollOffsetSingleAxis(ScrollbarOrientation,
84 float,
82 ScrollType, 85 ScrollType,
83 ScrollBehavior = ScrollBehaviorInstant); 86 ScrollBehavior = ScrollBehaviorInstant);
84 virtual void scrollBy(const DoubleSize&,
85 ScrollType,
86 ScrollBehavior = ScrollBehaviorInstant);
87 void setScrollPositionSingleAxis(ScrollbarOrientation,
88 double,
89 ScrollType,
90 ScrollBehavior = ScrollBehaviorInstant);
91 87
92 // Scrolls the area so that the given rect, given in the document's content co ordinates, such that it's 88 // Scrolls the area so that the given rect, given in the document's content co ordinates, such that it's
93 // visible in the area. Returns the new location of the input rect relative on ce again to the document. 89 // visible in the area. Returns the new location of the input rect relative on ce again to the document.
94 // Note, in the case of a Document container, such as FrameView, the output wi ll always be the input rect 90 // Note, in the case of a Document container, such as FrameView, the output wi ll always be the input rect
95 // since scrolling it can't change the location of content relative to the doc ument, unlike an overflowing 91 // since scrolling it can't change the location of content relative to the doc ument, unlike an overflowing
96 // element. 92 // element.
97 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent, 93 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent,
98 const ScrollAlignment& alignX, 94 const ScrollAlignment& alignX,
99 const ScrollAlignment& alignY, 95 const ScrollAlignment& alignY,
100 ScrollType = ProgrammaticScroll); 96 ScrollType = ProgrammaticScroll);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 143
148 // See Source/core/layout/README.md for an explanation of scroll origin. 144 // See Source/core/layout/README.md for an explanation of scroll origin.
149 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } 145 const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
150 bool scrollOriginChanged() const { return m_scrollOriginChanged; } 146 bool scrollOriginChanged() const { return m_scrollOriginChanged; }
151 147
152 // This is used to determine whether the incoming fractional scroll offset sho uld 148 // This is used to determine whether the incoming fractional scroll offset sho uld
153 // be truncated to integer. Current rule is that if preferCompositingToLCDText Enabled() 149 // be truncated to integer. Current rule is that if preferCompositingToLCDText Enabled()
154 // is disabled (which is true on low-dpi device by default) we should do the t runcation. 150 // is disabled (which is true on low-dpi device by default) we should do the t runcation.
155 // The justification is that non-composited elements using fractional scroll o ffsets 151 // The justification is that non-composited elements using fractional scroll o ffsets
156 // is causing too much nasty bugs but does not add too benefit on low-dpi devi ces. 152 // is causing too much nasty bugs but does not add too benefit on low-dpi devi ces.
153 // TODO(szager): Now that scroll offsets are floats everywhere, can we get rid of this?
157 virtual bool shouldUseIntegerScrollOffset() const { 154 virtual bool shouldUseIntegerScrollOffset() const {
158 return !RuntimeEnabledFeatures::fractionalScrollOffsetsEnabled(); 155 return !RuntimeEnabledFeatures::fractionalScrollOffsetsEnabled();
159 } 156 }
160 157
161 virtual bool isActive() const = 0; 158 virtual bool isActive() const = 0;
162 virtual int scrollSize(ScrollbarOrientation) const = 0; 159 virtual int scrollSize(ScrollbarOrientation) const = 0;
163 void setScrollbarNeedsPaintInvalidation(ScrollbarOrientation); 160 void setScrollbarNeedsPaintInvalidation(ScrollbarOrientation);
164 virtual bool isScrollCornerVisible() const = 0; 161 virtual bool isScrollCornerVisible() const = 0;
165 virtual IntRect scrollCornerRect() const = 0; 162 virtual IntRect scrollCornerRect() const = 0;
166 void setScrollCornerNeedsPaintInvalidation(); 163 void setScrollCornerNeedsPaintInvalidation();
(...skipping 19 matching lines...) Expand all
186 } 183 }
187 virtual IntPoint convertFromContainingWidgetToScrollbar( 184 virtual IntPoint convertFromContainingWidgetToScrollbar(
188 const Scrollbar& scrollbar, 185 const Scrollbar& scrollbar,
189 const IntPoint& parentPoint) const { 186 const IntPoint& parentPoint) const {
190 return scrollbar.Widget::convertFromContainingWidget(parentPoint); 187 return scrollbar.Widget::convertFromContainingWidget(parentPoint);
191 } 188 }
192 189
193 virtual Scrollbar* horizontalScrollbar() const { return nullptr; } 190 virtual Scrollbar* horizontalScrollbar() const { return nullptr; }
194 virtual Scrollbar* verticalScrollbar() const { return nullptr; } 191 virtual Scrollbar* verticalScrollbar() const { return nullptr; }
195 192
196 // scrollPosition is relative to the scrollOrigin. i.e. If the page is RTL 193 // scrollOffset is relative to the scrollOrigin. i.e. If the page is RTL
197 // then scrollPosition will be negative. By default, scrollPositionDouble() 194 // then scrollOffset will be negative. By default, scrollOffset()
198 // just call into scrollPosition(). Subclass can override scrollPositionDouble () 195 // just calls into scrollOffset(). Subclasses can override scrollOffset()
199 // to return floating point precision scrolloffset. 196 // to return floating point precision scroll offsets.
200 // FIXME: Remove scrollPosition(). crbug.com/414283. 197 // FIXME: Remove scrollOffset(). crbug.com/414283.
201 virtual IntPoint scrollPosition() const = 0; 198 virtual IntSize scrollOffsetInt() const = 0;
bokan 2016/10/02 19:47:51 Is there a reason this Position->Offset renaming i
szager1 2016/10/05 07:43:36 The other patch had functional changes, and it was
bokan 2016/10/06 22:32:17 Acknowledged.
202 virtual DoublePoint scrollPositionDouble() const { 199 virtual ScrollOffset scrollOffset() const {
203 return DoublePoint(scrollPosition()); 200 return ScrollOffset(scrollOffsetInt());
204 } 201 }
205 virtual IntPoint minimumScrollPosition() const = 0; 202 virtual IntSize minimumScrollOffsetInt() const = 0;
206 virtual DoublePoint minimumScrollPositionDouble() const { 203 virtual ScrollOffset minimumScrollOffset() const {
207 return DoublePoint(minimumScrollPosition()); 204 return ScrollOffset(minimumScrollOffsetInt());
208 } 205 }
209 virtual IntPoint maximumScrollPosition() const = 0; 206 virtual IntSize maximumScrollOffsetInt() const = 0;
210 virtual DoublePoint maximumScrollPositionDouble() const { 207 virtual ScrollOffset maximumScrollOffset() const {
211 return DoublePoint(maximumScrollPosition()); 208 return ScrollOffset(maximumScrollOffsetInt());
212 } 209 }
213 210
214 virtual DoubleRect visibleContentRectDouble(
215 IncludeScrollbarsInRect = ExcludeScrollbars) const;
216 virtual IntRect visibleContentRect( 211 virtual IntRect visibleContentRect(
217 IncludeScrollbarsInRect = ExcludeScrollbars) const; 212 IncludeScrollbarsInRect = ExcludeScrollbars) const;
218 virtual int visibleHeight() const { return visibleContentRect().height(); } 213 virtual int visibleHeight() const { return visibleContentRect().height(); }
219 virtual int visibleWidth() const { return visibleContentRect().width(); } 214 virtual int visibleWidth() const { return visibleContentRect().width(); }
220 virtual IntSize contentsSize() const = 0; 215 virtual IntSize contentsSize() const = 0;
221 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); } 216 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); }
222 217
223 virtual bool shouldSuspendScrollAnimations() const { return true; } 218 virtual bool shouldSuspendScrollAnimations() const { return true; }
224 virtual void scrollbarStyleChanged() {} 219 virtual void scrollbarStyleChanged() {}
225 virtual void scrollbarVisibilityChanged() {} 220 virtual void scrollbarVisibilityChanged() {}
226 virtual bool scrollbarsCanBeActive() const = 0; 221 virtual bool scrollbarsCanBeActive() const = 0;
227 222
228 // Returns the bounding box of this scrollable area, in the coordinate system of the enclosing scroll view. 223 // Returns the bounding box of this scrollable area, in the coordinate system of the enclosing scroll view.
229 virtual IntRect scrollableAreaBoundingBox() const = 0; 224 virtual IntRect scrollableAreaBoundingBox() const = 0;
230 225
231 virtual bool scrollAnimatorEnabled() const { return false; } 226 virtual bool scrollAnimatorEnabled() const { return false; }
232 227
233 // NOTE: Only called from Internals for testing. 228 // NOTE: Only called from Internals for testing.
234 void updateScrollPositionFromInternals(const IntPoint&); 229 void updateScrollOffsetFromInternals(const IntSize&);
235 230
236 IntPoint clampScrollPosition(const IntPoint&) const; 231 IntSize clampScrollOffset(const IntSize&) const;
237 DoublePoint clampScrollPosition(const DoublePoint&) const; 232 ScrollOffset clampScrollOffset(const ScrollOffset&) const;
238 233
239 // Let subclasses provide a way of asking for and servicing scroll 234 // Let subclasses provide a way of asking for and servicing scroll
240 // animations. 235 // animations.
241 virtual bool scheduleAnimation(); 236 virtual bool scheduleAnimation();
242 virtual void serviceScrollAnimations(double monotonicTime); 237 virtual void serviceScrollAnimations(double monotonicTime);
243 virtual void updateCompositorScrollAnimations(); 238 virtual void updateCompositorScrollAnimations();
244 virtual void registerForAnimation() {} 239 virtual void registerForAnimation() {}
245 virtual void deregisterForAnimation() {} 240 virtual void deregisterForAnimation() {}
246 241
247 virtual bool usesCompositedScrolling() const { return false; } 242 virtual bool usesCompositedScrolling() const { return false; }
248 virtual bool shouldScrollOnMainThread() const; 243 virtual bool shouldScrollOnMainThread() const;
249 244
250 // Returns true if the GraphicsLayer tree needs to be rebuilt. 245 // Returns true if the GraphicsLayer tree needs to be rebuilt.
251 virtual bool updateAfterCompositingChange() { return false; } 246 virtual bool updateAfterCompositingChange() { return false; }
252 247
253 virtual bool userInputScrollable(ScrollbarOrientation) const = 0; 248 virtual bool userInputScrollable(ScrollbarOrientation) const = 0;
254 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0; 249 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0;
255 250
256 // Convenience functions 251 // Convenience functions
257 int scrollPosition(ScrollbarOrientation orientation) { 252 float scrollOffset(ScrollbarOrientation orientation) {
258 return orientation == HorizontalScrollbar ? scrollPosition().x() 253 return orientation == HorizontalScrollbar ? scrollOffsetInt().width()
259 : scrollPosition().y(); 254 : scrollOffsetInt().height();
260 } 255 }
261 int minimumScrollPosition(ScrollbarOrientation orientation) { 256 float minimumScrollOffset(ScrollbarOrientation orientation) {
262 return orientation == HorizontalScrollbar ? minimumScrollPosition().x() 257 return orientation == HorizontalScrollbar ? minimumScrollOffset().width()
263 : minimumScrollPosition().y(); 258 : minimumScrollOffset().height();
264 } 259 }
265 int maximumScrollPosition(ScrollbarOrientation orientation) { 260 float maximumScrollOffset(ScrollbarOrientation orientation) {
266 return orientation == HorizontalScrollbar ? maximumScrollPosition().x() 261 return orientation == HorizontalScrollbar ? maximumScrollOffset().width()
267 : maximumScrollPosition().y(); 262 : maximumScrollOffset().height();
268 } 263 }
269 int clampScrollPosition(ScrollbarOrientation orientation, int pos) { 264 float clampScrollOffset(ScrollbarOrientation orientation, float offset) {
270 return clampTo(pos, minimumScrollPosition(orientation), 265 return clampTo(offset, minimumScrollOffset(orientation),
271 maximumScrollPosition(orientation)); 266 maximumScrollOffset(orientation));
272 } 267 }
273 268
274 virtual GraphicsLayer* layerForContainer() const; 269 virtual GraphicsLayer* layerForContainer() const;
275 virtual GraphicsLayer* layerForScrolling() const { return 0; } 270 virtual GraphicsLayer* layerForScrolling() const { return 0; }
276 virtual GraphicsLayer* layerForHorizontalScrollbar() const { return 0; } 271 virtual GraphicsLayer* layerForHorizontalScrollbar() const { return 0; }
277 virtual GraphicsLayer* layerForVerticalScrollbar() const { return 0; } 272 virtual GraphicsLayer* layerForVerticalScrollbar() const { return 0; }
278 virtual GraphicsLayer* layerForScrollCorner() const { return 0; } 273 virtual GraphicsLayer* layerForScrollCorner() const { return 0; }
279 bool hasLayerForHorizontalScrollbar() const; 274 bool hasLayerForHorizontalScrollbar() const;
280 bool hasLayerForVerticalScrollbar() const; 275 bool hasLayerForVerticalScrollbar() const;
281 bool hasLayerForScrollCorner() const; 276 bool hasLayerForScrollCorner() const;
(...skipping 14 matching lines...) Expand all
296 virtual ScrollBehavior scrollBehaviorStyle() const { 291 virtual ScrollBehavior scrollBehaviorStyle() const {
297 return ScrollBehaviorInstant; 292 return ScrollBehaviorInstant;
298 } 293 }
299 294
300 // TODO(bokan): This is only used in FrameView to check scrollability but is 295 // TODO(bokan): This is only used in FrameView to check scrollability but is
301 // needed here to allow RootFrameViewport to preserve wheelHandler 296 // needed here to allow RootFrameViewport to preserve wheelHandler
302 // semantics. Not sure why it's FrameView specific, it could probably be 297 // semantics. Not sure why it's FrameView specific, it could probably be
303 // generalized to other types of ScrollableAreas. 298 // generalized to other types of ScrollableAreas.
304 virtual bool isScrollable() { return true; } 299 virtual bool isScrollable() { return true; }
305 300
306 // TODO(bokan): FrameView::setScrollPosition uses updateScrollbars to scroll 301 // TODO(bokan): FrameView::setScrollOffset uses updateScrollbars to scroll
307 // which bails out early if its already in updateScrollbars, the effect being 302 // which bails out early if its already in updateScrollbars, the effect being
308 // that programmatic scrolls (i.e. setScrollPosition) are disabled when in 303 // that programmatic scrolls (i.e. setScrollOffset) are disabled when in
309 // updateScrollbars. Expose this here to allow RootFrameViewport to match the 304 // updateScrollbars. Expose this here to allow RootFrameViewport to match the
310 // semantics for now but it should be cleaned up at the source. 305 // semantics for now but it should be cleaned up at the source.
311 virtual bool isProgrammaticallyScrollable() { return true; } 306 virtual bool isProgrammaticallyScrollable() { return true; }
312 307
313 // Subtracts space occupied by this ScrollableArea's scrollbars. 308 // Subtracts space occupied by this ScrollableArea's scrollbars.
314 // Does nothing if overlay scrollbars are enabled. 309 // Does nothing if overlay scrollbars are enabled.
315 IntSize excludeScrollbars(const IntSize&) const; 310 IntSize excludeScrollbars(const IntSize&) const;
316 311
317 // Returns 0 if overlay scrollbars are enabled. 312 // Returns 0 if overlay scrollbars are enabled.
318 int verticalScrollbarWidth() const; 313 int verticalScrollbarWidth() const;
319 int horizontalScrollbarHeight() const; 314 int horizontalScrollbarHeight() const;
320 315
321 // Returns the widget associated with this ScrollableArea. 316 // Returns the widget associated with this ScrollableArea.
322 virtual Widget* getWidget() { return nullptr; } 317 virtual Widget* getWidget() { return nullptr; }
323 318
324 virtual LayoutBox* layoutBox() const { return nullptr; } 319 virtual LayoutBox* layoutBox() const { return nullptr; }
325 320
326 virtual bool isFrameView() const { return false; } 321 virtual bool isFrameView() const { return false; }
327 virtual bool isPaintLayerScrollableArea() const { return false; } 322 virtual bool isPaintLayerScrollableArea() const { return false; }
328 virtual bool isRootFrameViewport() const { return false; } 323 virtual bool isRootFrameViewport() const { return false; }
329 324
330 // Returns true if the scroller adjusts the scroll position to compensate 325 // Returns true if the scroller adjusts the scroll offset to compensate
331 // for layout movements (bit.ly/scroll-anchoring). 326 // for layout movements (bit.ly/scroll-anchoring).
332 virtual bool shouldPerformScrollAnchoring() const { return false; } 327 virtual bool shouldPerformScrollAnchoring() const { return false; }
333 328
334 // Need to promptly let go of owned animator objects. 329 // Need to promptly let go of owned animator objects.
335 EAGERLY_FINALIZE(); 330 EAGERLY_FINALIZE();
336 DECLARE_VIRTUAL_TRACE(); 331 DECLARE_VIRTUAL_TRACE();
337 332
338 virtual void clearScrollAnimators(); 333 virtual void clearScrollAnimators();
339 334
340 virtual ScrollAnchor* scrollAnchor() { return nullptr; } 335 virtual ScrollAnchor* scrollAnchor() { return nullptr; }
341 336
342 protected: 337 protected:
343 ScrollableArea(); 338 ScrollableArea();
344 339
345 ScrollbarOrientation scrollbarOrientationFromDirection( 340 ScrollbarOrientation scrollbarOrientationFromDirection(
346 ScrollDirectionPhysical) const; 341 ScrollDirectionPhysical) const;
347 float scrollStep(ScrollGranularity, ScrollbarOrientation) const; 342 float scrollStep(ScrollGranularity, ScrollbarOrientation) const;
348 343
349 void setScrollOrigin(const IntPoint&); 344 void setScrollOrigin(const IntPoint&);
350 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } 345 void resetScrollOriginChanged() { m_scrollOriginChanged = false; }
351 346
352 // Needed to let the animators call scrollPositionChanged. 347 // Needed to let the animators call scrollOffsetChanged.
353 friend class ScrollAnimatorCompositorCoordinator; 348 friend class ScrollAnimatorCompositorCoordinator;
354 void scrollPositionChanged(const DoublePoint&, ScrollType); 349 void scrollOffsetChanged(const ScrollOffset&, ScrollType);
355 350
356 bool horizontalScrollbarNeedsPaintInvalidation() const { 351 bool horizontalScrollbarNeedsPaintInvalidation() const {
357 return m_horizontalScrollbarNeedsPaintInvalidation; 352 return m_horizontalScrollbarNeedsPaintInvalidation;
358 } 353 }
359 bool verticalScrollbarNeedsPaintInvalidation() const { 354 bool verticalScrollbarNeedsPaintInvalidation() const {
360 return m_verticalScrollbarNeedsPaintInvalidation; 355 return m_verticalScrollbarNeedsPaintInvalidation;
361 } 356 }
362 bool scrollCornerNeedsPaintInvalidation() const { 357 bool scrollCornerNeedsPaintInvalidation() const {
363 return m_scrollCornerNeedsPaintInvalidation; 358 return m_scrollCornerNeedsPaintInvalidation;
364 } 359 }
365 void clearNeedsPaintInvalidationForScrollControls() { 360 void clearNeedsPaintInvalidationForScrollControls() {
366 m_horizontalScrollbarNeedsPaintInvalidation = false; 361 m_horizontalScrollbarNeedsPaintInvalidation = false;
367 m_verticalScrollbarNeedsPaintInvalidation = false; 362 m_verticalScrollbarNeedsPaintInvalidation = false;
368 m_scrollCornerNeedsPaintInvalidation = false; 363 m_scrollCornerNeedsPaintInvalidation = false;
369 } 364 }
370 365
371 private: 366 private:
372 void programmaticScrollHelper(const DoublePoint&, ScrollBehavior); 367 void programmaticScrollHelper(const ScrollOffset&, ScrollBehavior);
373 void userScrollHelper(const DoublePoint&, ScrollBehavior); 368 void userScrollHelper(const ScrollOffset&, ScrollBehavior);
374 369
375 // This function should be overriden by subclasses to perform the actual scrol l of the content. 370 // This function should be overriden by subclasses to perform the actual scrol l of the content.
376 virtual void updateScrollPosition(const DoublePoint&, ScrollType) = 0; 371 virtual void updateScrollOffset(const ScrollOffset&, ScrollType) = 0;
377 372
378 virtual int lineStep(ScrollbarOrientation) const; 373 virtual int lineStep(ScrollbarOrientation) const;
379 virtual int pageStep(ScrollbarOrientation) const; 374 virtual int pageStep(ScrollbarOrientation) const;
380 virtual int documentStep(ScrollbarOrientation) const; 375 virtual int documentStep(ScrollbarOrientation) const;
381 virtual float pixelStep(ScrollbarOrientation) const; 376 virtual float pixelStep(ScrollbarOrientation) const;
382 377
383 mutable Member<ScrollAnimatorBase> m_scrollAnimator; 378 mutable Member<ScrollAnimatorBase> m_scrollAnimator;
384 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator; 379 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator;
385 380
386 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle 381 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle
(...skipping 12 matching lines...) Expand all
399 // vertical-lr / ltr NO NO 394 // vertical-lr / ltr NO NO
400 // vertical-lr / rtl NO YES 395 // vertical-lr / rtl NO YES
401 // vertical-rl / ltr YES NO 396 // vertical-rl / ltr YES NO
402 // vertical-rl / rtl YES YES 397 // vertical-rl / rtl YES YES
403 IntPoint m_scrollOrigin; 398 IntPoint m_scrollOrigin;
404 }; 399 };
405 400
406 } // namespace blink 401 } // namespace blink
407 402
408 #endif // ScrollableArea_h 403 #endif // ScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698