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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md 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 71 // The window that hosts the ScrollableArea. The ScrollableArea will
76 // communicate scrolls and repaints to the host window in the window's 72 // communicate scrolls and repaints to the host window in the window's
77 // coordinate space. 73 // coordinate space.
78 virtual HostWindow* getHostWindow() const { return 0; } 74 virtual HostWindow* getHostWindow() const { return 0; }
79 75
80 virtual ScrollResult userScroll(ScrollGranularity, const FloatSize&); 76 virtual ScrollResult userScroll(ScrollGranularity, const ScrollOffset&);
81 77
82 virtual void setScrollPosition(const DoublePoint&, 78 virtual void setScrollOffset(const ScrollOffset&,
79 ScrollType,
80 ScrollBehavior = ScrollBehaviorInstant);
81 virtual void scrollBy(const ScrollOffset&,
82 ScrollType,
83 ScrollBehavior = ScrollBehaviorInstant);
84 void setScrollOffsetSingleAxis(ScrollbarOrientation,
85 float,
83 ScrollType, 86 ScrollType,
84 ScrollBehavior = ScrollBehaviorInstant); 87 ScrollBehavior = ScrollBehaviorInstant);
85 virtual void scrollBy(const DoubleSize&,
86 ScrollType,
87 ScrollBehavior = ScrollBehaviorInstant);
88 void setScrollPositionSingleAxis(ScrollbarOrientation,
89 double,
90 ScrollType,
91 ScrollBehavior = ScrollBehaviorInstant);
92 88
93 // Scrolls the area so that the given rect, given in the document's content 89 // Scrolls the area so that the given rect, given in the document's content
94 // coordinates, such that it's visible in the area. Returns the new location 90 // coordinates, such that it's visible in the area. Returns the new location
95 // of the input rect relative once again to the document. 91 // of the input rect relative once again to the document.
96 // Note, in the case of a Document container, such as FrameView, the output 92 // Note, in the case of a Document container, such as FrameView, the output
97 // will always be the input rect since scrolling it can't change the location 93 // will always be the input rect since scrolling it can't change the location
98 // of content relative to the document, unlike an overflowing element. 94 // of content relative to the document, unlike an overflowing element.
99 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent, 95 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent,
100 const ScrollAlignment& alignX, 96 const ScrollAlignment& alignX,
101 const ScrollAlignment& alignY, 97 const ScrollAlignment& alignY,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // See Source/core/layout/README.md for an explanation of scroll origin. 147 // See Source/core/layout/README.md for an explanation of scroll origin.
152 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } 148 const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
153 bool scrollOriginChanged() const { return m_scrollOriginChanged; } 149 bool scrollOriginChanged() const { return m_scrollOriginChanged; }
154 150
155 // This is used to determine whether the incoming fractional scroll offset 151 // This is used to determine whether the incoming fractional scroll offset
156 // should be truncated to integer. Current rule is that if 152 // should be truncated to integer. Current rule is that if
157 // preferCompositingToLCDTextEnabled() is disabled (which is true on low-dpi 153 // preferCompositingToLCDTextEnabled() is disabled (which is true on low-dpi
158 // device by default) we should do the truncation. The justification is that 154 // device by default) we should do the truncation. The justification is that
159 // non-composited elements using fractional scroll offsets is causing too much 155 // non-composited elements using fractional scroll offsets is causing too much
160 // nasty bugs but does not add too benefit on low-dpi devices. 156 // nasty bugs but does not add too benefit on low-dpi devices.
157 // TODO(szager): Now that scroll offsets are floats everywhere, can we get rid
158 // of this?
161 virtual bool shouldUseIntegerScrollOffset() const { 159 virtual bool shouldUseIntegerScrollOffset() const {
162 return !RuntimeEnabledFeatures::fractionalScrollOffsetsEnabled(); 160 return !RuntimeEnabledFeatures::fractionalScrollOffsetsEnabled();
163 } 161 }
164 162
165 virtual bool isActive() const = 0; 163 virtual bool isActive() const = 0;
166 virtual int scrollSize(ScrollbarOrientation) const = 0; 164 virtual int scrollSize(ScrollbarOrientation) const = 0;
167 void setScrollbarNeedsPaintInvalidation(ScrollbarOrientation); 165 void setScrollbarNeedsPaintInvalidation(ScrollbarOrientation);
168 virtual bool isScrollCornerVisible() const = 0; 166 virtual bool isScrollCornerVisible() const = 0;
169 virtual IntRect scrollCornerRect() const = 0; 167 virtual IntRect scrollCornerRect() const = 0;
170 void setScrollCornerNeedsPaintInvalidation(); 168 void setScrollCornerNeedsPaintInvalidation();
(...skipping 19 matching lines...) Expand all
190 } 188 }
191 virtual IntPoint convertFromContainingWidgetToScrollbar( 189 virtual IntPoint convertFromContainingWidgetToScrollbar(
192 const Scrollbar& scrollbar, 190 const Scrollbar& scrollbar,
193 const IntPoint& parentPoint) const { 191 const IntPoint& parentPoint) const {
194 return scrollbar.Widget::convertFromContainingWidget(parentPoint); 192 return scrollbar.Widget::convertFromContainingWidget(parentPoint);
195 } 193 }
196 194
197 virtual Scrollbar* horizontalScrollbar() const { return nullptr; } 195 virtual Scrollbar* horizontalScrollbar() const { return nullptr; }
198 virtual Scrollbar* verticalScrollbar() const { return nullptr; } 196 virtual Scrollbar* verticalScrollbar() const { return nullptr; }
199 197
200 // scrollPosition is relative to the scrollOrigin. i.e. If the page is RTL 198 // scrollPosition is the location of the top/left of the scroll viewport in
201 // then scrollPosition will be negative. By default, scrollPositionDouble() 199 // the coordinate system defined by the top/left of the overflow rect.
202 // just call into scrollPosition(). Subclass can override 200 // scrollOffset is the offset of the scroll viewport from its position when
203 // scrollPositionDouble() to return floating point precision scrolloffset. 201 // scrolled all the way to the beginning of its content's flow.
204 // FIXME: Remove scrollPosition(). crbug.com/414283. 202 // For a more detailed explanation of scrollPosition, scrollOffset, and
205 virtual IntPoint scrollPosition() const = 0; 203 // scrollOrigin, see core/layout/README.md.
206 virtual DoublePoint scrollPositionDouble() const { 204 FloatPoint scrollPosition() const {
207 return DoublePoint(scrollPosition()); 205 return FloatPoint(scrollOrigin()) + scrollOffset();
208 } 206 }
209 virtual IntPoint minimumScrollPosition() const = 0; 207 virtual IntSize scrollOffsetInt() const = 0;
210 virtual DoublePoint minimumScrollPositionDouble() const { 208 virtual ScrollOffset scrollOffset() const {
211 return DoublePoint(minimumScrollPosition()); 209 return ScrollOffset(scrollOffsetInt());
212 } 210 }
213 virtual IntPoint maximumScrollPosition() const = 0; 211 virtual IntSize minimumScrollOffsetInt() const = 0;
214 virtual DoublePoint maximumScrollPositionDouble() const { 212 virtual ScrollOffset minimumScrollOffset() const {
215 return DoublePoint(maximumScrollPosition()); 213 return ScrollOffset(minimumScrollOffsetInt());
214 }
215 virtual IntSize maximumScrollOffsetInt() const = 0;
216 virtual ScrollOffset maximumScrollOffset() const {
217 return ScrollOffset(maximumScrollOffsetInt());
216 } 218 }
217 219
218 virtual DoubleRect visibleContentRectDouble(
219 IncludeScrollbarsInRect = ExcludeScrollbars) const;
220 virtual IntRect visibleContentRect( 220 virtual IntRect visibleContentRect(
221 IncludeScrollbarsInRect = ExcludeScrollbars) const; 221 IncludeScrollbarsInRect = ExcludeScrollbars) const;
222 virtual int visibleHeight() const { return visibleContentRect().height(); } 222 virtual int visibleHeight() const { return visibleContentRect().height(); }
223 virtual int visibleWidth() const { return visibleContentRect().width(); } 223 virtual int visibleWidth() const { return visibleContentRect().width(); }
224 virtual IntSize contentsSize() const = 0; 224 virtual IntSize contentsSize() const = 0;
225 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); } 225 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); }
226 226
227 virtual bool shouldSuspendScrollAnimations() const { return true; } 227 virtual bool shouldSuspendScrollAnimations() const { return true; }
228 virtual void scrollbarStyleChanged() {} 228 virtual void scrollbarStyleChanged() {}
229 virtual void scrollbarVisibilityChanged() {} 229 virtual void scrollbarVisibilityChanged() {}
230 virtual bool scrollbarsCanBeActive() const = 0; 230 virtual bool scrollbarsCanBeActive() const = 0;
231 231
232 // Returns the bounding box of this scrollable area, in the coordinate system 232 // Returns the bounding box of this scrollable area, in the coordinate system
233 // of the enclosing scroll view. 233 // of the enclosing scroll view.
234 virtual IntRect scrollableAreaBoundingBox() const = 0; 234 virtual IntRect scrollableAreaBoundingBox() const = 0;
235 235
236 virtual bool scrollAnimatorEnabled() const { return false; } 236 virtual bool scrollAnimatorEnabled() const { return false; }
237 237
238 // NOTE: Only called from Internals for testing. 238 // NOTE: Only called from Internals for testing.
239 void setScrollOffsetFromInternals(const IntPoint&); 239 void updateScrollOffsetFromInternals(const IntSize&);
240 240
241 IntPoint clampScrollPosition(const IntPoint&) const; 241 IntSize clampScrollOffset(const IntSize&) const;
242 DoublePoint clampScrollPosition(const DoublePoint&) const; 242 ScrollOffset clampScrollOffset(const ScrollOffset&) const;
243 243
244 // Let subclasses provide a way of asking for and servicing scroll 244 // Let subclasses provide a way of asking for and servicing scroll
245 // animations. 245 // animations.
246 virtual bool scheduleAnimation(); 246 virtual bool scheduleAnimation();
247 virtual void serviceScrollAnimations(double monotonicTime); 247 virtual void serviceScrollAnimations(double monotonicTime);
248 virtual void updateCompositorScrollAnimations(); 248 virtual void updateCompositorScrollAnimations();
249 virtual void registerForAnimation() {} 249 virtual void registerForAnimation() {}
250 virtual void deregisterForAnimation() {} 250 virtual void deregisterForAnimation() {}
251 251
252 virtual bool usesCompositedScrolling() const { return false; } 252 virtual bool usesCompositedScrolling() const { return false; }
253 virtual bool shouldScrollOnMainThread() const; 253 virtual bool shouldScrollOnMainThread() const;
254 254
255 // Returns true if the GraphicsLayer tree needs to be rebuilt. 255 // Returns true if the GraphicsLayer tree needs to be rebuilt.
256 virtual bool updateAfterCompositingChange() { return false; } 256 virtual bool updateAfterCompositingChange() { return false; }
257 257
258 virtual bool userInputScrollable(ScrollbarOrientation) const = 0; 258 virtual bool userInputScrollable(ScrollbarOrientation) const = 0;
259 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0; 259 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0;
260 260
261 // Convenience functions 261 // Convenience functions
262 int scrollPosition(ScrollbarOrientation orientation) { 262 float scrollOffset(ScrollbarOrientation orientation) {
263 return orientation == HorizontalScrollbar ? scrollPosition().x() 263 return orientation == HorizontalScrollbar ? scrollOffsetInt().width()
264 : scrollPosition().y(); 264 : scrollOffsetInt().height();
265 } 265 }
266 int minimumScrollPosition(ScrollbarOrientation orientation) { 266 float minimumScrollOffset(ScrollbarOrientation orientation) {
267 return orientation == HorizontalScrollbar ? minimumScrollPosition().x() 267 return orientation == HorizontalScrollbar ? minimumScrollOffset().width()
268 : minimumScrollPosition().y(); 268 : minimumScrollOffset().height();
269 } 269 }
270 int maximumScrollPosition(ScrollbarOrientation orientation) { 270 float maximumScrollOffset(ScrollbarOrientation orientation) {
271 return orientation == HorizontalScrollbar ? maximumScrollPosition().x() 271 return orientation == HorizontalScrollbar ? maximumScrollOffset().width()
272 : maximumScrollPosition().y(); 272 : maximumScrollOffset().height();
273 } 273 }
274 int clampScrollPosition(ScrollbarOrientation orientation, int pos) { 274 float clampScrollOffset(ScrollbarOrientation orientation, float offset) {
275 return clampTo(pos, minimumScrollPosition(orientation), 275 return clampTo(offset, minimumScrollOffset(orientation),
276 maximumScrollPosition(orientation)); 276 maximumScrollOffset(orientation));
277 } 277 }
278 278
279 virtual GraphicsLayer* layerForContainer() const; 279 virtual GraphicsLayer* layerForContainer() const;
280 virtual GraphicsLayer* layerForScrolling() const { return 0; } 280 virtual GraphicsLayer* layerForScrolling() const { return 0; }
281 virtual GraphicsLayer* layerForHorizontalScrollbar() const { return 0; } 281 virtual GraphicsLayer* layerForHorizontalScrollbar() const { return 0; }
282 virtual GraphicsLayer* layerForVerticalScrollbar() const { return 0; } 282 virtual GraphicsLayer* layerForVerticalScrollbar() const { return 0; }
283 virtual GraphicsLayer* layerForScrollCorner() const { return 0; } 283 virtual GraphicsLayer* layerForScrollCorner() const { return 0; }
284 bool hasLayerForHorizontalScrollbar() const; 284 bool hasLayerForHorizontalScrollbar() const;
285 bool hasLayerForVerticalScrollbar() const; 285 bool hasLayerForVerticalScrollbar() const;
286 bool hasLayerForScrollCorner() const; 286 bool hasLayerForScrollCorner() const;
(...skipping 15 matching lines...) Expand all
302 virtual ScrollBehavior scrollBehaviorStyle() const { 302 virtual ScrollBehavior scrollBehaviorStyle() const {
303 return ScrollBehaviorInstant; 303 return ScrollBehaviorInstant;
304 } 304 }
305 305
306 // TODO(bokan): This is only used in FrameView to check scrollability but is 306 // TODO(bokan): This is only used in FrameView to check scrollability but is
307 // needed here to allow RootFrameViewport to preserve wheelHandler 307 // needed here to allow RootFrameViewport to preserve wheelHandler
308 // semantics. Not sure why it's FrameView specific, it could probably be 308 // semantics. Not sure why it's FrameView specific, it could probably be
309 // generalized to other types of ScrollableAreas. 309 // generalized to other types of ScrollableAreas.
310 virtual bool isScrollable() { return true; } 310 virtual bool isScrollable() { return true; }
311 311
312 // TODO(bokan): FrameView::setScrollPosition uses updateScrollbars to scroll 312 // TODO(bokan): FrameView::setScrollOffset uses updateScrollbars to scroll
313 // which bails out early if its already in updateScrollbars, the effect being 313 // which bails out early if its already in updateScrollbars, the effect being
314 // that programmatic scrolls (i.e. setScrollPosition) are disabled when in 314 // that programmatic scrolls (i.e. setScrollOffset) are disabled when in
315 // updateScrollbars. Expose this here to allow RootFrameViewport to match the 315 // updateScrollbars. Expose this here to allow RootFrameViewport to match the
316 // semantics for now but it should be cleaned up at the source. 316 // semantics for now but it should be cleaned up at the source.
317 virtual bool isProgrammaticallyScrollable() { return true; } 317 virtual bool isProgrammaticallyScrollable() { return true; }
318 318
319 // Subtracts space occupied by this ScrollableArea's scrollbars. 319 // Subtracts space occupied by this ScrollableArea's scrollbars.
320 // Does nothing if overlay scrollbars are enabled. 320 // Does nothing if overlay scrollbars are enabled.
321 IntSize excludeScrollbars(const IntSize&) const; 321 IntSize excludeScrollbars(const IntSize&) const;
322 322
323 // Returns 0 if overlay scrollbars are enabled. 323 // Returns 0 if overlay scrollbars are enabled.
324 int verticalScrollbarWidth() const; 324 int verticalScrollbarWidth() const;
325 int horizontalScrollbarHeight() const; 325 int horizontalScrollbarHeight() const;
326 326
327 // Returns the widget associated with this ScrollableArea. 327 // Returns the widget associated with this ScrollableArea.
328 virtual Widget* getWidget() { return nullptr; } 328 virtual Widget* getWidget() { return nullptr; }
329 329
330 virtual LayoutBox* layoutBox() const { return nullptr; } 330 virtual LayoutBox* layoutBox() const { return nullptr; }
331 331
332 virtual bool isFrameView() const { return false; } 332 virtual bool isFrameView() const { return false; }
333 virtual bool isPaintLayerScrollableArea() const { return false; } 333 virtual bool isPaintLayerScrollableArea() const { return false; }
334 virtual bool isRootFrameViewport() const { return false; } 334 virtual bool isRootFrameViewport() const { return false; }
335 335
336 // Returns true if the scroller adjusts the scroll position to compensate 336 // Returns true if the scroller adjusts the scroll offset to compensate
337 // for layout movements (bit.ly/scroll-anchoring). 337 // for layout movements (bit.ly/scroll-anchoring).
338 virtual bool shouldPerformScrollAnchoring() const { return false; } 338 virtual bool shouldPerformScrollAnchoring() const { return false; }
339 339
340 // Need to promptly let go of owned animator objects. 340 // Need to promptly let go of owned animator objects.
341 EAGERLY_FINALIZE(); 341 EAGERLY_FINALIZE();
342 DECLARE_VIRTUAL_TRACE(); 342 DECLARE_VIRTUAL_TRACE();
343 343
344 virtual void clearScrollAnimators(); 344 virtual void clearScrollAnimators();
345 345
346 virtual ScrollAnchor* scrollAnchor() { return nullptr; } 346 virtual ScrollAnchor* scrollAnchor() { return nullptr; }
347 347
348 protected: 348 protected:
349 ScrollableArea(); 349 ScrollableArea();
350 350
351 ScrollbarOrientation scrollbarOrientationFromDirection( 351 ScrollbarOrientation scrollbarOrientationFromDirection(
352 ScrollDirectionPhysical) const; 352 ScrollDirectionPhysical) const;
353 float scrollStep(ScrollGranularity, ScrollbarOrientation) const; 353 float scrollStep(ScrollGranularity, ScrollbarOrientation) const;
354 354
355 void setScrollOrigin(const IntPoint&); 355 void setScrollOrigin(const IntPoint&);
356 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } 356 void resetScrollOriginChanged() { m_scrollOriginChanged = false; }
357 357
358 // Needed to let the animators call scrollPositionChanged. 358 // Needed to let the animators call scrollOffsetChanged.
359 friend class ScrollAnimatorCompositorCoordinator; 359 friend class ScrollAnimatorCompositorCoordinator;
360 void scrollPositionChanged(const DoublePoint&, ScrollType); 360 void scrollOffsetChanged(const ScrollOffset&, ScrollType);
361 361
362 bool horizontalScrollbarNeedsPaintInvalidation() const { 362 bool horizontalScrollbarNeedsPaintInvalidation() const {
363 return m_horizontalScrollbarNeedsPaintInvalidation; 363 return m_horizontalScrollbarNeedsPaintInvalidation;
364 } 364 }
365 bool verticalScrollbarNeedsPaintInvalidation() const { 365 bool verticalScrollbarNeedsPaintInvalidation() const {
366 return m_verticalScrollbarNeedsPaintInvalidation; 366 return m_verticalScrollbarNeedsPaintInvalidation;
367 } 367 }
368 bool scrollCornerNeedsPaintInvalidation() const { 368 bool scrollCornerNeedsPaintInvalidation() const {
369 return m_scrollCornerNeedsPaintInvalidation; 369 return m_scrollCornerNeedsPaintInvalidation;
370 } 370 }
371 void clearNeedsPaintInvalidationForScrollControls() { 371 void clearNeedsPaintInvalidationForScrollControls() {
372 m_horizontalScrollbarNeedsPaintInvalidation = false; 372 m_horizontalScrollbarNeedsPaintInvalidation = false;
373 m_verticalScrollbarNeedsPaintInvalidation = false; 373 m_verticalScrollbarNeedsPaintInvalidation = false;
374 m_scrollCornerNeedsPaintInvalidation = false; 374 m_scrollCornerNeedsPaintInvalidation = false;
375 } 375 }
376 376
377 private: 377 private:
378 void programmaticScrollHelper(const DoublePoint&, ScrollBehavior); 378 void programmaticScrollHelper(const ScrollOffset&, ScrollBehavior);
379 void userScrollHelper(const DoublePoint&, ScrollBehavior); 379 void userScrollHelper(const ScrollOffset&, ScrollBehavior);
380 380
381 // This function should be overriden by subclasses to perform the actual 381 // This function should be overriden by subclasses to perform the actual
382 // scroll of the content. 382 // scroll of the content.
383 virtual void setScrollOffset(const DoublePoint&, ScrollType) = 0; 383 virtual void updateScrollOffset(const ScrollOffset&, ScrollType) = 0;
384 384
385 virtual int lineStep(ScrollbarOrientation) const; 385 virtual int lineStep(ScrollbarOrientation) const;
386 virtual int pageStep(ScrollbarOrientation) const; 386 virtual int pageStep(ScrollbarOrientation) const;
387 virtual int documentStep(ScrollbarOrientation) const; 387 virtual int documentStep(ScrollbarOrientation) const;
388 virtual float pixelStep(ScrollbarOrientation) const; 388 virtual float pixelStep(ScrollbarOrientation) const;
389 389
390 mutable Member<ScrollAnimatorBase> m_scrollAnimator; 390 mutable Member<ScrollAnimatorBase> m_scrollAnimator;
391 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator; 391 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator;
392 392
393 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle 393 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle
(...skipping 13 matching lines...) Expand all
407 // vertical-lr / ltr NO NO 407 // vertical-lr / ltr NO NO
408 // vertical-lr / rtl NO YES 408 // vertical-lr / rtl NO YES
409 // vertical-rl / ltr YES NO 409 // vertical-rl / ltr YES NO
410 // vertical-rl / rtl YES YES 410 // vertical-rl / rtl YES YES
411 IntPoint m_scrollOrigin; 411 IntPoint m_scrollOrigin;
412 }; 412 };
413 413
414 } // namespace blink 414 } // namespace blink
415 415
416 #endif // ScrollableArea_h 416 #endif // ScrollableArea_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollTypes.h ('k') | third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698