| Index: cc/trees/layer_tree_host_unittest_damage.cc
|
| diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc
|
| index 76c26f6682e9c35bf8fdbf75506167a702213575..a9afb92b67c93c98150989cef22a5b07c71f7824 100644
|
| --- a/cc/trees/layer_tree_host_unittest_damage.cc
|
| +++ b/cc/trees/layer_tree_host_unittest_damage.cc
|
| @@ -338,26 +338,26 @@ class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest {
|
| layer_tree_host()->SetRootLayer(root_layer);
|
|
|
| scoped_refptr<Layer> scroll_clip_layer = Layer::Create();
|
| - scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_);
|
| - content_layer->SetScrollClipLayerId(scroll_clip_layer->id());
|
| - content_layer->SetScrollOffset(gfx::ScrollOffset(10, 20));
|
| - content_layer->SetBounds(gfx::Size(100, 200));
|
| - content_layer->SetIsDrawable(true);
|
| + content_layer_ = FakePictureLayer::Create(&client_);
|
| + content_layer_->SetScrollClipLayerId(scroll_clip_layer->id());
|
| + content_layer_->SetScrollOffset(gfx::ScrollOffset(10, 20));
|
| + content_layer_->SetBounds(gfx::Size(100, 200));
|
| + content_layer_->SetIsDrawable(true);
|
| scroll_clip_layer->SetBounds(
|
| - gfx::Size(content_layer->bounds().width() - 30,
|
| - content_layer->bounds().height() - 50));
|
| - scroll_clip_layer->AddChild(content_layer);
|
| + gfx::Size(content_layer_->bounds().width() - 30,
|
| + content_layer_->bounds().height() - 50));
|
| + scroll_clip_layer->AddChild(content_layer_);
|
| root_layer->AddChild(scroll_clip_layer);
|
|
|
| scoped_refptr<Layer> scrollbar_layer =
|
| - FakePaintedScrollbarLayer::Create(false, true, content_layer->id());
|
| + FakePaintedScrollbarLayer::Create(false, true, content_layer_->id());
|
| scrollbar_layer->SetPosition(gfx::PointF(300.f, 300.f));
|
| scrollbar_layer->SetBounds(gfx::Size(10, 100));
|
| - scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(content_layer->id());
|
| + scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(content_layer_->id());
|
| root_layer->AddChild(scrollbar_layer);
|
|
|
| - gfx::RectF content_rect(content_layer->position(),
|
| - gfx::SizeF(content_layer->bounds()));
|
| + gfx::RectF content_rect(content_layer_->position(),
|
| + gfx::SizeF(content_layer_->bounds()));
|
| gfx::RectF scrollbar_rect(scrollbar_layer->position(),
|
| gfx::SizeF(scrollbar_layer->bounds()));
|
| EXPECT_FALSE(content_rect.Intersects(scrollbar_rect));
|
| @@ -368,6 +368,9 @@ class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest {
|
|
|
| private:
|
| FakeContentLayerClient client_;
|
| +
|
| + protected:
|
| + scoped_refptr<Layer> content_layer_;
|
| };
|
|
|
| class LayerTreeHostDamageTestScrollbarDoesDamage
|
| @@ -410,9 +413,8 @@ class LayerTreeHostDamageTestScrollbarDoesDamage
|
| void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override {
|
| ++did_swaps_;
|
| EXPECT_TRUE(result);
|
| - LayerImpl* root = host_impl->active_tree()->root_layer();
|
| - LayerImpl* scroll_clip_layer = root->children()[0];
|
| - LayerImpl* scroll_layer = scroll_clip_layer->children()[0];
|
| + LayerImpl* scroll_layer =
|
| + host_impl->active_tree()->LayerById(content_layer_->id());
|
| switch (did_swaps_) {
|
| case 1:
|
| // Test that modifying the position of the content layer (not
|
| @@ -439,18 +441,13 @@ class LayerTreeHostDamageTestScrollbarDoesDamage
|
|
|
| void ModifyContentLayerPosition() {
|
| EXPECT_EQ(1, did_swaps_);
|
| - Layer* root = layer_tree_host()->root_layer();
|
| - Layer* scroll_clip_layer = root->child_at(0);
|
| - Layer* scroll_layer = scroll_clip_layer->child_at(0);
|
| - scroll_layer->SetPosition(gfx::PointF(10.f, 10.f));
|
| + content_layer_->SetPosition(gfx::PointF(10.f, 10.f));
|
| }
|
|
|
| void ResizeScrollLayer() {
|
| EXPECT_EQ(3, did_swaps_);
|
| Layer* root = layer_tree_host()->root_layer();
|
| - Layer* scroll_clip_layer = root->child_at(0);
|
| - Layer* scroll_layer = scroll_clip_layer->child_at(0);
|
| - scroll_layer->SetBounds(
|
| + content_layer_->SetBounds(
|
| gfx::Size(root->bounds().width() + 60, root->bounds().height() + 100));
|
| }
|
|
|
| @@ -503,9 +500,8 @@ class LayerTreeHostDamageTestScrollbarCommitDoesNoDamage
|
| void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override {
|
| ++did_swaps_;
|
| EXPECT_TRUE(result);
|
| - LayerImpl* root = host_impl->active_tree()->root_layer();
|
| - LayerImpl* scroll_clip_layer = root->children()[0];
|
| - LayerImpl* scroll_layer = scroll_clip_layer->children()[0];
|
| + LayerImpl* scroll_layer =
|
| + host_impl->active_tree()->LayerById(content_layer_->id());
|
| switch (did_swaps_) {
|
| case 1:
|
| // Scroll on the thread. This should damage the scrollbar for the
|
|
|