Index: cc/trees/layer_tree_host_common_unittest.cc |
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc |
index b70cff3a3885cede1b795552ea7b9d3b3ce94780..baac4606617f5c64306161d7a92da399feb0cc47 100644 |
--- a/cc/trees/layer_tree_host_common_unittest.cc |
+++ b/cc/trees/layer_tree_host_common_unittest.cc |
@@ -55,7 +55,7 @@ namespace { |
class LayerWithForcedDrawsContent : public Layer { |
public: |
- LayerWithForcedDrawsContent() {} |
+ LayerWithForcedDrawsContent() { SetElementId(NextTestElementId()); } |
bool DrawsContent() const override; |
@@ -303,7 +303,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { |
gfx::Transform identity_matrix; |
std::unique_ptr<LayerImpl> sublayer_scoped_ptr( |
- LayerImpl::Create(host_impl.active_tree(), 1)); |
+ CreateTestLayerImpl(host_impl.active_tree(), 1)); |
LayerImpl* sublayer = sublayer_scoped_ptr.get(); |
sublayer->SetDrawsContent(true); |
SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(), |
@@ -311,13 +311,13 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { |
false); |
std::unique_ptr<LayerImpl> scroll_layer_scoped_ptr( |
- LayerImpl::Create(host_impl.active_tree(), 2)); |
+ CreateTestLayerImpl(host_impl.active_tree(), 2)); |
LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); |
SetLayerPropertiesForTesting(scroll_layer, identity_matrix, gfx::Point3F(), |
gfx::PointF(), gfx::Size(10, 20), true, false, |
false); |
std::unique_ptr<LayerImpl> clip_layer_scoped_ptr( |
- LayerImpl::Create(host_impl.active_tree(), 4)); |
+ CreateTestLayerImpl(host_impl.active_tree(), 4)); |
LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); |
scroll_layer->SetScrollClipLayer(clip_layer->id()); |
@@ -336,7 +336,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { |
kScrollOffset); |
std::unique_ptr<LayerImpl> root( |
- LayerImpl::Create(host_impl.active_tree(), 3)); |
+ CreateTestLayerImpl(host_impl.active_tree(), 3)); |
SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
gfx::PointF(), gfx::Size(3, 4), true, false, |
false); |
@@ -627,7 +627,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsForReplica) { |
LayerImpl* grand_child = AddChild<LayerImpl>(child); |
grand_child->SetDrawsContent(true); |
std::unique_ptr<LayerImpl> child_replica = |
- LayerImpl::Create(host_impl()->active_tree(), 100); |
+ CreateTestLayerImpl(host_impl()->active_tree(), 100); |
// One-time setup of root layer |
gfx::Transform identity_matrix; |
@@ -723,9 +723,9 @@ TEST_F(LayerTreeHostCommonTest, TransformsForRenderSurfaceHierarchy) { |
grand_child_of_rs2->SetDrawsContent(true); |
std::unique_ptr<LayerImpl> replica_of_rs1 = |
- LayerImpl::Create(host_impl()->active_tree(), 101); |
+ CreateTestLayerImpl(host_impl()->active_tree(), 101); |
std::unique_ptr<LayerImpl> replica_of_rs2 = |
- LayerImpl::Create(host_impl()->active_tree(), 102); |
+ CreateTestLayerImpl(host_impl()->active_tree(), 102); |
// In combination with descendant draws content, opacity != 1 forces the layer |
// to have a new render surface. |
@@ -2553,23 +2553,24 @@ TEST_F(LayerTreeHostCommonTest, AnimationsForRenderSurfaceHierarchy) { |
gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, false); |
// Put an animated opacity on the render surface. |
- AddOpacityTransitionToLayerWithPlayer(render_surface1->id(), timeline_impl(), |
- 10.0, 1.f, 0.f, false); |
+ AddOpacityTransitionToElementWithPlayer( |
+ render_surface1->element_id(), timeline_impl(), 10.0, 1.f, 0.f, false); |
// Also put an animated opacity on a layer without descendants. |
- AddOpacityTransitionToLayerWithPlayer(grand_child_of_root->id(), |
- timeline_impl(), 10.0, 1.f, 0.f, false); |
+ AddOpacityTransitionToElementWithPlayer(grand_child_of_root->element_id(), |
+ timeline_impl(), 10.0, 1.f, 0.f, |
+ false); |
// Put a transform animation on the render surface. |
- AddAnimatedTransformToLayerWithPlayer(render_surface2->id(), timeline_impl(), |
- 10.0, 30, 0); |
+ AddAnimatedTransformToElementWithPlayer(render_surface2->element_id(), |
+ timeline_impl(), 10.0, 30, 0); |
// Also put transform animations on grand_child_of_root, and |
// grand_child_of_rs2 |
- AddAnimatedTransformToLayerWithPlayer(grand_child_of_root->id(), |
- timeline_impl(), 10.0, 30, 0); |
- AddAnimatedTransformToLayerWithPlayer(grand_child_of_rs2->id(), |
- timeline_impl(), 10.0, 30, 0); |
+ AddAnimatedTransformToElementWithPlayer(grand_child_of_root->element_id(), |
+ timeline_impl(), 10.0, 30, 0); |
+ AddAnimatedTransformToElementWithPlayer(grand_child_of_rs2->element_id(), |
+ timeline_impl(), 10.0, 30, 0); |
ExecuteCalculateDrawProperties(parent); |
@@ -2693,8 +2694,8 @@ TEST_F(LayerTreeHostCommonTest, |
TargetProperty::TRANSFORM); |
animation->set_fill_mode(Animation::FILL_MODE_NONE); |
animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
- AddAnimationToLayerWithPlayer(grand_child->id(), timeline_impl(), |
- std::move(animation)); |
+ AddAnimationToElementWithPlayer(grand_child->element_id(), timeline_impl(), |
+ std::move(animation)); |
ExecuteCalculateDrawProperties(parent); |
EXPECT_FALSE(parent->screen_space_transform_is_animating()); |
@@ -3557,13 +3558,13 @@ TEST_F(LayerTreeHostCommonTest, |
FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
&task_graph_runner); |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.active_tree(), 1); |
+ CreateTestLayerImpl(host_impl.active_tree(), 1); |
std::unique_ptr<LayerImpl> child = |
- LayerImpl::Create(host_impl.active_tree(), 2); |
+ CreateTestLayerImpl(host_impl.active_tree(), 2); |
std::unique_ptr<LayerImpl> grand_child = |
- LayerImpl::Create(host_impl.active_tree(), 3); |
+ CreateTestLayerImpl(host_impl.active_tree(), 3); |
std::unique_ptr<LayerImpl> occluding_child = |
- LayerImpl::Create(host_impl.active_tree(), 4); |
+ CreateTestLayerImpl(host_impl.active_tree(), 4); |
child->SetDrawsContent(true); |
grand_child->SetDrawsContent(true); |
occluding_child->SetDrawsContent(true); |
@@ -4168,7 +4169,7 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) { |
// "flattened" to each parent layer according to current W3C spec. |
const gfx::Transform identity_matrix; |
- scoped_refptr<Layer> parent = Layer::Create(); |
+ scoped_refptr<Layer> parent = CreateTestLayer(); |
scoped_refptr<LayerWithForcedDrawsContent> front_facing_child = |
make_scoped_refptr(new LayerWithForcedDrawsContent()); |
scoped_refptr<LayerWithForcedDrawsContent> back_facing_child = |
@@ -4431,7 +4432,7 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) { |
// transforms should be treated as "unknown" so we can not be sure that their |
// back face is really showing. |
const gfx::Transform identity_matrix; |
- scoped_refptr<Layer> parent = Layer::Create(); |
+ scoped_refptr<Layer> parent = CreateTestLayer(); |
scoped_refptr<LayerWithForcedDrawsContent> child = |
make_scoped_refptr(new LayerWithForcedDrawsContent()); |
scoped_refptr<LayerWithForcedDrawsContent> animating_surface = |
@@ -4467,11 +4468,11 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) { |
animating_surface->SetForceRenderSurfaceForTesting(true); |
// Animate the transform on the render surface. |
- AddAnimatedTransformToLayerWithPlayer(animating_surface->id(), timeline(), |
- 10.0, 30, 0); |
+ AddAnimatedTransformToElementWithPlayer(animating_surface->element_id(), |
+ timeline(), 10.0, 30, 0); |
// This is just an animating layer, not a surface. |
- AddAnimatedTransformToLayerWithPlayer(animating_child->id(), timeline(), 10.0, |
- 30, 0); |
+ AddAnimatedTransformToElementWithPlayer(animating_child->element_id(), |
+ timeline(), 10.0, 30, 0); |
SetLayerPropertiesForTesting(parent.get(), |
identity_matrix, |
@@ -4557,7 +4558,7 @@ TEST_F(LayerTreeHostCommonTest, |
// created when it flattens its subtree, and its parent has preserves-3d. |
const gfx::Transform identity_matrix; |
- scoped_refptr<Layer> parent = Layer::Create(); |
+ scoped_refptr<Layer> parent = CreateTestLayer(); |
scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = |
make_scoped_refptr(new LayerWithForcedDrawsContent()); |
scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = |
@@ -4917,7 +4918,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { |
replica_transform.Scale(1.0, -1.0); |
std::unique_ptr<LayerImpl> replica = |
- LayerImpl::Create(host_impl()->active_tree(), 7); |
+ CreateTestLayerImpl(host_impl()->active_tree(), 7); |
SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), |
gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, |
true, false); |
@@ -5030,7 +5031,7 @@ TEST_F(LayerTreeHostCommonTest, |
gfx::Transform replica_transform; |
replica_transform.Scale(1.0, -1.0); |
std::unique_ptr<LayerImpl> replica = |
- LayerImpl::Create(host_impl()->active_tree(), 7); |
+ CreateTestLayerImpl(host_impl()->active_tree(), 7); |
SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), |
gfx::PointF(), gfx::Size(13, 11), false, true, |
false); |
@@ -5065,11 +5066,11 @@ TEST_F(LayerTreeHostCommonTest, |
} |
TEST_F(LayerTreeHostCommonTest, LayerSearch) { |
- scoped_refptr<Layer> root = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
- scoped_refptr<Layer> grand_child = Layer::Create(); |
- scoped_refptr<Layer> mask_layer = Layer::Create(); |
- scoped_refptr<Layer> replica_layer = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
+ scoped_refptr<Layer> child = CreateTestLayer(); |
+ scoped_refptr<Layer> grand_child = CreateTestLayer(); |
+ scoped_refptr<Layer> mask_layer = CreateTestLayer(); |
+ scoped_refptr<Layer> replica_layer = CreateTestLayer(); |
grand_child->SetReplicaLayer(replica_layer.get()); |
child->AddChild(grand_child.get()); |
@@ -5088,8 +5089,8 @@ TEST_F(LayerTreeHostCommonTest, LayerSearch) { |
} |
TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) { |
- scoped_refptr<Layer> root = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
+ scoped_refptr<Layer> child = CreateTestLayer(); |
scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
make_scoped_refptr(new LayerWithForcedDrawsContent()); |
@@ -5135,7 +5136,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
&shared_bitmap_manager, &task_graph_runner); |
host_impl.CreatePendingTree(); |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.pending_tree(), 1); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 1); |
const gfx::Transform identity_matrix; |
SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
@@ -5144,7 +5145,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
root->SetDrawsContent(true); |
std::unique_ptr<LayerImpl> child = |
- LayerImpl::Create(host_impl.pending_tree(), 2); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 2); |
SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), |
gfx::PointF(), gfx::Size(50, 50), true, false, |
false); |
@@ -5156,8 +5157,8 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
host_impl.animation_host()->AddAnimationTimeline(timeline); |
- AddOpacityTransitionToLayerWithPlayer(child->id(), timeline, 10.0, 0.0f, 1.0f, |
- false); |
+ AddOpacityTransitionToElementWithPlayer(child->element_id(), timeline, 10.0, |
+ 0.0f, 1.0f, false); |
root->AddChild(std::move(child)); |
root->SetHasRenderSurface(true); |
@@ -5251,11 +5252,11 @@ class LCDTextTest : public LayerTreeHostCommonTestBase, |
layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); |
std::unique_ptr<LayerImpl> root_ptr = |
- LayerImpl::Create(host_impl_.active_tree(), 1); |
+ CreateTestLayerImpl(host_impl_.active_tree(), 1); |
std::unique_ptr<LayerImpl> child_ptr = |
- LayerImpl::Create(host_impl_.active_tree(), 2); |
+ CreateTestLayerImpl(host_impl_.active_tree(), 2); |
std::unique_ptr<LayerImpl> grand_child_ptr = |
- LayerImpl::Create(host_impl_.active_tree(), 3); |
+ CreateTestLayerImpl(host_impl_.active_tree(), 3); |
// Stash raw pointers to look at later. |
root_ = root_ptr.get(); |
@@ -5418,8 +5419,8 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) { |
// Add opacity animation. |
child_->SetOpacity(0.9f); |
child_->layer_tree_impl()->property_trees()->needs_rebuild = true; |
- AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, |
- 0.1f, false); |
+ AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(), |
+ 10.0, 0.9f, 0.1f, false); |
ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, |
layers_always_allowed_lcd_text_); |
// Text LCD should be adjusted while animation is active. |
@@ -5441,8 +5442,8 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) { |
// Mark contents non-opaque within the first animation frame. |
child_->SetContentsOpaque(false); |
- AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f, |
- 0.1f, false); |
+ AddOpacityTransitionToElementWithPlayer(child_->element_id(), timeline(), |
+ 10.0, 0.9f, 0.1f, false); |
ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, |
layers_always_allowed_lcd_text_); |
// LCD text should be disabled for non-opaque layers even during animations. |
@@ -5467,7 +5468,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { |
const gfx::Transform identity_matrix; |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.pending_tree(), 1); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 1); |
LayerImpl* root_layer = root.get(); |
SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
gfx::PointF(), gfx::Size(50, 50), true, false, |
@@ -5475,14 +5476,14 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { |
root->SetDrawsContent(true); |
std::unique_ptr<LayerImpl> child = |
- LayerImpl::Create(host_impl.pending_tree(), 2); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 2); |
SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), |
gfx::PointF(), gfx::Size(40, 40), true, false, |
false); |
child->SetDrawsContent(true); |
std::unique_ptr<LayerImpl> grand_child = |
- LayerImpl::Create(host_impl.pending_tree(), 3); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 3); |
SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
true, false, false); |
@@ -5518,7 +5519,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { |
const gfx::Transform identity_matrix; |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.pending_tree(), 1); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 1); |
SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
gfx::PointF(), gfx::Size(50, 50), true, false, |
true); |
@@ -5526,7 +5527,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { |
LayerImpl* root_layer = root.get(); |
std::unique_ptr<LayerImpl> child = |
- LayerImpl::Create(host_impl.pending_tree(), 2); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 2); |
SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), |
gfx::PointF(), gfx::Size(40, 40), true, false, |
false); |
@@ -5534,7 +5535,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { |
child->test_properties()->hide_layer_and_subtree = true; |
std::unique_ptr<LayerImpl> grand_child = |
- LayerImpl::Create(host_impl.pending_tree(), 3); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 3); |
SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
true, false, false); |
@@ -5569,7 +5570,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
const gfx::Transform identity_matrix; |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.pending_tree(), 1); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 1); |
SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
gfx::PointF(), gfx::Size(50, 50), true, false, |
true); |
@@ -5577,7 +5578,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
LayerImpl* root_layer = root.get(); |
std::unique_ptr<LayerImpl> copy_grand_parent = |
- LayerImpl::Create(host_impl.pending_tree(), 2); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 2); |
SetLayerPropertiesForTesting(copy_grand_parent.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40), |
true, false, false); |
@@ -5585,7 +5586,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
LayerImpl* copy_grand_parent_layer = copy_grand_parent.get(); |
std::unique_ptr<LayerImpl> copy_parent = |
- LayerImpl::Create(host_impl.pending_tree(), 3); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 3); |
SetLayerPropertiesForTesting(copy_parent.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
true, false, true); |
@@ -5593,7 +5594,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
LayerImpl* copy_parent_layer = copy_parent.get(); |
std::unique_ptr<LayerImpl> copy_request = |
- LayerImpl::Create(host_impl.pending_tree(), 4); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 4); |
SetLayerPropertiesForTesting(copy_request.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), |
true, false, true); |
@@ -5601,7 +5602,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
LayerImpl* copy_layer = copy_request.get(); |
std::unique_ptr<LayerImpl> copy_child = |
- LayerImpl::Create(host_impl.pending_tree(), 5); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 5); |
SetLayerPropertiesForTesting(copy_child.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), |
true, false, false); |
@@ -5609,7 +5610,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
LayerImpl* copy_child_layer = copy_child.get(); |
std::unique_ptr<LayerImpl> copy_grand_child = |
- LayerImpl::Create(host_impl.pending_tree(), 6); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 6); |
SetLayerPropertiesForTesting(copy_grand_child.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), |
true, false, false); |
@@ -5617,7 +5618,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
LayerImpl* copy_grand_child_layer = copy_grand_child.get(); |
std::unique_ptr<LayerImpl> copy_grand_parent_sibling_before = |
- LayerImpl::Create(host_impl.pending_tree(), 7); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 7); |
SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(), |
identity_matrix, gfx::Point3F(), gfx::PointF(), |
gfx::Size(40, 40), true, false, false); |
@@ -5626,7 +5627,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
copy_grand_parent_sibling_before.get(); |
std::unique_ptr<LayerImpl> copy_grand_parent_sibling_after = |
- LayerImpl::Create(host_impl.pending_tree(), 8); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 8); |
SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), |
identity_matrix, gfx::Point3F(), gfx::PointF(), |
gfx::Size(40, 40), true, false, false); |
@@ -5732,14 +5733,14 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { |
const gfx::Transform identity_matrix; |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.pending_tree(), 1); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 1); |
SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
gfx::PointF(), gfx::Size(50, 50), true, false, |
true); |
root->SetDrawsContent(true); |
std::unique_ptr<LayerImpl> copy_parent = |
- LayerImpl::Create(host_impl.pending_tree(), 2); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 2); |
SetLayerPropertiesForTesting(copy_parent.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(), true, |
false, false); |
@@ -5747,14 +5748,14 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { |
copy_parent->SetMasksToBounds(true); |
std::unique_ptr<LayerImpl> copy_layer = |
- LayerImpl::Create(host_impl.pending_tree(), 3); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 3); |
SetLayerPropertiesForTesting(copy_layer.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
true, false, true); |
copy_layer->SetDrawsContent(true); |
std::unique_ptr<LayerImpl> copy_child = |
- LayerImpl::Create(host_impl.pending_tree(), 4); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 4); |
SetLayerPropertiesForTesting(copy_child.get(), identity_matrix, |
gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), |
true, false, false); |
@@ -6255,13 +6256,13 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
&task_graph_runner); |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.active_tree(), 12345); |
+ CreateTestLayerImpl(host_impl.active_tree(), 12345); |
std::unique_ptr<LayerImpl> child1 = |
- LayerImpl::Create(host_impl.active_tree(), 123456); |
+ CreateTestLayerImpl(host_impl.active_tree(), 123456); |
std::unique_ptr<LayerImpl> child2 = |
- LayerImpl::Create(host_impl.active_tree(), 1234567); |
+ CreateTestLayerImpl(host_impl.active_tree(), 1234567); |
std::unique_ptr<LayerImpl> child3 = |
- LayerImpl::Create(host_impl.active_tree(), 12345678); |
+ CreateTestLayerImpl(host_impl.active_tree(), 12345678); |
gfx::Transform identity_matrix; |
gfx::Point3F transform_origin; |
@@ -6994,16 +6995,16 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { |
&task_graph_runner); |
host_impl.CreatePendingTree(); |
std::unique_ptr<LayerImpl> root_ptr = |
- LayerImpl::Create(host_impl.active_tree(), 1); |
+ CreateTestLayerImpl(host_impl.active_tree(), 1); |
LayerImpl* root = root_ptr.get(); |
std::unique_ptr<LayerImpl> container = |
- LayerImpl::Create(host_impl.active_tree(), 2); |
+ CreateTestLayerImpl(host_impl.active_tree(), 2); |
LayerImpl* container_layer = container.get(); |
std::unique_ptr<LayerImpl> scroller = |
- LayerImpl::Create(host_impl.active_tree(), 3); |
+ CreateTestLayerImpl(host_impl.active_tree(), 3); |
LayerImpl* scroll_layer = scroller.get(); |
std::unique_ptr<LayerImpl> fixed = |
- LayerImpl::Create(host_impl.active_tree(), 4); |
+ CreateTestLayerImpl(host_impl.active_tree(), 4); |
LayerImpl* fixed_layer = fixed.get(); |
container->test_properties()->is_container_for_fixed_position_layers = true; |
@@ -7164,8 +7165,9 @@ TEST_F(LayerTreeHostCommonTest, |
start_operations.AppendMatrix(start_scale); |
TransformOperations end_operations; |
end_operations.AppendMatrix(end_scale); |
- AddAnimatedTransformToLayerWithPlayer(animated_layer->id(), timeline_impl(), |
- 1.0, start_operations, end_operations); |
+ AddAnimatedTransformToElementWithPlayer(animated_layer->element_id(), |
+ timeline_impl(), 1.0, |
+ start_operations, end_operations); |
gfx::Vector2dF scroll_delta(5.f, 9.f); |
SetScrollOffsetDelta(scroller, scroll_delta); |
@@ -7181,8 +7183,10 @@ class AnimationScaleFactorTrackingLayerImpl : public LayerImpl { |
static std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> Create( |
LayerTreeImpl* tree_impl, |
int id) { |
- return base::WrapUnique( |
+ auto layer = base::WrapUnique( |
new AnimationScaleFactorTrackingLayerImpl(tree_impl, id)); |
+ layer->SetElementId(NextTestElementId()); |
+ return layer; |
} |
~AnimationScaleFactorTrackingLayerImpl() override {} |
@@ -7268,8 +7272,9 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
host_impl.animation_host()->AddAnimationTimeline(timeline); |
- AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, |
- TransformOperations(), translation); |
+ AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
+ 1.0, TransformOperations(), |
+ translation); |
// No layers have scale-affecting animations. |
EXPECT_EQ( |
@@ -7295,8 +7300,8 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
TransformOperations scale; |
scale.AppendScale(5.f, 4.f, 3.f); |
- AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, |
- TransformOperations(), scale); |
+ AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, |
+ 1.0, TransformOperations(), scale); |
child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
ExecuteCalculateDrawProperties(grand_parent_raw); |
@@ -7321,8 +7326,9 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
1.f, |
grand_child_raw->draw_properties().starting_animation_contents_scale); |
- AddAnimatedTransformToLayerWithPlayer(grand_parent_raw->id(), timeline, 1.0, |
- TransformOperations(), scale); |
+ AddAnimatedTransformToElementWithPlayer(grand_parent_raw->element_id(), |
+ timeline, 1.0, TransformOperations(), |
+ scale); |
grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
ExecuteCalculateDrawProperties(grand_parent_raw); |
@@ -7349,8 +7355,8 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
0.f, |
grand_child_raw->draw_properties().starting_animation_contents_scale); |
- AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, |
- TransformOperations(), scale); |
+ AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
+ 1.0, TransformOperations(), scale); |
parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
ExecuteCalculateDrawProperties(grand_parent_raw); |
@@ -7375,18 +7381,19 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
0.f, |
grand_child_raw->draw_properties().starting_animation_contents_scale); |
- AbortAnimationsOnLayerWithPlayer(grand_parent_raw->id(), timeline, |
- TargetProperty::TRANSFORM); |
- AbortAnimationsOnLayerWithPlayer(parent_raw->id(), timeline, |
- TargetProperty::TRANSFORM); |
- AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, |
- TargetProperty::TRANSFORM); |
+ AbortAnimationsOnElementWithPlayer(grand_parent_raw->element_id(), timeline, |
+ TargetProperty::TRANSFORM); |
+ AbortAnimationsOnElementWithPlayer(parent_raw->element_id(), timeline, |
+ TargetProperty::TRANSFORM); |
+ AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, |
+ TargetProperty::TRANSFORM); |
TransformOperations perspective; |
perspective.AppendPerspective(10.f); |
- AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, |
- TransformOperations(), perspective); |
+ AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, |
+ 1.0, TransformOperations(), |
+ perspective); |
child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
ExecuteCalculateDrawProperties(grand_parent_raw); |
@@ -7412,16 +7419,16 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
0.f, |
grand_child_raw->draw_properties().starting_animation_contents_scale); |
- AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, |
- TargetProperty::TRANSFORM); |
+ AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, |
+ TargetProperty::TRANSFORM); |
gfx::Transform scale_matrix; |
scale_matrix.Scale(1.f, 2.f); |
grand_parent_raw->SetTransform(scale_matrix); |
parent_raw->SetTransform(scale_matrix); |
grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
- AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, |
- TransformOperations(), scale); |
+ AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
+ 1.0, TransformOperations(), scale); |
ExecuteCalculateDrawProperties(grand_parent_raw); |
// |grand_parent| and |parent| each have scale 2.f. |parent| has a scale |
@@ -7558,15 +7565,15 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { |
gfx::Transform identity_matrix; |
std::unique_ptr<LayerImpl> grand_parent = |
- LayerImpl::Create(host_impl.active_tree(), 1); |
+ CreateTestLayerImpl(host_impl.active_tree(), 1); |
std::unique_ptr<LayerImpl> parent = |
- LayerImpl::Create(host_impl.active_tree(), 3); |
+ CreateTestLayerImpl(host_impl.active_tree(), 3); |
std::unique_ptr<LayerImpl> child = |
- LayerImpl::Create(host_impl.active_tree(), 5); |
+ CreateTestLayerImpl(host_impl.active_tree(), 5); |
std::unique_ptr<LayerImpl> grand_child1 = |
- LayerImpl::Create(host_impl.active_tree(), 7); |
+ CreateTestLayerImpl(host_impl.active_tree(), 7); |
std::unique_ptr<LayerImpl> grand_child2 = |
- LayerImpl::Create(host_impl.active_tree(), 9); |
+ CreateTestLayerImpl(host_impl.active_tree(), 9); |
LayerImpl* grand_parent_raw = grand_parent.get(); |
LayerImpl* parent_raw = parent.get(); |
@@ -7674,7 +7681,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { |
EXPECT_EQ(expected, actual); |
// Add a mask layer to child. |
- child_raw->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); |
+ child_raw->SetMaskLayer(CreateTestLayerImpl(host_impl.active_tree(), 6)); |
child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
ExecuteCalculateDrawProperties(grand_parent_raw); |
@@ -7701,8 +7708,8 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { |
// Add replica mask layer. |
std::unique_ptr<LayerImpl> replica_layer = |
- LayerImpl::Create(host_impl.active_tree(), 20); |
- replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 21)); |
+ CreateTestLayerImpl(host_impl.active_tree(), 20); |
+ replica_layer->SetMaskLayer(CreateTestLayerImpl(host_impl.active_tree(), 21)); |
child_raw->SetReplicaLayer(std::move(replica_layer)); |
child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
@@ -7809,13 +7816,13 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
&shared_bitmap_manager, &task_graph_runner); |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.active_tree(), 1); |
+ CreateTestLayerImpl(host_impl.active_tree(), 1); |
LayerImpl* root_layer = root.get(); |
std::unique_ptr<LayerImpl> child1 = |
- LayerImpl::Create(host_impl.active_tree(), 2); |
+ CreateTestLayerImpl(host_impl.active_tree(), 2); |
LayerImpl* child1_layer = child1.get(); |
std::unique_ptr<LayerImpl> child2 = |
- LayerImpl::Create(host_impl.active_tree(), 3); |
+ CreateTestLayerImpl(host_impl.active_tree(), 3); |
LayerImpl* child2_layer = child2.get(); |
root->AddChild(std::move(child1)); |
@@ -7836,12 +7843,12 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
true, false, false); |
- child1_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4)); |
+ child1_layer->SetMaskLayer(CreateTestLayerImpl(host_impl.active_tree(), 4)); |
child1_layer->SetDrawsContent(true); |
std::unique_ptr<LayerImpl> replica_layer = |
- LayerImpl::Create(host_impl.active_tree(), 5); |
- replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); |
+ CreateTestLayerImpl(host_impl.active_tree(), 5); |
+ replica_layer->SetMaskLayer(CreateTestLayerImpl(host_impl.active_tree(), 6)); |
child1_layer->SetReplicaLayer(std::move(replica_layer)); |
child1_layer->SetHasRenderSurface(true); |
@@ -7854,8 +7861,8 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
host_impl.animation_host()->AddAnimationTimeline(timeline); |
- AddAnimatedTransformToLayerWithPlayer(child2_layer->id(), timeline, 1.0, |
- TransformOperations(), scale); |
+ AddAnimatedTransformToElementWithPlayer(child2_layer->element_id(), timeline, |
+ 1.0, TransformOperations(), scale); |
SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, |
gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
@@ -8020,7 +8027,7 @@ TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { |
host_impl.SetViewportSize(device_viewport_size); |
host_impl.active_tree()->SetRootLayer( |
- LayerImpl::Create(host_impl.active_tree(), 1)); |
+ CreateTestLayerImpl(host_impl.active_tree(), 1)); |
LayerImpl* root = host_impl.active_tree()->root_layer(); |
SetLayerPropertiesForTesting(root, |
@@ -8033,7 +8040,7 @@ TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { |
true); |
root->SetMasksToBounds(true); |
- root->AddChild(LayerImpl::Create(host_impl.active_tree(), 2)); |
+ root->AddChild(CreateTestLayerImpl(host_impl.active_tree(), 2)); |
LayerImpl* sublayer = root->child_at(0); |
SetLayerPropertiesForTesting(sublayer, |
@@ -8062,11 +8069,11 @@ TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { |
} |
TEST_F(LayerTreeHostCommonTest, NodesAffectedByBoundsDeltaGetUpdated) { |
- scoped_refptr<Layer> root = Layer::Create(); |
- scoped_refptr<Layer> inner_viewport_container_layer = Layer::Create(); |
- scoped_refptr<Layer> inner_viewport_scroll_layer = Layer::Create(); |
- scoped_refptr<Layer> outer_viewport_container_layer = Layer::Create(); |
- scoped_refptr<Layer> outer_viewport_scroll_layer = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
+ scoped_refptr<Layer> inner_viewport_container_layer = CreateTestLayer(); |
+ scoped_refptr<Layer> inner_viewport_scroll_layer = CreateTestLayer(); |
+ scoped_refptr<Layer> outer_viewport_container_layer = CreateTestLayer(); |
+ scoped_refptr<Layer> outer_viewport_scroll_layer = CreateTestLayer(); |
root->AddChild(inner_viewport_container_layer); |
inner_viewport_container_layer->AddChild(inner_viewport_scroll_layer); |
@@ -8085,8 +8092,8 @@ TEST_F(LayerTreeHostCommonTest, NodesAffectedByBoundsDeltaGetUpdated) { |
host()->RegisterViewportLayers(nullptr, root, inner_viewport_scroll_layer, |
outer_viewport_scroll_layer); |
- scoped_refptr<Layer> fixed_to_inner = Layer::Create(); |
- scoped_refptr<Layer> fixed_to_outer = Layer::Create(); |
+ scoped_refptr<Layer> fixed_to_inner = CreateTestLayer(); |
+ scoped_refptr<Layer> fixed_to_outer = CreateTestLayer(); |
inner_viewport_scroll_layer->AddChild(fixed_to_inner); |
outer_viewport_scroll_layer->AddChild(fixed_to_outer); |
@@ -8121,7 +8128,7 @@ TEST_F(LayerTreeHostCommonTest, NodesAffectedByBoundsDeltaGetUpdated) { |
TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
const gfx::Transform identity_matrix; |
- scoped_refptr<Layer> root = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
scoped_refptr<LayerWithForcedDrawsContent> animated = |
make_scoped_refptr(new LayerWithForcedDrawsContent()); |
@@ -8138,8 +8145,8 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
root->SetForceRenderSurfaceForTesting(true); |
animated->SetOpacity(0.f); |
- AddOpacityTransitionToLayerWithPlayer(animated->id(), timeline(), 10.0, 0.f, |
- 1.f, false); |
+ AddOpacityTransitionToElementWithPlayer(animated->element_id(), timeline(), |
+ 10.0, 0.f, 1.f, false); |
ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty()); |
@@ -8148,8 +8155,8 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
TEST_F(LayerTreeHostCommonTest, |
VisibleContentRectForAnimatedLayerWithSingularTransform) { |
const gfx::Transform identity_matrix; |
- scoped_refptr<Layer> root = Layer::Create(); |
- scoped_refptr<Layer> clip = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
+ scoped_refptr<Layer> clip = CreateTestLayer(); |
scoped_refptr<LayerWithForcedDrawsContent> animated = |
make_scoped_refptr(new LayerWithForcedDrawsContent()); |
scoped_refptr<LayerWithForcedDrawsContent> surface = |
@@ -8187,9 +8194,9 @@ TEST_F(LayerTreeHostCommonTest, |
start_transform_operations.AppendMatrix(uninvertible_matrix); |
TransformOperations end_transform_operations; |
- AddAnimatedTransformToLayerWithPlayer(animated->id(), timeline(), 10.0, |
- start_transform_operations, |
- end_transform_operations); |
+ AddAnimatedTransformToElementWithPlayer(animated->element_id(), timeline(), |
+ 10.0, start_transform_operations, |
+ end_transform_operations); |
ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
// The animated layer has a singular transform and maps to a non-empty rect in |
@@ -8224,9 +8231,9 @@ TEST_F(LayerTreeHostCommonTest, |
// Verify that having an animated filter (but no current filter, as these |
// are mutually exclusive) correctly creates a render surface. |
TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
- scoped_refptr<Layer> root = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
- scoped_refptr<Layer> grandchild = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
+ scoped_refptr<Layer> child = CreateTestLayer(); |
+ scoped_refptr<Layer> grandchild = CreateTestLayer(); |
root->AddChild(child); |
child->AddChild(grandchild); |
@@ -8240,7 +8247,8 @@ TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
true, false); |
host()->SetRootLayer(root); |
- AddAnimatedFilterToLayerWithPlayer(child->id(), timeline(), 10.0, 0.1f, 0.2f); |
+ AddAnimatedFilterToElementWithPlayer(child->element_id(), timeline(), 10.0, |
+ 0.1f, 0.2f); |
ExecuteCalculateDrawProperties(root.get()); |
EXPECT_TRUE(root->has_render_surface()); |
@@ -8259,9 +8267,9 @@ TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
// Verify that having a filter animation with a delayed start time creates a |
// render surface. |
TEST_F(LayerTreeHostCommonTest, DelayedFilterAnimationCreatesRenderSurface) { |
- scoped_refptr<Layer> root = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
- scoped_refptr<Layer> grandchild = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
+ scoped_refptr<Layer> child = CreateTestLayer(); |
+ scoped_refptr<Layer> grandchild = CreateTestLayer(); |
root->AddChild(child); |
child->AddChild(grandchild); |
@@ -8290,7 +8298,8 @@ TEST_F(LayerTreeHostCommonTest, DelayedFilterAnimationCreatesRenderSurface) { |
animation->set_fill_mode(Animation::FILL_MODE_NONE); |
animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
- AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation)); |
+ AddAnimationToElementWithPlayer(child->element_id(), timeline(), |
+ std::move(animation)); |
ExecuteCalculateDrawProperties(root.get()); |
EXPECT_TRUE(root->has_render_surface()); |
@@ -8386,23 +8395,23 @@ TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { |
rotate.Rotate(5); |
gfx::Transform identity; |
- scoped_refptr<Layer> root = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
gfx::PointF(), gfx::Size(2500, 1500), true, |
false); |
- scoped_refptr<Layer> frame_clip = Layer::Create(); |
+ scoped_refptr<Layer> frame_clip = CreateTestLayer(); |
SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
gfx::PointF(), gfx::Size(2500, 1500), true, |
false); |
frame_clip->SetMasksToBounds(true); |
- scoped_refptr<Layer> rotated = Layer::Create(); |
+ scoped_refptr<Layer> rotated = CreateTestLayer(); |
SetLayerPropertiesForTesting(rotated.get(), rotate, |
gfx::Point3F(1250, 250, 0), gfx::PointF(), |
gfx::Size(2500, 500), true, false); |
- scoped_refptr<Layer> surface = Layer::Create(); |
+ scoped_refptr<Layer> surface = CreateTestLayer(); |
SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), |
gfx::PointF(), gfx::Size(2500, 500), true, |
false); |
@@ -8509,7 +8518,7 @@ TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { |
translate.Translate(10, 10); |
rotate.Rotate(45); |
- scoped_refptr<Layer> root = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
gfx::PointF(), gfx::Size(800, 800), true, false); |
root->SetIsContainerForFixedPositionLayers(true); |
@@ -8600,11 +8609,11 @@ TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) { |
// greater than or equal to the actual number of copy requests in the |
// sub-layer_tree. |
- scoped_refptr<Layer> root = Layer::Create(); |
- scoped_refptr<Layer> child1 = Layer::Create(); |
- scoped_refptr<Layer> child2 = Layer::Create(); |
- scoped_refptr<Layer> grandchild = Layer::Create(); |
- scoped_refptr<Layer> greatgrandchild = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
+ scoped_refptr<Layer> child1 = CreateTestLayer(); |
+ scoped_refptr<Layer> child2 = CreateTestLayer(); |
+ scoped_refptr<Layer> grandchild = CreateTestLayer(); |
+ scoped_refptr<Layer> greatgrandchild = CreateTestLayer(); |
root->AddChild(child1); |
root->AddChild(child2); |
@@ -8628,7 +8637,7 @@ TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) { |
TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
gfx::Transform identity; |
- scoped_refptr<Layer> root = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
FakeContentLayerClient client; |
client.set_bounds(root->bounds()); |
scoped_refptr<LayerWithForcedDrawsContent> child = |
@@ -8686,13 +8695,14 @@ TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
animation_id, 1, TargetProperty::TRANSFORM); |
animation->set_fill_mode(Animation::FILL_MODE_NONE); |
animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
- AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation)); |
+ AddAnimationToElementWithPlayer(child->element_id(), timeline(), |
+ std::move(animation)); |
ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); |
grandchild->set_visible_layer_rect(gfx::Rect()); |
- RemoveAnimationFromLayerWithExistingPlayer(child->id(), timeline(), |
- animation_id); |
+ RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(), |
+ animation_id); |
child->SetTransform(identity); |
child->SetOpacity(0.f); |
ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
@@ -8714,8 +8724,8 @@ TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
animation_id, 1, TargetProperty::OPACITY); |
animation->set_fill_mode(Animation::FILL_MODE_NONE); |
animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
- AddAnimationToLayerWithExistingPlayer(child->id(), timeline(), |
- std::move(animation)); |
+ AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), |
+ std::move(animation)); |
ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); |
} |
@@ -8729,11 +8739,11 @@ TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
gfx::Transform identity; |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.active_tree(), 1); |
+ CreateTestLayerImpl(host_impl.active_tree(), 1); |
std::unique_ptr<LayerImpl> child = |
- LayerImpl::Create(host_impl.active_tree(), 2); |
+ CreateTestLayerImpl(host_impl.active_tree(), 2); |
std::unique_ptr<LayerImpl> grandchild = |
- LayerImpl::Create(host_impl.active_tree(), 3); |
+ CreateTestLayerImpl(host_impl.active_tree(), 3); |
std::unique_ptr<FakePictureLayerImpl> greatgrandchild( |
FakePictureLayerImpl::Create(host_impl.active_tree(), 4)); |
@@ -8857,10 +8867,10 @@ TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
- root_ptr->id(), player.get()); |
+ root_ptr->element_id(), player.get()); |
host_impl.active_tree() |
->animation_host() |
- ->GetElementAnimationsForElementId(root_ptr->id()) |
+ ->GetElementAnimationsForElementId(root_ptr->element_id()) |
->AddAnimation(std::move(transform_animation)); |
grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
child_ptr->SetScrollClipLayer(root_ptr->id()); |
@@ -8871,7 +8881,7 @@ TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
- root_ptr->id(), player.get()); |
+ root_ptr->element_id(), player.get()); |
} |
TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { |
@@ -8912,11 +8922,11 @@ TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { |
Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
host_impl()->active_tree()->animation_host()->RegisterPlayerForElement( |
- grand_child->id(), player.get()); |
+ grand_child->element_id(), player.get()); |
host_impl() |
->active_tree() |
->animation_host() |
- ->GetElementAnimationsForElementId(grand_child->id()) |
+ ->GetElementAnimationsForElementId(grand_child->element_id()) |
->AddAnimation(std::move(transform_animation)); |
ExecuteCalculateDrawProperties(root); |
@@ -8924,7 +8934,7 @@ TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { |
EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); |
host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( |
- grand_child->id(), player.get()); |
+ grand_child->element_id(), player.get()); |
} |
TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
@@ -8937,11 +8947,11 @@ TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
gfx::Transform identity; |
host_impl.CreatePendingTree(); |
std::unique_ptr<LayerImpl> root = |
- LayerImpl::Create(host_impl.pending_tree(), 1); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 1); |
std::unique_ptr<LayerImpl> child = |
- LayerImpl::Create(host_impl.pending_tree(), 2); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 2); |
std::unique_ptr<LayerImpl> grandchild = |
- LayerImpl::Create(host_impl.pending_tree(), 3); |
+ CreateTestLayerImpl(host_impl.pending_tree(), 3); |
std::unique_ptr<FakePictureLayerImpl> greatgrandchild( |
FakePictureLayerImpl::Create(host_impl.pending_tree(), 4)); |
@@ -8983,10 +8993,10 @@ TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); |
scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
- root_ptr->id(), player.get()); |
+ root_ptr->element_id(), player.get()); |
host_impl.active_tree() |
->animation_host() |
- ->GetElementAnimationsForElementId(root_ptr->id()) |
+ ->GetElementAnimationsForElementId(root_ptr->element_id()) |
->AddAnimation(std::move(animation)); |
root_ptr->SetOpacity(0); |
grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
@@ -8995,7 +9005,7 @@ TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
- root_ptr->id(), player.get()); |
+ root_ptr->element_id(), player.get()); |
} |
TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
@@ -9044,9 +9054,9 @@ TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { |
// Ensure that the treewalk in LayerTreeHostCommom:: |
// PreCalculateMetaInformation happens when its required. |
- scoped_refptr<Layer> root = Layer::Create(); |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
+ scoped_refptr<Layer> parent = CreateTestLayer(); |
+ scoped_refptr<Layer> child = CreateTestLayer(); |
root->AddChild(parent); |
parent->AddChild(child); |
@@ -9104,11 +9114,11 @@ TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { |
gfx::Transform translate_z; |
translate_z.Translate3d(0, 0, 10); |
- scoped_refptr<Layer> root = Layer::Create(); |
+ scoped_refptr<Layer> root = CreateTestLayer(); |
SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
gfx::PointF(), gfx::Size(800, 800), true, false); |
- scoped_refptr<Layer> child = Layer::Create(); |
+ scoped_refptr<Layer> child = CreateTestLayer(); |
SetLayerPropertiesForTesting(child.get(), translate_z, gfx::Point3F(), |
gfx::PointF(), gfx::Size(100, 100), true, false); |
@@ -9703,7 +9713,7 @@ TEST_F(LayerTreeHostCommonTest, MaskLayerScreenSpaceTransform) { |
gfx::Size(30, 30), true, false, false); |
root->SetDrawsContent(true); |
child->SetDrawsContent(false); |
- child->SetMaskLayer(LayerImpl::Create(root->layer_tree_impl(), 100)); |
+ child->SetMaskLayer(CreateTestLayerImpl(root->layer_tree_impl(), 100)); |
ExecuteCalculateDrawProperties(root); |
EXPECT_TRANSFORMATION_MATRIX_EQ(transform, |
@@ -9886,19 +9896,19 @@ TEST_F(LayerTreeHostCommonTest, ScrollTreeBuilderTest) { |
// parent4:1 |
// child9:1 |
// grand_child12:1 |
- scoped_refptr<Layer> root1 = Layer::Create(); |
- scoped_refptr<Layer> page_scale_layer = Layer::Create(); |
- scoped_refptr<Layer> parent2 = Layer::Create(); |
- scoped_refptr<Layer> parent3 = Layer::Create(); |
- scoped_refptr<Layer> parent4 = Layer::Create(); |
- scoped_refptr<Layer> parent5 = Layer::Create(); |
- scoped_refptr<Layer> child6 = Layer::Create(); |
- scoped_refptr<Layer> child7 = Layer::Create(); |
- scoped_refptr<Layer> child8 = Layer::Create(); |
- scoped_refptr<Layer> child9 = Layer::Create(); |
- scoped_refptr<Layer> grand_child10 = Layer::Create(); |
- scoped_refptr<Layer> grand_child11 = Layer::Create(); |
- scoped_refptr<Layer> grand_child12 = Layer::Create(); |
+ scoped_refptr<Layer> root1 = CreateTestLayer(); |
+ scoped_refptr<Layer> page_scale_layer = CreateTestLayer(); |
+ scoped_refptr<Layer> parent2 = CreateTestLayer(); |
+ scoped_refptr<Layer> parent3 = CreateTestLayer(); |
+ scoped_refptr<Layer> parent4 = CreateTestLayer(); |
+ scoped_refptr<Layer> parent5 = CreateTestLayer(); |
+ scoped_refptr<Layer> child6 = CreateTestLayer(); |
+ scoped_refptr<Layer> child7 = CreateTestLayer(); |
+ scoped_refptr<Layer> child8 = CreateTestLayer(); |
+ scoped_refptr<Layer> child9 = CreateTestLayer(); |
+ scoped_refptr<Layer> grand_child10 = CreateTestLayer(); |
+ scoped_refptr<Layer> grand_child11 = CreateTestLayer(); |
+ scoped_refptr<Layer> grand_child12 = CreateTestLayer(); |
root1->AddChild(page_scale_layer); |
page_scale_layer->AddChild(parent2); |
@@ -9961,6 +9971,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollTreeBuilderTest) { |
scroll_root1.data.user_scrollable_horizontal = true; |
scroll_root1.data.user_scrollable_vertical = true; |
scroll_root1.data.transform_id = root1->transform_tree_index(); |
+ scroll_root1.data.element_id = root1->element_id(); |
expected_scroll_tree.Insert(scroll_root1, 0); |
// The node owned by parent2 |
@@ -9977,6 +9988,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollTreeBuilderTest) { |
scroll_parent2.data.user_scrollable_horizontal = true; |
scroll_parent2.data.user_scrollable_vertical = true; |
scroll_parent2.data.transform_id = parent2->transform_tree_index(); |
+ scroll_parent2.data.element_id = parent2->element_id(); |
expected_scroll_tree.Insert(scroll_parent2, 1); |
// The node owned by child6 |
@@ -9989,6 +10001,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollTreeBuilderTest) { |
scroll_child6.data.user_scrollable_horizontal = true; |
scroll_child6.data.user_scrollable_vertical = true; |
scroll_child6.data.transform_id = child6->transform_tree_index(); |
+ scroll_child6.data.element_id = child6->element_id(); |
expected_scroll_tree.Insert(scroll_child6, 2); |
// The node owned by child7, child7 also owns a transform node |
@@ -10001,6 +10014,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollTreeBuilderTest) { |
scroll_child7.data.user_scrollable_horizontal = true; |
scroll_child7.data.user_scrollable_vertical = true; |
scroll_child7.data.transform_id = child7->transform_tree_index(); |
+ scroll_child7.data.element_id = child7->element_id(); |
expected_scroll_tree.Insert(scroll_child7, 1); |
// The node owned by grand_child11, grand_child11 also owns a transform node |
@@ -10012,6 +10026,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollTreeBuilderTest) { |
scroll_grand_child11.data.user_scrollable_vertical = true; |
scroll_grand_child11.data.transform_id = |
grand_child11->transform_tree_index(); |
+ scroll_grand_child11.data.element_id = grand_child11->element_id(); |
expected_scroll_tree.Insert(scroll_grand_child11, 4); |
// The node owned by parent5 |
@@ -10024,6 +10039,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollTreeBuilderTest) { |
scroll_parent5.data.user_scrollable_horizontal = true; |
scroll_parent5.data.user_scrollable_vertical = true; |
scroll_parent5.data.transform_id = parent5->transform_tree_index(); |
+ scroll_parent5.data.element_id = parent5->element_id(); |
expected_scroll_tree.Insert(scroll_parent5, 1); |
expected_scroll_tree.SetScrollOffset(parent2->id(), gfx::ScrollOffset(0, 0)); |