virtual void PaintContents(
SkCanvas* canvas,
const gfx::Rect& clip,
- gfx::RectF* opaque,
ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE {}
virtual void DidChangeLayerCanUseLCDText() OVERRIDE {}
virtual bool FillsBoundsCompletely() const OVERRIDE { return false; }
parent->AddChild(child);
child->AddChild(grand_child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
gfx::Transform identity_matrix;
parent->AddChild(child);
child->AddChild(grand_child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
gfx::Transform identity_matrix;
false);
root->AddChild(layer);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
// Case 2: Setting the bounds of the layer should not affect either the draw
parent->AddChild(child);
child->AddChild(grand_child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
// One-time setup of root layer
parent->AddChild(child);
child->AddChild(grand_child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
// One-time setup of root layer
// Render surface should have been created now.
ASSERT_TRUE(child->render_surface());
- ASSERT_EQ(child, child->render_target());
+ ASSERT_EQ(child.get(), child->render_target());
// The child layer's draw transform should refer to its new render surface.
// The screen-space transform, however, should still refer to the root.
child->AddChild(grand_child);
child->SetReplicaLayer(child_replica.get());
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
// One-time setup of root layer
// Render surface should have been created now.
ASSERT_TRUE(child->render_surface());
- ASSERT_EQ(child, child->render_target());
+ ASSERT_EQ(child.get(), child->render_target());
EXPECT_TRANSFORMATION_MATRIX_EQ(
replica_composite_transform,
render_surface1->SetReplicaLayer(replica_of_rs1.get());
render_surface2->SetReplicaLayer(replica_of_rs2.get());
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
// In combination with descendant draws content, opacity != 1 forces the layer
ASSERT_FALSE(grand_child_of_rs2->render_surface());
// Verify all render target accessors
- EXPECT_EQ(root, parent->render_target());
- EXPECT_EQ(root, child_of_root->render_target());
- EXPECT_EQ(root, grand_child_of_root->render_target());
+ EXPECT_EQ(root.get(), parent->render_target());
+ EXPECT_EQ(root.get(), child_of_root->render_target());
+ EXPECT_EQ(root.get(), grand_child_of_root->render_target());
- EXPECT_EQ(render_surface1, render_surface1->render_target());
- EXPECT_EQ(render_surface1, child_of_rs1->render_target());
- EXPECT_EQ(render_surface1, grand_child_of_rs1->render_target());
+ EXPECT_EQ(render_surface1.get(), render_surface1->render_target());
+ EXPECT_EQ(render_surface1.get(), child_of_rs1->render_target());
+ EXPECT_EQ(render_surface1.get(), grand_child_of_rs1->render_target());
- EXPECT_EQ(render_surface2, render_surface2->render_target());
- EXPECT_EQ(render_surface2, child_of_rs2->render_target());
- EXPECT_EQ(render_surface2, grand_child_of_rs2->render_target());
+ EXPECT_EQ(render_surface2.get(), render_surface2->render_target());
+ EXPECT_EQ(render_surface2.get(), child_of_rs2->render_target());
+ EXPECT_EQ(render_surface2.get(), grand_child_of_rs2->render_target());
// Verify layer draw transforms note that draw transforms are described with
// respect to the nearest ancestor render surface but screen space transforms
child->AddChild(grand_child);
child->SetForceRenderSurface(true);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
// No layers in this test should preserve 3d.
child->AddChild(grand_child);
child->SetForceRenderSurface(true);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
child->SetScrollClipLayerId(root->id());
root->AddChild(child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
SetLayerPropertiesForTesting(root.get(),
scoped_refptr<LayerWithForcedDrawsContent> child =
make_scoped_refptr(new LayerWithForcedDrawsContent());
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
const gfx::Transform identity_matrix;
scoped_refptr<LayerWithForcedDrawsContent> child =
make_scoped_refptr(new LayerWithForcedDrawsContent());
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
const gfx::Transform identity_matrix;
make_scoped_refptr(new LayerWithForcedDrawsContent());
render_surface1->SetForceRenderSurface(true);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
const gfx::Transform identity_matrix;
child->AddChild(grand_child);
grand_child->AddChild(great_grand_child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
// leaf_node1 ensures that parent and child are kept on the
child->AddChild(grand_child);
grand_child->AddChild(leaf_node);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
SetLayerPropertiesForTesting(parent.get(),
child2->AddChild(leaf_node2);
grand_child->AddChild(leaf_node1);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
child2->SetForceRenderSurface(true);
child->AddChild(grand_child3);
child->AddChild(grand_child4);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
SetLayerPropertiesForTesting(parent.get(),
child->AddChild(grand_child3);
child->AddChild(grand_child4);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
// the leaf nodes ensure that these grand_children become render surfaces for
child_of_rs1->AddChild(grand_child_of_rs1);
child_of_rs2->AddChild(grand_child_of_rs2);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
// Make our render surfaces.
ASSERT_FALSE(grand_child_of_rs2->render_surface());
// Verify all render target accessors
- EXPECT_EQ(parent, parent->render_target());
- EXPECT_EQ(parent, child_of_root->render_target());
- EXPECT_EQ(parent, grand_child_of_root->render_target());
+ EXPECT_EQ(parent.get(), parent->render_target());
+ EXPECT_EQ(parent.get(), child_of_root->render_target());
+ EXPECT_EQ(parent.get(), grand_child_of_root->render_target());
- EXPECT_EQ(render_surface1, render_surface1->render_target());
- EXPECT_EQ(render_surface1, child_of_rs1->render_target());
- EXPECT_EQ(render_surface1, grand_child_of_rs1->render_target());
+ EXPECT_EQ(render_surface1.get(), render_surface1->render_target());
+ EXPECT_EQ(render_surface1.get(), child_of_rs1->render_target());
+ EXPECT_EQ(render_surface1.get(), grand_child_of_rs1->render_target());
- EXPECT_EQ(render_surface2, render_surface2->render_target());
- EXPECT_EQ(render_surface2, child_of_rs2->render_target());
- EXPECT_EQ(render_surface2, grand_child_of_rs2->render_target());
+ EXPECT_EQ(render_surface2.get(), render_surface2->render_target());
+ EXPECT_EQ(render_surface2.get(), child_of_rs2->render_target());
+ EXPECT_EQ(render_surface2.get(), grand_child_of_rs2->render_target());
// Verify draw_opacity_is_animating values
EXPECT_FALSE(parent->draw_opacity_is_animating());
root->AddChild(child2);
root->AddChild(child3);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
child->AddChild(grand_child2);
child->AddChild(grand_child3);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
render_surface1->AddChild(child2);
render_surface1->AddChild(child3);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
make_scoped_refptr(new LayerWithForcedDrawsContent());
root->AddChild(child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
// Case 1: a truly degenerate matrix
make_scoped_refptr(new LayerWithForcedDrawsContent());
root->AddChild(child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) {
scoped_refptr<Layer> root = Layer::Create();
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
render_surface1->AddChild(child2);
render_surface1->AddChild(child3);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
render_surface2->AddChild(child2);
render_surface2->AddChild(child3);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
root->AddChild(render_surface1);
render_surface1->AddChild(child1);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
root->AddChild(render_surface1);
render_surface1->AddChild(child1);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
render_surface2->AddChild(child2);
render_surface2->AddChild(child3);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
back_facing_surface->AddChild(front_facing_child_of_back_facing_surface);
back_facing_surface->AddChild(back_facing_child_of_back_facing_surface);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
// Nothing is double-sided
back_facing_surface->AddChild(front_facing_child_of_back_facing_surface);
back_facing_surface->AddChild(back_facing_child_of_back_facing_surface);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
// Nothing is double-sided
parent->AddChild(animating_child);
parent->AddChild(child2);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
// Nothing is double-sided
front_facing_surface->AddChild(child1);
back_facing_surface->AddChild(child2);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
// RenderSurfaces are not double-sided
parent->AddChild(child_empty);
parent->AddChild(child_no_scale);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
float device_scale_factor = 2.5f;
parent->AddChild(scale_surface);
root->AddChild(parent);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
float device_scale_factor = 2.5f;
root.get(), parent->bounds(), &render_surface_layer_list);
inputs.device_scale_factor = device_scale_factor;
inputs.page_scale_factor = page_scale_factor;
- inputs.page_scale_application_layer = root;
+ inputs.page_scale_application_layer = root.get();
inputs.can_adjust_raster_scales = true;
LayerTreeHostCommon::CalculateDrawProperties(&inputs);
parent->AddChild(child);
parent->AddChild(child_no_scale);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
float device_scale_factor = 1.7f;
parent->AddChild(child_empty);
parent->AddChild(child_no_scale);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
float device_scale_factor = 2.5f;
parent->AddChild(child_empty);
parent->AddChild(child_no_scale);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
RenderSurfaceLayerList render_surface_layer_list;
parent->AddChild(child_scale);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
float device_scale_factor = 2.5f;
surface_no_scale->AddChild(surface_no_scale_child_scale);
surface_no_scale->AddChild(surface_no_scale_child_no_scale);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
SkMScalar device_scale_factor = 5;
surface_no_scale->AddChild(surface_no_scale_child_scale);
surface_no_scale->AddChild(surface_no_scale_child_no_scale);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
RenderSurfaceLayerList render_surface_layer_list;
parent->AddChild(child_scale);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
// Now put an animating transform on child.
scoped_refptr<Layer> child = CreateDrawableContentLayer(&delegate);
root->AddChild(child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
gfx::Transform identity_matrix;
child->AddChild(duplicate_child_non_owner);
child->SetReplicaLayer(replica.get());
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
RenderSurfaceLayerList render_surface_layer_list;
child->AddChild(duplicate_child_non_owner);
child->SetReplicaLayer(replica.get());
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(parent);
float device_scale_factor = 1.7f;
child->SetMaskLayer(mask_layer.get());
root->AddChild(child.get());
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
int nonexistent_id = -1;
- EXPECT_EQ(root,
+ EXPECT_EQ(root.get(),
LayerTreeHostCommon::FindLayerInSubtree(root.get(), root->id()));
- EXPECT_EQ(child,
+ EXPECT_EQ(child.get(),
LayerTreeHostCommon::FindLayerInSubtree(root.get(), child->id()));
EXPECT_EQ(
- grand_child,
+ grand_child.get(),
LayerTreeHostCommon::FindLayerInSubtree(root.get(), grand_child->id()));
EXPECT_EQ(
- mask_layer,
+ mask_layer.get(),
LayerTreeHostCommon::FindLayerInSubtree(root.get(), mask_layer->id()));
EXPECT_EQ(
- replica_layer,
+ replica_layer.get(),
LayerTreeHostCommon::FindLayerInSubtree(root.get(), replica_layer->id()));
EXPECT_EQ(
0, LayerTreeHostCommon::FindLayerInSubtree(root.get(), nonexistent_id));
child->AddChild(grand_child);
child->SetOpacity(0.5f);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
child_->SetForceRenderSurface(std::tr1::get<1>(GetParam()));
- host_ = FakeLayerTreeHost::Create();
+ host_ = CreateFakeLayerTreeHost();
host_->SetRootLayer(root_);
}
child->AddChild(grand_child);
root->AddChild(child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
RenderSurfaceLayerList render_surface_layer_list;
child->AddChild(grand_child);
root->AddChild(child);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
RenderSurfaceLayerList render_surface_layer_list;
root->AddChild(copy_grand_parent);
root->AddChild(copy_grand_parent_sibling_after);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
// Hide the copy_grand_parent and its subtree. But make a copy request in that
copy_parent->AddChild(copy_layer);
root->AddChild(copy_parent);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest(
surface->AddChild(surface_child);
root->AddChild(surface);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
RenderSurfaceLayerList render_surface_layer_list;
true,
false);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
true,
false);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
true,
false);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
true,
false);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
render_surface1->SetForceRenderSurface(true);
render_surface2->SetForceRenderSurface(true);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
render_surface->SetDoubleSided(false);
render_surface->SetForceRenderSurface(true);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
true,
false);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
true);
child->SetForceRenderSurface(true);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
true,
false);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
true,
false);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
// correct clip, the layer lists should be unaffected.
EXPECT_EQ(3u, root->render_surface()->layer_list().size());
EXPECT_EQ(scroll_child.get(),
- root->render_surface()->layer_list().at(0));
+ root->render_surface()->layer_list().at(0).get());
EXPECT_EQ(scroll_parent.get(),
- root->render_surface()->layer_list().at(1));
+ root->render_surface()->layer_list().at(1).get());
EXPECT_EQ(scroll_grandparent.get(),
- root->render_surface()->layer_list().at(2));
+ root->render_surface()->layer_list().at(2).get());
}
TEST_F(LayerTreeHostCommonTest, OutOfOrderClippingRequiresRSLLSorting) {
true,
false);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
RenderSurfaceLayerList render_surface_layer_list;
EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor);
}
+TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) {
+ scoped_refptr<Layer> root = Layer::Create();
+ SetLayerPropertiesForTesting(root.get(),
+ gfx::Transform(),
+ gfx::Point3F(),
+ gfx::PointF(),
+ gfx::Size(768 / 2, 3000),
+ true,
+ false);
+ root->SetIsDrawable(true);
+
+ scoped_refptr<Layer> clip = Layer::Create();
+ SetLayerPropertiesForTesting(clip.get(),
+ gfx::Transform(),
+ gfx::Point3F(),
+ gfx::PointF(),
+ gfx::Size(768 / 2, 10000),
+ true,
+ false);
+ clip->SetMasksToBounds(true);
+
+ scoped_refptr<Layer> content = Layer::Create();
+ SetLayerPropertiesForTesting(content.get(),
+ gfx::Transform(),
+ gfx::Point3F(),
+ gfx::PointF(),
+ gfx::Size(768 / 2, 10000),
+ true,
+ false);
+ content->SetIsDrawable(true);
+ content->SetForceRenderSurface(true);
+
+ root->AddChild(clip);
+ clip->AddChild(content);
+
+ FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
+ scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client);
+ host->SetRootLayer(root);
+
+ gfx::Size device_viewport_size(768, 582);
+ RenderSurfaceLayerList render_surface_layer_list;
+ LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
+ host->root_layer(), device_viewport_size, &render_surface_layer_list);
+ inputs.device_scale_factor = 2.f;
+ inputs.page_scale_factor = 1.f;
+ inputs.page_scale_application_layer = NULL;
+ LayerTreeHostCommon::CalculateDrawProperties(&inputs);
+
+ // Layers in the root render surface have their visible content rect clipped
+ // by the viewport.
+ EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect());
+
+ // Layers drawing to a child render surface should still have their visible
+ // content rect clipped by the viewport.
+ EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect());
+}
+
} // namespace
} // namespace cc