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

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

Issue 2453553003: Disable overlay scrollbars in Blink when hidden by the compositor. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
« no previous file with comments | « no previous file | cc/input/scrollbar_animation_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "cc/base/cc_export.h" 11 #include "cc/base/cc_export.h"
12 #include "cc/layers/layer_impl.h" 12 #include "cc/layers/layer_impl.h"
13 #include "cc/layers/scrollbar_layer_impl_base.h" 13 #include "cc/layers/scrollbar_layer_impl_base.h"
14 #include "ui/gfx/geometry/vector2d_f.h" 14 #include "ui/gfx/geometry/vector2d_f.h"
15 15
16 namespace cc { 16 namespace cc {
17 17
18 class ScrollbarAnimationController; 18 class ScrollbarAnimationController;
19 19
20 class CC_EXPORT ScrollbarAnimationControllerClient { 20 class CC_EXPORT ScrollbarAnimationControllerClient {
21 public: 21 public:
22 virtual void PostDelayedScrollbarAnimationTask(const base::Closure& task, 22 virtual void PostDelayedScrollbarAnimationTask(const base::Closure& task,
23 base::TimeDelta delay) = 0; 23 base::TimeDelta delay) = 0;
24 virtual void SetNeedsRedrawForScrollbarAnimation() = 0; 24 virtual void SetNeedsRedrawForScrollbarAnimation() = 0;
25 virtual void SetNeedsAnimateForScrollbarAnimation() = 0; 25 virtual void SetNeedsAnimateForScrollbarAnimation() = 0;
26 virtual void DidChangeScrollbarVisibility() = 0;
26 virtual ScrollbarSet ScrollbarsFor(int scroll_layer_id) const = 0; 27 virtual ScrollbarSet ScrollbarsFor(int scroll_layer_id) const = 0;
27 28
28 protected: 29 protected:
29 virtual ~ScrollbarAnimationControllerClient() {} 30 virtual ~ScrollbarAnimationControllerClient() {}
30 }; 31 };
31 32
32 // This abstract class represents the compositor-side analogy of 33 // This abstract class represents the compositor-side analogy of
33 // ScrollbarAnimator. Individual platforms should subclass it to provide 34 // ScrollbarAnimator. Individual platforms should subclass it to provide
34 // specialized implementation. 35 // specialized implementation.
35 class CC_EXPORT ScrollbarAnimationController { 36 class CC_EXPORT ScrollbarAnimationController {
36 public: 37 public:
37 virtual ~ScrollbarAnimationController(); 38 virtual ~ScrollbarAnimationController();
38 39
39 bool Animate(base::TimeTicks now); 40 bool Animate(base::TimeTicks now);
40 41
41 virtual void DidScrollBegin(); 42 virtual void DidScrollBegin();
42 virtual void DidScrollUpdate(bool on_resize); 43 virtual void DidScrollUpdate(bool on_resize);
43 virtual void DidScrollEnd(); 44 virtual void DidScrollEnd();
44 virtual void DidMouseDown() {} 45 virtual void DidMouseDown() {}
45 virtual void DidMouseUp() {} 46 virtual void DidMouseUp() {}
46 virtual void DidMouseLeave() {} 47 virtual void DidMouseLeave() {}
47 virtual void DidMouseMoveNear(float distance) {} 48 virtual void DidMouseMoveNear(float distance) {}
49 virtual bool ScrollbarsHidden() const;
48 50
49 protected: 51 protected:
50 ScrollbarAnimationController(int scroll_layer_id, 52 ScrollbarAnimationController(int scroll_layer_id,
51 ScrollbarAnimationControllerClient* client, 53 ScrollbarAnimationControllerClient* client,
52 base::TimeDelta delay_before_starting, 54 base::TimeDelta delay_before_starting,
53 base::TimeDelta resize_delay_before_starting); 55 base::TimeDelta resize_delay_before_starting);
54 56
55 virtual void RunAnimationFrame(float progress) = 0; 57 virtual void RunAnimationFrame(float progress) = 0;
56 virtual const base::TimeDelta& Duration() = 0; 58 virtual const base::TimeDelta& Duration() = 0;
57 59
58 void StartAnimation(); 60 void StartAnimation();
59 void StopAnimation(); 61 void StopAnimation();
60 ScrollbarSet Scrollbars() const; 62 ScrollbarSet Scrollbars() const;
61 63
62 ScrollbarAnimationControllerClient* client_; 64 ScrollbarAnimationControllerClient* client_;
63 65
64 void PostDelayedAnimationTask(bool on_resize); 66 void PostDelayedAnimationTask(bool on_resize);
65 67
68 int scroll_layer_id() const { return scroll_layer_id_; }
69
66 private: 70 private:
67 // Returns how far through the animation we are as a progress value from 71 // Returns how far through the animation we are as a progress value from
68 // 0 to 1. 72 // 0 to 1.
69 float AnimationProgressAtTime(base::TimeTicks now); 73 float AnimationProgressAtTime(base::TimeTicks now);
70 74
71 base::TimeTicks last_awaken_time_; 75 base::TimeTicks last_awaken_time_;
72 base::TimeDelta delay_before_starting_; 76 base::TimeDelta delay_before_starting_;
73 base::TimeDelta resize_delay_before_starting_; 77 base::TimeDelta resize_delay_before_starting_;
74 78
75 bool is_animating_; 79 bool is_animating_;
76 80
77 int scroll_layer_id_; 81 int scroll_layer_id_;
78 bool currently_scrolling_; 82 bool currently_scrolling_;
79 bool scroll_gesture_has_scrolled_; 83 bool scroll_gesture_has_scrolled_;
80 base::CancelableClosure delayed_scrollbar_fade_; 84 base::CancelableClosure delayed_scrollbar_fade_;
81 85
82 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; 86 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_;
83 }; 87 };
84 88
85 } // namespace cc 89 } // namespace cc
86 90
87 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ 91 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/input/scrollbar_animation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698