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 2552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2563 | 2563 |
2564 const float kEpsilon = 0.1f; | 2564 const float kEpsilon = 0.1f; |
2565 if (layer_impl == InnerViewportScrollLayer()) { | 2565 if (layer_impl == InnerViewportScrollLayer()) { |
2566 unused_root_delta.Subtract(applied_delta); | 2566 unused_root_delta.Subtract(applied_delta); |
2567 if (std::abs(unused_root_delta.x()) < kEpsilon) | 2567 if (std::abs(unused_root_delta.x()) < kEpsilon) |
2568 unused_root_delta.set_x(0.0f); | 2568 unused_root_delta.set_x(0.0f); |
2569 if (std::abs(unused_root_delta.y()) < kEpsilon) | 2569 if (std::abs(unused_root_delta.y()) < kEpsilon) |
2570 unused_root_delta.set_y(0.0f); | 2570 unused_root_delta.set_y(0.0f); |
2571 // Disable overscroll on axes which is impossible to scroll. | 2571 // Disable overscroll on axes which is impossible to scroll. |
2572 if (settings_.report_overscroll_only_for_scrollable_axes) { | 2572 if (settings_.report_overscroll_only_for_scrollable_axes) { |
2573 if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon) | 2573 if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon || |
| 2574 !layer_impl->user_scrollable_horizontal()) |
2574 unused_root_delta.set_x(0.0f); | 2575 unused_root_delta.set_x(0.0f); |
2575 if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon) | 2576 if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon || |
| 2577 !layer_impl->user_scrollable_vertical()) |
2576 unused_root_delta.set_y(0.0f); | 2578 unused_root_delta.set_y(0.0f); |
2577 } | 2579 } |
2578 } | 2580 } |
2579 | 2581 |
2580 // If the layer wasn't able to move, try the next one in the hierarchy. | 2582 // If the layer wasn't able to move, try the next one in the hierarchy. |
2581 bool did_move_layer_x = std::abs(applied_delta.x()) > kEpsilon; | 2583 bool did_move_layer_x = std::abs(applied_delta.x()) > kEpsilon; |
2582 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon; | 2584 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon; |
2583 did_scroll_x |= did_move_layer_x; | 2585 did_scroll_x |= did_move_layer_x; |
2584 did_scroll_y |= did_move_layer_y; | 2586 did_scroll_y |= did_move_layer_y; |
2585 if (!did_move_layer_x && !did_move_layer_y) { | 2587 if (!did_move_layer_x && !did_move_layer_y) { |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3380 } | 3382 } |
3381 | 3383 |
3382 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3384 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3383 std::vector<PictureLayerImpl*>::iterator it = | 3385 std::vector<PictureLayerImpl*>::iterator it = |
3384 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3386 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3385 DCHECK(it != picture_layers_.end()); | 3387 DCHECK(it != picture_layers_.end()); |
3386 picture_layers_.erase(it); | 3388 picture_layers_.erase(it); |
3387 } | 3389 } |
3388 | 3390 |
3389 } // namespace cc | 3391 } // namespace cc |
OLD | NEW |