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

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

Issue 2758343002: cc: Use Element Id to Record Animation Changes (Closed)
Patch Set: Created 3 years, 9 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 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 grand_child_of_rs1->SetBounds(gfx::Size(10, 10)); 2546 grand_child_of_rs1->SetBounds(gfx::Size(10, 10));
2547 grand_child_of_rs1->test_properties()->transform_origin = 2547 grand_child_of_rs1->test_properties()->transform_origin =
2548 gfx::Point3F(0.25f, 0.f, 0.f); 2548 gfx::Point3F(0.25f, 0.f, 0.f);
2549 grand_child_of_rs2->test_properties()->transform = layer_transform; 2549 grand_child_of_rs2->test_properties()->transform = layer_transform;
2550 grand_child_of_rs2->SetPosition(gfx::PointF(2.5f, 0.f)); 2550 grand_child_of_rs2->SetPosition(gfx::PointF(2.5f, 0.f));
2551 grand_child_of_rs2->SetBounds(gfx::Size(10, 10)); 2551 grand_child_of_rs2->SetBounds(gfx::Size(10, 10));
2552 grand_child_of_rs2->test_properties()->transform_origin = 2552 grand_child_of_rs2->test_properties()->transform_origin =
2553 gfx::Point3F(0.25f, 0.f, 0.f); 2553 gfx::Point3F(0.25f, 0.f, 0.f);
2554 2554
2555 root->layer_tree_impl()->BuildLayerListAndPropertyTreesForTesting(); 2555 root->layer_tree_impl()->BuildLayerListAndPropertyTreesForTesting();
2556 SetElementIdsForTesting();
2557 2556
2558 // Put an animated opacity on the render surface. 2557 // Put an animated opacity on the render surface.
2559 AddOpacityTransitionToElementWithPlayer( 2558 AddOpacityTransitionToElementWithPlayer(
2560 render_surface1->element_id(), timeline_impl(), 10.0, 1.f, 0.f, false); 2559 render_surface1->element_id(), timeline_impl(), 10.0, 1.f, 0.f, false);
2561 2560
2562 // Also put an animated opacity on a layer without descendants. 2561 // Also put an animated opacity on a layer without descendants.
2563 AddOpacityTransitionToElementWithPlayer(grand_child_of_root->element_id(), 2562 AddOpacityTransitionToElementWithPlayer(grand_child_of_root->element_id(),
2564 timeline_impl(), 10.0, 1.f, 0.f, 2563 timeline_impl(), 10.0, 1.f, 0.f,
2565 false); 2564 false);
2566 2565
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after
5054 const int child_id = child->id(); 5053 const int child_id = child->id();
5055 root->test_properties()->AddChild(std::move(child)); 5054 root->test_properties()->AddChild(std::move(child));
5056 LayerImpl* root_layer = root.get(); 5055 LayerImpl* root_layer = root.get();
5057 host_impl.pending_tree()->SetRootLayerForTesting(std::move(root)); 5056 host_impl.pending_tree()->SetRootLayerForTesting(std::move(root));
5058 host_impl.pending_tree()->BuildLayerListAndPropertyTreesForTesting(); 5057 host_impl.pending_tree()->BuildLayerListAndPropertyTreesForTesting();
5059 5058
5060 // Add opacity animation. 5059 // Add opacity animation.
5061 scoped_refptr<AnimationTimeline> timeline = 5060 scoped_refptr<AnimationTimeline> timeline =
5062 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 5061 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
5063 host_impl.animation_host()->AddAnimationTimeline(timeline); 5062 host_impl.animation_host()->AddAnimationTimeline(timeline);
5064 host_impl.pending_tree()->SetElementIdsForTesting();
5065 5063
5066 ElementId child_element_id = 5064 ElementId child_element_id =
5067 host_impl.pending_tree()->LayerById(child_id)->element_id(); 5065 host_impl.pending_tree()->LayerById(child_id)->element_id();
5068 5066
5069 AddOpacityTransitionToElementWithPlayer(child_element_id, timeline, 10.0, 5067 AddOpacityTransitionToElementWithPlayer(child_element_id, timeline, 10.0,
5070 0.0f, 1.0f, false); 5068 0.0f, 1.0f, false);
5071 5069
5072 LayerImplList render_surface_layer_list; 5070 LayerImplList render_surface_layer_list;
5073 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5071 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5074 root_layer, root_layer->bounds(), &render_surface_layer_list); 5072 root_layer, root_layer->bounds(), &render_surface_layer_list);
(...skipping 5704 matching lines...) Expand 10 before | Expand all | Expand 10 after
10779 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10777 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10780 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10778 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10781 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10779 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10782 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10780 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10783 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10781 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10784 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10782 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10785 } 10783 }
10786 10784
10787 } // namespace 10785 } // namespace
10788 } // namespace cc 10786 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698