| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { | 32 class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { |
| 33 public: | 33 public: |
| 34 LayerTreeHostScrollTestScrollSimple() | 34 LayerTreeHostScrollTestScrollSimple() |
| 35 : initial_scroll_(10, 20), | 35 : initial_scroll_(10, 20), |
| 36 second_scroll_(40, 5), | 36 second_scroll_(40, 5), |
| 37 scroll_amount_(2, -1), | 37 scroll_amount_(2, -1), |
| 38 num_scrolls_(0) {} | 38 num_scrolls_(0) {} |
| 39 | 39 |
| 40 void BeginTest() override { | 40 void BeginTest() override { |
| 41 Layer* root_layer = layer_tree_host()->root_layer(); | 41 Layer* root_layer = layer_tree_host()->root_layer(); |
| 42 scoped_refptr<Layer> scroll_layer = Layer::Create(); | 42 scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); |
| 43 root_layer->AddChild(scroll_layer); | 43 root_layer->AddChild(scroll_layer); |
| 44 // Create an effective max_scroll_offset of (100, 100). | 44 // Create an effective max_scroll_offset of (100, 100). |
| 45 scroll_layer->SetBounds(gfx::Size(root_layer->bounds().width() + 100, | 45 scroll_layer->SetBounds(gfx::Size(root_layer->bounds().width() + 100, |
| 46 root_layer->bounds().height() + 100)); | 46 root_layer->bounds().height() + 100)); |
| 47 scroll_layer->SetIsDrawable(true); | 47 scroll_layer->SetIsDrawable(true); |
| 48 scroll_layer->SetIsContainerForFixedPositionLayers(true); | 48 scroll_layer->SetIsContainerForFixedPositionLayers(true); |
| 49 scroll_layer->SetScrollClipLayerId(root_layer->id()); | 49 scroll_layer->SetScrollClipLayerId(root_layer->id()); |
| 50 scroll_layer->SetScrollOffset(initial_scroll_); | 50 scroll_layer->SetScrollOffset(initial_scroll_); |
| 51 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, scroll_layer, | 51 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, scroll_layer, |
| 52 NULL); | 52 NULL); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSimple); | 110 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSimple); |
| 111 | 111 |
| 112 class LayerTreeHostScrollTestScrollMultipleRedraw | 112 class LayerTreeHostScrollTestScrollMultipleRedraw |
| 113 : public LayerTreeHostScrollTest { | 113 : public LayerTreeHostScrollTest { |
| 114 public: | 114 public: |
| 115 LayerTreeHostScrollTestScrollMultipleRedraw() | 115 LayerTreeHostScrollTestScrollMultipleRedraw() |
| 116 : initial_scroll_(40, 10), scroll_amount_(-3, 17), num_scrolls_(0) {} | 116 : initial_scroll_(40, 10), scroll_amount_(-3, 17), num_scrolls_(0) {} |
| 117 | 117 |
| 118 void BeginTest() override { | 118 void BeginTest() override { |
| 119 Layer* root_layer = layer_tree_host()->root_layer(); | 119 Layer* root_layer = layer_tree_host()->root_layer(); |
| 120 scroll_layer_ = Layer::Create(); | 120 scroll_layer_ = Layer::Create(layer_settings()); |
| 121 root_layer->AddChild(scroll_layer_); | 121 root_layer->AddChild(scroll_layer_); |
| 122 // Create an effective max_scroll_offset of (100, 100). | 122 // Create an effective max_scroll_offset of (100, 100). |
| 123 scroll_layer_->SetBounds(gfx::Size(root_layer->bounds().width() + 100, | 123 scroll_layer_->SetBounds(gfx::Size(root_layer->bounds().width() + 100, |
| 124 root_layer->bounds().height() + 100)); | 124 root_layer->bounds().height() + 100)); |
| 125 scroll_layer_->SetIsDrawable(true); | 125 scroll_layer_->SetIsDrawable(true); |
| 126 scroll_layer_->SetIsContainerForFixedPositionLayers(true); | 126 scroll_layer_->SetIsContainerForFixedPositionLayers(true); |
| 127 scroll_layer_->SetScrollClipLayerId(root_layer->id()); | 127 scroll_layer_->SetScrollClipLayerId(root_layer->id()); |
| 128 scroll_layer_->SetScrollOffset(initial_scroll_); | 128 scroll_layer_->SetScrollOffset(initial_scroll_); |
| 129 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, scroll_layer_, | 129 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, scroll_layer_, |
| 130 NULL); | 130 NULL); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 num_will_commits_(0), | 214 num_will_commits_(0), |
| 215 num_did_commits_(0), | 215 num_did_commits_(0), |
| 216 num_impl_commits_(0), | 216 num_impl_commits_(0), |
| 217 num_impl_scrolls_(0) {} | 217 num_impl_scrolls_(0) {} |
| 218 | 218 |
| 219 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 219 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 220 | 220 |
| 221 void SetupTree() override { | 221 void SetupTree() override { |
| 222 LayerTreeHostScrollTest::SetupTree(); | 222 LayerTreeHostScrollTest::SetupTree(); |
| 223 Layer* root_layer = layer_tree_host()->root_layer(); | 223 Layer* root_layer = layer_tree_host()->root_layer(); |
| 224 scoped_refptr<Layer> root_scroll_layer = Layer::Create(); | 224 scoped_refptr<Layer> root_scroll_layer = Layer::Create(layer_settings()); |
| 225 root_scroll_layer->SetScrollClipLayerId(root_layer->id()); | 225 root_scroll_layer->SetScrollClipLayerId(root_layer->id()); |
| 226 root_scroll_layer->SetScrollOffset(initial_scroll_); | 226 root_scroll_layer->SetScrollOffset(initial_scroll_); |
| 227 root_scroll_layer->SetBounds(gfx::Size(200, 200)); | 227 root_scroll_layer->SetBounds(gfx::Size(200, 200)); |
| 228 root_scroll_layer->SetIsDrawable(true); | 228 root_scroll_layer->SetIsDrawable(true); |
| 229 root_scroll_layer->SetIsContainerForFixedPositionLayers(true); | 229 root_scroll_layer->SetIsContainerForFixedPositionLayers(true); |
| 230 root_layer->AddChild(root_scroll_layer); | 230 root_layer->AddChild(root_scroll_layer); |
| 231 | 231 |
| 232 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, | 232 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, |
| 233 root_scroll_layer, NULL); | 233 root_scroll_layer, NULL); |
| 234 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); | 234 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 396 |
| 397 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommit); | 397 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommit); |
| 398 | 398 |
| 399 class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { | 399 class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { |
| 400 public: | 400 public: |
| 401 LayerTreeHostScrollTestFractionalScroll() : scroll_amount_(1.75, 0) {} | 401 LayerTreeHostScrollTestFractionalScroll() : scroll_amount_(1.75, 0) {} |
| 402 | 402 |
| 403 void SetupTree() override { | 403 void SetupTree() override { |
| 404 LayerTreeHostScrollTest::SetupTree(); | 404 LayerTreeHostScrollTest::SetupTree(); |
| 405 Layer* root_layer = layer_tree_host()->root_layer(); | 405 Layer* root_layer = layer_tree_host()->root_layer(); |
| 406 scoped_refptr<Layer> root_scroll_layer = Layer::Create(); | 406 scoped_refptr<Layer> root_scroll_layer = Layer::Create(layer_settings()); |
| 407 root_scroll_layer->SetScrollClipLayerId(root_layer->id()); | 407 root_scroll_layer->SetScrollClipLayerId(root_layer->id()); |
| 408 root_scroll_layer->SetBounds( | 408 root_scroll_layer->SetBounds( |
| 409 gfx::Size(root_layer->bounds().width() + 100, | 409 gfx::Size(root_layer->bounds().width() + 100, |
| 410 root_layer->bounds().height() + 100)); | 410 root_layer->bounds().height() + 100)); |
| 411 root_scroll_layer->SetIsDrawable(true); | 411 root_scroll_layer->SetIsDrawable(true); |
| 412 root_scroll_layer->SetIsContainerForFixedPositionLayers(true); | 412 root_scroll_layer->SetIsContainerForFixedPositionLayers(true); |
| 413 root_layer->AddChild(root_scroll_layer); | 413 root_layer->AddChild(root_scroll_layer); |
| 414 | 414 |
| 415 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, | 415 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, |
| 416 root_scroll_layer, NULL); | 416 root_scroll_layer, NULL); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 public: | 463 public: |
| 464 LayerTreeHostScrollTestCaseWithChild() | 464 LayerTreeHostScrollTestCaseWithChild() |
| 465 : initial_offset_(10, 20), | 465 : initial_offset_(10, 20), |
| 466 javascript_scroll_(40, 5), | 466 javascript_scroll_(40, 5), |
| 467 scroll_amount_(2, -1), | 467 scroll_amount_(2, -1), |
| 468 num_scrolls_(0) {} | 468 num_scrolls_(0) {} |
| 469 | 469 |
| 470 void SetupTree() override { | 470 void SetupTree() override { |
| 471 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); | 471 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); |
| 472 | 472 |
| 473 scoped_refptr<Layer> root_layer = Layer::Create(); | 473 scoped_refptr<Layer> root_layer = Layer::Create(layer_settings()); |
| 474 root_layer->SetBounds(gfx::Size(10, 10)); | 474 root_layer->SetBounds(gfx::Size(10, 10)); |
| 475 | 475 |
| 476 root_scroll_layer_ = FakePictureLayer::Create(&fake_content_layer_client_); | 476 root_scroll_layer_ = |
| 477 FakePictureLayer::Create(layer_settings(), &fake_content_layer_client_); |
| 477 root_scroll_layer_->SetBounds(gfx::Size(110, 110)); | 478 root_scroll_layer_->SetBounds(gfx::Size(110, 110)); |
| 478 | 479 |
| 479 root_scroll_layer_->SetPosition(gfx::Point()); | 480 root_scroll_layer_->SetPosition(gfx::Point()); |
| 480 | 481 |
| 481 root_scroll_layer_->SetIsDrawable(true); | 482 root_scroll_layer_->SetIsDrawable(true); |
| 482 root_scroll_layer_->SetScrollClipLayerId(root_layer->id()); | 483 root_scroll_layer_->SetScrollClipLayerId(root_layer->id()); |
| 483 root_scroll_layer_->SetIsContainerForFixedPositionLayers(true); | 484 root_scroll_layer_->SetIsContainerForFixedPositionLayers(true); |
| 484 root_layer->AddChild(root_scroll_layer_); | 485 root_layer->AddChild(root_scroll_layer_); |
| 485 | 486 |
| 486 child_layer_ = FakePictureLayer::Create(&fake_content_layer_client_); | 487 child_layer_ = |
| 488 FakePictureLayer::Create(layer_settings(), &fake_content_layer_client_); |
| 487 child_layer_->set_did_scroll_callback( | 489 child_layer_->set_did_scroll_callback( |
| 488 base::Bind(&LayerTreeHostScrollTestCaseWithChild::DidScroll, | 490 base::Bind(&LayerTreeHostScrollTestCaseWithChild::DidScroll, |
| 489 base::Unretained(this))); | 491 base::Unretained(this))); |
| 490 child_layer_->SetBounds(gfx::Size(110, 110)); | 492 child_layer_->SetBounds(gfx::Size(110, 110)); |
| 491 | 493 |
| 492 if (scroll_child_layer_) { | 494 if (scroll_child_layer_) { |
| 493 // Scrolls on the child layer will happen at 5, 5. If they are treated | 495 // Scrolls on the child layer will happen at 5, 5. If they are treated |
| 494 // like device pixels, and device scale factor is 2, then they will | 496 // like device pixels, and device scale factor is 2, then they will |
| 495 // be considered at 2.5, 2.5 in logical pixels, and will miss this layer. | 497 // be considered at 2.5, 2.5 in logical pixels, and will miss this layer. |
| 496 child_layer_->SetPosition(gfx::Point(5, 5)); | 498 child_layer_->SetPosition(gfx::Point(5, 5)); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 ImplSidePaintingScrollTestSimple() | 769 ImplSidePaintingScrollTestSimple() |
| 768 : initial_scroll_(10, 20), | 770 : initial_scroll_(10, 20), |
| 769 main_thread_scroll_(40, 5), | 771 main_thread_scroll_(40, 5), |
| 770 impl_thread_scroll1_(2, -1), | 772 impl_thread_scroll1_(2, -1), |
| 771 impl_thread_scroll2_(-3, 10), | 773 impl_thread_scroll2_(-3, 10), |
| 772 num_scrolls_(0) {} | 774 num_scrolls_(0) {} |
| 773 | 775 |
| 774 void SetupTree() override { | 776 void SetupTree() override { |
| 775 LayerTreeHostScrollTest::SetupTree(); | 777 LayerTreeHostScrollTest::SetupTree(); |
| 776 Layer* root_layer = layer_tree_host()->root_layer(); | 778 Layer* root_layer = layer_tree_host()->root_layer(); |
| 777 scoped_refptr<Layer> root_scroll_layer = Layer::Create(); | 779 scoped_refptr<Layer> root_scroll_layer = Layer::Create(layer_settings()); |
| 778 root_scroll_layer->SetScrollClipLayerId(root_layer->id()); | 780 root_scroll_layer->SetScrollClipLayerId(root_layer->id()); |
| 779 root_scroll_layer->SetScrollOffset(initial_scroll_); | 781 root_scroll_layer->SetScrollOffset(initial_scroll_); |
| 780 root_scroll_layer->SetBounds( | 782 root_scroll_layer->SetBounds( |
| 781 gfx::Size(root_layer->bounds().width() + 100, | 783 gfx::Size(root_layer->bounds().width() + 100, |
| 782 root_layer->bounds().height() + 100)); | 784 root_layer->bounds().height() + 100)); |
| 783 root_scroll_layer->SetIsDrawable(true); | 785 root_scroll_layer->SetIsDrawable(true); |
| 784 root_scroll_layer->SetIsContainerForFixedPositionLayers(true); | 786 root_scroll_layer->SetIsContainerForFixedPositionLayers(true); |
| 785 root_layer->AddChild(root_scroll_layer); | 787 root_layer->AddChild(root_scroll_layer); |
| 786 | 788 |
| 787 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, | 789 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 // push properties. | 894 // push properties. |
| 893 class ImplSidePaintingScrollTestImplOnlyScroll | 895 class ImplSidePaintingScrollTestImplOnlyScroll |
| 894 : public ImplSidePaintingScrollTest { | 896 : public ImplSidePaintingScrollTest { |
| 895 public: | 897 public: |
| 896 ImplSidePaintingScrollTestImplOnlyScroll() | 898 ImplSidePaintingScrollTestImplOnlyScroll() |
| 897 : initial_scroll_(20, 10), impl_thread_scroll_(-2, 3), impl_scale_(2.f) {} | 899 : initial_scroll_(20, 10), impl_thread_scroll_(-2, 3), impl_scale_(2.f) {} |
| 898 | 900 |
| 899 void SetupTree() override { | 901 void SetupTree() override { |
| 900 LayerTreeHostScrollTest::SetupTree(); | 902 LayerTreeHostScrollTest::SetupTree(); |
| 901 Layer* root_layer = layer_tree_host()->root_layer(); | 903 Layer* root_layer = layer_tree_host()->root_layer(); |
| 902 scoped_refptr<Layer> root_scroll_layer = Layer::Create(); | 904 scoped_refptr<Layer> root_scroll_layer = Layer::Create(layer_settings()); |
| 903 root_scroll_layer->SetScrollClipLayerId(root_layer->id()); | 905 root_scroll_layer->SetScrollClipLayerId(root_layer->id()); |
| 904 root_scroll_layer->SetScrollOffset(initial_scroll_); | 906 root_scroll_layer->SetScrollOffset(initial_scroll_); |
| 905 root_scroll_layer->SetBounds( | 907 root_scroll_layer->SetBounds( |
| 906 gfx::Size(root_layer->bounds().width() + 100, | 908 gfx::Size(root_layer->bounds().width() + 100, |
| 907 root_layer->bounds().height() + 100)); | 909 root_layer->bounds().height() + 100)); |
| 908 root_scroll_layer->SetIsDrawable(true); | 910 root_scroll_layer->SetIsDrawable(true); |
| 909 root_scroll_layer->SetIsContainerForFixedPositionLayers(true); | 911 root_scroll_layer->SetIsContainerForFixedPositionLayers(true); |
| 910 root_layer->AddChild(root_scroll_layer); | 912 root_layer->AddChild(root_scroll_layer); |
| 911 | 913 |
| 912 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, | 914 layer_tree_host()->RegisterViewportLayers(NULL, root_layer, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 | 1028 |
| 1027 MULTI_THREAD_TEST_F(ImplSidePaintingScrollTestImplOnlyScroll); | 1029 MULTI_THREAD_TEST_F(ImplSidePaintingScrollTestImplOnlyScroll); |
| 1028 | 1030 |
| 1029 class LayerTreeHostScrollTestScrollZeroMaxScrollOffset | 1031 class LayerTreeHostScrollTestScrollZeroMaxScrollOffset |
| 1030 : public LayerTreeHostScrollTest { | 1032 : public LayerTreeHostScrollTest { |
| 1031 public: | 1033 public: |
| 1032 LayerTreeHostScrollTestScrollZeroMaxScrollOffset() {} | 1034 LayerTreeHostScrollTestScrollZeroMaxScrollOffset() {} |
| 1033 | 1035 |
| 1034 void SetupTree() override { | 1036 void SetupTree() override { |
| 1035 LayerTreeTest::SetupTree(); | 1037 LayerTreeTest::SetupTree(); |
| 1036 scoped_refptr<Layer> scroll_layer = Layer::Create(); | 1038 scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); |
| 1037 layer_tree_host()->root_layer()->AddChild(scroll_layer); | 1039 layer_tree_host()->root_layer()->AddChild(scroll_layer); |
| 1038 } | 1040 } |
| 1039 | 1041 |
| 1040 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1042 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1041 | 1043 |
| 1042 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 1044 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 1043 LayerImpl* root = impl->active_tree()->root_layer(); | 1045 LayerImpl* root = impl->active_tree()->root_layer(); |
| 1044 LayerImpl* scroll_layer = root->children()[0]; | 1046 LayerImpl* scroll_layer = root->children()[0]; |
| 1045 scroll_layer->SetScrollClipLayer(root->id()); | 1047 scroll_layer->SetScrollClipLayer(root->id()); |
| 1046 | 1048 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 EXPECT_TRUE(received_stop_flinging); | 1151 EXPECT_TRUE(received_stop_flinging); |
| 1150 } | 1152 } |
| 1151 | 1153 |
| 1152 class LayerTreeHostScrollTestLayerStructureChange | 1154 class LayerTreeHostScrollTestLayerStructureChange |
| 1153 : public LayerTreeHostScrollTest { | 1155 : public LayerTreeHostScrollTest { |
| 1154 public: | 1156 public: |
| 1155 LayerTreeHostScrollTestLayerStructureChange() | 1157 LayerTreeHostScrollTestLayerStructureChange() |
| 1156 : scroll_destroy_whole_tree_(false) {} | 1158 : scroll_destroy_whole_tree_(false) {} |
| 1157 | 1159 |
| 1158 void SetupTree() override { | 1160 void SetupTree() override { |
| 1159 scoped_refptr<Layer> root_layer = Layer::Create(); | 1161 scoped_refptr<Layer> root_layer = Layer::Create(layer_settings()); |
| 1160 root_layer->SetBounds(gfx::Size(10, 10)); | 1162 root_layer->SetBounds(gfx::Size(10, 10)); |
| 1161 | 1163 |
| 1162 Layer* root_scroll_layer = | 1164 Layer* root_scroll_layer = |
| 1163 CreateScrollLayer(root_layer.get(), &root_scroll_layer_client_); | 1165 CreateScrollLayer(root_layer.get(), &root_scroll_layer_client_); |
| 1164 CreateScrollLayer(root_layer.get(), &sibling_scroll_layer_client_); | 1166 CreateScrollLayer(root_layer.get(), &sibling_scroll_layer_client_); |
| 1165 CreateScrollLayer(root_scroll_layer, &child_scroll_layer_client_); | 1167 CreateScrollLayer(root_scroll_layer, &child_scroll_layer_client_); |
| 1166 | 1168 |
| 1167 layer_tree_host()->SetRootLayer(root_layer); | 1169 layer_tree_host()->SetRootLayer(root_layer); |
| 1168 LayerTreeHostScrollTest::SetupTree(); | 1170 LayerTreeHostScrollTest::SetupTree(); |
| 1169 } | 1171 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 public: | 1203 public: |
| 1202 void DidScroll() { | 1204 void DidScroll() { |
| 1203 owner_->DidScroll(layer_); | 1205 owner_->DidScroll(layer_); |
| 1204 } | 1206 } |
| 1205 LayerTreeHostScrollTestLayerStructureChange* owner_; | 1207 LayerTreeHostScrollTestLayerStructureChange* owner_; |
| 1206 Layer* layer_; | 1208 Layer* layer_; |
| 1207 }; | 1209 }; |
| 1208 | 1210 |
| 1209 Layer* CreateScrollLayer(Layer* parent, FakeLayerScrollClient* client) { | 1211 Layer* CreateScrollLayer(Layer* parent, FakeLayerScrollClient* client) { |
| 1210 scoped_refptr<PictureLayer> scroll_layer = | 1212 scoped_refptr<PictureLayer> scroll_layer = |
| 1211 PictureLayer::Create(&fake_content_layer_client_); | 1213 PictureLayer::Create(layer_settings(), &fake_content_layer_client_); |
| 1212 scroll_layer->SetBounds(gfx::Size(110, 110)); | 1214 scroll_layer->SetBounds(gfx::Size(110, 110)); |
| 1213 scroll_layer->SetPosition(gfx::Point(0, 0)); | 1215 scroll_layer->SetPosition(gfx::Point(0, 0)); |
| 1214 scroll_layer->SetIsDrawable(true); | 1216 scroll_layer->SetIsDrawable(true); |
| 1215 scroll_layer->SetScrollClipLayerId(parent->id()); | 1217 scroll_layer->SetScrollClipLayerId(parent->id()); |
| 1216 scroll_layer->SetBounds(gfx::Size(parent->bounds().width() + 100, | 1218 scroll_layer->SetBounds(gfx::Size(parent->bounds().width() + 100, |
| 1217 parent->bounds().height() + 100)); | 1219 parent->bounds().height() + 100)); |
| 1218 scroll_layer->set_did_scroll_callback(base::Bind( | 1220 scroll_layer->set_did_scroll_callback(base::Bind( |
| 1219 &FakeLayerScrollClient::DidScroll, base::Unretained(client))); | 1221 &FakeLayerScrollClient::DidScroll, base::Unretained(client))); |
| 1220 client->owner_ = this; | 1222 client->owner_ = this; |
| 1221 client->layer_ = scroll_layer.get(); | 1223 client->layer_ = scroll_layer.get(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1236 RunTest(true, false, true); | 1238 RunTest(true, false, true); |
| 1237 } | 1239 } |
| 1238 | 1240 |
| 1239 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1241 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
| 1240 scroll_destroy_whole_tree_ = true; | 1242 scroll_destroy_whole_tree_ = true; |
| 1241 RunTest(true, false, true); | 1243 RunTest(true, false, true); |
| 1242 } | 1244 } |
| 1243 | 1245 |
| 1244 } // namespace | 1246 } // namespace |
| 1245 } // namespace cc | 1247 } // namespace cc |
| OLD | NEW |