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