OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_STATE_H_ | 5 #ifndef CC_INPUT_SCROLL_STATE_H_ |
6 #define CC_INPUT_SCROLL_STATE_H_ | 6 #define CC_INPUT_SCROLL_STATE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 ScrollState(double delta_x, | 36 ScrollState(double delta_x, |
37 double delta_y, | 37 double delta_y, |
38 int start_position_x, | 38 int start_position_x, |
39 int start_position_y, | 39 int start_position_y, |
40 double velocity_x, | 40 double velocity_x, |
41 double velocity_y, | 41 double velocity_y, |
42 bool is_beginning, | 42 bool is_beginning, |
43 bool is_in_inertial_phase, | 43 bool is_in_inertial_phase, |
44 bool is_ending, | 44 bool is_ending, |
45 bool should_propagate = false, | 45 bool should_propagate = false, |
46 bool delta_consumed_for_scroll_sequence = false, | 46 bool is_direct_manipulation = false, |
47 bool is_direct_manipulation = false); | 47 bool delta_consumed_for_scroll_sequence = false); |
48 explicit ScrollState(ScrollStateData data); | 48 explicit ScrollState(ScrollStateData data); |
49 ~ScrollState(); | 49 ~ScrollState(); |
50 | 50 |
51 // Reduce deltas by x, y. | 51 // Reduce deltas by x, y. |
52 void ConsumeDelta(double x, double y); | 52 void ConsumeDelta(double x, double y); |
53 // Pops the first layer off of |scroll_chain_| and calls | 53 // Pops the first layer off of |scroll_chain_| and calls |
54 // |DistributeScroll| on it. | 54 // |DistributeScroll| on it. |
55 void DistributeToScrollChainDescendant(); | 55 void DistributeToScrollChainDescendant(); |
56 // Positive when scrolling left. | 56 // Positive when scrolling left. |
57 double delta_x() const { return data_.delta_x; } | 57 double delta_x() const { return data_.delta_x; } |
(...skipping 24 matching lines...) Expand all Loading... |
82 bool is_direct_manipulation() const { return data_.is_direct_manipulation; } | 82 bool is_direct_manipulation() const { return data_.is_direct_manipulation; } |
83 void set_is_direct_manipulation(bool is_direct_manipulation) { | 83 void set_is_direct_manipulation(bool is_direct_manipulation) { |
84 data_.is_direct_manipulation = is_direct_manipulation; | 84 data_.is_direct_manipulation = is_direct_manipulation; |
85 } | 85 } |
86 | 86 |
87 void set_scroll_chain(const std::list<LayerImpl*>& scroll_chain) { | 87 void set_scroll_chain(const std::list<LayerImpl*>& scroll_chain) { |
88 scroll_chain_ = scroll_chain; | 88 scroll_chain_ = scroll_chain; |
89 } | 89 } |
90 | 90 |
91 void set_current_native_scrolling_layer(LayerImpl* layer) { | 91 void set_current_native_scrolling_layer(LayerImpl* layer) { |
92 data_.current_native_scrolling_layer = layer; | 92 data_.set_current_native_scrolling_layer(layer); |
93 } | 93 } |
94 | 94 |
95 LayerImpl* current_native_scrolling_layer() const { | 95 LayerImpl* current_native_scrolling_layer() const { |
96 return data_.current_native_scrolling_layer; | 96 return data_.current_native_scrolling_layer(); |
97 } | 97 } |
98 | 98 |
99 bool delta_consumed_for_scroll_sequence() const { | 99 bool delta_consumed_for_scroll_sequence() const { |
100 return data_.delta_consumed_for_scroll_sequence; | 100 return data_.delta_consumed_for_scroll_sequence; |
101 } | 101 } |
102 void set_delta_consumed_for_scroll_sequence(bool delta_consumed) { | 102 void set_delta_consumed_for_scroll_sequence(bool delta_consumed) { |
103 data_.delta_consumed_for_scroll_sequence = delta_consumed; | 103 data_.delta_consumed_for_scroll_sequence = delta_consumed; |
104 } | 104 } |
105 | 105 |
106 bool FullyConsumed() const { return !data_.delta_x && !data_.delta_y; } | 106 bool FullyConsumed() const { return !data_.delta_x && !data_.delta_y; } |
107 | 107 |
108 void set_caused_scroll(bool x, bool y) { | 108 void set_caused_scroll(bool x, bool y) { |
109 data_.caused_scroll_x |= x; | 109 data_.caused_scroll_x |= x; |
110 data_.caused_scroll_y |= y; | 110 data_.caused_scroll_y |= y; |
111 } | 111 } |
112 | 112 |
113 bool caused_scroll_x() const { return data_.caused_scroll_x; } | 113 bool caused_scroll_x() const { return data_.caused_scroll_x; } |
114 bool caused_scroll_y() const { return data_.caused_scroll_y; } | 114 bool caused_scroll_y() const { return data_.caused_scroll_y; } |
115 | 115 |
116 ScrollStateData* data() { return &data_; } | 116 ScrollStateData* data() { return &data_; } |
117 | 117 |
118 private: | 118 private: |
119 ScrollStateData data_; | 119 ScrollStateData data_; |
120 std::list<LayerImpl*> scroll_chain_; | 120 std::list<LayerImpl*> scroll_chain_; |
121 }; | 121 }; |
122 | 122 |
123 } // namespace cc | 123 } // namespace cc |
124 | 124 |
125 #endif // CC_INPUT_SCROLL_STATE_H_ | 125 #endif // CC_INPUT_SCROLL_STATE_H_ |
OLD | NEW |