| 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 ea9defbe83d668f9d89205ce829be8b9be757c10..53a609ea64a69895102fb57647458916103b64fc 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(NextElementId()); }
|
|
|
| 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);
|
| @@ -4201,7 +4202,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 =
|
| @@ -4464,7 +4465,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 =
|
| @@ -4500,11 +4501,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,
|
| @@ -4590,7 +4591,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 =
|
| @@ -4950,7 +4951,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);
|
| @@ -5063,7 +5064,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);
|
| @@ -5098,11 +5099,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());
|
| @@ -5121,8 +5122,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());
|
|
|
| @@ -5168,7 +5169,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(),
|
| @@ -5177,7 +5178,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);
|
| @@ -5189,8 +5190,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);
|
| @@ -5284,11 +5285,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();
|
| @@ -5451,8 +5452,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.
|
| @@ -5474,8 +5475,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.
|
| @@ -5500,7 +5501,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,
|
| @@ -5508,14 +5509,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);
|
| @@ -5551,7 +5552,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);
|
| @@ -5559,7 +5560,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);
|
| @@ -5567,7 +5568,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
|
| child->SetHideLayerAndSubtree(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);
|
| @@ -5602,7 +5603,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);
|
| @@ -5610,7 +5611,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);
|
| @@ -5618,7 +5619,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);
|
| @@ -5626,7 +5627,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);
|
| @@ -5634,7 +5635,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);
|
| @@ -5642,7 +5643,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);
|
| @@ -5650,7 +5651,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);
|
| @@ -5659,7 +5660,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);
|
| @@ -5763,14 +5764,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);
|
| @@ -5778,14 +5779,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);
|
| @@ -6286,13 +6287,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;
|
| @@ -7025,16 +7026,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;
|
| @@ -7195,8 +7196,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);
|
|
|
| @@ -7212,8 +7214,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(NextElementId());
|
| + return layer;
|
| }
|
|
|
| ~AnimationScaleFactorTrackingLayerImpl() override {}
|
| @@ -7299,8 +7303,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(
|
| @@ -7326,8 +7331,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);
|
|
|
| @@ -7352,8 +7357,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);
|
|
|
| @@ -7380,8 +7386,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);
|
|
|
| @@ -7406,18 +7412,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);
|
|
|
| @@ -7443,16 +7450,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
|
| @@ -7589,15 +7596,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();
|
| @@ -7705,7 +7712,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);
|
| @@ -7732,8 +7739,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;
|
|
|
| @@ -7840,13 +7847,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));
|
| @@ -7867,12 +7874,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);
|
|
|
| @@ -7885,8 +7892,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),
|
| @@ -8051,7 +8058,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,
|
| @@ -8064,7 +8071,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,
|
| @@ -8093,11 +8100,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);
|
| @@ -8116,8 +8123,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);
|
| @@ -8152,7 +8159,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());
|
|
|
| @@ -8169,8 +8176,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());
|
| @@ -8179,8 +8186,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 =
|
| @@ -8218,9 +8225,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
|
| @@ -8255,9 +8262,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);
|
|
|
| @@ -8271,7 +8278,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());
|
| @@ -8290,9 +8298,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);
|
|
|
| @@ -8321,7 +8329,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());
|
| @@ -8417,23 +8426,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);
|
| @@ -8540,7 +8549,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);
|
| @@ -8631,11 +8640,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);
|
| @@ -8659,7 +8668,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 =
|
| @@ -8717,13 +8726,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());
|
| @@ -8745,8 +8755,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());
|
| }
|
| @@ -8760,11 +8770,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));
|
| @@ -8888,10 +8898,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());
|
| @@ -8902,7 +8912,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) {
|
| @@ -8943,11 +8953,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);
|
| @@ -8955,7 +8965,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) {
|
| @@ -8968,11 +8978,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));
|
| @@ -9014,10 +9024,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());
|
| @@ -9026,7 +9036,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) {
|
| @@ -9075,9 +9085,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);
|
| @@ -9135,11 +9145,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);
|
|
|
| @@ -9734,7 +9744,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,
|
| @@ -9917,19 +9927,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);
|
| @@ -9992,6 +10002,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
|
| @@ -10008,6 +10019,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
|
| @@ -10020,6 +10032,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
|
| @@ -10032,6 +10045,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
|
| @@ -10043,6 +10057,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
|
| @@ -10055,6 +10070,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));
|
|
|