| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.h" | 5 #include "cc/trees/layer_tree.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "cc/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
| 10 #include "cc/input/page_scale_animation.h" | 10 #include "cc/input/page_scale_animation.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 current_layer->SetLayerTreeHost(nullptr); | 38 current_layer->SetLayerTreeHost(nullptr); |
| 39 | 39 |
| 40 return layer; | 40 return layer; |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 LayerTree::Inputs::Inputs() | 45 LayerTree::Inputs::Inputs() |
| 46 : top_controls_height(0.f), | 46 : top_controls_height(0.f), |
| 47 top_controls_shown_ratio(0.f), | 47 top_controls_shown_ratio(0.f), |
| 48 top_controls_shrink_blink_size(false), | 48 browser_controls_shrink_blink_size(false), |
| 49 bottom_controls_height(0.f), | 49 bottom_controls_height(0.f), |
| 50 device_scale_factor(1.f), | 50 device_scale_factor(1.f), |
| 51 painted_device_scale_factor(1.f), | 51 painted_device_scale_factor(1.f), |
| 52 page_scale_factor(1.f), | 52 page_scale_factor(1.f), |
| 53 min_page_scale_factor(1.f), | 53 min_page_scale_factor(1.f), |
| 54 max_page_scale_factor(1.f), | 54 max_page_scale_factor(1.f), |
| 55 background_color(SK_ColorWHITE), | 55 background_color(SK_ColorWHITE), |
| 56 has_transparent_background(false), | 56 has_transparent_background(false), |
| 57 have_scroll_event_handlers(false), | 57 have_scroll_event_handlers(false), |
| 58 event_listener_properties() {} | 58 event_listener_properties() {} |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 void LayerTree::SetViewportSize(const gfx::Size& device_viewport_size) { | 151 void LayerTree::SetViewportSize(const gfx::Size& device_viewport_size) { |
| 152 if (inputs_.device_viewport_size == device_viewport_size) | 152 if (inputs_.device_viewport_size == device_viewport_size) |
| 153 return; | 153 return; |
| 154 | 154 |
| 155 inputs_.device_viewport_size = device_viewport_size; | 155 inputs_.device_viewport_size = device_viewport_size; |
| 156 | 156 |
| 157 SetPropertyTreesNeedRebuild(); | 157 SetPropertyTreesNeedRebuild(); |
| 158 SetNeedsCommit(); | 158 SetNeedsCommit(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void LayerTree::SetTopControlsHeight(float height, bool shrink) { | 161 void LayerTree::SetBrowserControlsHeight(float height, bool shrink) { |
| 162 if (inputs_.top_controls_height == height && | 162 if (inputs_.top_controls_height == height && |
| 163 inputs_.top_controls_shrink_blink_size == shrink) | 163 inputs_.browser_controls_shrink_blink_size == shrink) |
| 164 return; | 164 return; |
| 165 | 165 |
| 166 inputs_.top_controls_height = height; | 166 inputs_.top_controls_height = height; |
| 167 inputs_.top_controls_shrink_blink_size = shrink; | 167 inputs_.browser_controls_shrink_blink_size = shrink; |
| 168 SetNeedsCommit(); | 168 SetNeedsCommit(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void LayerTree::SetTopControlsShownRatio(float ratio) { | 171 void LayerTree::SetBrowserControlsShownRatio(float ratio) { |
| 172 if (inputs_.top_controls_shown_ratio == ratio) | 172 if (inputs_.top_controls_shown_ratio == ratio) |
| 173 return; | 173 return; |
| 174 | 174 |
| 175 inputs_.top_controls_shown_ratio = ratio; | 175 inputs_.top_controls_shown_ratio = ratio; |
| 176 SetNeedsCommit(); | 176 SetNeedsCommit(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void LayerTree::SetBottomControlsHeight(float height) { | 179 void LayerTree::SetBottomControlsHeight(float height) { |
| 180 if (inputs_.bottom_controls_height == height) | 180 if (inputs_.bottom_controls_height == height) |
| 181 return; | 181 return; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 else | 397 else |
| 398 tree_impl->MoveChangeTrackingToLayers(); | 398 tree_impl->MoveChangeTrackingToLayers(); |
| 399 } | 399 } |
| 400 // Setting property trees must happen before pushing the page scale. | 400 // Setting property trees must happen before pushing the page scale. |
| 401 tree_impl->SetPropertyTrees(&property_trees_); | 401 tree_impl->SetPropertyTrees(&property_trees_); |
| 402 | 402 |
| 403 tree_impl->PushPageScaleFromMainThread(inputs_.page_scale_factor, | 403 tree_impl->PushPageScaleFromMainThread(inputs_.page_scale_factor, |
| 404 inputs_.min_page_scale_factor, | 404 inputs_.min_page_scale_factor, |
| 405 inputs_.max_page_scale_factor); | 405 inputs_.max_page_scale_factor); |
| 406 | 406 |
| 407 tree_impl->set_top_controls_shrink_blink_size( | 407 tree_impl->set_browser_controls_shrink_blink_size( |
| 408 inputs_.top_controls_shrink_blink_size); | 408 inputs_.browser_controls_shrink_blink_size); |
| 409 tree_impl->set_top_controls_height(inputs_.top_controls_height); | 409 tree_impl->set_top_controls_height(inputs_.top_controls_height); |
| 410 tree_impl->set_bottom_controls_height(inputs_.bottom_controls_height); | 410 tree_impl->set_bottom_controls_height(inputs_.bottom_controls_height); |
| 411 tree_impl->PushTopControlsFromMainThread(inputs_.top_controls_shown_ratio); | 411 tree_impl->PushBrowserControlsFromMainThread( |
| 412 inputs_.top_controls_shown_ratio); |
| 412 tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); | 413 tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); |
| 413 if (tree_impl->IsActiveTree()) | 414 if (tree_impl->IsActiveTree()) |
| 414 tree_impl->elastic_overscroll()->PushPendingToActive(); | 415 tree_impl->elastic_overscroll()->PushPendingToActive(); |
| 415 | 416 |
| 416 tree_impl->set_painted_device_scale_factor( | 417 tree_impl->set_painted_device_scale_factor( |
| 417 inputs_.painted_device_scale_factor); | 418 inputs_.painted_device_scale_factor); |
| 418 | 419 |
| 419 tree_impl->SetDeviceColorSpace(inputs_.device_color_space); | 420 tree_impl->SetDeviceColorSpace(inputs_.device_color_space); |
| 420 | 421 |
| 421 if (inputs_.pending_page_scale_animation) { | 422 if (inputs_.pending_page_scale_animation) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 448 : Layer::INVALID_ID); | 449 : Layer::INVALID_ID); |
| 449 proto->set_inner_viewport_scroll_layer_id( | 450 proto->set_inner_viewport_scroll_layer_id( |
| 450 inputs_.inner_viewport_scroll_layer | 451 inputs_.inner_viewport_scroll_layer |
| 451 ? inputs_.inner_viewport_scroll_layer->id() | 452 ? inputs_.inner_viewport_scroll_layer->id() |
| 452 : Layer::INVALID_ID); | 453 : Layer::INVALID_ID); |
| 453 proto->set_outer_viewport_scroll_layer_id( | 454 proto->set_outer_viewport_scroll_layer_id( |
| 454 inputs_.outer_viewport_scroll_layer | 455 inputs_.outer_viewport_scroll_layer |
| 455 ? inputs_.outer_viewport_scroll_layer->id() | 456 ? inputs_.outer_viewport_scroll_layer->id() |
| 456 : Layer::INVALID_ID); | 457 : Layer::INVALID_ID); |
| 457 | 458 |
| 458 // Top Controls ignored. They are not supported. | 459 // Browser Controls ignored. They are not supported. |
| 459 DCHECK(!inputs_.top_controls_shrink_blink_size); | 460 DCHECK(!inputs_.browser_controls_shrink_blink_size); |
| 460 | 461 |
| 461 proto->set_device_scale_factor(inputs_.device_scale_factor); | 462 proto->set_device_scale_factor(inputs_.device_scale_factor); |
| 462 proto->set_painted_device_scale_factor(inputs_.painted_device_scale_factor); | 463 proto->set_painted_device_scale_factor(inputs_.painted_device_scale_factor); |
| 463 proto->set_page_scale_factor(inputs_.page_scale_factor); | 464 proto->set_page_scale_factor(inputs_.page_scale_factor); |
| 464 proto->set_min_page_scale_factor(inputs_.min_page_scale_factor); | 465 proto->set_min_page_scale_factor(inputs_.min_page_scale_factor); |
| 465 proto->set_max_page_scale_factor(inputs_.max_page_scale_factor); | 466 proto->set_max_page_scale_factor(inputs_.max_page_scale_factor); |
| 466 | 467 |
| 467 proto->set_background_color(inputs_.background_color); | 468 proto->set_background_color(inputs_.background_color); |
| 468 proto->set_has_transparent_background(inputs_.has_transparent_background); | 469 proto->set_has_transparent_background(inputs_.has_transparent_background); |
| 469 | 470 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 LayerListReverseIterator<Layer> LayerTree::rend() { | 692 LayerListReverseIterator<Layer> LayerTree::rend() { |
| 692 return LayerListReverseIterator<Layer>(nullptr); | 693 return LayerListReverseIterator<Layer>(nullptr); |
| 693 } | 694 } |
| 694 | 695 |
| 695 void LayerTree::SetNeedsDisplayOnAllLayers() { | 696 void LayerTree::SetNeedsDisplayOnAllLayers() { |
| 696 for (auto* layer : *this) | 697 for (auto* layer : *this) |
| 697 layer->SetNeedsDisplay(); | 698 layer->SetNeedsDisplay(); |
| 698 } | 699 } |
| 699 | 700 |
| 700 } // namespace cc | 701 } // namespace cc |
| OLD | NEW |