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

Side by Side Diff: cc/input/scrollbar_animation_controller.h

Issue 2554913002: Prevent overlay scrollbars expand or hover together (Closed)
Patch Set: Created 4 years 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 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_SCROLLBAR_ANIMATION_CONTROLLER_H_ 5 #ifndef CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_
6 #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ 6 #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_
7 7
8 #include <vector>
9
8 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
9 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
10 #include "base/time/time.h" 12 #include "base/time/time.h"
11 #include "cc/base/cc_export.h" 13 #include "cc/base/cc_export.h"
14 #include "cc/input/scrollbar.h"
12 #include "cc/layers/layer_impl.h" 15 #include "cc/layers/layer_impl.h"
13 #include "cc/layers/scrollbar_layer_impl_base.h" 16 #include "cc/layers/scrollbar_layer_impl_base.h"
14 #include "ui/gfx/geometry/vector2d_f.h" 17 #include "ui/gfx/geometry/vector2d_f.h"
15 18
16 namespace cc { 19 namespace cc {
17 20
18 class ScrollbarAnimationController; 21 class ScrollbarAnimationController;
22 using std::vector;
19 23
20 class CC_EXPORT ScrollbarAnimationControllerClient { 24 class CC_EXPORT ScrollbarAnimationControllerClient {
21 public: 25 public:
22 virtual void PostDelayedScrollbarAnimationTask(const base::Closure& task, 26 virtual void PostDelayedScrollbarAnimationTask(const base::Closure& task,
23 base::TimeDelta delay) = 0; 27 base::TimeDelta delay) = 0;
24 virtual void SetNeedsRedrawForScrollbarAnimation() = 0; 28 virtual void SetNeedsRedrawForScrollbarAnimation() = 0;
25 virtual void SetNeedsAnimateForScrollbarAnimation() = 0; 29 virtual void SetNeedsAnimateForScrollbarAnimation() = 0;
26 virtual void DidChangeScrollbarVisibility() = 0; 30 virtual void DidChangeScrollbarVisibility() = 0;
27 virtual ScrollbarSet ScrollbarsFor(int scroll_layer_id) const = 0; 31 virtual ScrollbarSet ScrollbarsFor(int scroll_layer_id) const = 0;
28 32
29 protected: 33 protected:
30 virtual ~ScrollbarAnimationControllerClient() {} 34 virtual ~ScrollbarAnimationControllerClient() {}
31 }; 35 };
32 36
33 // This abstract class represents the compositor-side analogy of 37 // This abstract class represents the compositor-side analogy of
34 // ScrollbarAnimator. Individual platforms should subclass it to provide 38 // ScrollbarAnimator. Individual platforms should subclass it to provide
35 // specialized implementation. 39 // specialized implementation.
36 class CC_EXPORT ScrollbarAnimationController { 40 class CC_EXPORT ScrollbarAnimationController {
37 public: 41 public:
42 struct DistanceToScrollbar {
43 ScrollbarOrientation orientation_;
44 float distance_;
45
46 DistanceToScrollbar(ScrollbarOrientation orientation, float distance)
47 : orientation_(orientation), distance_(distance) {}
48 };
38 virtual ~ScrollbarAnimationController(); 49 virtual ~ScrollbarAnimationController();
39 50
40 bool Animate(base::TimeTicks now); 51 virtual bool Animate(base::TimeTicks now);
41 52
42 virtual void DidScrollBegin(); 53 virtual void DidScrollBegin();
43 virtual void DidScrollUpdate(bool on_resize); 54 virtual void DidScrollUpdate(bool on_resize);
44 virtual void DidScrollEnd(); 55 virtual void DidScrollEnd();
45 virtual void DidMouseDown() {} 56 virtual void DidMouseDown() {}
46 virtual void DidMouseUp() {} 57 virtual void DidMouseUp() {}
47 virtual void DidMouseLeave() {} 58 virtual void DidMouseLeave() {}
48 virtual void DidMouseMoveNear(float distance) {} 59 virtual void DidMouseMoveNear(vector<DistanceToScrollbar>) {}
bokan 2016/12/06 19:44:46 Rather than introducing DistanceToScrollbar, I thi
49 virtual bool ScrollbarsHidden() const; 60 virtual bool ScrollbarsHidden() const;
50 61
51 protected: 62 protected:
52 ScrollbarAnimationController(int scroll_layer_id, 63 ScrollbarAnimationController(int scroll_layer_id,
53 ScrollbarAnimationControllerClient* client, 64 ScrollbarAnimationControllerClient* client,
54 base::TimeDelta delay_before_starting, 65 base::TimeDelta delay_before_starting,
55 base::TimeDelta resize_delay_before_starting); 66 base::TimeDelta resize_delay_before_starting);
56 67
57 virtual void RunAnimationFrame(float progress) = 0; 68 virtual void RunAnimationFrame(float progress) = 0;
58 virtual const base::TimeDelta& Duration() = 0; 69 virtual const base::TimeDelta& Duration() = 0;
(...skipping 23 matching lines...) Expand all
82 bool currently_scrolling_; 93 bool currently_scrolling_;
83 bool scroll_gesture_has_scrolled_; 94 bool scroll_gesture_has_scrolled_;
84 base::CancelableClosure delayed_scrollbar_fade_; 95 base::CancelableClosure delayed_scrollbar_fade_;
85 96
86 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; 97 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_;
87 }; 98 };
88 99
89 } // namespace cc 100 } // namespace cc
90 101
91 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ 102 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698