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

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: Fix nits and rebase Created 3 years, 4 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 800
799 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) { 801 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) {
800 if (bottom_controls_height_ == bottom_controls_height) 802 if (bottom_controls_height_ == bottom_controls_height)
801 return; 803 return;
802 804
803 bottom_controls_height_ = bottom_controls_height; 805 bottom_controls_height_ = bottom_controls_height;
804 if (IsActiveTree()) 806 if (IsActiveTree())
805 layer_tree_host_impl_->UpdateViewportContainerSizes(); 807 layer_tree_host_impl_->UpdateViewportContainerSizes();
806 } 808 }
807 809
810 void LayerTreeImpl::set_scroll_boundary_behavior(
811 const ScrollBoundaryBehavior& behavior) {
812 scroll_boundary_behavior_ = behavior;
813 }
814
808 bool LayerTreeImpl::ClampBrowserControlsShownRatio() { 815 bool LayerTreeImpl::ClampBrowserControlsShownRatio() {
809 float ratio = top_controls_shown_ratio_->Current(true); 816 float ratio = top_controls_shown_ratio_->Current(true);
810 ratio = std::max(ratio, 0.f); 817 ratio = std::max(ratio, 0.f);
811 ratio = std::min(ratio, 1.f); 818 ratio = std::min(ratio, 1.f);
812 return top_controls_shown_ratio_->SetCurrent(ratio); 819 return top_controls_shown_ratio_->SetCurrent(ratio);
813 } 820 }
814 821
815 bool LayerTreeImpl::SetCurrentBrowserControlsShownRatio(float ratio) { 822 bool LayerTreeImpl::SetCurrentBrowserControlsShownRatio(float ratio) {
816 bool changed = top_controls_shown_ratio_->SetCurrent(ratio); 823 bool changed = top_controls_shown_ratio_->SetCurrent(ratio);
817 changed |= ClampBrowserControlsShownRatio(); 824 changed |= ClampBrowserControlsShownRatio();
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 2071
2065 void LayerTreeImpl::ResetAllChangeTracking() { 2072 void LayerTreeImpl::ResetAllChangeTracking() {
2066 layers_that_should_push_properties_.clear(); 2073 layers_that_should_push_properties_.clear();
2067 // Iterate over all layers, including masks. 2074 // Iterate over all layers, including masks.
2068 for (auto& layer : *layers_) 2075 for (auto& layer : *layers_)
2069 layer->ResetChangeTracking(); 2076 layer->ResetChangeTracking();
2070 property_trees_.ResetAllChangeTracking(); 2077 property_trees_.ResetAllChangeTracking();
2071 } 2078 }
2072 2079
2073 } // namespace cc 2080 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698