Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2225973003: cc: Remove usage of ComputeVisibleRects on main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Project rects back to layer space after clipped by viewport. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 template <class LayerType> 164 template <class LayerType>
165 void ExecuteCalculateDrawProperties(LayerType* root_layer, 165 void ExecuteCalculateDrawProperties(LayerType* root_layer,
166 float device_scale_factor) { 166 float device_scale_factor) {
167 LayerType* page_scale_application_layer = nullptr; 167 LayerType* page_scale_application_layer = nullptr;
168 ExecuteCalculateDrawProperties(root_layer, device_scale_factor, 1.f, 168 ExecuteCalculateDrawProperties(root_layer, device_scale_factor, 1.f,
169 page_scale_application_layer); 169 page_scale_application_layer);
170 } 170 }
171 171
172 const LayerList* GetUpdateLayerList() { return &update_layer_list_; }
173
172 void ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* root_layer) { 174 void ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* root_layer) {
173 DCHECK(root_layer->layer_tree_host()); 175 DCHECK(root_layer->layer_tree_host());
174 PropertyTreeBuilder::PreCalculateMetaInformation(root_layer); 176 PropertyTreeBuilder::PreCalculateMetaInformation(root_layer);
175 177
176 bool can_render_to_separate_surface = true; 178 bool can_render_to_separate_surface = true;
177 179
178 const Layer* page_scale_layer = 180 const Layer* page_scale_layer =
179 root_layer->layer_tree_host()->page_scale_layer(); 181 root_layer->layer_tree_host()->page_scale_layer();
180 Layer* inner_viewport_scroll_layer = 182 Layer* inner_viewport_scroll_layer =
181 root_layer->layer_tree_host()->inner_viewport_scroll_layer(); 183 root_layer->layer_tree_host()->inner_viewport_scroll_layer();
(...skipping 14 matching lines...) Expand all
196 PropertyTreeBuilder::BuildPropertyTrees( 198 PropertyTreeBuilder::BuildPropertyTrees(
197 root_layer, page_scale_layer, inner_viewport_scroll_layer, 199 root_layer, page_scale_layer, inner_viewport_scroll_layer,
198 outer_viewport_scroll_layer, overscroll_elasticity_layer, 200 outer_viewport_scroll_layer, overscroll_elasticity_layer,
199 elastic_overscroll, page_scale_factor, device_scale_factor, 201 elastic_overscroll, page_scale_factor, device_scale_factor,
200 gfx::Rect(device_viewport_size), gfx::Transform(), property_trees); 202 gfx::Rect(device_viewport_size), gfx::Transform(), property_trees);
201 draw_property_utils::UpdatePropertyTrees(property_trees, 203 draw_property_utils::UpdatePropertyTrees(property_trees,
202 can_render_to_separate_surface); 204 can_render_to_separate_surface);
203 draw_property_utils::FindLayersThatNeedUpdates( 205 draw_property_utils::FindLayersThatNeedUpdates(
204 root_layer->layer_tree_host(), property_trees->transform_tree, 206 root_layer->layer_tree_host(), property_trees->transform_tree,
205 property_trees->effect_tree, &update_layer_list_); 207 property_trees->effect_tree, &update_layer_list_);
206 draw_property_utils::ComputeVisibleRectsForTesting(
207 property_trees, can_render_to_separate_surface, &update_layer_list_);
208 } 208 }
209 209
210 void ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* root_layer) { 210 void ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* root_layer) {
211 DCHECK(root_layer->layer_tree_impl()); 211 DCHECK(root_layer->layer_tree_impl());
212 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer); 212 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer);
213 213
214 bool can_render_to_separate_surface = true; 214 bool can_render_to_separate_surface = true;
215 215
216 LayerImpl* page_scale_layer = nullptr; 216 LayerImpl* page_scale_layer = nullptr;
217 LayerImpl* inner_viewport_scroll_layer = 217 LayerImpl* inner_viewport_scroll_layer =
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 273 }
274 274
275 const LayerImplList* render_surface_layer_list_impl() const { 275 const LayerImplList* render_surface_layer_list_impl() const {
276 return render_surface_layer_list_impl_.get(); 276 return render_surface_layer_list_impl_.get();
277 } 277 }
278 const LayerImplList* update_layer_list_impl() const { 278 const LayerImplList* update_layer_list_impl() const {
279 return update_layer_list_impl_.get(); 279 return update_layer_list_impl_.get();
280 } 280 }
281 const LayerList& update_layer_list() const { return update_layer_list_; } 281 const LayerList& update_layer_list() const { return update_layer_list_; }
282 282
283 bool VerifyLayerInList(int layer_id, const LayerList* layer_list) {
284 for (auto layer : *layer_list) {
ajuma 2016/08/09 20:44:02 How about using std::find here?
sunxd 2016/08/10 17:19:36 Done.
285 if (layer->id() == layer_id)
286 return true;
287 }
288 return false;
289 }
290
283 private: 291 private:
284 std::unique_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_; 292 std::unique_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_;
285 LayerList update_layer_list_; 293 LayerList update_layer_list_;
286 std::unique_ptr<LayerImplList> update_layer_list_impl_; 294 std::unique_ptr<LayerImplList> update_layer_list_impl_;
287 }; 295 };
288 296
289 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase, 297 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase,
290 public testing::Test {}; 298 public testing::Test {};
291 299
292 class LayerWithForcedDrawsContent : public Layer { 300 class LayerWithForcedDrawsContent : public Layer {
(...skipping 7549 matching lines...) Expand 10 before | Expand all | Expand 10 after
7842 EXPECT_TRUE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); 7850 EXPECT_TRUE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta());
7843 7851
7844 fixed_to_outer->SetPositionConstraint(fixed_to_left); 7852 fixed_to_outer->SetPositionConstraint(fixed_to_left);
7845 7853
7846 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 7854 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
7847 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); 7855 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta());
7848 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); 7856 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta());
7849 } 7857 }
7850 7858
7851 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { 7859 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) {
7852 scoped_refptr<Layer> root = Layer::Create(); 7860 host_impl()->CreatePendingTree();
7853 scoped_refptr<LayerWithForcedDrawsContent> animated = 7861 std::unique_ptr<LayerImpl> pending_root =
7854 make_scoped_refptr(new LayerWithForcedDrawsContent()); 7862 LayerImpl::Create(host_impl()->pending_tree(), 1);
7863 LayerImpl* root = pending_root.get();
7864 host_impl()->pending_tree()->SetRootLayerForTesting(std::move(pending_root));
7865 std::unique_ptr<LayerImpl> animated_ptr =
7866 LayerImpl::Create(host_impl()->pending_tree(), 2);
7867 LayerImpl* animated = animated_ptr.get();
7868 root->test_properties()->AddChild(std::move(animated_ptr));
7855 7869
7856 root->AddChild(animated); 7870 animated->SetDrawsContent(true);
7857 host()->SetRootLayer(root); 7871 host_impl()->pending_tree()->SetElementIdsForTesting();
7858 host()->SetElementIdsForTesting();
7859 7872
7860 root->SetBounds(gfx::Size(100, 100)); 7873 root->SetBounds(gfx::Size(100, 100));
7861 root->SetMasksToBounds(true); 7874 root->SetMasksToBounds(true);
7862 root->SetForceRenderSurfaceForTesting(true); 7875 root->test_properties()->force_render_surface = true;
7863 animated->SetOpacity(0.f); 7876 animated->test_properties()->opacity = 0.f;
7864 animated->SetBounds(gfx::Size(20, 20)); 7877 animated->SetBounds(gfx::Size(20, 20));
7865 7878
7866 AddOpacityTransitionToElementWithPlayer(animated->element_id(), timeline(), 7879 AddOpacityTransitionToElementWithPlayer(
7867 10.0, 0.f, 1.f, false); 7880 animated->element_id(), timeline_impl(), 10.0, 0.f, 1.f, false);
7868 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 7881 animated->test_properties()->opacity_can_animate = true;
7882 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
7883 ExecuteCalculateDrawPropertiesWithPropertyTrees(root);
7869 7884
7870 EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty()); 7885 EXPECT_FALSE(animated->visible_layer_rect().IsEmpty());
7871 } 7886 }
7872 7887
7873 TEST_F(LayerTreeHostCommonTest, 7888 TEST_F(LayerTreeHostCommonTest,
7874 VisibleContentRectForAnimatedLayerWithSingularTransform) { 7889 VisibleContentRectForAnimatedLayerWithSingularTransform) {
7875 scoped_refptr<Layer> root = Layer::Create(); 7890 LayerImpl* root = root_layer_for_testing();
7876 scoped_refptr<Layer> clip = Layer::Create(); 7891 LayerImpl* clip = AddChild<LayerImpl>(root);
7877 scoped_refptr<LayerWithForcedDrawsContent> animated = 7892 LayerImpl* animated = AddChild<LayerImpl>(clip);
7878 make_scoped_refptr(new LayerWithForcedDrawsContent()); 7893 LayerImpl* surface = AddChild<LayerImpl>(animated);
7879 scoped_refptr<LayerWithForcedDrawsContent> surface = 7894 LayerImpl* descendant_of_animation = AddChild<LayerImpl>(surface);
7880 make_scoped_refptr(new LayerWithForcedDrawsContent());
7881 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation =
7882 make_scoped_refptr(new LayerWithForcedDrawsContent());
7883 7895
7884 root->AddChild(clip); 7896 SetElementIdsForTesting();
7885 clip->AddChild(animated);
7886 animated->AddChild(surface);
7887 surface->AddChild(descendant_of_animation);
7888 7897
7889 host()->SetRootLayer(root); 7898 animated->SetDrawsContent(true);
7890 host()->SetElementIdsForTesting(); 7899 surface->SetDrawsContent(true);
7900 descendant_of_animation->SetDrawsContent(true);
7891 7901
7892 gfx::Transform uninvertible_matrix; 7902 gfx::Transform uninvertible_matrix;
7893 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f); 7903 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f);
7894 7904
7895 root->SetBounds(gfx::Size(100, 100)); 7905 root->SetBounds(gfx::Size(100, 100));
7896 clip->SetBounds(gfx::Size(10, 10)); 7906 clip->SetBounds(gfx::Size(10, 10));
7897 clip->SetMasksToBounds(true); 7907 clip->SetMasksToBounds(true);
7898 animated->SetTransform(uninvertible_matrix); 7908 animated->SetTransform(uninvertible_matrix);
7899 animated->SetBounds(gfx::Size(120, 120)); 7909 animated->SetBounds(gfx::Size(120, 120));
7900 surface->SetBounds(gfx::Size(100, 100)); 7910 surface->SetBounds(gfx::Size(100, 100));
7901 surface->SetForceRenderSurfaceForTesting(true); 7911 surface->test_properties()->force_render_surface = true;
7902 descendant_of_animation->SetBounds(gfx::Size(200, 200)); 7912 descendant_of_animation->SetBounds(gfx::Size(200, 200));
7903 7913
7904 TransformOperations start_transform_operations; 7914 TransformOperations start_transform_operations;
7905 start_transform_operations.AppendMatrix(uninvertible_matrix); 7915 start_transform_operations.AppendMatrix(uninvertible_matrix);
7906 TransformOperations end_transform_operations; 7916 TransformOperations end_transform_operations;
7907 7917
7908 SetElementIdsForTesting(); 7918 AddAnimatedTransformToElementWithPlayer(
7909 AddAnimatedTransformToElementWithPlayer(animated->element_id(), timeline(), 7919 animated->element_id(), timeline_impl(), 10.0, start_transform_operations,
7910 10.0, start_transform_operations, 7920 end_transform_operations);
7911 end_transform_operations); 7921 ExecuteCalculateDrawPropertiesWithPropertyTrees(root);
7912 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
7913 7922
7914 // The animated layer has a singular transform and maps to a non-empty rect in 7923 // The animated layer has a singular transform and maps to a non-empty rect in
7915 // clipped target space, so is treated as fully visible. 7924 // clipped target space, so is treated as fully visible.
7916 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect_for_testing()); 7925 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect());
7917 7926
7918 // The singular transform on |animated| is flattened when inherited by 7927 // The singular transform on |animated| is flattened when inherited by
7919 // |surface|, and this happens to make it invertible. 7928 // |surface|, and this happens to make it invertible.
7920 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect_for_testing()); 7929 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect());
7921 EXPECT_EQ(gfx::Rect(2, 2), 7930 EXPECT_EQ(gfx::Rect(2, 2), descendant_of_animation->visible_layer_rect());
7922 descendant_of_animation->visible_layer_rect_for_testing());
7923 7931
7924 gfx::Transform zero_matrix; 7932 gfx::Transform zero_matrix;
7925 zero_matrix.Scale3d(0.f, 0.f, 0.f); 7933 zero_matrix.Scale3d(0.f, 0.f, 0.f);
7926 animated->SetTransform(zero_matrix); 7934 animated->SetTransform(zero_matrix);
ajuma 2016/08/09 20:44:02 If you call OnTransformAnimated (instead of SetTra
sunxd 2016/08/10 17:19:37 Done.
7927 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 7935 host_impl()->active_tree()->property_trees()->needs_rebuild = true;
7936 ExecuteCalculateDrawPropertiesWithPropertyTrees(root);
7928 7937
7929 // The animated layer maps to the empty rect in clipped target space, so is 7938 // The animated layer maps to the empty rect in clipped target space, so is
7930 // treated as having an empty visible rect. 7939 // treated as having an empty visible rect.
7931 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect_for_testing()); 7940 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect());
7932 7941
7933 // This time, flattening does not make |animated|'s transform invertible. This 7942 // This time, flattening does not make |animated|'s transform invertible. This
7934 // means the clip cannot be projected into |surface|'s space, so we treat 7943 // means the clip cannot be projected into |surface|'s space, so we treat
7935 // |surface| and layers that draw into it as having empty visible rect. 7944 // |surface| and layers that draw into it as having empty visible rect.
7936 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect_for_testing()); 7945 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect());
7937 EXPECT_EQ(gfx::Rect(), 7946 EXPECT_EQ(gfx::Rect(), descendant_of_animation->visible_layer_rect());
7938 descendant_of_animation->visible_layer_rect_for_testing());
7939 } 7947 }
7940 7948
7941 // Verify that having animated opacity but current opacity 1 still creates 7949 // Verify that having animated opacity but current opacity 1 still creates
7942 // a render surface. 7950 // a render surface.
7943 TEST_F(LayerTreeHostCommonTest, AnimatedOpacityCreatesRenderSurface) { 7951 TEST_F(LayerTreeHostCommonTest, AnimatedOpacityCreatesRenderSurface) {
7944 LayerImpl* root = root_layer_for_testing(); 7952 LayerImpl* root = root_layer_for_testing();
7945 LayerImpl* child = AddChild<LayerImpl>(root); 7953 LayerImpl* child = AddChild<LayerImpl>(root);
7946 LayerImpl* grandchild = AddChild<LayerImpl>(child); 7954 LayerImpl* grandchild = AddChild<LayerImpl>(child);
7947 7955
7948 root->SetBounds(gfx::Size(50, 50)); 7956 root->SetBounds(gfx::Size(50, 50));
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
8280 greatgrandchild->SetBounds(gfx::Size(10, 10)); 8288 greatgrandchild->SetBounds(gfx::Size(10, 10));
8281 8289
8282 root->AddChild(child); 8290 root->AddChild(child);
8283 child->AddChild(grandchild); 8291 child->AddChild(grandchild);
8284 grandchild->AddChild(greatgrandchild); 8292 grandchild->AddChild(greatgrandchild);
8285 host()->SetRootLayer(root); 8293 host()->SetRootLayer(root);
8286 host()->SetElementIdsForTesting(); 8294 host()->SetElementIdsForTesting();
8287 8295
8288 // Check the non-skipped case. 8296 // Check the non-skipped case.
8289 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8297 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8290 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8298 const LayerList* update_list = GetUpdateLayerList();
8299 EXPECT_TRUE(VerifyLayerInList(grandchild->id(), update_list));
8291 8300
8292 // Now we will reset the visible rect from property trees for the grandchild, 8301 // Now we will reset the visible rect from property trees for the grandchild,
8293 // and we will configure |child| in several ways that should force the subtree 8302 // and we will configure |child| in several ways that should force the subtree
8294 // to be skipped. The visible content rect for |grandchild| should, therefore, 8303 // to be skipped. The visible content rect for |grandchild| should, therefore,
8295 // remain empty. 8304 // remain empty.
8296 grandchild->set_visible_layer_rect(gfx::Rect());
8297 gfx::Transform singular; 8305 gfx::Transform singular;
8298 singular.matrix().set(0, 0, 0); 8306 singular.matrix().set(0, 0, 0);
8299 8307
8300 child->SetTransform(singular); 8308 child->SetTransform(singular);
8301 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8309 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8302 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); 8310 update_list = GetUpdateLayerList();
8311 EXPECT_FALSE(VerifyLayerInList(grandchild->id(), update_list));
8303 child->SetTransform(gfx::Transform()); 8312 child->SetTransform(gfx::Transform());
8304 8313
8305 child->SetHideLayerAndSubtree(true); 8314 child->SetHideLayerAndSubtree(true);
8306 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8315 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8307 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); 8316 update_list = GetUpdateLayerList();
8317 EXPECT_FALSE(VerifyLayerInList(grandchild->id(), update_list));
8308 child->SetHideLayerAndSubtree(false); 8318 child->SetHideLayerAndSubtree(false);
8309 8319
8310 gfx::Transform zero_z_scale; 8320 gfx::Transform zero_z_scale;
8311 zero_z_scale.Scale3d(1, 1, 0); 8321 zero_z_scale.Scale3d(1, 1, 0);
8312 child->SetTransform(zero_z_scale); 8322 child->SetTransform(zero_z_scale);
8313 8323
8314 // Add a transform animation with a start delay. Now, even though |child| has 8324 // Add a transform animation with a start delay. Now, even though |child| has
8315 // a singular transform, the subtree should still get processed. 8325 // a singular transform, the subtree should still get processed.
8316 int animation_id = 0; 8326 int animation_id = 0;
8317 std::unique_ptr<Animation> animation = Animation::Create( 8327 std::unique_ptr<Animation> animation = Animation::Create(
8318 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 8328 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)),
8319 animation_id, 1, TargetProperty::TRANSFORM); 8329 animation_id, 1, TargetProperty::TRANSFORM);
8320 animation->set_fill_mode(Animation::FillMode::NONE); 8330 animation->set_fill_mode(Animation::FillMode::NONE);
8321 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8331 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8322 AddAnimationToElementWithPlayer(child->element_id(), timeline(), 8332 AddAnimationToElementWithPlayer(child->element_id(), timeline(),
8323 std::move(animation)); 8333 std::move(animation));
8324 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8334 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8325 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8335 update_list = GetUpdateLayerList();
8326 grandchild->set_visible_layer_rect(gfx::Rect()); 8336 EXPECT_TRUE(VerifyLayerInList(grandchild->id(), update_list));
8327 8337
8328 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(), 8338 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(),
8329 animation_id); 8339 animation_id);
8330 child->SetTransform(gfx::Transform()); 8340 child->SetTransform(gfx::Transform());
8331 child->SetOpacity(0.f); 8341 child->SetOpacity(0.f);
8332 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8342 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8333 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); 8343 update_list = GetUpdateLayerList();
8344 EXPECT_FALSE(VerifyLayerInList(grandchild->id(), update_list));
8334 8345
8335 // Now, even though child has zero opacity, we will configure |grandchild| and 8346 // Now, even though child has zero opacity, we will configure |grandchild| and
8336 // |greatgrandchild| in several ways that should force the subtree to be 8347 // |greatgrandchild| in several ways that should force the subtree to be
8337 // processed anyhow. 8348 // processed anyhow.
8338 grandchild->RequestCopyOfOutput( 8349 grandchild->RequestCopyOfOutput(
8339 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); 8350 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback)));
8340 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8351 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8341 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8352 update_list = GetUpdateLayerList();
8342 greatgrandchild->set_visible_layer_rect(gfx::Rect()); 8353 EXPECT_TRUE(VerifyLayerInList(grandchild->id(), update_list));
8343 8354
8344 // Add an opacity animation with a start delay. 8355 // Add an opacity animation with a start delay.
8345 animation_id = 1; 8356 animation_id = 1;
8346 animation = Animation::Create( 8357 animation = Animation::Create(
8347 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 8358 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
8348 animation_id, 1, TargetProperty::OPACITY); 8359 animation_id, 1, TargetProperty::OPACITY);
8349 animation->set_fill_mode(Animation::FillMode::NONE); 8360 animation->set_fill_mode(Animation::FillMode::NONE);
8350 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8361 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8351 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), 8362 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(),
8352 std::move(animation)); 8363 std::move(animation));
8353 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8364 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8354 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8365 update_list = GetUpdateLayerList();
8366 EXPECT_TRUE(VerifyLayerInList(grandchild->id(), update_list));
8355 } 8367 }
8356 8368
8357 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { 8369 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) {
8358 FakeImplTaskRunnerProvider task_runner_provider; 8370 FakeImplTaskRunnerProvider task_runner_provider;
8359 TestSharedBitmapManager shared_bitmap_manager; 8371 TestSharedBitmapManager shared_bitmap_manager;
8360 TestTaskGraphRunner task_graph_runner; 8372 TestTaskGraphRunner task_graph_runner;
8361 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8373 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
8362 &task_graph_runner); 8374 &task_graph_runner);
8363 8375
8364 std::unique_ptr<LayerImpl> root = 8376 std::unique_ptr<LayerImpl> root =
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
9712 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 9724 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
9713 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 9725 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
9714 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 9726 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
9715 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 9727 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
9716 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 9728 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
9717 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 9729 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
9718 } 9730 }
9719 9731
9720 } // namespace 9732 } // namespace
9721 } // namespace cc 9733 } // namespace cc
OLDNEW
« cc/debug/invalidation_benchmark.cc ('K') | « cc/trees/draw_property_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698