| Index: cc/trees/layer_tree_host_unittest_animation.cc
|
| diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
|
| index cfbe78771d371f72d1727d5f463d33d2cef560cc..3cb06bab6f1050cb73587aa19b303c88658a0692 100644
|
| --- a/cc/trees/layer_tree_host_unittest_animation.cc
|
| +++ b/cc/trees/layer_tree_host_unittest_animation.cc
|
| @@ -44,6 +44,7 @@ class LayerTreeHostAnimationTest : public LayerTreeTest {
|
|
|
| void AttachPlayersToTimeline() {
|
| layer_tree_host()->animation_host()->AddAnimationTimeline(timeline_.get());
|
| + layer_tree_host()->SetElementIdsForTesting();
|
| timeline_->AttachPlayer(player_.get());
|
| timeline_->AttachPlayer(player_child_.get());
|
| }
|
| @@ -145,7 +146,7 @@ class LayerTreeHostAnimationTestAddAnimation
|
|
|
| void BeginTest() override {
|
| AttachPlayersToTimeline();
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| PostAddInstantAnimationToMainThreadPlayer(player_.get());
|
| }
|
|
|
| @@ -186,7 +187,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws
|
|
|
| void BeginTest() override {
|
| AttachPlayersToTimeline();
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| PostAddAnimationToMainThreadPlayer(player_.get());
|
| }
|
|
|
| @@ -224,7 +225,7 @@ class LayerTreeHostAnimationTestAnimationsGetDeleted
|
|
|
| void BeginTest() override {
|
| AttachPlayersToTimeline();
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| PostAddAnimationToMainThreadPlayer(player_.get());
|
| }
|
|
|
| @@ -270,7 +271,7 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
|
| layer_tree_host()->root_layer()->AddChild(picture_);
|
|
|
| AttachPlayersToTimeline();
|
| - player_child_->AttachElement(picture_->id());
|
| + player_child_->AttachElement(picture_->element_id());
|
| }
|
|
|
| void BeginTest() override {
|
| @@ -336,7 +337,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
|
|
|
| AttachPlayersToTimeline();
|
| player_child_->set_animation_delegate(this);
|
| - player_child_->AttachElement(picture_->id());
|
| + player_child_->AttachElement(picture_->element_id());
|
| }
|
|
|
| void BeginTest() override {
|
| @@ -390,7 +391,7 @@ class LayerTreeHostAnimationTestAnimationFinishedEvents
|
| public:
|
| void BeginTest() override {
|
| AttachPlayersToTimeline();
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| PostAddInstantAnimationToMainThreadPlayer(player_.get());
|
| }
|
|
|
| @@ -426,7 +427,7 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
|
| LayerTreeHostAnimationTest::SetupTree();
|
|
|
| AttachPlayersToTimeline();
|
| - player_->AttachElement(update_check_layer_->id());
|
| + player_->AttachElement(update_check_layer_->element_id());
|
| }
|
|
|
| void BeginTest() override {
|
| @@ -474,7 +475,8 @@ class LayerTreeHostAnimationTestLayerAddedWithAnimation
|
| AttachPlayersToTimeline();
|
|
|
| scoped_refptr<Layer> layer = Layer::Create();
|
| - player_->AttachElement(layer->id());
|
| + layer->SetElementId(ElementId(42, 0));
|
| + player_->AttachElement(layer->element_id());
|
| player_->set_animation_delegate(this);
|
|
|
| // Any valid AnimationCurve will do here.
|
| @@ -625,7 +627,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
|
| layer_tree_host()->root_layer()->AddChild(picture_);
|
|
|
| AttachPlayersToTimeline();
|
| - player_child_->AttachElement(picture_->id());
|
| + player_child_->AttachElement(picture_->element_id());
|
| player_child_->set_animation_delegate(this);
|
| }
|
|
|
| @@ -714,7 +716,7 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
|
| layer_tree_host()->root_layer()->AddChild(scroll_layer_);
|
|
|
| AttachPlayersToTimeline();
|
| - player_child_->AttachElement(scroll_layer_->id());
|
| + player_child_->AttachElement(scroll_layer_->element_id());
|
| }
|
|
|
| void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| @@ -772,7 +774,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationTakeover
|
| layer_tree_host()->root_layer()->AddChild(scroll_layer_);
|
|
|
| AttachPlayersToTimeline();
|
| - player_child_->AttachElement(scroll_layer_->id());
|
| + player_child_->AttachElement(scroll_layer_->element_id());
|
| // Allows NotifyAnimationTakeover to get called.
|
| player_child_->set_animation_delegate(this);
|
| }
|
| @@ -786,7 +788,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationTakeover
|
| layer_tree_host()
|
| ->animation_host()
|
| ->scroll_offset_animations()
|
| - .AddTakeoverUpdate(scroll_layer_->id());
|
| + .AddTakeoverUpdate(scroll_layer_->element_id());
|
| EXPECT_TRUE(layer_tree_host()
|
| ->animation_host()
|
| ->scroll_offset_animations()
|
| @@ -797,7 +799,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationTakeover
|
| void WillCommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
|
| if (host_impl->sync_tree()->source_frame_number() == 0) {
|
| host_impl->animation_host()->ImplOnlyScrollAnimationCreate(
|
| - scroll_layer_->id(), gfx::ScrollOffset(650.f, 750.f),
|
| + scroll_layer_->element_id(), gfx::ScrollOffset(650.f, 750.f),
|
| gfx::ScrollOffset(10, 20));
|
| }
|
| }
|
| @@ -835,7 +837,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationAdjusted
|
| layer_tree_host()->root_layer()->AddChild(scroll_layer_);
|
|
|
| AttachPlayersToTimeline();
|
| - player_child_->AttachElement(scroll_layer_->id());
|
| + player_child_->AttachElement(scroll_layer_->element_id());
|
| }
|
|
|
| void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| @@ -847,7 +849,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationAdjusted
|
| layer_tree_host()
|
| ->animation_host()
|
| ->scroll_offset_animations()
|
| - .AddAdjustmentUpdate(scroll_layer_->id(),
|
| + .AddAdjustmentUpdate(scroll_layer_->element_id(),
|
| gfx::Vector2dF(100.f, 100.f));
|
| EXPECT_TRUE(layer_tree_host()
|
| ->animation_host()
|
| @@ -870,7 +872,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationAdjusted
|
| // WillCommitCompleteOnThread.
|
| Animation* animation =
|
| host_impl->animation_host()
|
| - ->GetElementAnimationsForElementId(scroll_layer_->id())
|
| + ->GetElementAnimationsForElementId(scroll_layer_->element_id())
|
| ->GetAnimation(TargetProperty::SCROLL_OFFSET);
|
| ScrollOffsetAnimationCurve* curve =
|
| animation->curve()->ToScrollOffsetAnimationCurve();
|
| @@ -887,7 +889,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationAdjusted
|
| void WillCommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
|
| if (host_impl->sync_tree()->source_frame_number() == 0) {
|
| host_impl->animation_host()->ImplOnlyScrollAnimationCreate(
|
| - scroll_layer_->id(), gfx::ScrollOffset(650.f, 750.f),
|
| + scroll_layer_->element_id(), gfx::ScrollOffset(650.f, 750.f),
|
| gfx::ScrollOffset(10, 20));
|
| }
|
| }
|
| @@ -896,7 +898,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationAdjusted
|
| if (host_impl->sync_tree()->source_frame_number() == 1) {
|
| Animation* animation =
|
| host_impl->animation_host()
|
| - ->GetElementAnimationsForElementId(scroll_layer_->id())
|
| + ->GetElementAnimationsForElementId(scroll_layer_->element_id())
|
| ->GetAnimation(TargetProperty::SCROLL_OFFSET);
|
| ScrollOffsetAnimationCurve* curve =
|
| animation->curve()->ToScrollOffsetAnimationCurve();
|
| @@ -950,7 +952,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
|
| animation->set_needs_synchronized_start_time(true);
|
|
|
| AttachPlayersToTimeline();
|
| - player_child_->AttachElement(scroll_layer_->id());
|
| + player_child_->AttachElement(scroll_layer_->element_id());
|
| player_child_->AddAnimation(std::move(animation));
|
| }
|
|
|
| @@ -1058,16 +1060,18 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
|
|
|
| void DidCommit() override {
|
| if (layer_tree_host()->source_frame_number() == 1) {
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| AddAnimatedTransformToPlayer(player_.get(), 4, 1, 1);
|
| } else if (layer_tree_host()->source_frame_number() == 2) {
|
| AddOpacityTransitionToPlayer(player_.get(), 1, 0.f, 0.5f, true);
|
|
|
| scoped_refptr<Layer> layer = Layer::Create();
|
| layer_tree_host()->root_layer()->AddChild(layer);
|
| +
|
| + layer_tree_host()->SetElementIdsForTesting();
|
| layer->SetBounds(gfx::Size(4, 4));
|
|
|
| - player_child_->AttachElement(layer->id());
|
| + player_child_->AttachElement(layer->element_id());
|
| player_child_->set_animation_delegate(this);
|
| AddOpacityTransitionToPlayer(player_child_.get(), 1, 0.f, 0.5f, true);
|
| }
|
| @@ -1155,7 +1159,9 @@ class LayerTreeHostAnimationTestPendingTreeAnimatesFirstCommit
|
| layer_->SetTransform(start_transform);
|
|
|
| layer_tree_host()->root_layer()->AddChild(layer_);
|
| - player_->AttachElement(layer_->id());
|
| + layer_tree_host()->SetElementIdsForTesting();
|
| +
|
| + player_->AttachElement(layer_->element_id());
|
|
|
| AttachPlayersToTimeline();
|
| }
|
| @@ -1225,9 +1231,11 @@ class LayerTreeHostAnimationTestAnimatedLayerRemovedAndAdded
|
| layer_->SetBounds(gfx::Size(4, 4));
|
| layer_tree_host()->root_layer()->AddChild(layer_);
|
|
|
| + layer_tree_host()->SetElementIdsForTesting();
|
| +
|
| layer_tree_host()->animation_host()->AddAnimationTimeline(timeline_.get());
|
| timeline_->AttachPlayer(player_.get());
|
| - player_->AttachElement(layer_->id());
|
| + player_->AttachElement(layer_->element_id());
|
| DCHECK(player_->element_animations());
|
|
|
| AddOpacityTransitionToPlayer(player_.get(), 10000.0, 0.1f, 0.9f, true);
|
| @@ -1309,8 +1317,8 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
|
|
|
| AttachPlayersToTimeline();
|
|
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| - player_child_->AttachElement(layer_->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| + player_child_->AttachElement(layer_->element_id());
|
| }
|
|
|
| void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| @@ -1338,11 +1346,11 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
|
| host_impl->animation_host()->active_element_animations_for_testing();
|
| EXPECT_EQ(2u, element_animations_copy.size());
|
| for (auto& it : element_animations_copy) {
|
| - int id = it.first;
|
| - if (id == host_impl->active_tree()->root_layer()->id()) {
|
| + ElementId id = it.first;
|
| + if (id == host_impl->active_tree()->root_layer()->element_id()) {
|
| Animation* anim = it.second->GetAnimation(TargetProperty::TRANSFORM);
|
| EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
|
| - } else if (id == layer_->id()) {
|
| + } else if (id == layer_->element_id()) {
|
| Animation* anim = it.second->GetAnimation(TargetProperty::OPACITY);
|
| EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
|
| }
|
| @@ -1371,8 +1379,8 @@ class LayerTreeHostAnimationTestRemoveAnimation
|
|
|
| AttachPlayersToTimeline();
|
|
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| - player_child_->AttachElement(layer_->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| + player_child_->AttachElement(layer_->element_id());
|
| }
|
|
|
| void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| @@ -1450,7 +1458,7 @@ class LayerTreeHostAnimationTestIsAnimating
|
| layer_tree_host()->root_layer()->AddChild(layer_);
|
|
|
| AttachPlayersToTimeline();
|
| - player_->AttachElement(layer_->id());
|
| + player_->AttachElement(layer_->element_id());
|
| }
|
|
|
| void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| @@ -1532,8 +1540,8 @@ class LayerTreeHostAnimationTestAnimationFinishesDuringCommit
|
|
|
| AttachPlayersToTimeline();
|
|
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| - player_child_->AttachElement(layer_->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| + player_child_->AttachElement(layer_->element_id());
|
| }
|
|
|
| void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| @@ -1606,7 +1614,7 @@ class LayerTreeHostAnimationTestNotifyAnimationFinished
|
| layer_tree_host()->root_layer()->AddChild(picture_);
|
|
|
| AttachPlayersToTimeline();
|
| - player_->AttachElement(picture_->id());
|
| + player_->AttachElement(picture_->element_id());
|
| player_->set_animation_delegate(this);
|
| }
|
|
|
| @@ -1654,7 +1662,7 @@ class LayerTreeHostAnimationTestChangeAnimationPlayer
|
| LayerTreeHostAnimationTest::SetupTree();
|
| AttachPlayersToTimeline();
|
| timeline_->DetachPlayer(player_child_.get());
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
|
|
| TransformOperations start;
|
| start.AppendTranslate(5.f, 5.f, 0.f);
|
| @@ -1689,7 +1697,8 @@ class LayerTreeHostAnimationTestChangeAnimationPlayer
|
| timeline_->DetachPlayer(player_.get());
|
| player_ = nullptr;
|
| timeline_->AttachPlayer(player_child_.get());
|
| - player_child_->AttachElement(layer_tree_host()->root_layer()->id());
|
| + player_child_->AttachElement(
|
| + layer_tree_host()->root_layer()->element_id());
|
| AddAnimatedTransformToPlayer(player_child_.get(), 1.0, 10, 10);
|
| Animation* animation = player_child_->element_animations()->GetAnimation(
|
| TargetProperty::TRANSFORM);
|
| @@ -1715,7 +1724,7 @@ class LayerTreeHostAnimationTestSetPotentiallyAnimatingOnLacDestruction
|
|
|
| LayerTreeHostAnimationTest::SetupTree();
|
| AttachPlayersToTimeline();
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| AddAnimatedTransformToPlayer(player_.get(), 1.0, 5, 5);
|
| }
|
|
|
| @@ -1799,8 +1808,8 @@ class LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit
|
|
|
| AttachPlayersToTimeline();
|
|
|
| - player_->AttachElement(layer_tree_host()->root_layer()->id());
|
| - player_child_->AttachElement(layer_->id());
|
| + player_->AttachElement(layer_tree_host()->root_layer()->element_id());
|
| + player_child_->AttachElement(layer_->element_id());
|
| }
|
|
|
| void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
|
|