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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 8329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8340 start_transform_operations.AppendMatrix(uninvertible_matrix); | 8340 start_transform_operations.AppendMatrix(uninvertible_matrix); |
8341 TransformOperations end_transform_operations; | 8341 TransformOperations end_transform_operations; |
8342 | 8342 |
8343 AddAnimatedTransformToElementWithPlayer( | 8343 AddAnimatedTransformToElementWithPlayer( |
8344 animated->element_id(), timeline_impl(), 10.0, start_transform_operations, | 8344 animated->element_id(), timeline_impl(), 10.0, start_transform_operations, |
8345 end_transform_operations); | 8345 end_transform_operations); |
8346 ExecuteCalculateDrawProperties(root); | 8346 ExecuteCalculateDrawProperties(root); |
8347 // Since animated has singular transform, it is not be part of render | 8347 // Since animated has singular transform, it is not be part of render |
8348 // surface layer list but should be rastered. | 8348 // surface layer list but should be rastered. |
8349 EXPECT_FALSE(animated->contributes_to_drawn_render_surface()); | 8349 EXPECT_FALSE(animated->contributes_to_drawn_render_surface()); |
8350 EXPECT_TRUE(animated->raster_even_if_not_in_rsll()); | 8350 EXPECT_TRUE(animated->raster_even_if_not_drawn()); |
8351 | 8351 |
8352 // The animated layer has a singular transform and maps to a non-empty rect in | 8352 // The animated layer has a singular transform and maps to a non-empty rect in |
8353 // clipped target space, so is treated as fully visible. | 8353 // clipped target space, so is treated as fully visible. |
8354 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect()); | 8354 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect()); |
8355 | 8355 |
8356 // The singular transform on |animated| is flattened when inherited by | 8356 // The singular transform on |animated| is flattened when inherited by |
8357 // |surface|, and this happens to make it invertible. | 8357 // |surface|, and this happens to make it invertible. |
8358 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect()); | 8358 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect()); |
8359 EXPECT_EQ(gfx::Rect(2, 2), descendant_of_animation->visible_layer_rect()); | 8359 EXPECT_EQ(gfx::Rect(2, 2), descendant_of_animation->visible_layer_rect()); |
8360 | 8360 |
(...skipping 19 matching lines...) Expand all Loading... |
8380 | 8380 |
8381 // Since the animated has singular transform, it is not be part of render | 8381 // Since the animated has singular transform, it is not be part of render |
8382 // surface layer list. | 8382 // surface layer list. |
8383 LayerImpl* active_animated = | 8383 LayerImpl* active_animated = |
8384 host_impl()->active_tree()->LayerById(animated->id()); | 8384 host_impl()->active_tree()->LayerById(animated->id()); |
8385 EXPECT_TRUE(active_root->contributes_to_drawn_render_surface()); | 8385 EXPECT_TRUE(active_root->contributes_to_drawn_render_surface()); |
8386 EXPECT_FALSE(active_animated->contributes_to_drawn_render_surface()); | 8386 EXPECT_FALSE(active_animated->contributes_to_drawn_render_surface()); |
8387 | 8387 |
8388 // Since animated has singular transform, it is not be part of render | 8388 // Since animated has singular transform, it is not be part of render |
8389 // surface layer list but should be rastered. | 8389 // surface layer list but should be rastered. |
8390 EXPECT_TRUE(animated->raster_even_if_not_in_rsll()); | 8390 EXPECT_TRUE(animated->raster_even_if_not_drawn()); |
8391 EXPECT_EQ(gfx::Rect(120, 120), active_animated->visible_layer_rect()); | 8391 EXPECT_EQ(gfx::Rect(120, 120), active_animated->visible_layer_rect()); |
8392 } | 8392 } |
8393 | 8393 |
8394 // Verify that having animated opacity but current opacity 1 still creates | 8394 // Verify that having animated opacity but current opacity 1 still creates |
8395 // a render surface. | 8395 // a render surface. |
8396 TEST_F(LayerTreeHostCommonTest, AnimatedOpacityCreatesRenderSurface) { | 8396 TEST_F(LayerTreeHostCommonTest, AnimatedOpacityCreatesRenderSurface) { |
8397 LayerImpl* root = root_layer_for_testing(); | 8397 LayerImpl* root = root_layer_for_testing(); |
8398 LayerImpl* child = AddChild<LayerImpl>(root); | 8398 LayerImpl* child = AddChild<LayerImpl>(root); |
8399 LayerImpl* grandchild = AddChild<LayerImpl>(child); | 8399 LayerImpl* grandchild = AddChild<LayerImpl>(child); |
8400 | 8400 |
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10209 | 10209 |
10210 // Check child layer draw properties. | 10210 // Check child layer draw properties. |
10211 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); | 10211 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); |
10212 EXPECT_EQ(gfx::Transform(), child->DrawTransform()); | 10212 EXPECT_EQ(gfx::Transform(), child->DrawTransform()); |
10213 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect()); | 10213 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect()); |
10214 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); | 10214 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); |
10215 } | 10215 } |
10216 | 10216 |
10217 } // namespace | 10217 } // namespace |
10218 } // namespace cc | 10218 } // namespace cc |
OLD | NEW |