| 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 #include "cc/trees/scroll_node.h" | 6 #include "cc/trees/scroll_node.h" |
| 7 | 7 |
| 8 namespace cc { | 8 namespace cc { |
| 9 | 9 |
| 10 ScrollStateData::ScrollStateData() | 10 ScrollStateData::ScrollStateData() |
| 11 : delta_x(0), | 11 : delta_x(0), |
| 12 delta_y(0), | 12 delta_y(0), |
| 13 position_x(0), | 13 position_x(0), |
| 14 position_y(0), | 14 position_y(0), |
| 15 velocity_x(0), | 15 velocity_x(0), |
| 16 velocity_y(0), | 16 velocity_y(0), |
| 17 is_beginning(false), | 17 is_beginning(false), |
| 18 is_in_inertial_phase(false), | 18 is_in_inertial_phase(false), |
| 19 is_ending(false), | 19 is_ending(false), |
| 20 should_propagate(false), | 20 should_propagate(false), |
| 21 from_user_input(false), | 21 from_user_input(false), |
| 22 delta_consumed_for_scroll_sequence(false), | 22 delta_consumed_for_scroll_sequence(false), |
| 23 is_direct_manipulation(false), | 23 is_direct_manipulation(false), |
| 24 delta_granularity(0), | 24 delta_granularity(0), |
| 25 caused_scroll_x(false), | 25 caused_scroll_x(false), |
| 26 caused_scroll_y(false), | 26 caused_scroll_y(false), |
| 27 current_native_scrolling_node_(nullptr) {} | 27 current_native_scrolling_node_(nullptr), |
| 28 current_native_scrolling_element_(kInvalidElementId) {} |
| 28 | 29 |
| 29 ScrollStateData::ScrollStateData(const ScrollStateData& other) = default; | 30 ScrollStateData::ScrollStateData(const ScrollStateData& other) = default; |
| 30 | 31 |
| 31 ScrollNode* ScrollStateData::current_native_scrolling_node() const { | 32 ScrollNode* ScrollStateData::current_native_scrolling_node() const { |
| 32 return current_native_scrolling_node_; | 33 return current_native_scrolling_node_; |
| 33 } | 34 } |
| 34 | 35 |
| 35 void ScrollStateData::set_current_native_scrolling_node( | 36 void ScrollStateData::set_current_native_scrolling_node( |
| 36 ScrollNode* current_native_scrolling_node) { | 37 ScrollNode* current_native_scrolling_node) { |
| 37 current_native_scrolling_node_ = current_native_scrolling_node; | 38 current_native_scrolling_node_ = current_native_scrolling_node; |
| 38 current_native_scrolling_element_ = ElementId(); | 39 current_native_scrolling_element_ = ElementId(); |
| 39 } | 40 } |
| 40 | 41 |
| 41 ElementId ScrollStateData::current_native_scrolling_element() const { | 42 ElementId ScrollStateData::current_native_scrolling_element() const { |
| 42 if (current_native_scrolling_node_) | 43 if (current_native_scrolling_node_) |
| 43 return current_native_scrolling_node_->element_id; | 44 return current_native_scrolling_node_->element_id; |
| 44 return current_native_scrolling_element_; | 45 return current_native_scrolling_element_; |
| 45 } | 46 } |
| 46 | 47 |
| 47 void ScrollStateData::set_current_native_scrolling_element( | 48 void ScrollStateData::set_current_native_scrolling_element( |
| 48 ElementId element_id) { | 49 ElementId element_id) { |
| 49 current_native_scrolling_element_ = element_id; | 50 current_native_scrolling_element_ = element_id; |
| 50 current_native_scrolling_node_ = nullptr; | 51 current_native_scrolling_node_ = nullptr; |
| 51 } | 52 } |
| 52 | 53 |
| 53 } // namespace cc | 54 } // namespace cc |
| OLD | NEW |