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

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

Issue 2884423003: Use scroll-boundary-behavior to control overscroll-refresh/glow on android. (Closed)
Patch Set: Fixed the comments Created 3 years, 7 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
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_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 411
412 target_tree->PassSwapPromises(std::move(swap_promise_list_)); 412 target_tree->PassSwapPromises(std::move(swap_promise_list_));
413 swap_promise_list_.clear(); 413 swap_promise_list_.clear();
414 414
415 target_tree->set_browser_controls_shrink_blink_size( 415 target_tree->set_browser_controls_shrink_blink_size(
416 browser_controls_shrink_blink_size_); 416 browser_controls_shrink_blink_size_);
417 target_tree->set_top_controls_height(top_controls_height_); 417 target_tree->set_top_controls_height(top_controls_height_);
418 target_tree->set_bottom_controls_height(bottom_controls_height_); 418 target_tree->set_bottom_controls_height(bottom_controls_height_);
419 target_tree->PushBrowserControls(nullptr); 419 target_tree->PushBrowserControls(nullptr);
420 420
421 target_tree->set_scroll_boundary_behavior(scroll_boundary_behavior_);
422
421 // The page scale factor update can affect scrolling which requires that 423 // The page scale factor update can affect scrolling which requires that
422 // these ids are set, so this must be before PushPageScaleFactorAndLimits. 424 // these ids are set, so this must be before PushPageScaleFactorAndLimits.
423 target_tree->SetViewportLayersFromIds( 425 target_tree->SetViewportLayersFromIds(
424 overscroll_elasticity_layer_id_, page_scale_layer_id_, 426 overscroll_elasticity_layer_id_, page_scale_layer_id_,
425 inner_viewport_scroll_layer_id_, outer_viewport_scroll_layer_id_); 427 inner_viewport_scroll_layer_id_, outer_viewport_scroll_layer_id_);
426 428
427 // Active tree already shares the page_scale_factor object with pending 429 // Active tree already shares the page_scale_factor object with pending
428 // tree so only the limits need to be provided. 430 // tree so only the limits need to be provided.
429 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), 431 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(),
430 max_page_scale_factor()); 432 max_page_scale_factor());
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 846
845 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) { 847 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) {
846 if (bottom_controls_height_ == bottom_controls_height) 848 if (bottom_controls_height_ == bottom_controls_height)
847 return; 849 return;
848 850
849 bottom_controls_height_ = bottom_controls_height; 851 bottom_controls_height_ = bottom_controls_height;
850 if (IsActiveTree()) 852 if (IsActiveTree())
851 layer_tree_host_impl_->UpdateViewportContainerSizes(); 853 layer_tree_host_impl_->UpdateViewportContainerSizes();
852 } 854 }
853 855
856 void LayerTreeImpl::set_scroll_boundary_behavior(
857 ScrollBoundaryBehavior behavior) {
858 scroll_boundary_behavior_ = behavior;
859 }
860
854 bool LayerTreeImpl::ClampBrowserControlsShownRatio() { 861 bool LayerTreeImpl::ClampBrowserControlsShownRatio() {
855 float ratio = top_controls_shown_ratio_->Current(true); 862 float ratio = top_controls_shown_ratio_->Current(true);
856 ratio = std::max(ratio, 0.f); 863 ratio = std::max(ratio, 0.f);
857 ratio = std::min(ratio, 1.f); 864 ratio = std::min(ratio, 1.f);
858 return top_controls_shown_ratio_->SetCurrent(ratio); 865 return top_controls_shown_ratio_->SetCurrent(ratio);
859 } 866 }
860 867
861 bool LayerTreeImpl::SetCurrentBrowserControlsShownRatio(float ratio) { 868 bool LayerTreeImpl::SetCurrentBrowserControlsShownRatio(float ratio) {
862 bool changed = top_controls_shown_ratio_->SetCurrent(ratio); 869 bool changed = top_controls_shown_ratio_->SetCurrent(ratio);
863 changed |= ClampBrowserControlsShownRatio(); 870 changed |= ClampBrowserControlsShownRatio();
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 2112
2106 void LayerTreeImpl::ResetAllChangeTracking() { 2113 void LayerTreeImpl::ResetAllChangeTracking() {
2107 layers_that_should_push_properties_.clear(); 2114 layers_that_should_push_properties_.clear();
2108 // Iterate over all layers, including masks. 2115 // Iterate over all layers, including masks.
2109 for (auto& layer : *layers_) 2116 for (auto& layer : *layers_)
2110 layer->ResetChangeTracking(); 2117 layer->ResetChangeTracking();
2111 property_trees_.ResetAllChangeTracking(); 2118 property_trees_.ResetAllChangeTracking();
2112 } 2119 }
2113 2120
2114 } // namespace cc 2121 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698