OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_INPUT_SCROLL_ELASTICITY_HELPER_H_ | 5 #ifndef CC_INPUT_SCROLL_ELASTICITY_HELPER_H_ |
6 #define CC_INPUT_SCROLL_ELASTICITY_HELPER_H_ | 6 #define CC_INPUT_SCROLL_ELASTICITY_HELPER_H_ |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 10 #include "ui/gfx/geometry/scroll_offset.h" |
10 #include "ui/gfx/geometry/vector2d_f.h" | 11 #include "ui/gfx/geometry/vector2d_f.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 class LayerTreeHostImpl; | 15 class LayerTreeHostImpl; |
15 | 16 |
16 // ScrollElasticityHelper is based on | 17 // ScrollElasticityHelper is based on |
17 // WebKit/Source/platform/mac/ScrollElasticityController.h | 18 // WebKit/Source/platform/mac/ScrollElasticityController.h |
18 /* | 19 /* |
19 * Copyright (C) 2011 Apple Inc. All rights reserved. | 20 * Copyright (C) 2011 Apple Inc. All rights reserved. |
(...skipping 25 matching lines...) Expand all Loading... |
45 // interface itself. This artificial boundary is introduced to reduce the amount | 46 // interface itself. This artificial boundary is introduced to reduce the amount |
46 // of logic and state held directly inside LayerTreeHostImpl. | 47 // of logic and state held directly inside LayerTreeHostImpl. |
47 class CC_EXPORT ScrollElasticityHelper { | 48 class CC_EXPORT ScrollElasticityHelper { |
48 public: | 49 public: |
49 static ScrollElasticityHelper* CreateForLayerTreeHostImpl( | 50 static ScrollElasticityHelper* CreateForLayerTreeHostImpl( |
50 LayerTreeHostImpl* layer_tree_host_impl); | 51 LayerTreeHostImpl* layer_tree_host_impl); |
51 | 52 |
52 virtual ~ScrollElasticityHelper() {} | 53 virtual ~ScrollElasticityHelper() {} |
53 | 54 |
54 // The amount that the view is stretched past the normal allowable bounds. | 55 // The amount that the view is stretched past the normal allowable bounds. |
55 virtual gfx::Vector2dF StretchAmount() = 0; | 56 virtual gfx::Vector2dF StretchAmount() const = 0; |
56 virtual void SetStretchAmount(const gfx::Vector2dF& stretch_amount) = 0; | 57 virtual void SetStretchAmount(const gfx::Vector2dF& stretch_amount) = 0; |
57 // Returns true if either component of |direction| is pointing in a direction | 58 |
58 // in which it is not possible to scroll any farther. It is only in this | 59 // Functions for the scrolling of the root scroll layer. |
59 // circumstance that an overscroll in that direction may begin. | 60 virtual gfx::ScrollOffset ScrollOffset() const = 0; |
60 // TODO(ccameron): Note that it is possible for a scroll to occur against a | 61 virtual gfx::ScrollOffset MaxScrollOffset() const = 0; |
61 // previous over-scroll. Such a scroll needs to first cancel out the | 62 virtual void ScrollBy(const gfx::Vector2dF& delta) = 0; |
62 // over-scroll, and only then may it start scrolling away from the edge. | 63 |
63 virtual bool PinnedInDirection(const gfx::Vector2dF& direction) = 0; | |
64 // Whether or not the content of the page is scrollable in each direction. | |
65 virtual bool CanScrollHorizontally() = 0; | |
66 virtual bool CanScrollVertically() = 0; | |
67 // Request that the controller have its Animate method called for the next | 64 // Request that the controller have its Animate method called for the next |
68 // frame. | 65 // frame. |
69 virtual void RequestAnimate() = 0; | 66 virtual void RequestAnimate() = 0; |
70 }; | 67 }; |
71 | 68 |
72 } // namespace cc | 69 } // namespace cc |
73 | 70 |
74 #endif // CC_INPUT_SCROLL_ELASTICITY_HELPER_H_ | 71 #endif // CC_INPUT_SCROLL_ELASTICITY_HELPER_H_ |
OLD | NEW |