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 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2302 ScrollLayerWithViewportSpaceDelta(layer_impl, | 2302 ScrollLayerWithViewportSpaceDelta(layer_impl, |
2303 scale_from_viewport_to_screen_space, | 2303 scale_from_viewport_to_screen_space, |
2304 viewport_point, pending_delta); | 2304 viewport_point, pending_delta); |
2305 } else { | 2305 } else { |
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) |
jdduke (slow)
2014/04/09 22:51:48
It might make sense for us to move the zero-ing co
| |
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 } | 2316 } |
2317 | 2317 |
2318 // If the layer wasn't able to move, try the next one in the hierarchy. | 2318 // 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; | 2319 bool did_move_layer_x = std::abs(applied_delta.x()) > kEpsilon; |
2320 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon; | 2320 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon; |
2321 did_scroll_x |= did_move_layer_x; | 2321 did_scroll_x |= did_move_layer_x; |
2322 did_scroll_y |= did_move_layer_y; | 2322 did_scroll_y |= did_move_layer_y; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2360 SetNeedsRedraw(); | 2360 SetNeedsRedraw(); |
2361 client_->RenewTreePriority(); | 2361 client_->RenewTreePriority(); |
2362 } | 2362 } |
2363 | 2363 |
2364 // Scrolling along an axis resets accumulated root overscroll for that axis. | 2364 // Scrolling along an axis resets accumulated root overscroll for that axis. |
2365 if (did_scroll_x) | 2365 if (did_scroll_x) |
2366 accumulated_root_overscroll_.set_x(0); | 2366 accumulated_root_overscroll_.set_x(0); |
2367 if (did_scroll_y) | 2367 if (did_scroll_y) |
2368 accumulated_root_overscroll_.set_y(0); | 2368 accumulated_root_overscroll_.set_y(0); |
2369 | 2369 |
2370 if (!settings_.using_synchronous_renderer_compositor) { | |
jdduke (slow)
2014/04/09 17:35:00
I don't think we want to piggyback on this setting
aelias_OOO_until_Jul13
2014/04/09 19:43:43
"report_overscroll_only_for_scrollable_axes" sound
| |
2371 gfx::SizeF ceiled_viewport_size = | |
2372 gfx::ToCeiledSize(active_tree_->ScrollableViewportSize()); | |
2373 gfx::SizeF root_layer_size = active_tree_->ScrollableSize(); | |
2374 if (!(ceiled_viewport_size.width() < root_layer_size.width())) { | |
2375 // Horizontal Glow Disabled as scrolling on Horizontal axes is impossible. | |
jdduke (slow)
2014/04/09 17:35:00
I wonder if we should just use:
if (InnerViewport
aelias_OOO_until_Jul13
2014/04/09 19:43:43
This sounds fine. If MaxScrollOffset suffers from
| |
2376 if ((unused_root_delta.x() != 0 && unused_root_delta.y() == 0 && | |
2377 !did_scroll_x)) | |
2378 return did_scroll_content || did_scroll_top_controls; | |
2379 } | |
2380 if (!(ceiled_viewport_size.height() < root_layer_size.height())) { | |
2381 // Vertical Glow Disabled as scrolling on Horizontal axes is impossible. | |
2382 if ((unused_root_delta.x() == 0 && unused_root_delta.y() != 0 && | |
2383 !did_scroll_y)) | |
2384 return did_scroll_content || did_scroll_top_controls; | |
2385 } | |
2386 } | |
2387 | |
2370 accumulated_root_overscroll_ += unused_root_delta; | 2388 accumulated_root_overscroll_ += unused_root_delta; |
2371 bool did_overscroll = !unused_root_delta.IsZero(); | 2389 bool did_overscroll = !unused_root_delta.IsZero(); |
2372 if (did_overscroll && input_handler_client_) { | 2390 if (did_overscroll && input_handler_client_) { |
2373 input_handler_client_->DidOverscroll(accumulated_root_overscroll_, | 2391 input_handler_client_->DidOverscroll(accumulated_root_overscroll_, |
2374 unused_root_delta); | 2392 unused_root_delta); |
2375 } | 2393 } |
2376 | 2394 |
2377 return did_scroll_content || did_scroll_top_controls; | 2395 return did_scroll_content || did_scroll_top_controls; |
2378 } | 2396 } |
2379 | 2397 |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3067 swap_promise_monitor_.erase(monitor); | 3085 swap_promise_monitor_.erase(monitor); |
3068 } | 3086 } |
3069 | 3087 |
3070 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3088 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3071 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3089 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3072 for (; it != swap_promise_monitor_.end(); it++) | 3090 for (; it != swap_promise_monitor_.end(); it++) |
3073 (*it)->OnSetNeedsRedrawOnImpl(); | 3091 (*it)->OnSetNeedsRedrawOnImpl(); |
3074 } | 3092 } |
3075 | 3093 |
3076 } // namespace cc | 3094 } // namespace cc |
OLD | NEW |