Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2703)

Unified Diff: cc/damage_tracker_unittest.cc

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/damage_tracker.cc ('k') | cc/debug_rect_history.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/damage_tracker_unittest.cc
diff --git a/cc/damage_tracker_unittest.cc b/cc/damage_tracker_unittest.cc
index f3274c60438a12b130e1841dd99f5b77a30cf848..e15a22c722c11f2e3e617682f2d1ce837fdd4d7c 100644
--- a/cc/damage_tracker_unittest.cc
+++ b/cc/damage_tracker_unittest.cc
@@ -29,7 +29,7 @@ void executeCalculateDrawProperties(LayerImpl* root, std::vector<LayerImpl*>& re
// Sanity check: The test itself should create the root layer's render surface, so
// that the surface (and its damage tracker) can persist across multiple
// calls to this function.
- ASSERT_TRUE(root->renderSurface());
+ ASSERT_TRUE(root->render_surface());
ASSERT_FALSE(renderSurfaceLayerList.size());
LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList, false);
@@ -37,8 +37,8 @@ void executeCalculateDrawProperties(LayerImpl* root, std::vector<LayerImpl*>& re
void clearDamageForAllSurfaces(LayerImpl* layer)
{
- if (layer->renderSurface())
- layer->renderSurface()->damage_tracker()->DidDrawDamagedArea();
+ if (layer->render_surface())
+ layer->render_surface()->damage_tracker()->DidDrawDamagedArea();
// Recursively clear damage for any existing surface.
for (size_t i = 0; i < layer->children().size(); ++i)
@@ -57,11 +57,11 @@ void emulateDrawingOneFrame(LayerImpl* root)
// Iterate back-to-front, so that damage correctly propagates from descendant surfaces to ancestors.
for (int i = renderSurfaceLayerList.size() - 1; i >= 0; --i) {
- RenderSurfaceImpl* targetSurface = renderSurfaceLayerList[i]->renderSurface();
- targetSurface->damage_tracker()->UpdateDamageTrackingState(targetSurface->layer_list(), targetSurface->OwningLayerId(), targetSurface->SurfacePropertyChangedOnlyFromDescendant(), targetSurface->content_rect(), renderSurfaceLayerList[i]->maskLayer(), renderSurfaceLayerList[i]->filters(), renderSurfaceLayerList[i]->filter().get());
+ RenderSurfaceImpl* targetSurface = renderSurfaceLayerList[i]->render_surface();
+ targetSurface->damage_tracker()->UpdateDamageTrackingState(targetSurface->layer_list(), targetSurface->OwningLayerId(), targetSurface->SurfacePropertyChangedOnlyFromDescendant(), targetSurface->content_rect(), renderSurfaceLayerList[i]->mask_layer(), renderSurfaceLayerList[i]->filters(), renderSurfaceLayerList[i]->filter().get());
}
- root->resetAllChangeTrackingForSubtree();
+ root->ResetAllChangeTrackingForSubtree();
}
class DamageTrackerTest : public testing::Test {
@@ -73,23 +73,23 @@ public:
scoped_ptr<LayerImpl> createTestTreeWithOneSurface()
{
- scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.activeTree(), 1);
- scoped_ptr<LayerImpl> child = LayerImpl::create(m_hostImpl.activeTree(), 2);
-
- root->setPosition(gfx::PointF());
- root->setAnchorPoint(gfx::PointF());
- root->setBounds(gfx::Size(500, 500));
- root->setContentBounds(gfx::Size(500, 500));
- root->setDrawsContent(true);
- root->createRenderSurface();
- root->renderSurface()->SetContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
-
- child->setPosition(gfx::PointF(100, 100));
- child->setAnchorPoint(gfx::PointF());
- child->setBounds(gfx::Size(30, 30));
- child->setContentBounds(gfx::Size(30, 30));
- child->setDrawsContent(true);
- root->addChild(child.Pass());
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> child = LayerImpl::Create(m_hostImpl.activeTree(), 2);
+
+ root->SetPosition(gfx::PointF());
+ root->SetAnchorPoint(gfx::PointF());
+ root->SetBounds(gfx::Size(500, 500));
+ root->SetContentBounds(gfx::Size(500, 500));
+ root->SetDrawsContent(true);
+ root->CreateRenderSurface();
+ root->render_surface()->SetContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
+
+ child->SetPosition(gfx::PointF(100, 100));
+ child->SetAnchorPoint(gfx::PointF());
+ child->SetBounds(gfx::Size(30, 30));
+ child->SetContentBounds(gfx::Size(30, 30));
+ child->SetDrawsContent(true);
+ root->AddChild(child.Pass());
return root.Pass();
}
@@ -100,50 +100,50 @@ public:
// child1. Additionally, the root has a second child layer, and child1 has two
// children of its own.
- scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.activeTree(), 1);
- scoped_ptr<LayerImpl> child1 = LayerImpl::create(m_hostImpl.activeTree(), 2);
- scoped_ptr<LayerImpl> child2 = LayerImpl::create(m_hostImpl.activeTree(), 3);
- scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(m_hostImpl.activeTree(), 4);
- scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(m_hostImpl.activeTree(), 5);
-
- root->setPosition(gfx::PointF());
- root->setAnchorPoint(gfx::PointF());
- root->setBounds(gfx::Size(500, 500));
- root->setContentBounds(gfx::Size(500, 500));
- root->setDrawsContent(true);
- root->createRenderSurface();
- root->renderSurface()->SetContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
-
- child1->setPosition(gfx::PointF(100, 100));
- child1->setAnchorPoint(gfx::PointF());
- child1->setBounds(gfx::Size(30, 30));
- child1->setContentBounds(gfx::Size(30, 30));
- child1->setOpacity(0.5); // with a child that drawsContent, this will cause the layer to create its own renderSurface.
- child1->setDrawsContent(false); // this layer does not draw, but is intended to create its own renderSurface.
- child1->setForceRenderSurface(true);
-
- child2->setPosition(gfx::PointF(11, 11));
- child2->setAnchorPoint(gfx::PointF());
- child2->setBounds(gfx::Size(18, 18));
- child2->setContentBounds(gfx::Size(18, 18));
- child2->setDrawsContent(true);
-
- grandChild1->setPosition(gfx::PointF(200, 200));
- grandChild1->setAnchorPoint(gfx::PointF());
- grandChild1->setBounds(gfx::Size(6, 8));
- grandChild1->setContentBounds(gfx::Size(6, 8));
- grandChild1->setDrawsContent(true);
-
- grandChild2->setPosition(gfx::PointF(190, 190));
- grandChild2->setAnchorPoint(gfx::PointF());
- grandChild2->setBounds(gfx::Size(6, 8));
- grandChild2->setContentBounds(gfx::Size(6, 8));
- grandChild2->setDrawsContent(true);
-
- child1->addChild(grandChild1.Pass());
- child1->addChild(grandChild2.Pass());
- root->addChild(child1.Pass());
- root->addChild(child2.Pass());
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> child1 = LayerImpl::Create(m_hostImpl.activeTree(), 2);
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.activeTree(), 3);
+ scoped_ptr<LayerImpl> grandChild1 = LayerImpl::Create(m_hostImpl.activeTree(), 4);
+ scoped_ptr<LayerImpl> grandChild2 = LayerImpl::Create(m_hostImpl.activeTree(), 5);
+
+ root->SetPosition(gfx::PointF());
+ root->SetAnchorPoint(gfx::PointF());
+ root->SetBounds(gfx::Size(500, 500));
+ root->SetContentBounds(gfx::Size(500, 500));
+ root->SetDrawsContent(true);
+ root->CreateRenderSurface();
+ root->render_surface()->SetContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
+
+ child1->SetPosition(gfx::PointF(100, 100));
+ child1->SetAnchorPoint(gfx::PointF());
+ child1->SetBounds(gfx::Size(30, 30));
+ child1->SetContentBounds(gfx::Size(30, 30));
+ child1->SetOpacity(0.5); // with a child that drawsContent, this will cause the layer to create its own renderSurface.
+ child1->SetDrawsContent(false); // this layer does not draw, but is intended to create its own renderSurface.
+ child1->SetForceRenderSurface(true);
+
+ child2->SetPosition(gfx::PointF(11, 11));
+ child2->SetAnchorPoint(gfx::PointF());
+ child2->SetBounds(gfx::Size(18, 18));
+ child2->SetContentBounds(gfx::Size(18, 18));
+ child2->SetDrawsContent(true);
+
+ grandChild1->SetPosition(gfx::PointF(200, 200));
+ grandChild1->SetAnchorPoint(gfx::PointF());
+ grandChild1->SetBounds(gfx::Size(6, 8));
+ grandChild1->SetContentBounds(gfx::Size(6, 8));
+ grandChild1->SetDrawsContent(true);
+
+ grandChild2->SetPosition(gfx::PointF(190, 190));
+ grandChild2->SetAnchorPoint(gfx::PointF());
+ grandChild2->SetBounds(gfx::Size(6, 8));
+ grandChild2->SetContentBounds(gfx::Size(6, 8));
+ grandChild2->SetDrawsContent(true);
+
+ child1->AddChild(grandChild1.Pass());
+ child1->AddChild(grandChild2.Pass());
+ root->AddChild(child1.Pass());
+ root->AddChild(child2.Pass());
return root.Pass();
}
@@ -182,11 +182,11 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithOneSurface)
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface();
- EXPECT_EQ(2u, root->renderSurface()->layer_list().size());
- EXPECT_EQ(1, root->renderSurface()->layer_list()[0]->id());
- EXPECT_EQ(2, root->renderSurface()->layer_list()[1]->id());
+ EXPECT_EQ(2u, root->render_surface()->layer_list().size());
+ EXPECT_EQ(1, root->render_surface()->layer_list()[0]->id());
+ EXPECT_EQ(2, root->render_surface()->layer_list()[1]->id());
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
}
@@ -199,13 +199,13 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
LayerImpl* child1 = root->children()[0];
LayerImpl* child2 = root->children()[1];
- gfx::RectF childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
- ASSERT_TRUE(child1->renderSurface());
- EXPECT_FALSE(child2->renderSurface());
- EXPECT_EQ(3u, root->renderSurface()->layer_list().size());
- EXPECT_EQ(2u, child1->renderSurface()->layer_list().size());
+ ASSERT_TRUE(child1->render_surface());
+ EXPECT_FALSE(child2->render_surface());
+ EXPECT_EQ(3u, root->render_surface()->layer_list().size());
+ EXPECT_EQ(2u, child1->render_surface()->layer_list().size());
// The render surface for child1 only has a contentRect that encloses grandChild1 and grandChild2, because child1 does not draw content.
EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
@@ -220,29 +220,29 @@ TEST_F(DamageTrackerTest, verifyDamageForUpdateRects)
// CASE 1: Setting the update rect should cause the corresponding damage to the surface.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
+ child->set_update_rect(gfx::RectF(10, 11, 12, 13));
emulateDrawingOneFrame(root.get());
// Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100).
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 12, 13), rootDamageRect);
// CASE 2: The same update rect twice in a row still produces the same damage.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
+ child->set_update_rect(gfx::RectF(10, 11, 12, 13));
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 12, 13), rootDamageRect);
// CASE 3: Setting a different update rect should cause damage on the new update region, but no additional exposed old region.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(gfx::RectF(20, 25, 1, 2));
+ child->set_update_rect(gfx::RectF(20, 25, 1, 2));
emulateDrawingOneFrame(root.get());
// Damage position on the surface should be: position of updateRect (20, 25) relative to the child (100, 100).
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(120, 125, 1, 2), rootDamageRect);
}
@@ -254,17 +254,17 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
// CASE 1: The layer's property changed flag takes priority over update rect.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
- child->setOpacity(0.5);
+ child->set_update_rect(gfx::RectF(10, 11, 12, 13));
+ child->SetOpacity(0.5);
emulateDrawingOneFrame(root.get());
// Sanity check - we should not have accidentally created a separate render surface for the translucent layer.
- ASSERT_FALSE(child->renderSurface());
- ASSERT_EQ(2u, root->renderSurface()->layer_list().size());
+ ASSERT_FALSE(child->render_surface());
+ ASSERT_EQ(2u, root->render_surface()->layer_list().size());
// Damage should be the entire child layer in targetSurface space.
gfx::RectF expectedRect = gfx::RectF(100, 100, 30, 30);
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
// CASE 2: If a layer moves due to property change, it damages both the new location
@@ -274,16 +274,16 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
// Cycle one frame of no change, just to sanity check that the next rect is not because of the old damage state.
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
- EXPECT_TRUE(root->renderSurface()->damage_tracker()->current_damage_rect().IsEmpty());
+ EXPECT_TRUE(root->render_surface()->damage_tracker()->current_damage_rect().IsEmpty());
// Then, test the actual layer movement.
clearDamageForAllSurfaces(root.get());
- child->setPosition(gfx::PointF(200, 230));
+ child->SetPosition(gfx::PointF(200, 230));
emulateDrawingOneFrame(root.get());
// Expect damage to be the combination of the previous one and the new one.
expectedRect.Union(gfx::RectF(200, 230, 30, 30));
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
}
@@ -299,18 +299,18 @@ TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer)
rotation.Rotate(45);
clearDamageForAllSurfaces(root.get());
- child->setAnchorPoint(gfx::PointF(0.5, 0.5));
- child->setPosition(gfx::PointF(85, 85));
+ child->SetAnchorPoint(gfx::PointF(0.5, 0.5));
+ child->SetPosition(gfx::PointF(85, 85));
emulateDrawingOneFrame(root.get());
// Sanity check that the layer actually moved to (85, 85), damaging its old location and new location.
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(85, 85, 45, 45), rootDamageRect);
// With the anchor on the layer's center, now we can test the rotation more
// intuitively, since it applies about the layer's anchor.
clearDamageForAllSurfaces(root.get());
- child->setTransform(rotation);
+ child->SetTransform(rotation);
emulateDrawingOneFrame(root.get());
// Since the child layer is square, rotation by 45 degrees about the center should
@@ -319,7 +319,7 @@ TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer)
double expectedWidth = 30 * sqrt(2.0);
double expectedPosition = 100 - 0.5 * expectedWidth;
gfx::RectF expectedRect(expectedPosition, expectedPosition, expectedWidth, expectedWidth);
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
}
@@ -345,10 +345,10 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
transform.Translate3d(-50, -50, 0);
// Set up the child
- child->setPosition(gfx::PointF(0, 0));
- child->setBounds(gfx::Size(100, 100));
- child->setContentBounds(gfx::Size(100, 100));
- child->setTransform(transform);
+ child->SetPosition(gfx::PointF(0, 0));
+ child->SetBounds(gfx::Size(100, 100));
+ child->SetContentBounds(gfx::Size(100, 100));
+ child->SetTransform(transform);
emulateDrawingOneFrame(root.get());
// Sanity check that the child layer's bounds would actually get clipped by w < 0,
@@ -360,12 +360,12 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
// Damage the child without moving it.
clearDamageForAllSurfaces(root.get());
- child->setOpacity(0.5);
+ child->SetOpacity(0.5);
emulateDrawingOneFrame(root.get());
// The expected damage should cover the entire root surface (500x500), but we don't
// care whether the damage rect was clamped or is larger than the surface for this test.
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
gfx::RectF damageWeCareAbout = gfx::RectF(gfx::PointF(), gfx::SizeF(500, 500));
EXPECT_TRUE(rootDamageRect.Contains(damageWeCareAbout));
}
@@ -382,16 +382,16 @@ TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface)
// Setting the filter will damage the whole surface.
clearDamageForAllSurfaces(root.get());
- root->setFilters(filters);
+ root->SetFilters(filters);
emulateDrawingOneFrame(root.get());
// Setting the update rect should cause the corresponding damage to the surface, blurred based on the size of the blur filter.
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
+ child->set_update_rect(gfx::RectF(10, 11, 12, 13));
emulateDrawingOneFrame(root.get());
// Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100), but expanded by the blur outsets.
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
gfx::RectF expectedDamageRect = gfx::RectF(110, 111, 12, 13);
expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
@@ -404,25 +404,25 @@ TEST_F(DamageTrackerTest, verifyDamageForImageFilter)
gfx::RectF rootDamageRect, childDamageRect;
// Allow us to set damage on child too.
- child->setDrawsContent(true);
+ child->SetDrawsContent(true);
skia::RefPtr<SkImageFilter> filter = skia::AdoptRef(new SkBlurImageFilter(SkIntToScalar(2), SkIntToScalar(2)));
// Setting the filter will damage the whole surface.
clearDamageForAllSurfaces(root.get());
- child->setFilter(filter);
+ child->SetFilter(filter);
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
- childDamageRect = child->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
// CASE 1: Setting the update rect should damage the whole surface (for now)
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(gfx::RectF(0, 0, 1, 1));
+ child->set_update_rect(gfx::RectF(0, 0, 1, 1));
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
- childDamageRect = child->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
}
@@ -434,7 +434,7 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
LayerImpl* child2 = root->children()[1];
// Allow us to set damage on child1 too.
- child1->setDrawsContent(true);
+ child1->SetDrawsContent(true);
WebFilterOperations filters;
filters.append(WebFilterOperation::createBlurFilter(2));
@@ -443,17 +443,17 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// Setting the filter will damage the whole surface.
clearDamageForAllSurfaces(root.get());
- child1->setBackgroundFilters(filters);
+ child1->SetBackgroundFilters(filters);
emulateDrawingOneFrame(root.get());
// CASE 1: Setting the update rect should cause the corresponding damage to
// the surface, blurred based on the size of the child's background blur
// filter.
clearDamageForAllSurfaces(root.get());
- root->setUpdateRect(gfx::RectF(297, 297, 2, 2));
+ root->set_update_rect(gfx::RectF(297, 297, 2, 2));
emulateDrawingOneFrame(root.get());
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// Damage position on the surface should be a composition of the damage on the root and on child2.
// Damage on the root should be: position of updateRect (297, 297), but expanded by the blur outsets.
gfx::RectF expectedDamageRect = gfx::RectF(297, 297, 2, 2);
@@ -465,10 +465,10 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// filter. Since the damage extends to the right/bottom outside of the
// blurred layer, only the left/top should end up expanded.
clearDamageForAllSurfaces(root.get());
- root->setUpdateRect(gfx::RectF(297, 297, 30, 30));
+ root->set_update_rect(gfx::RectF(297, 297, 30, 30));
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// Damage position on the surface should be a composition of the damage on the root and on child2.
// Damage on the root should be: position of updateRect (297, 297), but expanded on the left/top
// by the blur outsets.
@@ -479,10 +479,10 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// CASE 3: Setting this update rect outside the blurred contentBounds of the blurred
// child1 will not cause it to be expanded.
clearDamageForAllSurfaces(root.get());
- root->setUpdateRect(gfx::RectF(30, 30, 2, 2));
+ root->set_update_rect(gfx::RectF(30, 30, 2, 2));
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// Damage on the root should be: position of updateRect (30, 30), not
// expanded.
expectedDamageRect = gfx::RectF(30, 30, 2, 2);
@@ -491,10 +491,10 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// CASE 4: Setting this update rect inside the blurred contentBounds but outside the
// original contentBounds of the blurred child1 will cause it to be expanded.
clearDamageForAllSurfaces(root.get());
- root->setUpdateRect(gfx::RectF(99, 99, 1, 1));
+ root->set_update_rect(gfx::RectF(99, 99, 1, 1));
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// Damage on the root should be: position of updateRect (99, 99), expanded
// by the blurring on child1, but since it is 1 pixel outside the layer, the
// expanding should be reduced by 1.
@@ -505,10 +505,10 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// CASE 5: Setting the update rect on child2, which is above child1, will
// not get blurred by child1, so it does not need to get expanded.
clearDamageForAllSurfaces(root.get());
- child2->setUpdateRect(gfx::RectF(0, 0, 1, 1));
+ child2->set_update_rect(gfx::RectF(0, 0, 1, 1));
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// Damage on child2 should be: position of updateRect offset by the child's position (11, 11), and not expanded by anything.
expectedDamageRect = gfx::RectF(11, 11, 1, 1);
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
@@ -516,10 +516,10 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// CASE 6: Setting the update rect on child1 will also blur the damage, so
// that any pixels needed for the blur are redrawn in the current frame.
clearDamageForAllSurfaces(root.get());
- child1->setUpdateRect(gfx::RectF(0, 0, 1, 1));
+ child1->set_update_rect(gfx::RectF(0, 0, 1, 1));
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// Damage on child1 should be: position of updateRect offset by the child's position (100, 100), and expanded by the damage.
expectedDamageRect = gfx::RectF(100, 100, 1, 1);
expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
@@ -535,20 +535,20 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
//
clearDamageForAllSurfaces(root.get());
{
- scoped_ptr<LayerImpl> child2 = LayerImpl::create(m_hostImpl.activeTree(), 3);
- child2->setPosition(gfx::PointF(400, 380));
- child2->setAnchorPoint(gfx::PointF());
- child2->setBounds(gfx::Size(6, 8));
- child2->setContentBounds(gfx::Size(6, 8));
- child2->setDrawsContent(true);
- root->addChild(child2.Pass());
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.activeTree(), 3);
+ child2->SetPosition(gfx::PointF(400, 380));
+ child2->SetAnchorPoint(gfx::PointF());
+ child2->SetBounds(gfx::Size(6, 8));
+ child2->SetContentBounds(gfx::Size(6, 8));
+ child2->SetDrawsContent(true);
+ root->AddChild(child2.Pass());
}
emulateDrawingOneFrame(root.get());
// Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
- ASSERT_EQ(3u, root->renderSurface()->layer_list().size());
+ ASSERT_EQ(3u, root->render_surface()->layer_list().size());
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(400, 380, 6, 8), rootDamageRect);
// CASE 2: If the layer is removed, its entire old layer becomes exposed, not just the
@@ -557,13 +557,13 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
// Advance one frame without damage so that we know the damage rect is not leftover from the previous case.
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
- EXPECT_TRUE(root->renderSurface()->damage_tracker()->current_damage_rect().IsEmpty());
+ EXPECT_TRUE(root->render_surface()->damage_tracker()->current_damage_rect().IsEmpty());
// Then, test removing child1.
- root->removeChild(child1);
+ root->RemoveChild(child1);
child1 = NULL;
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
}
@@ -576,25 +576,25 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
clearDamageForAllSurfaces(root.get());
{
- scoped_ptr<LayerImpl> child2 = LayerImpl::create(m_hostImpl.activeTree(), 3);
- child2->setPosition(gfx::PointF(400, 380));
- child2->setAnchorPoint(gfx::PointF());
- child2->setBounds(gfx::Size(6, 8));
- child2->setContentBounds(gfx::Size(6, 8));
- child2->setDrawsContent(true);
- child2->resetAllChangeTrackingForSubtree();
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.activeTree(), 3);
+ child2->SetPosition(gfx::PointF(400, 380));
+ child2->SetAnchorPoint(gfx::PointF());
+ child2->SetBounds(gfx::Size(6, 8));
+ child2->SetContentBounds(gfx::Size(6, 8));
+ child2->SetDrawsContent(true);
+ child2->ResetAllChangeTrackingForSubtree();
// Sanity check the initial conditions of the test, if these asserts trigger, it
// means the test no longer actually covers the intended scenario.
- ASSERT_FALSE(child2->layerPropertyChanged());
- ASSERT_TRUE(child2->updateRect().IsEmpty());
- root->addChild(child2.Pass());
+ ASSERT_FALSE(child2->LayerPropertyChanged());
+ ASSERT_TRUE(child2->update_rect().IsEmpty());
+ root->AddChild(child2.Pass());
}
emulateDrawingOneFrame(root.get());
// Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
- ASSERT_EQ(3u, root->renderSurface()->layer_list().size());
+ ASSERT_EQ(3u, root->render_surface()->layer_list().size());
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(400, 380, 6, 8), rootDamageRect);
}
@@ -606,13 +606,13 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
// In this test we don't want the above tree manipulation to be considered part of the same frame.
clearDamageForAllSurfaces(root.get());
{
- scoped_ptr<LayerImpl> child2 = LayerImpl::create(m_hostImpl.activeTree(), 3);
- child2->setPosition(gfx::PointF(400, 380));
- child2->setAnchorPoint(gfx::PointF());
- child2->setBounds(gfx::Size(6, 8));
- child2->setContentBounds(gfx::Size(6, 8));
- child2->setDrawsContent(true);
- root->addChild(child2.Pass());
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.activeTree(), 3);
+ child2->SetPosition(gfx::PointF(400, 380));
+ child2->SetAnchorPoint(gfx::PointF());
+ child2->SetBounds(gfx::Size(6, 8));
+ child2->SetContentBounds(gfx::Size(6, 8));
+ child2->SetDrawsContent(true);
+ root->AddChild(child2.Pass());
}
LayerImpl* child2 = root->children()[1];
emulateDrawingOneFrame(root.get());
@@ -621,10 +621,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
// - child1 update rect in surface space: gfx::RectF(100, 100, 1, 2);
// - child2 update rect in surface space: gfx::RectF(400, 380, 3, 4);
clearDamageForAllSurfaces(root.get());
- child1->setUpdateRect(gfx::RectF(0, 0, 1, 2));
- child2->setUpdateRect(gfx::RectF(0, 0, 3, 4));
+ child1->set_update_rect(gfx::RectF(0, 0, 1, 2));
+ child2->set_update_rect(gfx::RectF(0, 0, 3, 4));
emulateDrawingOneFrame(root.get());
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 303, 284), rootDamageRect);
}
@@ -640,10 +640,10 @@ TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
// CASE 1: Damage to a descendant surface should propagate properly to ancestor surface.
//
clearDamageForAllSurfaces(root.get());
- grandChild1->setOpacity(0.5);
+ grandChild1->SetOpacity(0.5);
emulateDrawingOneFrame(root.get());
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(200, 200, 6, 8), childDamageRect);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(300, 300, 6, 8), rootDamageRect);
@@ -651,11 +651,11 @@ TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
// - child1 surface damage in root surface space: gfx::RectF(300, 300, 6, 8);
// - child2 damage in root surface space: gfx::RectF(11, 11, 18, 18);
clearDamageForAllSurfaces(root.get());
- grandChild1->setOpacity(0.7f);
- child2->setOpacity(0.7f);
+ grandChild1->SetOpacity(0.7f);
+ child2->SetOpacity(0.7f);
emulateDrawingOneFrame(root.get());
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(200, 200, 6, 8), childDamageRect);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(11, 11, 295, 297), rootDamageRect);
}
@@ -676,10 +676,10 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer)
gfx::RectF rootDamageRect;
clearDamageForAllSurfaces(root.get());
- grandChild1->setPosition(gfx::PointF(195, 205));
+ grandChild1->SetPosition(gfx::PointF(195, 205));
emulateDrawingOneFrame(root.get());
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// The new surface bounds should be damaged entirely, even though only one of the layers changed.
EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 11, 23), childDamageRect);
@@ -708,10 +708,10 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer)
gfx::RectF rootDamageRect;
clearDamageForAllSurfaces(root.get());
- child1->setPosition(gfx::PointF(50, 50));
+ child1->SetPosition(gfx::PointF(50, 50));
emulateDrawingOneFrame(root.get());
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// The new surface bounds should be damaged entirely.
EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
@@ -732,15 +732,15 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
// CASE 1: If a descendant surface disappears, its entire old area becomes exposed.
//
clearDamageForAllSurfaces(root.get());
- child1->setOpacity(1);
- child1->setForceRenderSurface(false);
+ child1->SetOpacity(1);
+ child1->SetForceRenderSurface(false);
emulateDrawingOneFrame(root.get());
// Sanity check that there is only one surface now.
- ASSERT_FALSE(child1->renderSurface());
- ASSERT_EQ(4u, root->renderSurface()->layer_list().size());
+ ASSERT_FALSE(child1->render_surface());
+ ASSERT_EQ(4u, root->render_surface()->layer_list().size());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 18), rootDamageRect);
// CASE 2: If a descendant surface appears, its entire old area becomes exposed.
@@ -748,22 +748,22 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
// Cycle one frame of no change, just to sanity check that the next rect is not because of the old damage state.
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(rootDamageRect.IsEmpty());
// Then change the tree so that the render surface is added back.
clearDamageForAllSurfaces(root.get());
- child1->setOpacity(0.5);
- child1->setForceRenderSurface(true);
+ child1->SetOpacity(0.5);
+ child1->SetForceRenderSurface(true);
emulateDrawingOneFrame(root.get());
// Sanity check that there is a new surface now.
- ASSERT_TRUE(child1->renderSurface());
- EXPECT_EQ(3u, root->renderSurface()->layer_list().size());
- EXPECT_EQ(2u, child1->renderSurface()->layer_list().size());
+ ASSERT_TRUE(child1->render_surface());
+ EXPECT_EQ(3u, root->render_surface()->layer_list().size());
+ EXPECT_EQ(2u, child1->render_surface()->layer_list().size());
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 18), rootDamageRect);
}
@@ -779,8 +779,8 @@ TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
//
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(childDamageRect.IsEmpty());
EXPECT_TRUE(rootDamageRect.IsEmpty());
@@ -788,8 +788,8 @@ TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
//
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(childDamageRect.IsEmpty());
EXPECT_TRUE(rootDamageRect.IsEmpty());
}
@@ -804,10 +804,10 @@ TEST_F(DamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent)
// In our specific tree, the update rect of child1 should not cause any damage to any
// surface because it does not actually draw content.
clearDamageForAllSurfaces(root.get());
- child1->setUpdateRect(gfx::RectF(0, 0, 1, 2));
+ child1->set_update_rect(gfx::RectF(0, 0, 1, 2));
emulateDrawingOneFrame(root.get());
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(childDamageRect.IsEmpty());
EXPECT_TRUE(rootDamageRect.IsEmpty());
}
@@ -825,36 +825,36 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
// For this test case, we modify grandChild2, and add grandChild3 to extend the bounds
// of child1's surface. This way, we can test reflection changes without changing
// contentBounds of the surface.
- grandChild2->setPosition(gfx::PointF(180, 180));
+ grandChild2->SetPosition(gfx::PointF(180, 180));
{
- scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(m_hostImpl.activeTree(), 6);
- grandChild3->setPosition(gfx::PointF(240, 240));
- grandChild3->setAnchorPoint(gfx::PointF());
- grandChild3->setBounds(gfx::Size(10, 10));
- grandChild3->setContentBounds(gfx::Size(10, 10));
- grandChild3->setDrawsContent(true);
- child1->addChild(grandChild3.Pass());
+ scoped_ptr<LayerImpl> grandChild3 = LayerImpl::Create(m_hostImpl.activeTree(), 6);
+ grandChild3->SetPosition(gfx::PointF(240, 240));
+ grandChild3->SetAnchorPoint(gfx::PointF());
+ grandChild3->SetBounds(gfx::Size(10, 10));
+ grandChild3->SetContentBounds(gfx::Size(10, 10));
+ grandChild3->SetDrawsContent(true);
+ child1->AddChild(grandChild3.Pass());
}
- child1->setOpacity(0.5);
+ child1->SetOpacity(0.5);
emulateDrawingOneFrame(root.get());
// CASE 1: adding a reflection about the left edge of grandChild1.
//
clearDamageForAllSurfaces(root.get());
{
- scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(m_hostImpl.activeTree(), 7);
- grandChild1Replica->setPosition(gfx::PointF());
- grandChild1Replica->setAnchorPoint(gfx::PointF());
+ scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::Create(m_hostImpl.activeTree(), 7);
+ grandChild1Replica->SetPosition(gfx::PointF());
+ grandChild1Replica->SetAnchorPoint(gfx::PointF());
gfx::Transform reflection;
reflection.Scale3d(-1, 1, 1);
- grandChild1Replica->setTransform(reflection);
- grandChild1->setReplicaLayer(grandChild1Replica.Pass());
+ grandChild1Replica->SetTransform(reflection);
+ grandChild1->SetReplicaLayer(grandChild1Replica.Pass());
}
emulateDrawingOneFrame(root.get());
- gfx::RectF grandChildDamageRect = grandChild1->renderSurface()->damage_tracker()->current_damage_rect();
- gfx::RectF childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF grandChildDamageRect = grandChild1->render_surface()->damage_tracker()->current_damage_rect();
+ gfx::RectF childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// The grandChild surface damage should not include its own replica. The child
// surface damage should include the normal and replica surfaces.
@@ -865,15 +865,15 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
// CASE 2: moving the descendant surface should cause both the original and reflected
// areas to be damaged on the target.
clearDamageForAllSurfaces(root.get());
- gfx::Rect oldContentRect = child1->renderSurface()->content_rect();
- grandChild1->setPosition(gfx::PointF(195, 205));
+ gfx::Rect oldContentRect = child1->render_surface()->content_rect();
+ grandChild1->SetPosition(gfx::PointF(195, 205));
emulateDrawingOneFrame(root.get());
- ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->content_rect().width());
- ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->content_rect().height());
+ ASSERT_EQ(oldContentRect.width(), child1->render_surface()->content_rect().width());
+ ASSERT_EQ(oldContentRect.height(), child1->render_surface()->content_rect().height());
- grandChildDamageRect = grandChild1->renderSurface()->damage_tracker()->current_damage_rect();
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ grandChildDamageRect = grandChild1->render_surface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
// The child surface damage should include normal and replica surfaces for both old and new locations.
// - old location in target space: gfx::RectF(194, 200, 12, 8)
@@ -885,14 +885,14 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
// CASE 3: removing the reflection should cause the entire region including reflection
// to damage the target surface.
clearDamageForAllSurfaces(root.get());
- grandChild1->setReplicaLayer(scoped_ptr<LayerImpl>());
+ grandChild1->SetReplicaLayer(scoped_ptr<LayerImpl>());
emulateDrawingOneFrame(root.get());
- ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->content_rect().width());
- ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->content_rect().height());
+ ASSERT_EQ(oldContentRect.width(), child1->render_surface()->content_rect().width());
+ ASSERT_EQ(oldContentRect.height(), child1->render_surface()->content_rect().height());
- EXPECT_FALSE(grandChild1->renderSurface());
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ EXPECT_FALSE(grandChild1->render_surface());
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(189, 205, 12, 8), childDamageRect);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(289, 305, 12, 8), rootDamageRect);
@@ -910,37 +910,37 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
// Set up the mask layer.
{
- scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(m_hostImpl.activeTree(), 3);
- maskLayer->setPosition(child->position());
- maskLayer->setAnchorPoint(gfx::PointF());
- maskLayer->setBounds(child->bounds());
- maskLayer->setContentBounds(child->bounds());
- child->setMaskLayer(maskLayer.Pass());
+ scoped_ptr<LayerImpl> maskLayer = LayerImpl::Create(m_hostImpl.activeTree(), 3);
+ maskLayer->SetPosition(child->position());
+ maskLayer->SetAnchorPoint(gfx::PointF());
+ maskLayer->SetBounds(child->bounds());
+ maskLayer->SetContentBounds(child->bounds());
+ child->SetMaskLayer(maskLayer.Pass());
}
- LayerImpl* maskLayer = child->maskLayer();
+ LayerImpl* maskLayer = child->mask_layer();
// Add opacity and a grandChild so that the render surface persists even after we remove the mask.
- child->setOpacity(0.5);
+ child->SetOpacity(0.5);
{
- scoped_ptr<LayerImpl> grandChild = LayerImpl::create(m_hostImpl.activeTree(), 4);
- grandChild->setPosition(gfx::PointF(2, 2));
- grandChild->setAnchorPoint(gfx::PointF());
- grandChild->setBounds(gfx::Size(2, 2));
- grandChild->setContentBounds(gfx::Size(2, 2));
- grandChild->setDrawsContent(true);
- child->addChild(grandChild.Pass());
+ scoped_ptr<LayerImpl> grandChild = LayerImpl::Create(m_hostImpl.activeTree(), 4);
+ grandChild->SetPosition(gfx::PointF(2, 2));
+ grandChild->SetAnchorPoint(gfx::PointF());
+ grandChild->SetBounds(gfx::Size(2, 2));
+ grandChild->SetContentBounds(gfx::Size(2, 2));
+ grandChild->SetDrawsContent(true);
+ child->AddChild(grandChild.Pass());
}
emulateDrawingOneFrame(root.get());
// Sanity check that a new surface was created for the child.
- ASSERT_TRUE(child->renderSurface());
+ ASSERT_TRUE(child->render_surface());
// CASE 1: the updateRect on a mask layer should damage the entire target surface.
//
clearDamageForAllSurfaces(root.get());
- maskLayer->setUpdateRect(gfx::RectF(1, 2, 3, 4));
+ maskLayer->set_update_rect(gfx::RectF(1, 2, 3, 4));
emulateDrawingOneFrame(root.get());
- gfx::RectF childDamageRect = child->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF childDamageRect = child->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
// CASE 2: a property change on the mask layer should damage the entire target surface.
@@ -949,15 +949,15 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
// Advance one frame without damage so that we know the damage rect is not leftover from the previous case.
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
- childDamageRect = child->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(childDamageRect.IsEmpty());
// Then test the property change.
clearDamageForAllSurfaces(root.get());
- maskLayer->setStackingOrderChanged(true);
+ maskLayer->SetStackingOrderChanged(true);
emulateDrawingOneFrame(root.get());
- childDamageRect = child->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
// CASE 3: removing the mask also damages the entire target surface.
@@ -966,19 +966,19 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
// Advance one frame without damage so that we know the damage rect is not leftover from the previous case.
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
- childDamageRect = child->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(childDamageRect.IsEmpty());
// Then test mask removal.
clearDamageForAllSurfaces(root.get());
- child->setMaskLayer(scoped_ptr<LayerImpl>());
- ASSERT_TRUE(child->layerPropertyChanged());
+ child->SetMaskLayer(scoped_ptr<LayerImpl>());
+ ASSERT_TRUE(child->LayerPropertyChanged());
emulateDrawingOneFrame(root.get());
// Sanity check that a render surface still exists.
- ASSERT_TRUE(child->renderSurface());
+ ASSERT_TRUE(child->render_surface());
- childDamageRect = child->renderSurface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
}
@@ -995,39 +995,39 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
// Create a reflection about the left edge of grandChild1.
{
- scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(m_hostImpl.activeTree(), 6);
- grandChild1Replica->setPosition(gfx::PointF());
- grandChild1Replica->setAnchorPoint(gfx::PointF());
+ scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::Create(m_hostImpl.activeTree(), 6);
+ grandChild1Replica->SetPosition(gfx::PointF());
+ grandChild1Replica->SetAnchorPoint(gfx::PointF());
gfx::Transform reflection;
reflection.Scale3d(-1, 1, 1);
- grandChild1Replica->setTransform(reflection);
- grandChild1->setReplicaLayer(grandChild1Replica.Pass());
+ grandChild1Replica->SetTransform(reflection);
+ grandChild1->SetReplicaLayer(grandChild1Replica.Pass());
}
- LayerImpl* grandChild1Replica = grandChild1->replicaLayer();
+ LayerImpl* grandChild1Replica = grandChild1->replica_layer();
// Set up the mask layer on the replica layer
{
- scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(m_hostImpl.activeTree(), 7);
- replicaMaskLayer->setPosition(gfx::PointF());
- replicaMaskLayer->setAnchorPoint(gfx::PointF());
- replicaMaskLayer->setBounds(grandChild1->bounds());
- replicaMaskLayer->setContentBounds(grandChild1->bounds());
- grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass());
+ scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::Create(m_hostImpl.activeTree(), 7);
+ replicaMaskLayer->SetPosition(gfx::PointF());
+ replicaMaskLayer->SetAnchorPoint(gfx::PointF());
+ replicaMaskLayer->SetBounds(grandChild1->bounds());
+ replicaMaskLayer->SetContentBounds(grandChild1->bounds());
+ grandChild1Replica->SetMaskLayer(replicaMaskLayer.Pass());
}
- LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer();
+ LayerImpl* replicaMaskLayer = grandChild1Replica->mask_layer();
emulateDrawingOneFrame(root.get());
// Sanity check that the appropriate render surfaces were created
- ASSERT_TRUE(grandChild1->renderSurface());
+ ASSERT_TRUE(grandChild1->render_surface());
// CASE 1: a property change on the mask should damage only the reflected region on the target surface.
clearDamageForAllSurfaces(root.get());
- replicaMaskLayer->setStackingOrderChanged(true);
+ replicaMaskLayer->SetStackingOrderChanged(true);
emulateDrawingOneFrame(root.get());
- gfx::RectF grandChildDamageRect = grandChild1->renderSurface()->damage_tracker()->current_damage_rect();
- gfx::RectF childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF grandChildDamageRect = grandChild1->render_surface()->damage_tracker()->current_damage_rect();
+ gfx::RectF childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(grandChildDamageRect.IsEmpty());
EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 6, 8), childDamageRect);
@@ -1035,11 +1035,11 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
// CASE 2: removing the replica mask damages only the reflected region on the target surface.
//
clearDamageForAllSurfaces(root.get());
- grandChild1Replica->setMaskLayer(scoped_ptr<LayerImpl>());
+ grandChild1Replica->SetMaskLayer(scoped_ptr<LayerImpl>());
emulateDrawingOneFrame(root.get());
- grandChildDamageRect = grandChild1->renderSurface()->damage_tracker()->current_damage_rect();
- childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
+ grandChildDamageRect = grandChild1->render_surface()->damage_tracker()->current_damage_rect();
+ childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(grandChildDamageRect.IsEmpty());
EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 6, 8), childDamageRect);
@@ -1054,42 +1054,42 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
// Verify that the correct replicaOriginTransform is used for the replicaMask;
clearDamageForAllSurfaces(root.get());
- grandChild1->setAnchorPoint(gfx::PointF(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point.
+ grandChild1->SetAnchorPoint(gfx::PointF(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point.
{
- scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(m_hostImpl.activeTree(), 6);
- grandChild1Replica->setPosition(gfx::PointF());
- grandChild1Replica->setAnchorPoint(gfx::PointF(1, 0)); // This is the anchor being tested.
+ scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::Create(m_hostImpl.activeTree(), 6);
+ grandChild1Replica->SetPosition(gfx::PointF());
+ grandChild1Replica->SetAnchorPoint(gfx::PointF(1, 0)); // This is the anchor being tested.
gfx::Transform reflection;
reflection.Scale3d(-1, 1, 1);
- grandChild1Replica->setTransform(reflection);
- grandChild1->setReplicaLayer(grandChild1Replica.Pass());
+ grandChild1Replica->SetTransform(reflection);
+ grandChild1->SetReplicaLayer(grandChild1Replica.Pass());
}
- LayerImpl* grandChild1Replica = grandChild1->replicaLayer();
+ LayerImpl* grandChild1Replica = grandChild1->replica_layer();
// Set up the mask layer on the replica layer
{
- scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(m_hostImpl.activeTree(), 7);
- replicaMaskLayer->setPosition(gfx::PointF());
- replicaMaskLayer->setAnchorPoint(gfx::PointF()); // note, this is not the anchor being tested.
- replicaMaskLayer->setBounds(grandChild1->bounds());
- replicaMaskLayer->setContentBounds(grandChild1->bounds());
- grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass());
+ scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::Create(m_hostImpl.activeTree(), 7);
+ replicaMaskLayer->SetPosition(gfx::PointF());
+ replicaMaskLayer->SetAnchorPoint(gfx::PointF()); // note, this is not the anchor being tested.
+ replicaMaskLayer->SetBounds(grandChild1->bounds());
+ replicaMaskLayer->SetContentBounds(grandChild1->bounds());
+ grandChild1Replica->SetMaskLayer(replicaMaskLayer.Pass());
}
- LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer();
+ LayerImpl* replicaMaskLayer = grandChild1Replica->mask_layer();
emulateDrawingOneFrame(root.get());
// Sanity check that the appropriate render surfaces were created
- ASSERT_TRUE(grandChild1->renderSurface());
+ ASSERT_TRUE(grandChild1->render_surface());
// A property change on the replicaMask should damage the reflected region on the target surface.
clearDamageForAllSurfaces(root.get());
- replicaMaskLayer->setStackingOrderChanged(true);
+ replicaMaskLayer->SetStackingOrderChanged(true);
emulateDrawingOneFrame(root.get());
- gfx::RectF childDamageRect = child1->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF childDamageRect = child1->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(206, 200, 6, 8), childDamageRect);
}
@@ -1102,19 +1102,19 @@ TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
// it takes priority over any other partial damage.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
- root->renderSurface()->damage_tracker()->ForceFullDamageNextUpdate();
+ child->set_update_rect(gfx::RectF(10, 11, 12, 13));
+ root->render_surface()->damage_tracker()->ForceFullDamageNextUpdate();
emulateDrawingOneFrame(root.get());
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
// Case 2: An additional sanity check that forcing full damage works even when nothing
// on the layer tree changed.
//
clearDamageForAllSurfaces(root.get());
- root->renderSurface()->damage_tracker()->ForceFullDamageNextUpdate();
+ root->render_surface()->damage_tracker()->ForceFullDamageNextUpdate();
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
}
@@ -1123,11 +1123,11 @@ TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList)
// Though it should never happen, its a good idea to verify that the damage tracker
// does not crash when it receives an empty layerList.
- scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl.activeTree(), 1);
- root->createRenderSurface();
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ root->CreateRenderSurface();
- ASSERT_TRUE(root == root->renderTarget());
- RenderSurfaceImpl* targetSurface = root->renderSurface();
+ ASSERT_TRUE(root == root->render_target());
+ RenderSurfaceImpl* targetSurface = root->render_surface();
targetSurface->ClearLayerLists();
targetSurface->damage_tracker()->UpdateDamageTrackingState(targetSurface->layer_list(), targetSurface->OwningLayerId(), false, gfx::Rect(), 0, WebFilterOperations(), 0);
@@ -1143,27 +1143,27 @@ TEST_F(DamageTrackerTest, verifyDamageAccumulatesUntilReset)
LayerImpl* child = root->children()[0];
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(gfx::RectF(10, 11, 1, 2));
+ child->set_update_rect(gfx::RectF(10, 11, 1, 2));
emulateDrawingOneFrame(root.get());
// Sanity check damage after the first frame; this isnt the actual test yet.
- gfx::RectF rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ gfx::RectF rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 1, 2), rootDamageRect);
// New damage, without having cleared the previous damage, should be unioned to the previous one.
- child->setUpdateRect(gfx::RectF(20, 25, 1, 2));
+ child->set_update_rect(gfx::RectF(20, 25, 1, 2));
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 11, 16), rootDamageRect);
// If we notify the damage tracker that we drew the damaged area, then damage should be emptied.
- root->renderSurface()->damage_tracker()->DidDrawDamagedArea();
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ root->render_surface()->damage_tracker()->DidDrawDamagedArea();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(rootDamageRect.IsEmpty());
// Damage should remain empty even after one frame, since there's yet no new damage
emulateDrawingOneFrame(root.get());
- rootDamageRect = root->renderSurface()->damage_tracker()->current_damage_rect();
+ rootDamageRect = root->render_surface()->damage_tracker()->current_damage_rect();
EXPECT_TRUE(rootDamageRect.IsEmpty());
}
« no previous file with comments | « cc/damage_tracker.cc ('k') | cc/debug_rect_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698