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/trees/layer_tree_impl.h" | 9 #include "cc/trees/layer_tree_impl.h" |
| 10 #include "cc/trees/scroll_node.h" |
10 | 11 |
11 namespace cc { | 12 namespace cc { |
12 | 13 |
13 ScrollState::ScrollState(ScrollStateData data) | 14 ScrollState::ScrollState(ScrollStateData data) |
14 : data_(data), layer_tree_impl_(nullptr) {} | 15 : data_(data), layer_tree_impl_(nullptr) {} |
15 | 16 |
16 ScrollState::ScrollState(const ScrollState& other) = default; | 17 ScrollState::ScrollState(const ScrollState& other) = default; |
17 | 18 |
18 ScrollState::~ScrollState() {} | 19 ScrollState::~ScrollState() {} |
19 | 20 |
20 void ScrollState::ConsumeDelta(double x, double y) { | 21 void ScrollState::ConsumeDelta(double x, double y) { |
21 data_.delta_x -= x; | 22 data_.delta_x -= x; |
22 data_.delta_y -= y; | 23 data_.delta_y -= y; |
23 | 24 |
24 if (x || y) | 25 if (x || y) |
25 data_.delta_consumed_for_scroll_sequence = true; | 26 data_.delta_consumed_for_scroll_sequence = true; |
26 } | 27 } |
27 | 28 |
28 void ScrollState::DistributeToScrollChainDescendant() { | 29 void ScrollState::DistributeToScrollChainDescendant() { |
29 if (!scroll_chain_.empty()) { | 30 if (!scroll_chain_.empty()) { |
30 const ScrollNode* next = scroll_chain_.front(); | 31 const ScrollNode* next = scroll_chain_.front(); |
31 scroll_chain_.pop_front(); | 32 scroll_chain_.pop_front(); |
32 layer_tree_impl_->LayerById(next->owner_id)->DistributeScroll(this); | 33 layer_tree_impl_->LayerById(next->owner_id)->DistributeScroll(this); |
33 } | 34 } |
34 } | 35 } |
35 | 36 |
36 } // namespace cc | 37 } // namespace cc |
OLD | NEW |