| 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 | 38 |
| 39 return layer; | 39 return layer; |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 LayerTree::Inputs::Inputs() | 44 LayerTree::Inputs::Inputs() |
| 45 : top_controls_height(0.f), | 45 : top_controls_height(0.f), |
| 46 top_controls_shown_ratio(0.f), | 46 top_controls_shown_ratio(0.f), |
| 47 top_controls_shrink_blink_size(false), | 47 top_controls_shrink_blink_size(false), |
| 48 bottom_controls_height(0.f), |
| 48 device_scale_factor(1.f), | 49 device_scale_factor(1.f), |
| 49 painted_device_scale_factor(1.f), | 50 painted_device_scale_factor(1.f), |
| 50 page_scale_factor(1.f), | 51 page_scale_factor(1.f), |
| 51 min_page_scale_factor(1.f), | 52 min_page_scale_factor(1.f), |
| 52 max_page_scale_factor(1.f), | 53 max_page_scale_factor(1.f), |
| 53 background_color(SK_ColorWHITE), | 54 background_color(SK_ColorWHITE), |
| 54 has_transparent_background(false), | 55 has_transparent_background(false), |
| 55 have_scroll_event_handlers(false), | 56 have_scroll_event_handlers(false), |
| 56 event_listener_properties() {} | 57 event_listener_properties() {} |
| 57 | 58 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 167 } |
| 167 | 168 |
| 168 void LayerTree::SetTopControlsShownRatio(float ratio) { | 169 void LayerTree::SetTopControlsShownRatio(float ratio) { |
| 169 if (inputs_.top_controls_shown_ratio == ratio) | 170 if (inputs_.top_controls_shown_ratio == ratio) |
| 170 return; | 171 return; |
| 171 | 172 |
| 172 inputs_.top_controls_shown_ratio = ratio; | 173 inputs_.top_controls_shown_ratio = ratio; |
| 173 SetNeedsCommit(); | 174 SetNeedsCommit(); |
| 174 } | 175 } |
| 175 | 176 |
| 177 void LayerTree::SetBottomControlsHeight(float height) { |
| 178 if (inputs_.bottom_controls_height == height) |
| 179 return; |
| 180 |
| 181 inputs_.bottom_controls_height = height; |
| 182 SetNeedsCommit(); |
| 183 } |
| 184 |
| 176 void LayerTree::SetPageScaleFactorAndLimits(float page_scale_factor, | 185 void LayerTree::SetPageScaleFactorAndLimits(float page_scale_factor, |
| 177 float min_page_scale_factor, | 186 float min_page_scale_factor, |
| 178 float max_page_scale_factor) { | 187 float max_page_scale_factor) { |
| 179 if (inputs_.page_scale_factor == page_scale_factor && | 188 if (inputs_.page_scale_factor == page_scale_factor && |
| 180 inputs_.min_page_scale_factor == min_page_scale_factor && | 189 inputs_.min_page_scale_factor == min_page_scale_factor && |
| 181 inputs_.max_page_scale_factor == max_page_scale_factor) | 190 inputs_.max_page_scale_factor == max_page_scale_factor) |
| 182 return; | 191 return; |
| 183 | 192 |
| 184 inputs_.page_scale_factor = page_scale_factor; | 193 inputs_.page_scale_factor = page_scale_factor; |
| 185 inputs_.min_page_scale_factor = min_page_scale_factor; | 194 inputs_.min_page_scale_factor = min_page_scale_factor; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // Setting property trees must happen before pushing the page scale. | 386 // Setting property trees must happen before pushing the page scale. |
| 378 tree_impl->SetPropertyTrees(&property_trees_); | 387 tree_impl->SetPropertyTrees(&property_trees_); |
| 379 | 388 |
| 380 tree_impl->PushPageScaleFromMainThread(inputs_.page_scale_factor, | 389 tree_impl->PushPageScaleFromMainThread(inputs_.page_scale_factor, |
| 381 inputs_.min_page_scale_factor, | 390 inputs_.min_page_scale_factor, |
| 382 inputs_.max_page_scale_factor); | 391 inputs_.max_page_scale_factor); |
| 383 | 392 |
| 384 tree_impl->set_top_controls_shrink_blink_size( | 393 tree_impl->set_top_controls_shrink_blink_size( |
| 385 inputs_.top_controls_shrink_blink_size); | 394 inputs_.top_controls_shrink_blink_size); |
| 386 tree_impl->set_top_controls_height(inputs_.top_controls_height); | 395 tree_impl->set_top_controls_height(inputs_.top_controls_height); |
| 396 tree_impl->set_bottom_controls_height(inputs_.bottom_controls_height); |
| 387 tree_impl->PushTopControlsFromMainThread(inputs_.top_controls_shown_ratio); | 397 tree_impl->PushTopControlsFromMainThread(inputs_.top_controls_shown_ratio); |
| 388 tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); | 398 tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); |
| 389 if (tree_impl->IsActiveTree()) | 399 if (tree_impl->IsActiveTree()) |
| 390 tree_impl->elastic_overscroll()->PushPendingToActive(); | 400 tree_impl->elastic_overscroll()->PushPendingToActive(); |
| 391 | 401 |
| 392 tree_impl->set_painted_device_scale_factor( | 402 tree_impl->set_painted_device_scale_factor( |
| 393 inputs_.painted_device_scale_factor); | 403 inputs_.painted_device_scale_factor); |
| 394 | 404 |
| 395 if (inputs_.pending_page_scale_animation) { | 405 if (inputs_.pending_page_scale_animation) { |
| 396 tree_impl->SetPendingPageScaleAnimation( | 406 tree_impl->SetPendingPageScaleAnimation( |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 // updated for other reasons. All layers that at this point are part of the | 540 // updated for other reasons. All layers that at this point are part of the |
| 531 // layer tree are valid, so it is OK that they have a valid sequence number. | 541 // layer tree are valid, so it is OK that they have a valid sequence number. |
| 532 int seq_num = property_trees_.sequence_number; | 542 int seq_num = property_trees_.sequence_number; |
| 533 LayerTreeHostCommon::CallFunctionForEveryLayer( | 543 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 534 layer_tree_host_, [seq_num](Layer* layer) { | 544 layer_tree_host_, [seq_num](Layer* layer) { |
| 535 layer->set_property_tree_sequence_number(seq_num); | 545 layer->set_property_tree_sequence_number(seq_num); |
| 536 }); | 546 }); |
| 537 } | 547 } |
| 538 | 548 |
| 539 } // namespace cc | 549 } // namespace cc |
| OLD | NEW |