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_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
10 #include "cc/animation/transform_operations.h" | 10 #include "cc/animation/transform_operations.h" |
(...skipping 8541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8552 EXPECT_FLOAT_EQ( | 8552 EXPECT_FLOAT_EQ( |
8553 4.f, child1_layer->mask_layer()->draw_properties().device_scale_factor); | 8553 4.f, child1_layer->mask_layer()->draw_properties().device_scale_factor); |
8554 EXPECT_FLOAT_EQ(4.f, | 8554 EXPECT_FLOAT_EQ(4.f, |
8555 child1_layer->replica_layer() | 8555 child1_layer->replica_layer() |
8556 ->mask_layer() | 8556 ->mask_layer() |
8557 ->draw_properties() | 8557 ->draw_properties() |
8558 .device_scale_factor); | 8558 .device_scale_factor); |
8559 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); | 8559 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); |
8560 } | 8560 } |
8561 | 8561 |
| 8562 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { |
| 8563 scoped_refptr<Layer> root = Layer::Create(); |
| 8564 SetLayerPropertiesForTesting(root.get(), |
| 8565 gfx::Transform(), |
| 8566 gfx::Point3F(), |
| 8567 gfx::PointF(), |
| 8568 gfx::Size(768 / 2, 3000), |
| 8569 true, |
| 8570 false); |
| 8571 root->SetIsDrawable(true); |
| 8572 |
| 8573 scoped_refptr<Layer> clip = Layer::Create(); |
| 8574 SetLayerPropertiesForTesting(clip.get(), |
| 8575 gfx::Transform(), |
| 8576 gfx::Point3F(), |
| 8577 gfx::PointF(), |
| 8578 gfx::Size(768 / 2, 10000), |
| 8579 true, |
| 8580 false); |
| 8581 clip->SetMasksToBounds(true); |
| 8582 |
| 8583 scoped_refptr<Layer> content = Layer::Create(); |
| 8584 SetLayerPropertiesForTesting(content.get(), |
| 8585 gfx::Transform(), |
| 8586 gfx::Point3F(), |
| 8587 gfx::PointF(), |
| 8588 gfx::Size(768 / 2, 10000), |
| 8589 true, |
| 8590 false); |
| 8591 content->SetIsDrawable(true); |
| 8592 content->SetForceRenderSurface(true); |
| 8593 |
| 8594 root->AddChild(clip); |
| 8595 clip->AddChild(content); |
| 8596 |
| 8597 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); |
| 8598 host->SetRootLayer(root); |
| 8599 |
| 8600 gfx::Size device_viewport_size(768, 582); |
| 8601 RenderSurfaceLayerList render_surface_layer_list; |
| 8602 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 8603 host->root_layer(), device_viewport_size, &render_surface_layer_list); |
| 8604 inputs.device_scale_factor = 2.f; |
| 8605 inputs.page_scale_factor = 1.f; |
| 8606 inputs.page_scale_application_layer = NULL; |
| 8607 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 8608 |
| 8609 // Layers in the root render surface have their visible content rect clipped |
| 8610 // by the viewport. |
| 8611 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); |
| 8612 |
| 8613 // Layers drawing to a child render surface should still have their visible |
| 8614 // content rect clipped by the viewport. |
| 8615 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); |
| 8616 } |
| 8617 |
8562 } // namespace | 8618 } // namespace |
8563 } // namespace cc | 8619 } // namespace cc |
OLD | NEW |