OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 scale_factor); | 2586 scale_factor); |
2587 } | 2587 } |
2588 | 2588 |
2589 return ScrollLayerWithViewportSpaceDelta(layer_impl, | 2589 return ScrollLayerWithViewportSpaceDelta(layer_impl, |
2590 viewport_point, | 2590 viewport_point, |
2591 delta); | 2591 delta); |
2592 } | 2592 } |
2593 | 2593 |
2594 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 2594 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
2595 const gfx::Point& viewport_point, | 2595 const gfx::Point& viewport_point, |
2596 const gfx::Vector2dF& scroll_delta) { | 2596 const gfx::Vector2dF& unrailed_scroll_delta, |
| 2597 InputHandler::RailsMode rails_mode) { |
2597 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); | 2598 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); |
2598 if (!CurrentlyScrollingLayer()) | 2599 if (!CurrentlyScrollingLayer()) |
2599 return InputHandlerScrollResult(); | 2600 return InputHandlerScrollResult(); |
2600 | 2601 |
2601 gfx::Vector2dF pending_delta = scroll_delta; | 2602 gfx::Vector2dF pending_delta = unrailed_scroll_delta; |
| 2603 if (rails_mode == InputHandler::RAILS_MODE_HORIZONTAL) |
| 2604 pending_delta.set_y(0); |
| 2605 if (rails_mode == InputHandler::RAILS_MODE_VERTICAL) |
| 2606 pending_delta.set_x(0); |
2602 gfx::Vector2dF unused_root_delta; | 2607 gfx::Vector2dF unused_root_delta; |
2603 bool did_scroll_x = false; | 2608 bool did_scroll_x = false; |
2604 bool did_scroll_y = false; | 2609 bool did_scroll_y = false; |
2605 bool did_scroll_top_controls = false; | 2610 bool did_scroll_top_controls = false; |
2606 | 2611 |
2607 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); | 2612 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); |
2608 layer_impl; | 2613 layer_impl; |
2609 layer_impl = layer_impl->parent()) { | 2614 layer_impl = layer_impl->parent()) { |
2610 // Skip the outer viewport scroll layer so that we try to scroll the | 2615 // Skip the outer viewport scroll layer so that we try to scroll the |
2611 // viewport only once. i.e. The inner viewport layer represents the | 2616 // viewport only once. i.e. The inner viewport layer represents the |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3416 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3421 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
3417 | 3422 |
3418 curve->UpdateTarget( | 3423 curve->UpdateTarget( |
3419 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3424 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
3420 .InSecondsF(), | 3425 .InSecondsF(), |
3421 new_target); | 3426 new_target); |
3422 | 3427 |
3423 return true; | 3428 return true; |
3424 } | 3429 } |
3425 } // namespace cc | 3430 } // namespace cc |
OLD | NEW |