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

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

Issue 910373002: [Android] Disable pull-to-refresh with overflow:hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass overflow:hidden via metadata Created 5 years, 10 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/output/compositor_frame_metadata.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 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 if (top_controls_manager_) { 1439 if (top_controls_manager_) {
1440 metadata.location_bar_offset = 1440 metadata.location_bar_offset =
1441 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset()); 1441 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset());
1442 metadata.location_bar_content_translation = 1442 metadata.location_bar_content_translation =
1443 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset()); 1443 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset());
1444 } 1444 }
1445 1445
1446 active_tree_->GetViewportSelection(&metadata.selection_start, 1446 active_tree_->GetViewportSelection(&metadata.selection_start,
1447 &metadata.selection_end); 1447 &metadata.selection_end);
1448 1448
1449 LayerImpl* root_layer_for_overflow = OuterViewportScrollLayer()
1450 ? OuterViewportScrollLayer()
1451 : InnerViewportScrollLayer();
1452 if (root_layer_for_overflow) {
1453 metadata.root_overflow_x_hidden =
1454 !root_layer_for_overflow->user_scrollable_horizontal();
1455 metadata.root_overflow_y_hidden =
1456 !root_layer_for_overflow->user_scrollable_vertical();
1457 }
1458
1449 if (!InnerViewportScrollLayer()) 1459 if (!InnerViewportScrollLayer())
1450 return metadata; 1460 return metadata;
1451 1461
1452 // TODO(miletus) : Change the metadata to hold ScrollOffset. 1462 // TODO(miletus) : Change the metadata to hold ScrollOffset.
1453 metadata.root_scroll_offset = gfx::ScrollOffsetToVector2dF( 1463 metadata.root_scroll_offset = gfx::ScrollOffsetToVector2dF(
1454 active_tree_->TotalScrollOffset()); 1464 active_tree_->TotalScrollOffset());
1455 1465
1456 return metadata; 1466 return metadata;
1457 } 1467 }
1458 1468
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2657 layer_impl, pending_delta, active_tree_->current_page_scale_factor()); 2667 layer_impl, pending_delta, active_tree_->current_page_scale_factor());
2658 } 2668 }
2659 2669
2660 const float kEpsilon = 0.1f; 2670 const float kEpsilon = 0.1f;
2661 if (layer_impl == InnerViewportScrollLayer()) { 2671 if (layer_impl == InnerViewportScrollLayer()) {
2662 unused_root_delta.Subtract(applied_delta); 2672 unused_root_delta.Subtract(applied_delta);
2663 if (std::abs(unused_root_delta.x()) < kEpsilon) 2673 if (std::abs(unused_root_delta.x()) < kEpsilon)
2664 unused_root_delta.set_x(0.0f); 2674 unused_root_delta.set_x(0.0f);
2665 if (std::abs(unused_root_delta.y()) < kEpsilon) 2675 if (std::abs(unused_root_delta.y()) < kEpsilon)
2666 unused_root_delta.set_y(0.0f); 2676 unused_root_delta.set_y(0.0f);
2677
2678 // If there is unconsumed scroll after application to the viewport, and
2679 // the (outer) viewport layer is explicitly marked unscrollable, suppress
2680 // any overscroll, preventing bubbling to UI layers.
2681 const LayerImpl* layer_for_user_scrollable_testing =
jdduke (slow) 2015/02/11 22:22:56 Oops, I'll go ahead and revert this change, it's n
2682 OuterViewportScrollLayer() ? OuterViewportScrollLayer() : layer_impl;
2683 if (unused_root_delta.x() &&
2684 !layer_for_user_scrollable_testing->user_scrollable_horizontal()) {
2685 unused_root_delta.set_x(0);
2686 }
2687 if (unused_root_delta.y() &&
2688 !layer_for_user_scrollable_testing->user_scrollable_vertical()) {
2689 unused_root_delta.set_y(0);
2690 }
2691
2667 // Disable overscroll on axes which is impossible to scroll. 2692 // Disable overscroll on axes which is impossible to scroll.
2668 if (settings_.report_overscroll_only_for_scrollable_axes) { 2693 if (settings_.report_overscroll_only_for_scrollable_axes) {
2669 if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon || 2694 if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon)
2670 !layer_impl->user_scrollable_horizontal())
2671 unused_root_delta.set_x(0.0f); 2695 unused_root_delta.set_x(0.0f);
2672 if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon || 2696 if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon)
2673 !layer_impl->user_scrollable_vertical())
2674 unused_root_delta.set_y(0.0f); 2697 unused_root_delta.set_y(0.0f);
2675 } 2698 }
2676 } 2699 }
2677 2700
2678 // Scrolls should bubble perfectly between the outer and inner viewports. 2701 // Scrolls should bubble perfectly between the outer and inner viewports.
2679 bool allow_unrestricted_bubbling_for_current_layer = 2702 bool allow_unrestricted_bubbling_for_current_layer =
2680 layer_impl == OuterViewportScrollLayer(); 2703 layer_impl == OuterViewportScrollLayer();
2681 bool allow_bubbling_for_current_layer = 2704 bool allow_bubbling_for_current_layer =
2682 allow_unrestricted_bubbling_for_current_layer || should_bubble_scrolls_; 2705 allow_unrestricted_bubbling_for_current_layer || should_bubble_scrolls_;
2683 2706
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
3485 (*it)->OnSetNeedsRedrawOnImpl(); 3508 (*it)->OnSetNeedsRedrawOnImpl();
3486 } 3509 }
3487 3510
3488 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { 3511 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() {
3489 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3512 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3490 for (; it != swap_promise_monitor_.end(); it++) 3513 for (; it != swap_promise_monitor_.end(); it++)
3491 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); 3514 (*it)->OnForwardScrollUpdateToMainThreadOnImpl();
3492 } 3515 }
3493 3516
3494 } // namespace cc 3517 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/compositor_frame_metadata.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