Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 206153002: Avoid unnecessary gloweffect calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 did_scroll_y |= did_move_layer_y; 2265 did_scroll_y |= did_move_layer_y;
2266 if (!did_move_layer_x && !did_move_layer_y) { 2266 if (!did_move_layer_x && !did_move_layer_y) {
2267 // Scrolls should always bubble between the outer and inner viewports 2267 // Scrolls should always bubble between the outer and inner viewports
2268 if (should_bubble_scrolls_ || !did_lock_scrolling_layer_ || 2268 if (should_bubble_scrolls_ || !did_lock_scrolling_layer_ ||
2269 layer_impl == OuterViewportScrollLayer()) 2269 layer_impl == OuterViewportScrollLayer())
2270 continue; 2270 continue;
2271 else 2271 else
2272 break; 2272 break;
2273 } 2273 }
2274 2274
2275 if (layer_impl == InnerViewportScrollLayer()) 2275 if (layer_impl == InnerViewportScrollLayer())
aelias_OOO_until_Jul13 2014/03/21 00:16:11 Replace this with: if (layer_impl == InnerVie
2276 unused_root_delta.Subtract(applied_delta); 2276 unused_root_delta.Subtract(applied_delta);
2277 2277
2278 did_lock_scrolling_layer_ = true; 2278 did_lock_scrolling_layer_ = true;
2279 if (!should_bubble_scrolls_) { 2279 if (!should_bubble_scrolls_) {
2280 active_tree_->SetCurrentlyScrollingLayer(layer_impl); 2280 active_tree_->SetCurrentlyScrollingLayer(layer_impl);
2281 break; 2281 break;
2282 } 2282 }
2283 2283
2284 // If the applied delta is within 45 degrees of the input delta, bail out to 2284 // If the applied delta is within 45 degrees of the input delta, bail out to
2285 // make it easier to scroll just one layer in one direction without 2285 // make it easier to scroll just one layer in one direction without
(...skipping 21 matching lines...) Expand all
2307 client_->RenewTreePriority(); 2307 client_->RenewTreePriority();
2308 } 2308 }
2309 2309
2310 // Scrolling along an axis resets accumulated root overscroll for that axis. 2310 // Scrolling along an axis resets accumulated root overscroll for that axis.
2311 if (did_scroll_x) 2311 if (did_scroll_x)
2312 accumulated_root_overscroll_.set_x(0); 2312 accumulated_root_overscroll_.set_x(0);
2313 if (did_scroll_y) 2313 if (did_scroll_y)
2314 accumulated_root_overscroll_.set_y(0); 2314 accumulated_root_overscroll_.set_y(0);
2315 2315
2316 accumulated_root_overscroll_ += unused_root_delta; 2316 accumulated_root_overscroll_ += unused_root_delta;
2317
2318 // Scrolling along an axis resets unused root delta which unnecessarily calls
2319 // glow effect
danakj 2014/03/20 17:01:30 nit: missing period
2320 if (did_scroll_x)
2321 unused_root_delta.set_y(0);
2322 if (did_scroll_y)
2323 unused_root_delta.set_x(0);
2324
2317 bool did_overscroll = !gfx::ToRoundedVector2d(unused_root_delta).IsZero(); 2325 bool did_overscroll = !gfx::ToRoundedVector2d(unused_root_delta).IsZero();
aelias_OOO_until_Jul13 2014/03/21 00:16:11 And this can be simplified to: bool did_overscrol
2318 if (did_overscroll && input_handler_client_) { 2326 if (did_overscroll && input_handler_client_) {
2319 DidOverscrollParams params; 2327 DidOverscrollParams params;
2320 params.accumulated_overscroll = accumulated_root_overscroll_; 2328 params.accumulated_overscroll = accumulated_root_overscroll_;
2321 params.latest_overscroll_delta = unused_root_delta; 2329 params.latest_overscroll_delta = unused_root_delta;
2322 params.current_fling_velocity = current_fling_velocity_; 2330 params.current_fling_velocity = current_fling_velocity_;
2323 input_handler_client_->DidOverscroll(params); 2331 input_handler_client_->DidOverscroll(params);
2324 } 2332 }
2325 2333
2326 return did_scroll_content || did_scroll_top_controls; 2334 return did_scroll_content || did_scroll_top_controls;
2327 } 2335 }
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
3020 swap_promise_monitor_.erase(monitor); 3028 swap_promise_monitor_.erase(monitor);
3021 } 3029 }
3022 3030
3023 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { 3031 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() {
3024 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3032 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3025 for (; it != swap_promise_monitor_.end(); it++) 3033 for (; it != swap_promise_monitor_.end(); it++)
3026 (*it)->OnSetNeedsRedrawOnImpl(); 3034 (*it)->OnSetNeedsRedrawOnImpl();
3027 } 3035 }
3028 3036
3029 } // namespace cc 3037 } // namespace cc
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698