Chromium Code Reviews| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 LayerImpl* inner_container = InnerViewportContainerLayer(); | 293 LayerImpl* inner_container = InnerViewportContainerLayer(); |
| 294 LayerImpl* outer_container = OuterViewportContainerLayer(); | 294 LayerImpl* outer_container = OuterViewportContainerLayer(); |
| 295 | 295 |
| 296 UpdateClipTreeForBoundsDeltaOnLayer(inner_container, | 296 UpdateClipTreeForBoundsDeltaOnLayer(inner_container, |
| 297 &property_trees_.clip_tree); | 297 &property_trees_.clip_tree); |
| 298 UpdateClipTreeForBoundsDeltaOnLayer(InnerViewportScrollLayer(), | 298 UpdateClipTreeForBoundsDeltaOnLayer(InnerViewportScrollLayer(), |
| 299 &property_trees_.clip_tree); | 299 &property_trees_.clip_tree); |
| 300 UpdateClipTreeForBoundsDeltaOnLayer(outer_container, | 300 UpdateClipTreeForBoundsDeltaOnLayer(outer_container, |
| 301 &property_trees_.clip_tree); | 301 &property_trees_.clip_tree); |
| 302 | 302 |
| 303 TransformTree& transform_tree = property_trees_.transform_tree; | |
| 304 if (inner_container) | 303 if (inner_container) |
| 305 transform_tree.SetInnerViewportBoundsDelta(inner_container->bounds_delta()); | 304 property_trees_.SetInnerViewportContainerBoundsDelta( |
| 305 inner_container->bounds_delta()); | |
| 306 if (outer_container) | 306 if (outer_container) |
| 307 transform_tree.SetOuterViewportBoundsDelta(outer_container->bounds_delta()); | 307 property_trees_.SetOuterViewportContainerBoundsDelta( |
| 308 outer_container->bounds_delta()); | |
|
ajuma
2016/02/09 22:35:05
Do we need to do the same for the inner viewport s
| |
| 308 } | 309 } |
| 309 | 310 |
| 310 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { | 311 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { |
| 311 // The request queue should have been processed and does not require a push. | 312 // The request queue should have been processed and does not require a push. |
| 312 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); | 313 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); |
| 313 | 314 |
| 314 target_tree->SetPropertyTrees(property_trees_); | 315 target_tree->SetPropertyTrees(property_trees_); |
| 315 | 316 |
| 316 if (next_activation_forces_redraw_) { | 317 if (next_activation_forces_redraw_) { |
| 317 target_tree->ForceRedrawNextActivation(); | 318 target_tree->ForceRedrawNextActivation(); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 return; | 481 return; |
| 481 LayerTreeHostCommon::CallFunctionForSubtree( | 482 LayerTreeHostCommon::CallFunctionForSubtree( |
| 482 root_layer(), [](LayerImpl* layer) { | 483 root_layer(), [](LayerImpl* layer) { |
| 483 layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded(); | 484 layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded(); |
| 484 }); | 485 }); |
| 485 } | 486 } |
| 486 | 487 |
| 487 void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) { | 488 void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) { |
| 488 DCHECK(IsActiveTree()); | 489 DCHECK(IsActiveTree()); |
| 489 if (page_scale_factor()->SetCurrent( | 490 if (page_scale_factor()->SetCurrent( |
| 490 ClampPageScaleFactorToLimits(active_page_scale))) | 491 ClampPageScaleFactorToLimits(active_page_scale))) { |
| 492 gfx::Transform identity_transform; | |
| 493 if (PageScaleLayer()) | |
| 494 UpdatePageScaleFactorInPropertyTrees( | |
| 495 property_trees(), PageScaleLayer(), | |
| 496 ClampPageScaleFactorToLimits(active_page_scale), | |
|
ajuma
2016/02/09 22:35:05
I think you can use current_page_scale_factor() he
| |
| 497 device_scale_factor(), identity_transform); | |
|
ajuma
2016/02/09 22:35:05
Instead of identity_transform, this should use the
| |
| 491 DidUpdatePageScale(); | 498 DidUpdatePageScale(); |
| 499 } | |
| 492 } | 500 } |
| 493 | 501 |
| 494 void LayerTreeImpl::PushPageScaleFromMainThread(float page_scale_factor, | 502 void LayerTreeImpl::PushPageScaleFromMainThread(float page_scale_factor, |
| 495 float min_page_scale_factor, | 503 float min_page_scale_factor, |
| 496 float max_page_scale_factor) { | 504 float max_page_scale_factor) { |
| 497 PushPageScaleFactorAndLimits(&page_scale_factor, min_page_scale_factor, | 505 PushPageScaleFactorAndLimits(&page_scale_factor, min_page_scale_factor, |
| 498 max_page_scale_factor); | 506 max_page_scale_factor); |
| 499 } | 507 } |
| 500 | 508 |
| 501 void LayerTreeImpl::PushPageScaleFactorAndLimits(const float* page_scale_factor, | 509 void LayerTreeImpl::PushPageScaleFactorAndLimits(const float* page_scale_factor, |
| 502 float min_page_scale_factor, | 510 float min_page_scale_factor, |
| 503 float max_page_scale_factor) { | 511 float max_page_scale_factor) { |
| 504 DCHECK(page_scale_factor || IsActiveTree()); | 512 DCHECK(page_scale_factor || IsActiveTree()); |
| 505 bool changed_page_scale = false; | 513 bool changed_page_scale = false; |
| 514 | |
| 515 changed_page_scale |= | |
| 516 SetPageScaleFactorLimits(min_page_scale_factor, max_page_scale_factor); | |
| 517 | |
| 506 if (page_scale_factor) { | 518 if (page_scale_factor) { |
| 507 DCHECK(!IsActiveTree() || !layer_tree_host_impl_->pending_tree()); | 519 DCHECK(!IsActiveTree() || !layer_tree_host_impl_->pending_tree()); |
| 508 changed_page_scale |= page_scale_factor_->Delta() != 1.f; | 520 changed_page_scale |= page_scale_factor_->Delta() != 1.f; |
| 509 // TODO(enne): Once CDP goes away, ignore this call below. The only time | 521 // TODO(enne): Once CDP goes away, ignore this call below. The only time |
| 510 // the property trees will differ is if there's been a page scale on the | 522 // the property trees will differ is if there's been a page scale on the |
| 511 // compositor thread after the begin frame, which is the delta check above. | 523 // compositor thread after the begin frame, which is the delta check above. |
| 512 changed_page_scale |= | 524 changed_page_scale |= |
| 513 page_scale_factor_->PushFromMainThread(*page_scale_factor); | 525 page_scale_factor_->PushFromMainThread(*page_scale_factor); |
| 526 if (PageScaleLayer()) { | |
| 527 gfx::Transform identity_transform; | |
| 528 UpdatePageScaleFactorInPropertyTrees( | |
| 529 property_trees(), PageScaleLayer(), | |
| 530 ClampPageScaleFactorToLimits(*page_scale_factor), | |
|
ajuma
2016/02/09 22:35:05
If you move this to the end of this method then yo
| |
| 531 device_scale_factor(), identity_transform); | |
|
ajuma
2016/02/09 22:35:05
Instead of identity_transform, this should be laye
| |
| 532 } else { | |
| 533 property_trees()->transform_tree.set_page_scale_factor( | |
| 534 ClampPageScaleFactorToLimits(*page_scale_factor)); | |
|
ajuma
2016/02/09 22:35:05
Is this code needed? It seems wrong to have a non-
sunxd
2016/02/09 23:03:56
This is also for testing, LayerTreeHostCommonTestB
ajuma
2016/02/10 00:15:06
Checking for a non-null PageScaleLayer() is fine,
| |
| 535 } | |
| 514 } | 536 } |
| 537 | |
| 515 if (IsActiveTree()) { | 538 if (IsActiveTree()) { |
| 516 // TODO(enne): Pushing from pending to active should never require | 539 // TODO(enne): Pushing from pending to active should never require |
| 517 // DidUpdatePageScale. The values should already be set by the fully | 540 // DidUpdatePageScale. The values should already be set by the fully |
| 518 // computed property trees being synced from one tree to another. Remove | 541 // computed property trees being synced from one tree to another. Remove |
| 519 // this once CDP goes away. | 542 // this once CDP goes away. |
| 520 changed_page_scale |= page_scale_factor_->PushPendingToActive(); | 543 changed_page_scale |= page_scale_factor_->PushPendingToActive(); |
| 521 } | 544 } |
| 522 | 545 |
| 523 changed_page_scale |= | |
| 524 SetPageScaleFactorLimits(min_page_scale_factor, max_page_scale_factor); | |
| 525 | |
| 526 if (changed_page_scale) | 546 if (changed_page_scale) |
| 527 DidUpdatePageScale(); | 547 DidUpdatePageScale(); |
| 528 } | 548 } |
| 529 | 549 |
| 530 void LayerTreeImpl::set_top_controls_shrink_blink_size(bool shrink) { | 550 void LayerTreeImpl::set_top_controls_shrink_blink_size(bool shrink) { |
| 531 if (top_controls_shrink_blink_size_ == shrink) | 551 if (top_controls_shrink_blink_size_ == shrink) |
| 532 return; | 552 return; |
| 533 | 553 |
| 534 top_controls_shrink_blink_size_ = shrink; | 554 top_controls_shrink_blink_size_ = shrink; |
| 535 if (IsActiveTree()) | 555 if (IsActiveTree()) |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2050 const gfx::BoxF& box, | 2070 const gfx::BoxF& box, |
| 2051 gfx::BoxF* bounds) const { | 2071 gfx::BoxF* bounds) const { |
| 2052 *bounds = gfx::BoxF(); | 2072 *bounds = gfx::BoxF(); |
| 2053 return layer_tree_host_impl_->animation_host() | 2073 return layer_tree_host_impl_->animation_host() |
| 2054 ? layer_tree_host_impl_->animation_host() | 2074 ? layer_tree_host_impl_->animation_host() |
| 2055 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) | 2075 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) |
| 2056 : true; | 2076 : true; |
| 2057 } | 2077 } |
| 2058 | 2078 |
| 2059 } // namespace cc | 2079 } // namespace cc |
| OLD | NEW |