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 f2e2ca7ea67814def6e9e3354278667a442fb46f..f25d15b61ee5a9c19efadec70da148bfaed635cf 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(42lu)); |
+ 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(); } |
@@ -771,7 +773,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); |
} |
@@ -785,7 +787,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() |
@@ -796,7 +798,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)); |
} |
} |
@@ -834,7 +836,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(); } |
@@ -846,7 +848,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() |
@@ -869,7 +871,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(); |
@@ -886,7 +888,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)); |
} |
} |
@@ -895,7 +897,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(); |
@@ -947,7 +949,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)); |
} |
@@ -1055,16 +1057,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); |
} |
@@ -1152,7 +1156,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(); |
} |
@@ -1222,9 +1228,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); |
@@ -1306,8 +1314,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(); } |
@@ -1335,11 +1343,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->RootLayer()->id()) { |
+ ElementId id = it.first; |
+ if (id == host_impl->RootLayer()->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); |
} |
@@ -1368,8 +1376,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(); } |
@@ -1447,7 +1455,7 @@ class LayerTreeHostAnimationTestIsAnimating |
layer_tree_host()->root_layer()->AddChild(layer_); |
AttachPlayersToTimeline(); |
- player_->AttachElement(layer_->id()); |
+ player_->AttachElement(layer_->element_id()); |
} |
void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
@@ -1529,8 +1537,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(); } |
@@ -1603,7 +1611,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); |
} |
@@ -1653,7 +1661,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); |
} |
@@ -1737,8 +1745,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(); } |