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

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: vector->float in IPC Created 4 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 layers_(new OwnedLayerImplList), 78 layers_(new OwnedLayerImplList),
79 viewport_size_invalid_(false), 79 viewport_size_invalid_(false),
80 needs_update_draw_properties_(true), 80 needs_update_draw_properties_(true),
81 needs_full_tree_sync_(true), 81 needs_full_tree_sync_(true),
82 next_activation_forces_redraw_(false), 82 next_activation_forces_redraw_(false),
83 has_ever_been_drawn_(false), 83 has_ever_been_drawn_(false),
84 have_scroll_event_handlers_(false), 84 have_scroll_event_handlers_(false),
85 event_listener_properties_(), 85 event_listener_properties_(),
86 top_controls_shrink_blink_size_(false), 86 top_controls_shrink_blink_size_(false),
87 top_controls_height_(0), 87 top_controls_height_(0),
88 bottom_controls_height_(0),
88 top_controls_shown_ratio_(top_controls_shown_ratio) { 89 top_controls_shown_ratio_(top_controls_shown_ratio) {
89 property_trees()->is_main_thread = false; 90 property_trees()->is_main_thread = false;
90 } 91 }
91 92
92 LayerTreeImpl::~LayerTreeImpl() { 93 LayerTreeImpl::~LayerTreeImpl() {
93 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS 94 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS
94 : SwapPromise::ACTIVATION_FAILS); 95 : SwapPromise::ACTIVATION_FAILS);
95 96
96 // Need to explicitly clear the tree prior to destroying this so that 97 // Need to explicitly clear the tree prior to destroying this so that
97 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. 98 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor.
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 if (next_activation_forces_redraw_) { 424 if (next_activation_forces_redraw_) {
424 target_tree->ForceRedrawNextActivation(); 425 target_tree->ForceRedrawNextActivation();
425 next_activation_forces_redraw_ = false; 426 next_activation_forces_redraw_ = false;
426 } 427 }
427 428
428 target_tree->PassSwapPromises(std::move(swap_promise_list_)); 429 target_tree->PassSwapPromises(std::move(swap_promise_list_));
429 430
430 target_tree->set_top_controls_shrink_blink_size( 431 target_tree->set_top_controls_shrink_blink_size(
431 top_controls_shrink_blink_size_); 432 top_controls_shrink_blink_size_);
432 target_tree->set_top_controls_height(top_controls_height_); 433 target_tree->set_top_controls_height(top_controls_height_);
434 target_tree->set_bottom_controls_height(bottom_controls_height_);
433 target_tree->PushTopControls(nullptr); 435 target_tree->PushTopControls(nullptr);
434 436
435 // Active tree already shares the page_scale_factor object with pending 437 // Active tree already shares the page_scale_factor object with pending
436 // tree so only the limits need to be provided. 438 // tree so only the limits need to be provided.
437 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), 439 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(),
438 max_page_scale_factor()); 440 max_page_scale_factor());
439 target_tree->SetDeviceScaleFactor(device_scale_factor()); 441 target_tree->SetDeviceScaleFactor(device_scale_factor());
440 target_tree->set_painted_device_scale_factor(painted_device_scale_factor()); 442 target_tree->set_painted_device_scale_factor(painted_device_scale_factor());
441 target_tree->elastic_overscroll()->PushPendingToActive(); 443 target_tree->elastic_overscroll()->PushPendingToActive();
442 444
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 765
764 void LayerTreeImpl::set_top_controls_height(float top_controls_height) { 766 void LayerTreeImpl::set_top_controls_height(float top_controls_height) {
765 if (top_controls_height_ == top_controls_height) 767 if (top_controls_height_ == top_controls_height)
766 return; 768 return;
767 769
768 top_controls_height_ = top_controls_height; 770 top_controls_height_ = top_controls_height;
769 if (IsActiveTree()) 771 if (IsActiveTree())
770 layer_tree_host_impl_->UpdateViewportContainerSizes(); 772 layer_tree_host_impl_->UpdateViewportContainerSizes();
771 } 773 }
772 774
775 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) {
776 if (bottom_controls_height_ == bottom_controls_height)
777 return;
778
779 bottom_controls_height_ = bottom_controls_height;
780 if (IsActiveTree())
781 layer_tree_host_impl_->UpdateViewportContainerSizes();
782 }
783
773 bool LayerTreeImpl::ClampTopControlsShownRatio() { 784 bool LayerTreeImpl::ClampTopControlsShownRatio() {
774 float ratio = top_controls_shown_ratio_->Current(true); 785 float ratio = top_controls_shown_ratio_->Current(true);
775 ratio = std::max(ratio, 0.f); 786 ratio = std::max(ratio, 0.f);
776 ratio = std::min(ratio, 1.f); 787 ratio = std::min(ratio, 1.f);
777 return top_controls_shown_ratio_->SetCurrent(ratio); 788 return top_controls_shown_ratio_->SetCurrent(ratio);
778 } 789 }
779 790
780 bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) { 791 bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) {
781 bool changed = top_controls_shown_ratio_->SetCurrent(ratio); 792 bool changed = top_controls_shown_ratio_->SetCurrent(ratio);
782 changed |= ClampTopControlsShownRatio(); 793 changed |= ClampTopControlsShownRatio();
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 2052
2042 void LayerTreeImpl::ResetAllChangeTracking() { 2053 void LayerTreeImpl::ResetAllChangeTracking() {
2043 layers_that_should_push_properties_.clear(); 2054 layers_that_should_push_properties_.clear();
2044 // Iterate over all layers, including masks and replicas. 2055 // Iterate over all layers, including masks and replicas.
2045 for (auto& layer : *layers_) 2056 for (auto& layer : *layers_)
2046 layer->ResetChangeTracking(); 2057 layer->ResetChangeTracking();
2047 property_trees_.ResetAllChangeTracking(); 2058 property_trees_.ResetAllChangeTracking();
2048 } 2059 }
2049 2060
2050 } // namespace cc 2061 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698