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

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

Issue 626403003: Respect user_scrollable disabling in pinch-virtual-viewport mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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 | « cc/layers/layer_impl_unittest.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | 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 2552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 2563
2564 const float kEpsilon = 0.1f; 2564 const float kEpsilon = 0.1f;
2565 if (layer_impl == InnerViewportScrollLayer()) { 2565 if (layer_impl == InnerViewportScrollLayer()) {
2566 unused_root_delta.Subtract(applied_delta); 2566 unused_root_delta.Subtract(applied_delta);
2567 if (std::abs(unused_root_delta.x()) < kEpsilon) 2567 if (std::abs(unused_root_delta.x()) < kEpsilon)
2568 unused_root_delta.set_x(0.0f); 2568 unused_root_delta.set_x(0.0f);
2569 if (std::abs(unused_root_delta.y()) < kEpsilon) 2569 if (std::abs(unused_root_delta.y()) < kEpsilon)
2570 unused_root_delta.set_y(0.0f); 2570 unused_root_delta.set_y(0.0f);
2571 // Disable overscroll on axes which is impossible to scroll. 2571 // Disable overscroll on axes which is impossible to scroll.
2572 if (settings_.report_overscroll_only_for_scrollable_axes) { 2572 if (settings_.report_overscroll_only_for_scrollable_axes) {
2573 if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon) 2573 if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon ||
2574 !layer_impl->user_scrollable_horizontal())
2574 unused_root_delta.set_x(0.0f); 2575 unused_root_delta.set_x(0.0f);
2575 if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon) 2576 if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon ||
2577 !layer_impl->user_scrollable_vertical())
2576 unused_root_delta.set_y(0.0f); 2578 unused_root_delta.set_y(0.0f);
2577 } 2579 }
2578 } 2580 }
2579 2581
2580 // If the layer wasn't able to move, try the next one in the hierarchy. 2582 // If the layer wasn't able to move, try the next one in the hierarchy.
2581 bool did_move_layer_x = std::abs(applied_delta.x()) > kEpsilon; 2583 bool did_move_layer_x = std::abs(applied_delta.x()) > kEpsilon;
2582 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon; 2584 bool did_move_layer_y = std::abs(applied_delta.y()) > kEpsilon;
2583 did_scroll_x |= did_move_layer_x; 2585 did_scroll_x |= did_move_layer_x;
2584 did_scroll_y |= did_move_layer_y; 2586 did_scroll_y |= did_move_layer_y;
2585 if (!did_move_layer_x && !did_move_layer_y) { 2587 if (!did_move_layer_x && !did_move_layer_y) {
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
3380 } 3382 }
3381 3383
3382 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3384 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3383 std::vector<PictureLayerImpl*>::iterator it = 3385 std::vector<PictureLayerImpl*>::iterator it =
3384 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3386 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3385 DCHECK(it != picture_layers_.end()); 3387 DCHECK(it != picture_layers_.end());
3386 picture_layers_.erase(it); 3388 picture_layers_.erase(it);
3387 } 3389 }
3388 3390
3389 } // namespace cc 3391 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698