OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/input/scroll_state.h" |
| 6 |
| 7 #include "cc/layers/layer_impl.h" |
| 8 |
| 9 namespace cc { |
| 10 |
| 11 ScrollState::ScrollState(double delta_x, |
| 12 double delta_y, |
| 13 int start_position_x, |
| 14 int start_position_y, |
| 15 bool should_propagate, |
| 16 bool delta_consumed_for_scroll_sequence, |
| 17 bool is_direct_manipulation) |
| 18 : delta_x_(delta_x), |
| 19 delta_y_(delta_y), |
| 20 start_position_x_(start_position_x), |
| 21 start_position_y_(start_position_y), |
| 22 should_propagate_(should_propagate), |
| 23 delta_consumed_for_scroll_sequence_(delta_consumed_for_scroll_sequence), |
| 24 is_direct_manipulation_(is_direct_manipulation), |
| 25 caused_scroll_x_(false), |
| 26 caused_scroll_y_(false) {} |
| 27 |
| 28 ScrollState::~ScrollState() {} |
| 29 |
| 30 void ScrollState::ConsumeDelta(double x, double y) { |
| 31 delta_x_ -= x; |
| 32 delta_y_ -= y; |
| 33 |
| 34 if (x || y) |
| 35 delta_consumed_for_scroll_sequence_ = true; |
| 36 } |
| 37 |
| 38 void ScrollState::DistributeToScrollChainDescendant() { |
| 39 if (!scroll_chain_.empty()) { |
| 40 LayerImpl* next = scroll_chain_.front(); |
| 41 scroll_chain_.pop_front(); |
| 42 next->DistributeScroll(this); |
| 43 } |
| 44 } |
| 45 |
| 46 } // namespace cc |
OLD | NEW |