OLD | NEW |
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 17 matching lines...) Expand all Loading... |
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/FloatQuad.h" | 31 #include "platform/geometry/FloatQuad.h" |
32 #include "platform/geometry/LayoutRect.h" | 32 #include "platform/geometry/LayoutRect.h" |
33 #include "platform/graphics/Color.h" | 33 #include "platform/graphics/Color.h" |
34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
35 #include "platform/scroll/ScrollAnimatorBase.h" | 35 #include "platform/scroll/ScrollAnimatorBase.h" |
36 #include "platform/scroll/ScrollTypes.h" | 36 #include "platform/scroll/ScrollTypes.h" |
37 #include "platform/scroll/Scrollbar.h" | 37 #include "platform/scroll/Scrollbar.h" |
| 38 #include "public/platform/WebLayerScrollClient.h" |
38 #include "wtf/MathExtras.h" | 39 #include "wtf/MathExtras.h" |
39 #include "wtf/Noncopyable.h" | 40 #include "wtf/Noncopyable.h" |
40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 | 44 |
44 class CompositorAnimationHost; | 45 class CompositorAnimationHost; |
45 class CompositorAnimationTimeline; | 46 class CompositorAnimationTimeline; |
46 class GraphicsLayer; | 47 class GraphicsLayer; |
47 class HostWindow; | 48 class HostWindow; |
48 class LayoutBox; | 49 class LayoutBox; |
49 class LayoutObject; | 50 class LayoutObject; |
50 class PaintLayer; | 51 class PaintLayer; |
51 class ProgrammaticScrollAnimator; | 52 class ProgrammaticScrollAnimator; |
52 struct ScrollAlignment; | 53 struct ScrollAlignment; |
53 class ScrollAnchor; | 54 class ScrollAnchor; |
54 class ScrollAnimatorBase; | 55 class ScrollAnimatorBase; |
55 class CompositorAnimationTimeline; | 56 class CompositorAnimationTimeline; |
56 | 57 |
57 enum IncludeScrollbarsInRect { | 58 enum IncludeScrollbarsInRect { |
58 ExcludeScrollbars, | 59 ExcludeScrollbars, |
59 IncludeScrollbars, | 60 IncludeScrollbars, |
60 }; | 61 }; |
61 | 62 |
62 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin { | 63 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin, |
| 64 public WebLayerScrollClient { |
63 WTF_MAKE_NONCOPYABLE(ScrollableArea); | 65 WTF_MAKE_NONCOPYABLE(ScrollableArea); |
64 | 66 |
65 public: | 67 public: |
66 static int pixelsPerLineStep(HostWindow*); | 68 static int pixelsPerLineStep(HostWindow*); |
67 static float minFractionToStepWhenPaging(); | 69 static float minFractionToStepWhenPaging(); |
68 static int maxOverlapBetweenPages(); | 70 static int maxOverlapBetweenPages(); |
69 | 71 |
70 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as | 72 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as |
71 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. | 73 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. |
72 static float normalizeNonFiniteScroll(float value) { | 74 static float normalizeNonFiniteScroll(float value) { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 virtual void clearScrollableArea(); | 367 virtual void clearScrollableArea(); |
366 | 368 |
367 virtual ScrollAnchor* scrollAnchor() { return nullptr; } | 369 virtual ScrollAnchor* scrollAnchor() { return nullptr; } |
368 | 370 |
369 virtual void didScrollWithScrollbar(ScrollbarPart, ScrollbarOrientation) {} | 371 virtual void didScrollWithScrollbar(ScrollbarPart, ScrollbarOrientation) {} |
370 | 372 |
371 // Returns the task runner to be used for scrollable area timers. | 373 // Returns the task runner to be used for scrollable area timers. |
372 // Ideally a frame-specific throttled one can be used. | 374 // Ideally a frame-specific throttled one can be used. |
373 virtual RefPtr<WebTaskRunner> getTimerTaskRunner() const = 0; | 375 virtual RefPtr<WebTaskRunner> getTimerTaskRunner() const = 0; |
374 | 376 |
| 377 // Callback for compositor-side scrolling. |
| 378 void didScroll(const gfx::ScrollOffset&) override; |
| 379 |
375 protected: | 380 protected: |
376 ScrollableArea(); | 381 ScrollableArea(); |
377 | 382 |
378 ScrollbarOrientation scrollbarOrientationFromDirection( | 383 ScrollbarOrientation scrollbarOrientationFromDirection( |
379 ScrollDirectionPhysical) const; | 384 ScrollDirectionPhysical) const; |
380 float scrollStep(ScrollGranularity, ScrollbarOrientation) const; | 385 float scrollStep(ScrollGranularity, ScrollbarOrientation) const; |
381 | 386 |
382 void setScrollOrigin(const IntPoint&); | 387 void setScrollOrigin(const IntPoint&); |
383 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } | 388 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } |
384 | 389 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 // vertical-lr / ltr NO NO | 453 // vertical-lr / ltr NO NO |
449 // vertical-lr / rtl NO YES | 454 // vertical-lr / rtl NO YES |
450 // vertical-rl / ltr YES NO | 455 // vertical-rl / ltr YES NO |
451 // vertical-rl / rtl YES YES | 456 // vertical-rl / rtl YES YES |
452 IntPoint m_scrollOrigin; | 457 IntPoint m_scrollOrigin; |
453 }; | 458 }; |
454 | 459 |
455 } // namespace blink | 460 } // namespace blink |
456 | 461 |
457 #endif // ScrollableArea_h | 462 #endif // ScrollableArea_h |
OLD | NEW |