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

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: findbug 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 swap_promise_list_.clear(); 430 swap_promise_list_.clear();
430 431
431 target_tree->set_top_controls_shrink_blink_size( 432 target_tree->set_top_controls_shrink_blink_size(
432 top_controls_shrink_blink_size_); 433 top_controls_shrink_blink_size_);
433 target_tree->set_top_controls_height(top_controls_height_); 434 target_tree->set_top_controls_height(top_controls_height_);
435 target_tree->set_bottom_controls_height(bottom_controls_height_);
434 target_tree->PushTopControls(nullptr); 436 target_tree->PushTopControls(nullptr);
435 437
436 // Active tree already shares the page_scale_factor object with pending 438 // Active tree already shares the page_scale_factor object with pending
437 // tree so only the limits need to be provided. 439 // tree so only the limits need to be provided.
438 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), 440 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(),
439 max_page_scale_factor()); 441 max_page_scale_factor());
440 target_tree->SetDeviceScaleFactor(device_scale_factor()); 442 target_tree->SetDeviceScaleFactor(device_scale_factor());
441 target_tree->set_painted_device_scale_factor(painted_device_scale_factor()); 443 target_tree->set_painted_device_scale_factor(painted_device_scale_factor());
442 target_tree->elastic_overscroll()->PushPendingToActive(); 444 target_tree->elastic_overscroll()->PushPendingToActive();
443 445
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 766
765 void LayerTreeImpl::set_top_controls_height(float top_controls_height) { 767 void LayerTreeImpl::set_top_controls_height(float top_controls_height) {
766 if (top_controls_height_ == top_controls_height) 768 if (top_controls_height_ == top_controls_height)
767 return; 769 return;
768 770
769 top_controls_height_ = top_controls_height; 771 top_controls_height_ = top_controls_height;
770 if (IsActiveTree()) 772 if (IsActiveTree())
771 layer_tree_host_impl_->UpdateViewportContainerSizes(); 773 layer_tree_host_impl_->UpdateViewportContainerSizes();
772 } 774 }
773 775
776 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) {
777 if (bottom_controls_height_ == bottom_controls_height)
778 return;
779
780 bottom_controls_height_ = bottom_controls_height;
781 if (IsActiveTree())
782 layer_tree_host_impl_->UpdateViewportContainerSizes();
783 }
784
774 bool LayerTreeImpl::ClampTopControlsShownRatio() { 785 bool LayerTreeImpl::ClampTopControlsShownRatio() {
775 float ratio = top_controls_shown_ratio_->Current(true); 786 float ratio = top_controls_shown_ratio_->Current(true);
776 ratio = std::max(ratio, 0.f); 787 ratio = std::max(ratio, 0.f);
777 ratio = std::min(ratio, 1.f); 788 ratio = std::min(ratio, 1.f);
778 return top_controls_shown_ratio_->SetCurrent(ratio); 789 return top_controls_shown_ratio_->SetCurrent(ratio);
779 } 790 }
780 791
781 bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) { 792 bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) {
782 bool changed = top_controls_shown_ratio_->SetCurrent(ratio); 793 bool changed = top_controls_shown_ratio_->SetCurrent(ratio);
783 changed |= ClampTopControlsShownRatio(); 794 changed |= ClampTopControlsShownRatio();
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 2077
2067 void LayerTreeImpl::ResetAllChangeTracking() { 2078 void LayerTreeImpl::ResetAllChangeTracking() {
2068 layers_that_should_push_properties_.clear(); 2079 layers_that_should_push_properties_.clear();
2069 // Iterate over all layers, including masks and replicas. 2080 // Iterate over all layers, including masks and replicas.
2070 for (auto& layer : *layers_) 2081 for (auto& layer : *layers_)
2071 layer->ResetChangeTracking(); 2082 layer->ResetChangeTracking();
2072 property_trees_.ResetAllChangeTracking(); 2083 property_trees_.ResetAllChangeTracking();
2073 } 2084 }
2074 2085
2075 } // namespace cc 2086 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698