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 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2306 applied_delta = ScrollLayerWithLocalDelta(layer_impl, pending_delta); | 2306 applied_delta = ScrollLayerWithLocalDelta(layer_impl, pending_delta); |
2307 } | 2307 } |
2308 | 2308 |
2309 const float kEpsilon = 0.1f; | 2309 const float kEpsilon = 0.1f; |
2310 if (layer_impl == InnerViewportScrollLayer()) { | 2310 if (layer_impl == InnerViewportScrollLayer()) { |
2311 unused_root_delta.Subtract(applied_delta); | 2311 unused_root_delta.Subtract(applied_delta); |
2312 if (std::abs(unused_root_delta.x()) < kEpsilon) | 2312 if (std::abs(unused_root_delta.x()) < kEpsilon) |
2313 unused_root_delta.set_x(0.0f); | 2313 unused_root_delta.set_x(0.0f); |
2314 if (std::abs(unused_root_delta.y()) < kEpsilon) | 2314 if (std::abs(unused_root_delta.y()) < kEpsilon) |
2315 unused_root_delta.set_y(0.0f); | 2315 unused_root_delta.set_y(0.0f); |
| 2316 // Disable overscroll on axes which is impossible to scroll. |
| 2317 if (settings_.report_overscroll_only_for_scrollable_axes) { |
| 2318 if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon) |
| 2319 unused_root_delta.set_x(0.0f); |
| 2320 if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon) |
| 2321 unused_root_delta.set_y(0.0f); |
| 2322 } |
2316 } | 2323 } |
2317 | 2324 |
2318 // If the layer wasn't able to move, try the next one in the hierarchy. | 2325 // If the layer wasn't able to move, try the next one in the hierarchy. |
2319 bool did_move_layer_x = std::abs(applied_delta.x()) > kEpsilon; | 2326 bool did_move_layer_x = std::abs(applied_delta.x()) > kEpsilon; |
2320 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon; | 2327 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon; |
2321 did_scroll_x |= did_move_layer_x; | 2328 did_scroll_x |= did_move_layer_x; |
2322 did_scroll_y |= did_move_layer_y; | 2329 did_scroll_y |= did_move_layer_y; |
2323 if (!did_move_layer_x && !did_move_layer_y) { | 2330 if (!did_move_layer_x && !did_move_layer_y) { |
2324 // Scrolls should always bubble between the outer and inner viewports | 2331 // Scrolls should always bubble between the outer and inner viewports |
2325 if (should_bubble_scrolls_ || !did_lock_scrolling_layer_ || | 2332 if (should_bubble_scrolls_ || !did_lock_scrolling_layer_ || |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3067 swap_promise_monitor_.erase(monitor); | 3074 swap_promise_monitor_.erase(monitor); |
3068 } | 3075 } |
3069 | 3076 |
3070 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3077 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3071 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3078 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3072 for (; it != swap_promise_monitor_.end(); it++) | 3079 for (; it != swap_promise_monitor_.end(); it++) |
3073 (*it)->OnSetNeedsRedrawOnImpl(); | 3080 (*it)->OnSetNeedsRedrawOnImpl(); |
3074 } | 3081 } |
3075 | 3082 |
3076 } // namespace cc | 3083 } // namespace cc |
OLD | NEW |