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

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

Issue 2106753004: Introduce bottom controls to CC and let it respond to scrolling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change to height and ratio Created 4 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 layers_(new OwnedLayerImplList), 73 layers_(new OwnedLayerImplList),
74 viewport_size_invalid_(false), 74 viewport_size_invalid_(false),
75 needs_update_draw_properties_(true), 75 needs_update_draw_properties_(true),
76 needs_full_tree_sync_(true), 76 needs_full_tree_sync_(true),
77 next_activation_forces_redraw_(false), 77 next_activation_forces_redraw_(false),
78 has_ever_been_drawn_(false), 78 has_ever_been_drawn_(false),
79 have_scroll_event_handlers_(false), 79 have_scroll_event_handlers_(false),
80 event_listener_properties_(), 80 event_listener_properties_(),
81 top_controls_shrink_blink_size_(false), 81 top_controls_shrink_blink_size_(false),
82 top_controls_height_(0), 82 top_controls_height_(0),
83 bottom_controls_height_(0),
83 top_controls_shown_ratio_(top_controls_shown_ratio) { 84 top_controls_shown_ratio_(top_controls_shown_ratio) {
84 property_trees()->is_main_thread = false; 85 property_trees()->is_main_thread = false;
85 } 86 }
86 87
87 LayerTreeImpl::~LayerTreeImpl() { 88 LayerTreeImpl::~LayerTreeImpl() {
88 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS 89 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS
89 : SwapPromise::ACTIVATION_FAILS); 90 : SwapPromise::ACTIVATION_FAILS);
90 91
91 // Need to explicitly clear the tree prior to destroying this so that 92 // Need to explicitly clear the tree prior to destroying this so that
92 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. 93 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor.
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (next_activation_forces_redraw_) { 415 if (next_activation_forces_redraw_) {
415 target_tree->ForceRedrawNextActivation(); 416 target_tree->ForceRedrawNextActivation();
416 next_activation_forces_redraw_ = false; 417 next_activation_forces_redraw_ = false;
417 } 418 }
418 419
419 target_tree->PassSwapPromises(&swap_promise_list_); 420 target_tree->PassSwapPromises(&swap_promise_list_);
420 421
421 target_tree->set_top_controls_shrink_blink_size( 422 target_tree->set_top_controls_shrink_blink_size(
422 top_controls_shrink_blink_size_); 423 top_controls_shrink_blink_size_);
423 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_);
424 target_tree->PushTopControls(nullptr); 426 target_tree->PushTopControls(nullptr);
425 427
426 // Active tree already shares the page_scale_factor object with pending 428 // Active tree already shares the page_scale_factor object with pending
427 // tree so only the limits need to be provided. 429 // tree so only the limits need to be provided.
428 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), 430 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(),
429 max_page_scale_factor()); 431 max_page_scale_factor());
430 target_tree->SetDeviceScaleFactor(device_scale_factor()); 432 target_tree->SetDeviceScaleFactor(device_scale_factor());
431 target_tree->set_painted_device_scale_factor(painted_device_scale_factor()); 433 target_tree->set_painted_device_scale_factor(painted_device_scale_factor());
432 target_tree->elastic_overscroll()->PushPendingToActive(); 434 target_tree->elastic_overscroll()->PushPendingToActive();
433 435
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 725
724 void LayerTreeImpl::set_top_controls_height(float top_controls_height) { 726 void LayerTreeImpl::set_top_controls_height(float top_controls_height) {
725 if (top_controls_height_ == top_controls_height) 727 if (top_controls_height_ == top_controls_height)
726 return; 728 return;
727 729
728 top_controls_height_ = top_controls_height; 730 top_controls_height_ = top_controls_height;
729 if (IsActiveTree()) 731 if (IsActiveTree())
730 layer_tree_host_impl_->UpdateViewportContainerSizes(); 732 layer_tree_host_impl_->UpdateViewportContainerSizes();
731 } 733 }
732 734
735 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) {
736 if (bottom_controls_height_ == bottom_controls_height)
737 return;
738
739 bottom_controls_height_ = bottom_controls_height;
740 if (IsActiveTree())
741 layer_tree_host_impl_->UpdateViewportContainerSizes();
742 }
743
733 bool LayerTreeImpl::ClampTopControlsShownRatio() { 744 bool LayerTreeImpl::ClampTopControlsShownRatio() {
734 float ratio = top_controls_shown_ratio_->Current(true); 745 float ratio = top_controls_shown_ratio_->Current(true);
735 ratio = std::max(ratio, 0.f); 746 ratio = std::max(ratio, 0.f);
736 ratio = std::min(ratio, 1.f); 747 ratio = std::min(ratio, 1.f);
737 return top_controls_shown_ratio_->SetCurrent(ratio); 748 return top_controls_shown_ratio_->SetCurrent(ratio);
738 } 749 }
739 750
740 bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) { 751 bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) {
741 bool changed = top_controls_shown_ratio_->SetCurrent(ratio); 752 bool changed = top_controls_shown_ratio_->SetCurrent(ratio);
742 changed |= ClampTopControlsShownRatio(); 753 changed |= ClampTopControlsShownRatio();
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 2116
2106 void LayerTreeImpl::ResetAllChangeTracking() { 2117 void LayerTreeImpl::ResetAllChangeTracking() {
2107 layers_that_should_push_properties_.clear(); 2118 layers_that_should_push_properties_.clear();
2108 // Iterate over all layers, including masks and replicas. 2119 // Iterate over all layers, including masks and replicas.
2109 for (auto& layer : *layers_) 2120 for (auto& layer : *layers_)
2110 layer->ResetChangeTracking(); 2121 layer->ResetChangeTracking();
2111 property_trees_.ResetAllChangeTracking(); 2122 property_trees_.ResetAllChangeTracking();
2112 } 2123 }
2113 2124
2114 } // namespace cc 2125 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698