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

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

Issue 218883005: Fix another inappropriate overscroll glow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: check for unnecessary glow Created 6 years, 8 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 | « no previous file | 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 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698