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

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: rebase Created 3 years, 5 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 target_tree->PassSwapPromises(std::move(swap_promise_list_)); 419 target_tree->PassSwapPromises(std::move(swap_promise_list_));
420 swap_promise_list_.clear(); 420 swap_promise_list_.clear();
421 421
422 target_tree->set_browser_controls_shrink_blink_size( 422 target_tree->set_browser_controls_shrink_blink_size(
423 browser_controls_shrink_blink_size_); 423 browser_controls_shrink_blink_size_);
424 target_tree->set_top_controls_height(top_controls_height_); 424 target_tree->set_top_controls_height(top_controls_height_);
425 target_tree->set_bottom_controls_height(bottom_controls_height_); 425 target_tree->set_bottom_controls_height(bottom_controls_height_);
426 target_tree->PushBrowserControls(nullptr); 426 target_tree->PushBrowserControls(nullptr);
427 427
428 target_tree->set_scroll_boundary_behavior(scroll_boundary_behavior_);
429
428 // The page scale factor update can affect scrolling which requires that 430 // The page scale factor update can affect scrolling which requires that
429 // these ids are set, so this must be before PushPageScaleFactorAndLimits. 431 // these ids are set, so this must be before PushPageScaleFactorAndLimits.
430 target_tree->SetViewportLayersFromIds(viewport_layer_ids_); 432 target_tree->SetViewportLayersFromIds(viewport_layer_ids_);
431 433
432 // Active tree already shares the page_scale_factor object with pending 434 // Active tree already shares the page_scale_factor object with pending
433 // tree so only the limits need to be provided. 435 // tree so only the limits need to be provided.
434 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), 436 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(),
435 max_page_scale_factor()); 437 max_page_scale_factor());
436 target_tree->SetDeviceScaleFactor(device_scale_factor()); 438 target_tree->SetDeviceScaleFactor(device_scale_factor());
437 target_tree->set_painted_device_scale_factor(painted_device_scale_factor()); 439 target_tree->set_painted_device_scale_factor(painted_device_scale_factor());
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 818
817 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) { 819 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) {
818 if (bottom_controls_height_ == bottom_controls_height) 820 if (bottom_controls_height_ == bottom_controls_height)
819 return; 821 return;
820 822
821 bottom_controls_height_ = bottom_controls_height; 823 bottom_controls_height_ = bottom_controls_height;
822 if (IsActiveTree()) 824 if (IsActiveTree())
823 layer_tree_host_impl_->UpdateViewportContainerSizes(); 825 layer_tree_host_impl_->UpdateViewportContainerSizes();
824 } 826 }
825 827
828 void LayerTreeImpl::set_scroll_boundary_behavior(
829 const ScrollBoundaryBehavior& behavior) {
830 scroll_boundary_behavior_ = behavior;
831 }
832
826 bool LayerTreeImpl::ClampBrowserControlsShownRatio() { 833 bool LayerTreeImpl::ClampBrowserControlsShownRatio() {
827 float ratio = top_controls_shown_ratio_->Current(true); 834 float ratio = top_controls_shown_ratio_->Current(true);
828 ratio = std::max(ratio, 0.f); 835 ratio = std::max(ratio, 0.f);
829 ratio = std::min(ratio, 1.f); 836 ratio = std::min(ratio, 1.f);
830 return top_controls_shown_ratio_->SetCurrent(ratio); 837 return top_controls_shown_ratio_->SetCurrent(ratio);
831 } 838 }
832 839
833 bool LayerTreeImpl::SetCurrentBrowserControlsShownRatio(float ratio) { 840 bool LayerTreeImpl::SetCurrentBrowserControlsShownRatio(float ratio) {
834 bool changed = top_controls_shown_ratio_->SetCurrent(ratio); 841 bool changed = top_controls_shown_ratio_->SetCurrent(ratio);
835 changed |= ClampBrowserControlsShownRatio(); 842 changed |= ClampBrowserControlsShownRatio();
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 2081
2075 void LayerTreeImpl::ResetAllChangeTracking() { 2082 void LayerTreeImpl::ResetAllChangeTracking() {
2076 layers_that_should_push_properties_.clear(); 2083 layers_that_should_push_properties_.clear();
2077 // Iterate over all layers, including masks. 2084 // Iterate over all layers, including masks.
2078 for (auto& layer : *layers_) 2085 for (auto& layer : *layers_)
2079 layer->ResetChangeTracking(); 2086 layer->ResetChangeTracking();
2080 property_trees_.ResetAllChangeTracking(); 2087 property_trees_.ResetAllChangeTracking();
2081 } 2088 }
2082 2089
2083 } // namespace cc 2090 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698