Chromium Code Reviews| 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 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2257 bool did_move_layer_x = std::abs(applied_delta.x()) > move_threshold; | 2257 bool did_move_layer_x = std::abs(applied_delta.x()) > move_threshold; |
| 2258 bool did_move_layer_y = std::abs(applied_delta.y()) > move_threshold; | 2258 bool did_move_layer_y = std::abs(applied_delta.y()) > move_threshold; |
| 2259 did_scroll_x |= did_move_layer_x; | 2259 did_scroll_x |= did_move_layer_x; |
| 2260 did_scroll_y |= did_move_layer_y; | 2260 did_scroll_y |= did_move_layer_y; |
| 2261 if (!did_move_layer_x && !did_move_layer_y) { | 2261 if (!did_move_layer_x && !did_move_layer_y) { |
| 2262 // Scrolls should always bubble between the outer and inner viewports | 2262 // Scrolls should always bubble between the outer and inner viewports |
| 2263 if (should_bubble_scrolls_ || !did_lock_scrolling_layer_ || | 2263 if (should_bubble_scrolls_ || !did_lock_scrolling_layer_ || |
| 2264 layer_impl == OuterViewportScrollLayer()) | 2264 layer_impl == OuterViewportScrollLayer()) |
| 2265 continue; | 2265 continue; |
| 2266 else | 2266 else |
| 2267 break; | 2267 break; |
|
aelias_OOO_until_Jul13
2014/04/01 02:28:20
Hmm, even with your latest changes, I notice anoth
| |
| 2268 } | 2268 } |
| 2269 | 2269 |
| 2270 if (layer_impl == InnerViewportScrollLayer()) { | 2270 if (layer_impl == InnerViewportScrollLayer()) { |
| 2271 unused_root_delta.Subtract(applied_delta); | 2271 unused_root_delta.Subtract(applied_delta); |
| 2272 const float kOverscrollEpsilon = 0.01f; | 2272 const float kOverscrollEpsilon = move_threshold; |
| 2273 if (std::abs(unused_root_delta.x()) < kOverscrollEpsilon) | 2273 if (std::abs(unused_root_delta.x()) < kOverscrollEpsilon) |
| 2274 unused_root_delta.set_x(0.0f); | 2274 unused_root_delta.set_x(0.0f); |
| 2275 if (std::abs(unused_root_delta.y()) < kOverscrollEpsilon) | 2275 if (std::abs(unused_root_delta.y()) < kOverscrollEpsilon) |
| 2276 unused_root_delta.set_y(0.0f); | 2276 unused_root_delta.set_y(0.0f); |
| 2277 } | 2277 } |
| 2278 | 2278 |
| 2279 did_lock_scrolling_layer_ = true; | 2279 did_lock_scrolling_layer_ = true; |
| 2280 if (!should_bubble_scrolls_) { | 2280 if (!should_bubble_scrolls_) { |
| 2281 active_tree_->SetCurrentlyScrollingLayer(layer_impl); | 2281 active_tree_->SetCurrentlyScrollingLayer(layer_impl); |
| 2282 break; | 2282 break; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 2308 client_->RenewTreePriority(); | 2308 client_->RenewTreePriority(); |
| 2309 } | 2309 } |
| 2310 | 2310 |
| 2311 // Scrolling along an axis resets accumulated root overscroll for that axis. | 2311 // Scrolling along an axis resets accumulated root overscroll for that axis. |
| 2312 if (did_scroll_x) | 2312 if (did_scroll_x) |
| 2313 accumulated_root_overscroll_.set_x(0); | 2313 accumulated_root_overscroll_.set_x(0); |
| 2314 if (did_scroll_y) | 2314 if (did_scroll_y) |
| 2315 accumulated_root_overscroll_.set_y(0); | 2315 accumulated_root_overscroll_.set_y(0); |
| 2316 | 2316 |
| 2317 accumulated_root_overscroll_ += unused_root_delta; | 2317 accumulated_root_overscroll_ += unused_root_delta; |
| 2318 bool did_overscroll = !unused_root_delta.IsZero(); | 2318 bool did_overscroll = |
| 2319 !unused_root_delta.IsZero() && !(did_scroll_x && did_scroll_y); | |
| 2319 if (did_overscroll && input_handler_client_) { | 2320 if (did_overscroll && input_handler_client_) { |
| 2320 DidOverscrollParams params; | 2321 DidOverscrollParams params; |
| 2321 params.accumulated_overscroll = accumulated_root_overscroll_; | 2322 params.accumulated_overscroll = accumulated_root_overscroll_; |
| 2322 params.latest_overscroll_delta = unused_root_delta; | 2323 params.latest_overscroll_delta = unused_root_delta; |
| 2323 params.current_fling_velocity = current_fling_velocity_; | 2324 params.current_fling_velocity = current_fling_velocity_; |
| 2324 input_handler_client_->DidOverscroll(params); | 2325 input_handler_client_->DidOverscroll(params); |
| 2325 } | 2326 } |
| 2326 | 2327 |
| 2327 return did_scroll_content || did_scroll_top_controls; | 2328 return did_scroll_content || did_scroll_top_controls; |
| 2328 } | 2329 } |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3019 swap_promise_monitor_.erase(monitor); | 3020 swap_promise_monitor_.erase(monitor); |
| 3020 } | 3021 } |
| 3021 | 3022 |
| 3022 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3023 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
| 3023 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3024 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
| 3024 for (; it != swap_promise_monitor_.end(); it++) | 3025 for (; it != swap_promise_monitor_.end(); it++) |
| 3025 (*it)->OnSetNeedsRedrawOnImpl(); | 3026 (*it)->OnSetNeedsRedrawOnImpl(); |
| 3026 } | 3027 } |
| 3027 | 3028 |
| 3028 } // namespace cc | 3029 } // namespace cc |
| OLD | NEW |