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

Side by Side Diff: cc/trees/layer_tree_host_unittest_scroll.cc

Issue 2253143002: Revert of cc: Move data to LayerTree from LayerTreeHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@layer_tree_change
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 static ScrollTree* ScrollTreeForLayer(LayerImpl* layer_impl) { 61 static ScrollTree* ScrollTreeForLayer(LayerImpl* layer_impl) {
62 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree; 62 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree;
63 } 63 }
64 64
65 class LayerTreeHostScrollTest : public LayerTreeTest { 65 class LayerTreeHostScrollTest : public LayerTreeTest {
66 protected: 66 protected:
67 void SetupTree() override { 67 void SetupTree() override {
68 LayerTreeTest::SetupTree(); 68 LayerTreeTest::SetupTree();
69 Layer* root_layer = layer_tree()->root_layer(); 69 Layer* root_layer = layer_tree_host()->root_layer();
70 70
71 // Create an effective max_scroll_offset of (100, 100). 71 // Create an effective max_scroll_offset of (100, 100).
72 gfx::Size scroll_layer_bounds(root_layer->bounds().width() + 100, 72 gfx::Size scroll_layer_bounds(root_layer->bounds().width() + 100,
73 root_layer->bounds().height() + 100); 73 root_layer->bounds().height() + 100);
74 74
75 CreateVirtualViewportLayers(root_layer, root_layer->bounds(), 75 CreateVirtualViewportLayers(root_layer, root_layer->bounds(),
76 root_layer->bounds(), scroll_layer_bounds, 76 root_layer->bounds(), scroll_layer_bounds,
77 layer_tree_host()); 77 layer_tree_host());
78 } 78 }
79 }; 79 };
80 80
81 class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { 81 class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest {
82 public: 82 public:
83 LayerTreeHostScrollTestScrollSimple() 83 LayerTreeHostScrollTestScrollSimple()
84 : initial_scroll_(10, 20), 84 : initial_scroll_(10, 20),
85 second_scroll_(40, 5), 85 second_scroll_(40, 5),
86 scroll_amount_(2, -1), 86 scroll_amount_(2, -1),
87 num_scrolls_(0) {} 87 num_scrolls_(0) {}
88 88
89 void BeginTest() override { 89 void BeginTest() override {
90 outer_viewport_container_layer_id_ = 90 outer_viewport_container_layer_id_ = layer_tree_host()
91 layer_tree()->outer_viewport_scroll_layer()->scroll_clip_layer()->id(); 91 ->outer_viewport_scroll_layer()
92 layer_tree()->outer_viewport_scroll_layer()->SetScrollOffset( 92 ->scroll_clip_layer()
93 ->id();
94 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset(
93 initial_scroll_); 95 initial_scroll_);
94 layer_tree()->outer_viewport_scroll_layer()->set_did_scroll_callback( 96 layer_tree_host()->outer_viewport_scroll_layer()->set_did_scroll_callback(
95 base::Bind(&LayerTreeHostScrollTestScrollSimple::DidScrollOuterViewport, 97 base::Bind(&LayerTreeHostScrollTestScrollSimple::DidScrollOuterViewport,
96 base::Unretained(this))); 98 base::Unretained(this)));
97 PostSetNeedsCommitToMainThread(); 99 PostSetNeedsCommitToMainThread();
98 } 100 }
99 101
100 void UpdateLayerTreeHost() override { 102 void UpdateLayerTreeHost() override {
101 Layer* scroll_layer = layer_tree()->outer_viewport_scroll_layer(); 103 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer();
102 if (!layer_tree_host()->source_frame_number()) { 104 if (!layer_tree_host()->source_frame_number()) {
103 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->scroll_offset()); 105 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->scroll_offset());
104 } else { 106 } else {
105 EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(initial_scroll_, 107 EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(initial_scroll_,
106 scroll_amount_), 108 scroll_amount_),
107 scroll_layer->scroll_offset()); 109 scroll_layer->scroll_offset());
108 110
109 // Pretend like Javascript updated the scroll position itself. 111 // Pretend like Javascript updated the scroll position itself.
110 scroll_layer->SetScrollOffset(second_scroll_); 112 scroll_layer->SetScrollOffset(second_scroll_);
111 } 113 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 155
154 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSimple); 156 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSimple);
155 157
156 class LayerTreeHostScrollTestScrollMultipleRedraw 158 class LayerTreeHostScrollTestScrollMultipleRedraw
157 : public LayerTreeHostScrollTest { 159 : public LayerTreeHostScrollTest {
158 public: 160 public:
159 LayerTreeHostScrollTestScrollMultipleRedraw() 161 LayerTreeHostScrollTestScrollMultipleRedraw()
160 : initial_scroll_(40, 10), scroll_amount_(-3, 17), num_scrolls_(0) {} 162 : initial_scroll_(40, 10), scroll_amount_(-3, 17), num_scrolls_(0) {}
161 163
162 void BeginTest() override { 164 void BeginTest() override {
163 scroll_layer_ = layer_tree()->outer_viewport_scroll_layer(); 165 scroll_layer_ = layer_tree_host()->outer_viewport_scroll_layer();
164 scroll_layer_->SetScrollOffset(initial_scroll_); 166 scroll_layer_->SetScrollOffset(initial_scroll_);
165 scroll_layer_->set_did_scroll_callback(base::Bind( 167 scroll_layer_->set_did_scroll_callback(base::Bind(
166 &LayerTreeHostScrollTestScrollMultipleRedraw::DidScrollOuterViewport, 168 &LayerTreeHostScrollTestScrollMultipleRedraw::DidScrollOuterViewport,
167 base::Unretained(this))); 169 base::Unretained(this)));
168 PostSetNeedsCommitToMainThread(); 170 PostSetNeedsCommitToMainThread();
169 } 171 }
170 172
171 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { 173 void BeginCommitOnThread(LayerTreeHostImpl* impl) override {
172 switch (layer_tree_host()->source_frame_number()) { 174 switch (layer_tree_host()->source_frame_number()) {
173 case 0: 175 case 0:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 second_main_scroll_(14, -3), 246 second_main_scroll_(14, -3),
245 impl_scale_(2.f), 247 impl_scale_(2.f),
246 num_will_begin_main_frames_(0), 248 num_will_begin_main_frames_(0),
247 num_did_begin_main_frames_(0), 249 num_did_begin_main_frames_(0),
248 num_will_commits_(0), 250 num_will_commits_(0),
249 num_did_commits_(0), 251 num_did_commits_(0),
250 num_impl_commits_(0), 252 num_impl_commits_(0),
251 num_impl_scrolls_(0) {} 253 num_impl_scrolls_(0) {}
252 254
253 void BeginTest() override { 255 void BeginTest() override {
254 layer_tree()->outer_viewport_scroll_layer()->SetScrollOffset( 256 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset(
255 initial_scroll_); 257 initial_scroll_);
256 layer_tree()->outer_viewport_scroll_layer()->set_did_scroll_callback( 258 layer_tree_host()->outer_viewport_scroll_layer()->set_did_scroll_callback(
257 base::Bind( 259 base::Bind(
258 &LayerTreeHostScrollTestScrollAbortedCommit::DidScrollOuterViewport, 260 &LayerTreeHostScrollTestScrollAbortedCommit::DidScrollOuterViewport,
259 base::Unretained(this))); 261 base::Unretained(this)));
260 PostSetNeedsCommitToMainThread(); 262 PostSetNeedsCommitToMainThread();
261 } 263 }
262 264
263 void SetupTree() override { 265 void SetupTree() override {
264 LayerTreeHostScrollTest::SetupTree(); 266 LayerTreeHostScrollTest::SetupTree();
265 267
266 gfx::Size scroll_layer_bounds(200, 200); 268 gfx::Size scroll_layer_bounds(200, 200);
267 layer_tree()->outer_viewport_scroll_layer()->SetBounds(scroll_layer_bounds); 269 layer_tree_host()->outer_viewport_scroll_layer()->SetBounds(
268 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); 270 scroll_layer_bounds);
271 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f);
269 } 272 }
270 273
271 void WillBeginMainFrame() override { 274 void WillBeginMainFrame() override {
272 num_will_begin_main_frames_++; 275 num_will_begin_main_frames_++;
273 Layer* root_scroll_layer = layer_tree()->outer_viewport_scroll_layer(); 276 Layer* root_scroll_layer =
277 layer_tree_host()->outer_viewport_scroll_layer();
274 switch (num_will_begin_main_frames_) { 278 switch (num_will_begin_main_frames_) {
275 case 1: 279 case 1:
276 // This will not be aborted because of the initial prop changes. 280 // This will not be aborted because of the initial prop changes.
277 EXPECT_EQ(0, num_impl_scrolls_); 281 EXPECT_EQ(0, num_impl_scrolls_);
278 EXPECT_EQ(0, layer_tree_host()->source_frame_number()); 282 EXPECT_EQ(0, layer_tree_host()->source_frame_number());
279 EXPECT_VECTOR_EQ(initial_scroll_, root_scroll_layer->scroll_offset()); 283 EXPECT_VECTOR_EQ(initial_scroll_, root_scroll_layer->scroll_offset());
280 EXPECT_EQ(1.f, layer_tree()->page_scale_factor()); 284 EXPECT_EQ(1.f, layer_tree_host()->page_scale_factor());
281 break; 285 break;
282 case 2: 286 case 2:
283 // This commit will be aborted, and another commit will be 287 // This commit will be aborted, and another commit will be
284 // initiated from the redraw. 288 // initiated from the redraw.
285 EXPECT_EQ(1, num_impl_scrolls_); 289 EXPECT_EQ(1, num_impl_scrolls_);
286 EXPECT_EQ(1, layer_tree_host()->source_frame_number()); 290 EXPECT_EQ(1, layer_tree_host()->source_frame_number());
287 EXPECT_VECTOR_EQ( 291 EXPECT_VECTOR_EQ(
288 gfx::ScrollOffsetWithDelta(initial_scroll_, impl_scroll_), 292 gfx::ScrollOffsetWithDelta(initial_scroll_, impl_scroll_),
289 root_scroll_layer->scroll_offset()); 293 root_scroll_layer->scroll_offset());
290 EXPECT_EQ(impl_scale_, layer_tree()->page_scale_factor()); 294 EXPECT_EQ(impl_scale_, layer_tree_host()->page_scale_factor());
291 PostSetNeedsRedrawToMainThread(); 295 PostSetNeedsRedrawToMainThread();
292 break; 296 break;
293 case 3: 297 case 3:
294 // This commit will not be aborted because of the scroll change. 298 // This commit will not be aborted because of the scroll change.
295 EXPECT_EQ(2, num_impl_scrolls_); 299 EXPECT_EQ(2, num_impl_scrolls_);
296 // The source frame number still increases even with the abort. 300 // The source frame number still increases even with the abort.
297 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); 301 EXPECT_EQ(2, layer_tree_host()->source_frame_number());
298 EXPECT_VECTOR_EQ( 302 EXPECT_VECTOR_EQ(
299 gfx::ScrollOffsetWithDelta(initial_scroll_, 303 gfx::ScrollOffsetWithDelta(initial_scroll_,
300 impl_scroll_ + impl_scroll_), 304 impl_scroll_ + impl_scroll_),
301 root_scroll_layer->scroll_offset()); 305 root_scroll_layer->scroll_offset());
302 EXPECT_EQ(impl_scale_ * impl_scale_, layer_tree()->page_scale_factor()); 306 EXPECT_EQ(impl_scale_ * impl_scale_,
307 layer_tree_host()->page_scale_factor());
303 root_scroll_layer->SetScrollOffset(gfx::ScrollOffsetWithDelta( 308 root_scroll_layer->SetScrollOffset(gfx::ScrollOffsetWithDelta(
304 root_scroll_layer->scroll_offset(), second_main_scroll_)); 309 root_scroll_layer->scroll_offset(), second_main_scroll_));
305 break; 310 break;
306 case 4: 311 case 4:
307 // This commit will also be aborted. 312 // This commit will also be aborted.
308 EXPECT_EQ(3, num_impl_scrolls_); 313 EXPECT_EQ(3, num_impl_scrolls_);
309 EXPECT_EQ(3, layer_tree_host()->source_frame_number()); 314 EXPECT_EQ(3, layer_tree_host()->source_frame_number());
310 gfx::Vector2dF delta = 315 gfx::Vector2dF delta =
311 impl_scroll_ + impl_scroll_ + impl_scroll_ + second_main_scroll_; 316 impl_scroll_ + impl_scroll_ + impl_scroll_ + second_main_scroll_;
312 EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(initial_scroll_, delta), 317 EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(initial_scroll_, delta),
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 }; 434 };
430 435
431 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommit); 436 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommit);
432 437
433 class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { 438 class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest {
434 public: 439 public:
435 LayerTreeHostScrollTestFractionalScroll() : scroll_amount_(1.75, 0) {} 440 LayerTreeHostScrollTestFractionalScroll() : scroll_amount_(1.75, 0) {}
436 441
437 void SetupTree() override { 442 void SetupTree() override {
438 LayerTreeHostScrollTest::SetupTree(); 443 LayerTreeHostScrollTest::SetupTree();
439 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); 444 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f);
440 } 445 }
441 446
442 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 447 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
443 448
444 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 449 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
445 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); 450 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
446 451
447 // Check that a fractional scroll delta is correctly accumulated over 452 // Check that a fractional scroll delta is correctly accumulated over
448 // multiple commits. 453 // multiple commits.
449 switch (impl->active_tree()->source_frame_number()) { 454 switch (impl->active_tree()->source_frame_number()) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 }; 490 };
486 491
487 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestFractionalScroll); 492 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestFractionalScroll);
488 493
489 class LayerTreeHostScrollTestScrollSnapping : public LayerTreeHostScrollTest { 494 class LayerTreeHostScrollTestScrollSnapping : public LayerTreeHostScrollTest {
490 public: 495 public:
491 LayerTreeHostScrollTestScrollSnapping() : scroll_amount_(1.75, 0) {} 496 LayerTreeHostScrollTestScrollSnapping() : scroll_amount_(1.75, 0) {}
492 497
493 void SetupTree() override { 498 void SetupTree() override {
494 LayerTreeHostScrollTest::SetupTree(); 499 LayerTreeHostScrollTest::SetupTree();
495 layer_tree() 500 layer_tree_host()
496 ->outer_viewport_scroll_layer() 501 ->outer_viewport_scroll_layer()
497 ->scroll_clip_layer() 502 ->scroll_clip_layer()
498 ->SetForceRenderSurfaceForTesting(true); 503 ->SetForceRenderSurfaceForTesting(true);
499 gfx::Transform translate; 504 gfx::Transform translate;
500 translate.Translate(0.25f, 0.f); 505 translate.Translate(0.25f, 0.f);
501 layer_tree() 506 layer_tree_host()
502 ->outer_viewport_scroll_layer() 507 ->outer_viewport_scroll_layer()
503 ->scroll_clip_layer() 508 ->scroll_clip_layer()
504 ->SetTransform(translate); 509 ->SetTransform(translate);
505 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.1f, 100.f); 510 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.1f, 100.f);
506 } 511 }
507 512
508 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 513 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
509 514
510 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 515 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
511 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); 516 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
512 gfx::Transform translate; 517 gfx::Transform translate;
513 518
514 // Check that screen space transform of the scrollable layer is correctly 519 // Check that screen space transform of the scrollable layer is correctly
515 // snapped to integers. 520 // snapped to integers.
(...skipping 29 matching lines...) Expand all
545 550
546 class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { 551 class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest {
547 public: 552 public:
548 LayerTreeHostScrollTestCaseWithChild() 553 LayerTreeHostScrollTestCaseWithChild()
549 : initial_offset_(10, 20), 554 : initial_offset_(10, 20),
550 javascript_scroll_(40, 5), 555 javascript_scroll_(40, 5),
551 scroll_amount_(2, -1), 556 scroll_amount_(2, -1),
552 num_scrolls_(0) {} 557 num_scrolls_(0) {}
553 558
554 void SetupTree() override { 559 void SetupTree() override {
555 layer_tree()->SetDeviceScaleFactor(device_scale_factor_); 560 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_);
556 561
557 scoped_refptr<Layer> root_layer = Layer::Create(); 562 scoped_refptr<Layer> root_layer = Layer::Create();
558 root_layer->SetBounds(gfx::Size(10, 10)); 563 root_layer->SetBounds(gfx::Size(10, 10));
559 564
560 root_scroll_layer_ = FakePictureLayer::Create(&fake_content_layer_client_); 565 root_scroll_layer_ = FakePictureLayer::Create(&fake_content_layer_client_);
561 root_scroll_layer_->SetBounds(gfx::Size(110, 110)); 566 root_scroll_layer_->SetBounds(gfx::Size(110, 110));
562 root_scroll_layer_->SetPosition(gfx::PointF()); 567 root_scroll_layer_->SetPosition(gfx::PointF());
563 root_scroll_layer_->SetIsDrawable(true); 568 root_scroll_layer_->SetIsDrawable(true);
564 569
565 CreateVirtualViewportLayers(root_layer.get(), root_scroll_layer_, 570 CreateVirtualViewportLayers(root_layer.get(), root_scroll_layer_,
(...skipping 10 matching lines...) Expand all
576 // Scrolls on the child layer will happen at 5, 5. If they are treated 581 // Scrolls on the child layer will happen at 5, 5. If they are treated
577 // like device pixels, and device scale factor is 2, then they will 582 // like device pixels, and device scale factor is 2, then they will
578 // be considered at 2.5, 2.5 in logical pixels, and will miss this layer. 583 // be considered at 2.5, 2.5 in logical pixels, and will miss this layer.
579 child_layer_->SetPosition(gfx::PointF(5.f, 5.f)); 584 child_layer_->SetPosition(gfx::PointF(5.f, 5.f));
580 } else { 585 } else {
581 // Adjust the child layer horizontally so that scrolls will never hit it. 586 // Adjust the child layer horizontally so that scrolls will never hit it.
582 child_layer_->SetPosition(gfx::PointF(60.f, 5.f)); 587 child_layer_->SetPosition(gfx::PointF(60.f, 5.f));
583 } 588 }
584 589
585 scoped_refptr<Layer> outer_container_layer = 590 scoped_refptr<Layer> outer_container_layer =
586 layer_tree()->outer_viewport_scroll_layer()->parent(); 591 layer_tree_host()->outer_viewport_scroll_layer()->parent();
587 592
588 child_layer_->SetIsDrawable(true); 593 child_layer_->SetIsDrawable(true);
589 child_layer_->SetScrollClipLayerId(outer_container_layer->id()); 594 child_layer_->SetScrollClipLayerId(outer_container_layer->id());
590 child_layer_->SetBounds(root_scroll_layer_->bounds()); 595 child_layer_->SetBounds(root_scroll_layer_->bounds());
591 root_scroll_layer_->AddChild(child_layer_); 596 root_scroll_layer_->AddChild(child_layer_);
592 597
593 if (scroll_child_layer_) { 598 if (scroll_child_layer_) {
594 expected_scroll_layer_ = child_layer_; 599 expected_scroll_layer_ = child_layer_;
595 expected_no_scroll_layer_ = root_scroll_layer_; 600 expected_no_scroll_layer_ = root_scroll_layer_;
596 } else { 601 } else {
597 expected_scroll_layer_ = root_scroll_layer_; 602 expected_scroll_layer_ = root_scroll_layer_;
598 expected_no_scroll_layer_ = child_layer_; 603 expected_no_scroll_layer_ = child_layer_;
599 } 604 }
600 605
601 expected_scroll_layer_->SetScrollOffset(initial_offset_); 606 expected_scroll_layer_->SetScrollOffset(initial_offset_);
602 607
603 layer_tree()->SetRootLayer(root_layer); 608 layer_tree_host()->SetRootLayer(root_layer);
604 LayerTreeTest::SetupTree(); 609 LayerTreeTest::SetupTree();
605 fake_content_layer_client_.set_bounds(root_layer->bounds()); 610 fake_content_layer_client_.set_bounds(root_layer->bounds());
606 611
607 layer_tree()->outer_viewport_scroll_layer()->set_did_scroll_callback( 612 layer_tree_host()->outer_viewport_scroll_layer()->set_did_scroll_callback(
608 base::Bind( 613 base::Bind(
609 &LayerTreeHostScrollTestCaseWithChild::DidScrollOuterViewport, 614 &LayerTreeHostScrollTestCaseWithChild::DidScrollOuterViewport,
610 base::Unretained(this))); 615 base::Unretained(this)));
611 } 616 }
612 617
613 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 618 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
614 619
615 void WillCommit() override { 620 void WillCommit() override {
616 // Keep the test committing (otherwise the early out for no update 621 // Keep the test committing (otherwise the early out for no update
617 // will stall the test). 622 // will stall the test).
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 public: 815 public:
811 LayerTreeHostScrollTestSimple() 816 LayerTreeHostScrollTestSimple()
812 : initial_scroll_(10, 20), 817 : initial_scroll_(10, 20),
813 main_thread_scroll_(40, 5), 818 main_thread_scroll_(40, 5),
814 impl_thread_scroll1_(2, -1), 819 impl_thread_scroll1_(2, -1),
815 impl_thread_scroll2_(-3, 10), 820 impl_thread_scroll2_(-3, 10),
816 num_scrolls_(0) {} 821 num_scrolls_(0) {}
817 822
818 void SetupTree() override { 823 void SetupTree() override {
819 LayerTreeHostScrollTest::SetupTree(); 824 LayerTreeHostScrollTest::SetupTree();
820 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); 825 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f);
821 } 826 }
822 827
823 void BeginTest() override { 828 void BeginTest() override {
824 layer_tree()->outer_viewport_scroll_layer()->SetScrollOffset( 829 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset(
825 initial_scroll_); 830 initial_scroll_);
826 layer_tree()->outer_viewport_scroll_layer()->set_did_scroll_callback( 831 layer_tree_host()->outer_viewport_scroll_layer()->set_did_scroll_callback(
827 base::Bind(&LayerTreeHostScrollTestSimple::DidScrollOuterViewport, 832 base::Bind(&LayerTreeHostScrollTestSimple::DidScrollOuterViewport,
828 base::Unretained(this))); 833 base::Unretained(this)));
829 PostSetNeedsCommitToMainThread(); 834 PostSetNeedsCommitToMainThread();
830 } 835 }
831 836
832 void UpdateLayerTreeHost() override { 837 void UpdateLayerTreeHost() override {
833 Layer* scroll_layer = layer_tree()->outer_viewport_scroll_layer(); 838 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer();
834 if (!layer_tree_host()->source_frame_number()) { 839 if (!layer_tree_host()->source_frame_number()) {
835 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->scroll_offset()); 840 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->scroll_offset());
836 } else { 841 } else {
837 EXPECT_VECTOR_EQ( 842 EXPECT_VECTOR_EQ(
838 scroll_layer->scroll_offset(), 843 scroll_layer->scroll_offset(),
839 gfx::ScrollOffsetWithDelta(initial_scroll_, impl_thread_scroll1_)); 844 gfx::ScrollOffsetWithDelta(initial_scroll_, impl_thread_scroll1_));
840 845
841 // Pretend like Javascript updated the scroll position itself with a 846 // Pretend like Javascript updated the scroll position itself with a
842 // change of main_thread_scroll. 847 // change of main_thread_scroll.
843 scroll_layer->SetScrollOffset( 848 scroll_layer->SetScrollOffset(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 // beginning a commit and finishing a commit (aka scroll deltas not 937 // beginning a commit and finishing a commit (aka scroll deltas not
933 // included in sent scroll delta) still apply to layers that don't 938 // included in sent scroll delta) still apply to layers that don't
934 // push properties. 939 // push properties.
935 class LayerTreeHostScrollTestImplOnlyScroll : public LayerTreeHostScrollTest { 940 class LayerTreeHostScrollTestImplOnlyScroll : public LayerTreeHostScrollTest {
936 public: 941 public:
937 LayerTreeHostScrollTestImplOnlyScroll() 942 LayerTreeHostScrollTestImplOnlyScroll()
938 : initial_scroll_(20, 10), impl_thread_scroll_(-2, 3), impl_scale_(2.f) {} 943 : initial_scroll_(20, 10), impl_thread_scroll_(-2, 3), impl_scale_(2.f) {}
939 944
940 void SetupTree() override { 945 void SetupTree() override {
941 LayerTreeHostScrollTest::SetupTree(); 946 LayerTreeHostScrollTest::SetupTree();
942 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); 947 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f);
943 } 948 }
944 949
945 void BeginTest() override { 950 void BeginTest() override {
946 layer_tree()->outer_viewport_scroll_layer()->SetScrollOffset( 951 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset(
947 initial_scroll_); 952 initial_scroll_);
948 PostSetNeedsCommitToMainThread(); 953 PostSetNeedsCommitToMainThread();
949 } 954 }
950 955
951 void WillCommit() override { 956 void WillCommit() override {
952 Layer* scroll_layer = layer_tree()->outer_viewport_scroll_layer(); 957 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer();
953 switch (layer_tree_host()->source_frame_number()) { 958 switch (layer_tree_host()->source_frame_number()) {
954 case 0: 959 case 0:
955 EXPECT_TRUE( 960 EXPECT_TRUE(
956 scroll_layer->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 961 scroll_layer->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
957 scroll_layer)); 962 scroll_layer));
958 break; 963 break;
959 case 1: 964 case 1:
960 // Even if this layer doesn't need push properties, it should 965 // Even if this layer doesn't need push properties, it should
961 // still pick up scrolls that happen on the active layer during 966 // still pick up scrolls that happen on the active layer during
962 // commit. 967 // commit.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 1077
1073 // This tests scrolling on the impl side which is only possible with a thread. 1078 // This tests scrolling on the impl side which is only possible with a thread.
1074 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestImplOnlyScroll); 1079 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestImplOnlyScroll);
1075 1080
1076 class LayerTreeHostScrollTestScrollZeroMaxScrollOffset 1081 class LayerTreeHostScrollTestScrollZeroMaxScrollOffset
1077 : public LayerTreeHostScrollTest { 1082 : public LayerTreeHostScrollTest {
1078 public: 1083 public:
1079 LayerTreeHostScrollTestScrollZeroMaxScrollOffset() {} 1084 LayerTreeHostScrollTestScrollZeroMaxScrollOffset() {}
1080 1085
1081 void BeginTest() override { 1086 void BeginTest() override {
1082 outer_viewport_container_layer_id_ = 1087 outer_viewport_container_layer_id_ = layer_tree_host()
1083 layer_tree()->outer_viewport_scroll_layer()->scroll_clip_layer()->id(); 1088 ->outer_viewport_scroll_layer()
1089 ->scroll_clip_layer()
1090 ->id();
1084 PostSetNeedsCommitToMainThread(); 1091 PostSetNeedsCommitToMainThread();
1085 } 1092 }
1086 1093
1087 void UpdateLayerTreeHost() override { 1094 void UpdateLayerTreeHost() override {
1088 Layer* root = layer_tree()->root_layer(); 1095 Layer* root = layer_tree_host()->root_layer();
1089 Layer* scroll_layer = layer_tree()->outer_viewport_scroll_layer(); 1096 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer();
1090 switch (layer_tree_host()->source_frame_number()) { 1097 switch (layer_tree_host()->source_frame_number()) {
1091 case 0: 1098 case 0:
1092 scroll_layer->SetScrollClipLayerId(outer_viewport_container_layer_id_); 1099 scroll_layer->SetScrollClipLayerId(outer_viewport_container_layer_id_);
1093 // Set max_scroll_offset = (100, 100). 1100 // Set max_scroll_offset = (100, 100).
1094 scroll_layer->SetBounds(gfx::Size(root->bounds().width() + 100, 1101 scroll_layer->SetBounds(gfx::Size(root->bounds().width() + 100,
1095 root->bounds().height() + 100)); 1102 root->bounds().height() + 100));
1096 break; 1103 break;
1097 case 1: 1104 case 1:
1098 // Set max_scroll_offset = (0, 0). 1105 // Set max_scroll_offset = (0, 0).
1099 scroll_layer->SetBounds(root->bounds()); 1106 scroll_layer->SetBounds(root->bounds());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1155
1149 class LayerTreeHostScrollTestScrollNonDrawnLayer 1156 class LayerTreeHostScrollTestScrollNonDrawnLayer
1150 : public LayerTreeHostScrollTest { 1157 : public LayerTreeHostScrollTest {
1151 public: 1158 public:
1152 LayerTreeHostScrollTestScrollNonDrawnLayer() {} 1159 LayerTreeHostScrollTestScrollNonDrawnLayer() {}
1153 1160
1154 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1161 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1155 1162
1156 void SetupTree() override { 1163 void SetupTree() override {
1157 LayerTreeHostScrollTest::SetupTree(); 1164 LayerTreeHostScrollTest::SetupTree();
1158 layer_tree()->outer_viewport_scroll_layer()->SetIsDrawable(false); 1165 layer_tree_host()->outer_viewport_scroll_layer()->SetIsDrawable(false);
1159 layer_tree()->outer_viewport_scroll_layer()->SetScrollOffset( 1166 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset(
1160 gfx::ScrollOffset(20.f, 20.f)); 1167 gfx::ScrollOffset(20.f, 20.f));
1161 layer_tree()->outer_viewport_scroll_layer()->SetNonFastScrollableRegion( 1168 layer_tree_host()
1162 gfx::Rect(20, 20, 20, 20)); 1169 ->outer_viewport_scroll_layer()
1170 ->SetNonFastScrollableRegion(gfx::Rect(20, 20, 20, 20));
1163 } 1171 }
1164 1172
1165 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 1173 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1166 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); 1174 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
1167 1175
1168 ScrollTree& scroll_tree = 1176 ScrollTree& scroll_tree =
1169 impl->active_tree()->property_trees()->scroll_tree; 1177 impl->active_tree()->property_trees()->scroll_tree;
1170 ScrollNode* scroll_node = 1178 ScrollNode* scroll_node =
1171 scroll_tree.Node(scroll_layer->scroll_tree_index()); 1179 scroll_tree.Node(scroll_layer->scroll_tree_index());
1172 1180
(...skipping 24 matching lines...) Expand all
1197 1205
1198 class LayerTreeHostScrollTestImplScrollUnderMainThreadScrollingParent 1206 class LayerTreeHostScrollTestImplScrollUnderMainThreadScrollingParent
1199 : public LayerTreeHostScrollTest { 1207 : public LayerTreeHostScrollTest {
1200 public: 1208 public:
1201 LayerTreeHostScrollTestImplScrollUnderMainThreadScrollingParent() {} 1209 LayerTreeHostScrollTestImplScrollUnderMainThreadScrollingParent() {}
1202 1210
1203 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1211 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1204 1212
1205 void SetupTree() override { 1213 void SetupTree() override {
1206 LayerTreeHostScrollTest::SetupTree(); 1214 LayerTreeHostScrollTest::SetupTree();
1207 layer_tree()->inner_viewport_scroll_layer()->AddMainThreadScrollingReasons( 1215 layer_tree_host()
1208 MainThreadScrollingReason::kEventHandlers); 1216 ->inner_viewport_scroll_layer()
1217 ->AddMainThreadScrollingReasons(
1218 MainThreadScrollingReason::kEventHandlers);
1209 } 1219 }
1210 1220
1211 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 1221 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1212 LayerImpl* inner_scroll_layer = impl->InnerViewportScrollLayer(); 1222 LayerImpl* inner_scroll_layer = impl->InnerViewportScrollLayer();
1213 LayerImpl* outer_scroll_layer = impl->OuterViewportScrollLayer(); 1223 LayerImpl* outer_scroll_layer = impl->OuterViewportScrollLayer();
1214 1224
1215 ScrollTree& scroll_tree = 1225 ScrollTree& scroll_tree =
1216 impl->active_tree()->property_trees()->scroll_tree; 1226 impl->active_tree()->property_trees()->scroll_tree;
1217 ScrollNode* inner_scroll_node = 1227 ScrollNode* inner_scroll_node =
1218 scroll_tree.Node(inner_scroll_layer->scroll_tree_index()); 1228 scroll_tree.Node(inner_scroll_layer->scroll_tree_index());
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 } 1339 }
1330 1340
1331 class LayerTreeHostScrollTestLayerStructureChange 1341 class LayerTreeHostScrollTestLayerStructureChange
1332 : public LayerTreeHostScrollTest { 1342 : public LayerTreeHostScrollTest {
1333 public: 1343 public:
1334 LayerTreeHostScrollTestLayerStructureChange() 1344 LayerTreeHostScrollTestLayerStructureChange()
1335 : scroll_destroy_whole_tree_(false) {} 1345 : scroll_destroy_whole_tree_(false) {}
1336 1346
1337 void SetupTree() override { 1347 void SetupTree() override {
1338 LayerTreeTest::SetupTree(); 1348 LayerTreeTest::SetupTree();
1339 Layer* root_layer = layer_tree()->root_layer(); 1349 Layer* root_layer = layer_tree_host()->root_layer();
1340 root_layer->SetBounds(gfx::Size(10, 10)); 1350 root_layer->SetBounds(gfx::Size(10, 10));
1341 1351
1342 CreateVirtualViewportLayers(root_layer, root_layer->bounds(), 1352 CreateVirtualViewportLayers(root_layer, root_layer->bounds(),
1343 root_layer->bounds(), root_layer->bounds(), 1353 root_layer->bounds(), root_layer->bounds(),
1344 layer_tree_host()); 1354 layer_tree_host());
1345 1355
1346 Layer* outer_scroll_layer = layer_tree()->outer_viewport_scroll_layer(); 1356 Layer* outer_scroll_layer =
1357 layer_tree_host()->outer_viewport_scroll_layer();
1347 1358
1348 Layer* root_scroll_layer = 1359 Layer* root_scroll_layer =
1349 CreateScrollLayer(outer_scroll_layer, &root_scroll_layer_client_); 1360 CreateScrollLayer(outer_scroll_layer, &root_scroll_layer_client_);
1350 Layer* sibling_scroll_layer = 1361 Layer* sibling_scroll_layer =
1351 CreateScrollLayer(outer_scroll_layer, &sibling_scroll_layer_client_); 1362 CreateScrollLayer(outer_scroll_layer, &sibling_scroll_layer_client_);
1352 Layer* child_scroll_layer = 1363 Layer* child_scroll_layer =
1353 CreateScrollLayer(root_scroll_layer, &child_scroll_layer_client_); 1364 CreateScrollLayer(root_scroll_layer, &child_scroll_layer_client_);
1354 root_scroll_layer_id_ = root_scroll_layer->id(); 1365 root_scroll_layer_id_ = root_scroll_layer->id();
1355 sibling_scroll_layer_id_ = sibling_scroll_layer->id(); 1366 sibling_scroll_layer_id_ = sibling_scroll_layer->id();
1356 child_scroll_layer_id_ = child_scroll_layer->id(); 1367 child_scroll_layer_id_ = child_scroll_layer->id();
(...skipping 19 matching lines...) Expand all
1376 case 1: 1387 case 1:
1377 EndTest(); 1388 EndTest();
1378 break; 1389 break;
1379 } 1390 }
1380 } 1391 }
1381 1392
1382 void AfterTest() override {} 1393 void AfterTest() override {}
1383 1394
1384 virtual void DidScroll(Layer* layer) { 1395 virtual void DidScroll(Layer* layer) {
1385 if (scroll_destroy_whole_tree_) { 1396 if (scroll_destroy_whole_tree_) {
1386 layer_tree()->RegisterViewportLayers(NULL, NULL, NULL, NULL); 1397 layer_tree_host()->RegisterViewportLayers(NULL, NULL, NULL, NULL);
1387 layer_tree()->SetRootLayer(NULL); 1398 layer_tree_host()->SetRootLayer(NULL);
1388 EndTest(); 1399 EndTest();
1389 return; 1400 return;
1390 } 1401 }
1391 layer->RemoveFromParent(); 1402 layer->RemoveFromParent();
1392 } 1403 }
1393 1404
1394 protected: 1405 protected:
1395 class FakeLayerScrollClient { 1406 class FakeLayerScrollClient {
1396 public: 1407 public:
1397 void DidScroll() { 1408 void DidScroll() {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 third_scroll_(20, 10), 1468 third_scroll_(20, 10),
1458 scroll_amount_(2, -1), 1469 scroll_amount_(2, -1),
1459 num_commits_(0), 1470 num_commits_(0),
1460 num_scrolls_(0) {} 1471 num_scrolls_(0) {}
1461 1472
1462 void InitializeSettings(LayerTreeSettings* settings) override { 1473 void InitializeSettings(LayerTreeSettings* settings) override {
1463 settings->main_frame_before_activation_enabled = true; 1474 settings->main_frame_before_activation_enabled = true;
1464 } 1475 }
1465 1476
1466 void BeginTest() override { 1477 void BeginTest() override {
1467 outer_viewport_container_layer_id_ = 1478 outer_viewport_container_layer_id_ = layer_tree_host()
1468 layer_tree()->outer_viewport_scroll_layer()->scroll_clip_layer()->id(); 1479 ->outer_viewport_scroll_layer()
1469 layer_tree()->outer_viewport_scroll_layer()->SetScrollOffset( 1480 ->scroll_clip_layer()
1481 ->id();
1482 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset(
1470 initial_scroll_); 1483 initial_scroll_);
1471 layer_tree()->outer_viewport_scroll_layer()->set_did_scroll_callback( 1484 layer_tree_host()->outer_viewport_scroll_layer()->set_did_scroll_callback(
1472 base::Bind(&LayerTreeHostScrollTestScrollMFBA::DidScrollOuterViewport, 1485 base::Bind(&LayerTreeHostScrollTestScrollMFBA::DidScrollOuterViewport,
1473 base::Unretained(this))); 1486 base::Unretained(this)));
1474 PostSetNeedsCommitToMainThread(); 1487 PostSetNeedsCommitToMainThread();
1475 } 1488 }
1476 1489
1477 void ReadyToCommitOnThread(LayerTreeHostImpl* impl) override { 1490 void ReadyToCommitOnThread(LayerTreeHostImpl* impl) override {
1478 switch (num_commits_) { 1491 switch (num_commits_) {
1479 case 1: 1492 case 1:
1480 // Ask for commit here because activation (and draw) will be blocked. 1493 // Ask for commit here because activation (and draw) will be blocked.
1481 impl->SetNeedsCommit(); 1494 impl->SetNeedsCommit();
1482 // Block activation after second commit until third commit is ready. 1495 // Block activation after second commit until third commit is ready.
1483 impl->BlockNotifyReadyToActivateForTesting(true); 1496 impl->BlockNotifyReadyToActivateForTesting(true);
1484 break; 1497 break;
1485 case 2: 1498 case 2:
1486 // Unblock activation after third commit is ready. 1499 // Unblock activation after third commit is ready.
1487 impl->BlockNotifyReadyToActivateForTesting(false); 1500 impl->BlockNotifyReadyToActivateForTesting(false);
1488 break; 1501 break;
1489 } 1502 }
1490 num_commits_++; 1503 num_commits_++;
1491 } 1504 }
1492 1505
1493 void UpdateLayerTreeHost() override { 1506 void UpdateLayerTreeHost() override {
1494 Layer* scroll_layer = layer_tree()->outer_viewport_scroll_layer(); 1507 Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer();
1495 switch (layer_tree_host()->source_frame_number()) { 1508 switch (layer_tree_host()->source_frame_number()) {
1496 case 0: 1509 case 0:
1497 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->scroll_offset()); 1510 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->scroll_offset());
1498 break; 1511 break;
1499 case 1: 1512 case 1:
1500 EXPECT_VECTOR_EQ( 1513 EXPECT_VECTOR_EQ(
1501 gfx::ScrollOffsetWithDelta(initial_scroll_, scroll_amount_), 1514 gfx::ScrollOffsetWithDelta(initial_scroll_, scroll_amount_),
1502 scroll_layer->scroll_offset()); 1515 scroll_layer->scroll_offset());
1503 // Pretend like Javascript updated the scroll position itself. 1516 // Pretend like Javascript updated the scroll position itself.
1504 scroll_layer->SetScrollOffset(second_scroll_); 1517 scroll_layer->SetScrollOffset(second_scroll_);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 num_impl_commits_(0), 1601 num_impl_commits_(0),
1589 num_aborted_commits_(0), 1602 num_aborted_commits_(0),
1590 num_impl_scrolls_(0), 1603 num_impl_scrolls_(0),
1591 num_draws_(0) {} 1604 num_draws_(0) {}
1592 1605
1593 void InitializeSettings(LayerTreeSettings* settings) override { 1606 void InitializeSettings(LayerTreeSettings* settings) override {
1594 settings->main_frame_before_activation_enabled = true; 1607 settings->main_frame_before_activation_enabled = true;
1595 } 1608 }
1596 1609
1597 void BeginTest() override { 1610 void BeginTest() override {
1598 layer_tree()->outer_viewport_scroll_layer()->SetScrollOffset( 1611 layer_tree_host()->outer_viewport_scroll_layer()->SetScrollOffset(
1599 initial_scroll_); 1612 initial_scroll_);
1600 layer_tree()->outer_viewport_scroll_layer()->set_did_scroll_callback( 1613 layer_tree_host()->outer_viewport_scroll_layer()->set_did_scroll_callback(
1601 base::Bind(&LayerTreeHostScrollTestScrollAbortedCommitMFBA:: 1614 base::Bind(&LayerTreeHostScrollTestScrollAbortedCommitMFBA::
1602 DidScrollOuterViewport, 1615 DidScrollOuterViewport,
1603 base::Unretained(this))); 1616 base::Unretained(this)));
1604 PostSetNeedsCommitToMainThread(); 1617 PostSetNeedsCommitToMainThread();
1605 } 1618 }
1606 1619
1607 void SetupTree() override { 1620 void SetupTree() override {
1608 LayerTreeHostScrollTest::SetupTree(); 1621 LayerTreeHostScrollTest::SetupTree();
1609 1622
1610 gfx::Size scroll_layer_bounds(200, 200); 1623 gfx::Size scroll_layer_bounds(200, 200);
1611 layer_tree()->outer_viewport_scroll_layer()->SetBounds(scroll_layer_bounds); 1624 layer_tree_host()->outer_viewport_scroll_layer()->SetBounds(
1612 layer_tree()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); 1625 scroll_layer_bounds);
1626 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f);
1613 } 1627 }
1614 1628
1615 void WillBeginMainFrame() override { 1629 void WillBeginMainFrame() override {
1616 num_will_begin_main_frames_++; 1630 num_will_begin_main_frames_++;
1617 Layer* root_scroll_layer = layer_tree()->outer_viewport_scroll_layer(); 1631 Layer* root_scroll_layer = layer_tree_host()->outer_viewport_scroll_layer();
1618 switch (num_will_begin_main_frames_) { 1632 switch (num_will_begin_main_frames_) {
1619 case 1: 1633 case 1:
1620 // This will not be aborted because of the initial prop changes. 1634 // This will not be aborted because of the initial prop changes.
1621 EXPECT_EQ(0, num_impl_scrolls_); 1635 EXPECT_EQ(0, num_impl_scrolls_);
1622 EXPECT_EQ(0, layer_tree_host()->source_frame_number()); 1636 EXPECT_EQ(0, layer_tree_host()->source_frame_number());
1623 EXPECT_VECTOR_EQ(initial_scroll_, root_scroll_layer->scroll_offset()); 1637 EXPECT_VECTOR_EQ(initial_scroll_, root_scroll_layer->scroll_offset());
1624 break; 1638 break;
1625 case 2: 1639 case 2:
1626 // This commit will not be aborted because of the scroll change. 1640 // This commit will not be aborted because of the scroll change.
1627 EXPECT_EQ(1, num_impl_scrolls_); 1641 EXPECT_EQ(1, num_impl_scrolls_);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 int num_impl_commits_; 1805 int num_impl_commits_;
1792 int num_aborted_commits_; 1806 int num_aborted_commits_;
1793 int num_impl_scrolls_; 1807 int num_impl_scrolls_;
1794 int num_draws_; 1808 int num_draws_;
1795 }; 1809 };
1796 1810
1797 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommitMFBA); 1811 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommitMFBA);
1798 1812
1799 } // namespace 1813 } // namespace
1800 } // namespace cc 1814 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_proxy.cc ('k') | cc/trees/layer_tree_host_unittest_serialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698