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_data.h" | 5 #include "cc/input/scroll_state_data.h" |
6 | 6 |
| 7 #include "cc/layers/layer_impl.h" |
| 8 |
7 namespace cc { | 9 namespace cc { |
8 | 10 |
9 ScrollStateData::ScrollStateData(double delta_x, | 11 ScrollStateData::ScrollStateData(double delta_x, |
10 double delta_y, | 12 double delta_y, |
11 int start_position_x, | 13 int start_position_x, |
12 int start_position_y, | 14 int start_position_y, |
13 double velocity_x, | 15 double velocity_x, |
14 double velocity_y, | 16 double velocity_y, |
15 bool is_beginning, | 17 bool is_beginning, |
16 bool is_in_inertial_phase, | 18 bool is_in_inertial_phase, |
17 bool is_ending, | 19 bool is_ending, |
18 bool should_propagate, | 20 bool should_propagate, |
19 bool delta_consumed_for_scroll_sequence, | 21 bool from_user_input, |
20 bool is_direct_manipulation) | 22 bool is_direct_manipulation, |
| 23 double delta_granularity, |
| 24 bool delta_consumed_for_scroll_sequence) |
21 : delta_x(delta_x), | 25 : delta_x(delta_x), |
22 delta_y(delta_y), | 26 delta_y(delta_y), |
23 start_position_x(start_position_x), | 27 start_position_x(start_position_x), |
24 start_position_y(start_position_y), | 28 start_position_y(start_position_y), |
25 velocity_x(velocity_x), | 29 velocity_x(velocity_x), |
26 velocity_y(velocity_y), | 30 velocity_y(velocity_y), |
27 is_beginning(is_beginning), | 31 is_beginning(is_beginning), |
28 is_in_inertial_phase(is_in_inertial_phase), | 32 is_in_inertial_phase(is_in_inertial_phase), |
29 is_ending(is_ending), | 33 is_ending(is_ending), |
30 should_propagate(should_propagate), | 34 should_propagate(should_propagate), |
31 current_native_scrolling_layer(nullptr), | 35 from_user_input(from_user_input), |
32 delta_consumed_for_scroll_sequence(delta_consumed_for_scroll_sequence), | 36 delta_consumed_for_scroll_sequence(delta_consumed_for_scroll_sequence), |
33 is_direct_manipulation(is_direct_manipulation), | 37 is_direct_manipulation(is_direct_manipulation), |
| 38 delta_granularity(delta_granularity), |
34 caused_scroll_x(false), | 39 caused_scroll_x(false), |
35 caused_scroll_y(false) {} | 40 caused_scroll_y(false), |
| 41 current_native_scrolling_layer_(nullptr), |
| 42 current_native_scrolling_element_(0) {} |
36 | 43 |
37 ScrollStateData::ScrollStateData() | 44 ScrollStateData::ScrollStateData() |
38 : ScrollStateData(0, | 45 : ScrollStateData(0, |
39 0, | 46 0, |
40 0, | 47 0, |
41 0, | 48 0, |
42 0, | 49 0, |
43 0, | 50 0, |
44 false, | 51 false, |
45 false, | 52 false, |
46 false, | 53 false, |
47 true, | 54 true, |
48 false, | 55 false, |
49 false) {} | 56 false, |
| 57 false, |
| 58 0) {} |
| 59 |
| 60 LayerImpl* ScrollStateData::current_native_scrolling_layer() const { |
| 61 return current_native_scrolling_layer_; |
| 62 } |
| 63 void ScrollStateData::set_current_native_scrolling_layer( |
| 64 LayerImpl* current_native_scrolling_layer) { |
| 65 current_native_scrolling_layer_ = current_native_scrolling_layer; |
| 66 current_native_scrolling_element_ = 0; |
| 67 } |
| 68 uint64_t ScrollStateData::current_native_scrolling_element() const { |
| 69 if (current_native_scrolling_layer_) |
| 70 return current_native_scrolling_layer_->element_id(); |
| 71 return current_native_scrolling_element_; |
| 72 } |
| 73 void ScrollStateData::set_current_native_scrolling_element( |
| 74 uint64_t element_id) { |
| 75 current_native_scrolling_element_ = element_id; |
| 76 current_native_scrolling_layer_ = nullptr; |
| 77 } |
50 | 78 |
51 } // namespace cc | 79 } // namespace cc |
OLD | NEW |