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 #include "cc/input/scroll_state.h" | 5 #include "cc/input/scroll_state.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 ScrollState::ScrollState(double delta_x, | 13 ScrollState::ScrollState(double delta_x, |
14 double delta_y, | 14 double delta_y, |
15 int start_position_x, | 15 int start_position_x, |
16 int start_position_y, | 16 int start_position_y, |
17 double velocity_x, | 17 double velocity_x, |
18 double velocity_y, | 18 double velocity_y, |
19 bool is_beginning, | 19 bool is_beginning, |
20 bool is_in_inertial_phase, | 20 bool is_in_inertial_phase, |
21 bool is_ending, | 21 bool is_ending, |
22 bool should_propagate, | 22 bool should_propagate, |
23 bool delta_consumed_for_scroll_sequence, | 23 bool is_direct_manipulation, |
24 bool is_direct_manipulation) | 24 bool delta_consumed_for_scroll_sequence) |
25 : data_(delta_x, | 25 : data_(delta_x, |
26 delta_y, | 26 delta_y, |
27 start_position_x, | 27 start_position_x, |
28 start_position_y, | 28 start_position_y, |
29 velocity_x, | 29 velocity_x, |
30 velocity_y, | 30 velocity_y, |
31 is_beginning, | 31 is_beginning, |
32 is_in_inertial_phase, | 32 is_in_inertial_phase, |
33 is_ending, | 33 is_ending, |
34 should_propagate, | 34 should_propagate, |
35 delta_consumed_for_scroll_sequence, | 35 true, // TODO(tdresser): populate from_user_input. |
36 is_direct_manipulation) {} | 36 is_direct_manipulation, |
| 37 0, // TODO(tdresser): populate delta_granularity. |
| 38 delta_consumed_for_scroll_sequence) {} |
37 | 39 |
38 ScrollState::ScrollState(ScrollStateData data) : data_(data) {} | 40 ScrollState::ScrollState(ScrollStateData data) : data_(data) {} |
39 | 41 |
40 ScrollState::~ScrollState() {} | 42 ScrollState::~ScrollState() {} |
41 | 43 |
42 void ScrollState::ConsumeDelta(double x, double y) { | 44 void ScrollState::ConsumeDelta(double x, double y) { |
43 data_.delta_x -= x; | 45 data_.delta_x -= x; |
44 data_.delta_y -= y; | 46 data_.delta_y -= y; |
45 | 47 |
46 if (x || y) | 48 if (x || y) |
47 data_.delta_consumed_for_scroll_sequence = true; | 49 data_.delta_consumed_for_scroll_sequence = true; |
48 } | 50 } |
49 | 51 |
50 void ScrollState::DistributeToScrollChainDescendant() { | 52 void ScrollState::DistributeToScrollChainDescendant() { |
51 if (!scroll_chain_.empty()) { | 53 if (!scroll_chain_.empty()) { |
52 LayerImpl* next = scroll_chain_.front(); | 54 LayerImpl* next = scroll_chain_.front(); |
53 scroll_chain_.pop_front(); | 55 scroll_chain_.pop_front(); |
54 next->DistributeScroll(this); | 56 next->DistributeScroll(this); |
55 } | 57 } |
56 } | 58 } |
57 | 59 |
58 } // namespace cc | 60 } // namespace cc |
OLD | NEW |