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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2655 unused_root_delta.set_y(0.0f); | 2655 unused_root_delta.set_y(0.0f); |
2656 // Disable overscroll on axes which is impossible to scroll. | 2656 // Disable overscroll on axes which is impossible to scroll. |
2657 if (settings_.report_overscroll_only_for_scrollable_axes) { | 2657 if (settings_.report_overscroll_only_for_scrollable_axes) { |
2658 if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon || | 2658 if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon || |
2659 !layer_impl->user_scrollable_horizontal()) | 2659 !layer_impl->user_scrollable_horizontal()) |
2660 unused_root_delta.set_x(0.0f); | 2660 unused_root_delta.set_x(0.0f); |
2661 if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon || | 2661 if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon || |
2662 !layer_impl->user_scrollable_vertical()) | 2662 !layer_impl->user_scrollable_vertical()) |
2663 unused_root_delta.set_y(0.0f); | 2663 unused_root_delta.set_y(0.0f); |
2664 } | 2664 } |
2665 if (consume_by_top_controls && unused_root_delta.y() > 0.0f) | |
jdduke (slow)
2014/10/16 21:29:17
Can you think of a solution that limits how much L
sujith
2014/10/17 14:51:04
Done.
| |
2666 top_controls_manager_->RemoveUnUsedScrollDelta(unused_root_delta.y()); | |
2665 } | 2667 } |
2666 | 2668 |
2667 // If the layer wasn't able to move, try the next one in the hierarchy. | 2669 // If the layer wasn't able to move, try the next one in the hierarchy. |
2668 bool did_move_layer_x = std::abs(applied_delta.x()) > kEpsilon; | 2670 bool did_move_layer_x = std::abs(applied_delta.x()) > kEpsilon; |
2669 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon; | 2671 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon; |
2670 did_scroll_x |= did_move_layer_x; | 2672 did_scroll_x |= did_move_layer_x; |
2671 did_scroll_y |= did_move_layer_y; | 2673 did_scroll_y |= did_move_layer_y; |
2672 if (!did_move_layer_x && !did_move_layer_y) { | 2674 if (!did_move_layer_x && !did_move_layer_y) { |
2673 // Scrolls should always bubble between the outer and inner viewports | 2675 // Scrolls should always bubble between the outer and inner viewports |
2674 if (should_bubble_scrolls_ || !did_lock_scrolling_layer_ || | 2676 if (should_bubble_scrolls_ || !did_lock_scrolling_layer_ || |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3473 } | 3475 } |
3474 | 3476 |
3475 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3477 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3476 std::vector<PictureLayerImpl*>::iterator it = | 3478 std::vector<PictureLayerImpl*>::iterator it = |
3477 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3479 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3478 DCHECK(it != picture_layers_.end()); | 3480 DCHECK(it != picture_layers_.end()); |
3479 picture_layers_.erase(it); | 3481 picture_layers_.erase(it); |
3480 } | 3482 } |
3481 | 3483 |
3482 } // namespace cc | 3484 } // namespace cc |
OLD | NEW |