OLD | NEW |
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 Loading... |
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 if (next_activation_forces_redraw_) { | 402 if (next_activation_forces_redraw_) { |
402 target_tree->ForceRedrawNextActivation(); | 403 target_tree->ForceRedrawNextActivation(); |
403 next_activation_forces_redraw_ = false; | 404 next_activation_forces_redraw_ = false; |
404 } | 405 } |
405 | 406 |
406 target_tree->PassSwapPromises(&swap_promise_list_); | 407 target_tree->PassSwapPromises(&swap_promise_list_); |
407 | 408 |
408 target_tree->set_top_controls_shrink_blink_size( | 409 target_tree->set_top_controls_shrink_blink_size( |
409 top_controls_shrink_blink_size_); | 410 top_controls_shrink_blink_size_); |
410 target_tree->set_top_controls_height(top_controls_height_); | 411 target_tree->set_top_controls_height(top_controls_height_); |
| 412 target_tree->set_bottom_controls_height(bottom_controls_height_); |
411 target_tree->PushTopControls(nullptr); | 413 target_tree->PushTopControls(nullptr); |
412 | 414 |
413 // Active tree already shares the page_scale_factor object with pending | 415 // Active tree already shares the page_scale_factor object with pending |
414 // tree so only the limits need to be provided. | 416 // tree so only the limits need to be provided. |
415 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), | 417 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), |
416 max_page_scale_factor()); | 418 max_page_scale_factor()); |
417 target_tree->SetDeviceScaleFactor(device_scale_factor()); | 419 target_tree->SetDeviceScaleFactor(device_scale_factor()); |
418 target_tree->set_painted_device_scale_factor(painted_device_scale_factor()); | 420 target_tree->set_painted_device_scale_factor(painted_device_scale_factor()); |
419 target_tree->elastic_overscroll()->PushPendingToActive(); | 421 target_tree->elastic_overscroll()->PushPendingToActive(); |
420 | 422 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 | 717 |
716 void LayerTreeImpl::set_top_controls_height(float top_controls_height) { | 718 void LayerTreeImpl::set_top_controls_height(float top_controls_height) { |
717 if (top_controls_height_ == top_controls_height) | 719 if (top_controls_height_ == top_controls_height) |
718 return; | 720 return; |
719 | 721 |
720 top_controls_height_ = top_controls_height; | 722 top_controls_height_ = top_controls_height; |
721 if (IsActiveTree()) | 723 if (IsActiveTree()) |
722 layer_tree_host_impl_->UpdateViewportContainerSizes(); | 724 layer_tree_host_impl_->UpdateViewportContainerSizes(); |
723 } | 725 } |
724 | 726 |
| 727 void LayerTreeImpl::set_bottom_controls_height(float bottom_controls_height) { |
| 728 if (bottom_controls_height_ == bottom_controls_height) |
| 729 return; |
| 730 |
| 731 bottom_controls_height_ = bottom_controls_height; |
| 732 if (IsActiveTree()) |
| 733 layer_tree_host_impl_->UpdateViewportContainerSizes(); |
| 734 } |
| 735 |
725 bool LayerTreeImpl::ClampTopControlsShownRatio() { | 736 bool LayerTreeImpl::ClampTopControlsShownRatio() { |
726 float ratio = top_controls_shown_ratio_->Current(true); | 737 float ratio = top_controls_shown_ratio_->Current(true); |
727 ratio = std::max(ratio, 0.f); | 738 ratio = std::max(ratio, 0.f); |
728 ratio = std::min(ratio, 1.f); | 739 ratio = std::min(ratio, 1.f); |
729 return top_controls_shown_ratio_->SetCurrent(ratio); | 740 return top_controls_shown_ratio_->SetCurrent(ratio); |
730 } | 741 } |
731 | 742 |
732 bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) { | 743 bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) { |
733 bool changed = top_controls_shown_ratio_->SetCurrent(ratio); | 744 bool changed = top_controls_shown_ratio_->SetCurrent(ratio); |
734 changed |= ClampTopControlsShownRatio(); | 745 changed |= ClampTopControlsShownRatio(); |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 | 2098 |
2088 void LayerTreeImpl::ResetAllChangeTracking() { | 2099 void LayerTreeImpl::ResetAllChangeTracking() { |
2089 layers_that_should_push_properties_.clear(); | 2100 layers_that_should_push_properties_.clear(); |
2090 // Iterate over all layers, including masks and replicas. | 2101 // Iterate over all layers, including masks and replicas. |
2091 for (auto& layer : *layers_) | 2102 for (auto& layer : *layers_) |
2092 layer->ResetChangeTracking(); | 2103 layer->ResetChangeTracking(); |
2093 property_trees_.ResetAllChangeTracking(); | 2104 property_trees_.ResetAllChangeTracking(); |
2094 } | 2105 } |
2095 | 2106 |
2096 } // namespace cc | 2107 } // namespace cc |
OLD | NEW |