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

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

Issue 1766053002: Clean LayerImpl's scroll offset callers in unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove transform tree update setting Created 4 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_unittest_animation_timelines.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return scroll_state; 49 return scroll_state;
50 } 50 }
51 51
52 scoped_ptr<ScrollState> EndState() { 52 scoped_ptr<ScrollState> EndState() {
53 ScrollStateData scroll_state_data; 53 ScrollStateData scroll_state_data;
54 scroll_state_data.is_ending = true; 54 scroll_state_data.is_ending = true;
55 scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); 55 scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data));
56 return scroll_state; 56 return scroll_state;
57 } 57 }
58 58
59 static ScrollTree* ScrollTreeForLayer(LayerImpl* layer_impl) {
60 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree;
61 }
62
59 class LayerTreeHostScrollTest : public LayerTreeTest { 63 class LayerTreeHostScrollTest : public LayerTreeTest {
60 protected: 64 protected:
61 void SetupTree() override { 65 void SetupTree() override {
62 LayerTreeTest::SetupTree(); 66 LayerTreeTest::SetupTree();
63 Layer* root_layer = layer_tree_host()->root_layer(); 67 Layer* root_layer = layer_tree_host()->root_layer();
64 68
65 // Create an effective max_scroll_offset of (100, 100). 69 // Create an effective max_scroll_offset of (100, 100).
66 gfx::Size scroll_layer_bounds(root_layer->bounds().width() + 100, 70 gfx::Size scroll_layer_bounds(root_layer->bounds().width() + 100,
67 root_layer->bounds().height() + 100); 71 root_layer->bounds().height() + 100);
68 72
(...skipping 30 matching lines...) Expand all
99 scroll_layer->scroll_offset()); 103 scroll_layer->scroll_offset());
100 104
101 // Pretend like Javascript updated the scroll position itself. 105 // Pretend like Javascript updated the scroll position itself.
102 scroll_layer->SetScrollOffset(second_scroll_); 106 scroll_layer->SetScrollOffset(second_scroll_);
103 } 107 }
104 } 108 }
105 109
106 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 110 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
107 LayerImpl* root = impl->active_tree()->root_layer(); 111 LayerImpl* root = impl->active_tree()->root_layer();
108 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); 112 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
109 EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer->ScrollDelta()); 113 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(scroll_layer));
110 114
111 scroll_layer->SetScrollClipLayer(root->children()[0]->id()); 115 scroll_layer->SetScrollClipLayer(root->children()[0]->id());
112 scroll_layer->SetBounds( 116 scroll_layer->SetBounds(
113 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); 117 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100));
114 scroll_layer->ScrollBy(scroll_amount_); 118 scroll_layer->ScrollBy(scroll_amount_);
115 119
116 switch (impl->active_tree()->source_frame_number()) { 120 switch (impl->active_tree()->source_frame_number()) {
117 case 0: 121 case 0:
118 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); 122 EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer)
119 EXPECT_VECTOR_EQ(scroll_amount_, scroll_layer->ScrollDelta()); 123 ->GetScrollOffsetBaseForTesting(
124 scroll_layer->id()));
125 EXPECT_VECTOR_EQ(scroll_amount_, ScrollDelta(scroll_layer));
120 PostSetNeedsCommitToMainThread(); 126 PostSetNeedsCommitToMainThread();
121 break; 127 break;
122 case 1: 128 case 1:
123 EXPECT_VECTOR_EQ(second_scroll_, scroll_layer->BaseScrollOffset()); 129 EXPECT_VECTOR_EQ(second_scroll_, ScrollTreeForLayer(scroll_layer)
124 EXPECT_VECTOR_EQ(scroll_amount_, scroll_layer->ScrollDelta()); 130 ->GetScrollOffsetBaseForTesting(
131 scroll_layer->id()));
132 EXPECT_VECTOR_EQ(scroll_amount_, ScrollDelta(scroll_layer));
125 EndTest(); 133 EndTest();
126 break; 134 break;
127 } 135 }
128 } 136 }
129 137
130 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 138 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
131 const gfx::Vector2dF& outer_delta, 139 const gfx::Vector2dF& outer_delta,
132 const gfx::Vector2dF& elastic_overscroll_delta, 140 const gfx::Vector2dF& elastic_overscroll_delta,
133 float scale, 141 float scale,
134 float top_controls_delta) override { 142 float top_controls_delta) override {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 break; 184 break;
177 } 185 }
178 } 186 }
179 187
180 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 188 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
181 LayerImpl* scroll_layer = 189 LayerImpl* scroll_layer =
182 impl->active_tree()->LayerById(scroll_layer_->id()); 190 impl->active_tree()->LayerById(scroll_layer_->id());
183 if (impl->active_tree()->source_frame_number() == 0 && 191 if (impl->active_tree()->source_frame_number() == 0 &&
184 impl->SourceAnimationFrameNumberForTesting() == 1) { 192 impl->SourceAnimationFrameNumberForTesting() == 1) {
185 // First draw after first commit. 193 // First draw after first commit.
186 EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer->ScrollDelta()); 194 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(scroll_layer));
187 scroll_layer->ScrollBy(scroll_amount_); 195 scroll_layer->ScrollBy(scroll_amount_);
188 EXPECT_VECTOR_EQ(scroll_amount_, scroll_layer->ScrollDelta()); 196 EXPECT_VECTOR_EQ(scroll_amount_, ScrollDelta(scroll_layer));
189 197
190 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); 198 EXPECT_VECTOR_EQ(initial_scroll_,
199 ScrollTreeForLayer(scroll_layer)
200 ->GetScrollOffsetBaseForTesting(scroll_layer->id()));
191 PostSetNeedsRedrawToMainThread(); 201 PostSetNeedsRedrawToMainThread();
192 } else if (impl->active_tree()->source_frame_number() == 0 && 202 } else if (impl->active_tree()->source_frame_number() == 0 &&
193 impl->SourceAnimationFrameNumberForTesting() == 2) { 203 impl->SourceAnimationFrameNumberForTesting() == 2) {
194 // Second draw after first commit. 204 // Second draw after first commit.
195 EXPECT_EQ(scroll_layer->ScrollDelta(), scroll_amount_); 205 EXPECT_EQ(ScrollDelta(scroll_layer), scroll_amount_);
196 scroll_layer->ScrollBy(scroll_amount_); 206 scroll_layer->ScrollBy(scroll_amount_);
197 EXPECT_VECTOR_EQ(scroll_amount_ + scroll_amount_, 207 EXPECT_VECTOR_EQ(scroll_amount_ + scroll_amount_,
198 scroll_layer->ScrollDelta()); 208 ScrollDelta(scroll_layer));
199 209
200 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer_->scroll_offset()); 210 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer_->scroll_offset());
201 PostSetNeedsCommitToMainThread(); 211 PostSetNeedsCommitToMainThread();
202 } else if (impl->active_tree()->source_frame_number() == 1) { 212 } else if (impl->active_tree()->source_frame_number() == 1) {
203 // Third or later draw after second commit. 213 // Third or later draw after second commit.
204 EXPECT_GE(impl->SourceAnimationFrameNumberForTesting(), 3u); 214 EXPECT_GE(impl->SourceAnimationFrameNumberForTesting(), 3u);
205 EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer_->ScrollDelta());
206 EXPECT_VECTOR_EQ( 215 EXPECT_VECTOR_EQ(
207 gfx::ScrollOffsetWithDelta(initial_scroll_, 216 gfx::ScrollOffsetWithDelta(initial_scroll_,
208 scroll_amount_ + scroll_amount_), 217 scroll_amount_ + scroll_amount_),
209 scroll_layer_->scroll_offset()); 218 scroll_layer_->scroll_offset());
210 EndTest(); 219 EndTest();
211 } 220 }
212 } 221 }
213 222
214 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 223 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
215 const gfx::Vector2dF& outer_delta, 224 const gfx::Vector2dF& outer_delta,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 void BeginCommitOnThread(LayerTreeHostImpl* impl) override { 330 void BeginCommitOnThread(LayerTreeHostImpl* impl) override {
322 num_impl_commits_++; 331 num_impl_commits_++;
323 } 332 }
324 333
325 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 334 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
326 LayerImpl* root_scroll_layer = impl->OuterViewportScrollLayer(); 335 LayerImpl* root_scroll_layer = impl->OuterViewportScrollLayer();
327 336
328 if (impl->active_tree()->source_frame_number() == 0 && 337 if (impl->active_tree()->source_frame_number() == 0 &&
329 impl->SourceAnimationFrameNumberForTesting() == 1) { 338 impl->SourceAnimationFrameNumberForTesting() == 1) {
330 // First draw 339 // First draw
331 EXPECT_VECTOR_EQ(gfx::Vector2d(), root_scroll_layer->ScrollDelta()); 340 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(root_scroll_layer));
332 root_scroll_layer->ScrollBy(impl_scroll_); 341 root_scroll_layer->ScrollBy(impl_scroll_);
333 EXPECT_VECTOR_EQ(impl_scroll_, root_scroll_layer->ScrollDelta()); 342 EXPECT_VECTOR_EQ(impl_scroll_, ScrollDelta(root_scroll_layer));
334 EXPECT_VECTOR_EQ(initial_scroll_, root_scroll_layer->BaseScrollOffset()); 343 EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(root_scroll_layer)
344 ->GetScrollOffsetBaseForTesting(
345 root_scroll_layer->id()));
335 346
336 EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta()); 347 EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta());
337 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); 348 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor());
338 impl->active_tree()->SetPageScaleOnActiveTree(impl_scale_); 349 impl->active_tree()->SetPageScaleOnActiveTree(impl_scale_);
339 EXPECT_EQ(impl_scale_, impl->active_tree()->page_scale_delta()); 350 EXPECT_EQ(impl_scale_, impl->active_tree()->page_scale_delta());
340 EXPECT_EQ(impl_scale_, impl->active_tree()->current_page_scale_factor()); 351 EXPECT_EQ(impl_scale_, impl->active_tree()->current_page_scale_factor());
341 352
342 // To simplify the testing flow, don't redraw here, just commit. 353 // To simplify the testing flow, don't redraw here, just commit.
343 impl->SetNeedsCommit(); 354 impl->SetNeedsCommit();
344 } else if (impl->active_tree()->source_frame_number() == 0 && 355 } else if (impl->active_tree()->source_frame_number() == 0 &&
345 impl->SourceAnimationFrameNumberForTesting() == 2) { 356 impl->SourceAnimationFrameNumberForTesting() == 2) {
346 // Test a second draw after an aborted commit. 357 // Test a second draw after an aborted commit.
347 // The scroll/scale values should be baked into the offset/scale factor 358 // The scroll/scale values should be baked into the offset/scale factor
348 // since the main thread consumed but aborted the begin frame. 359 // since the main thread consumed but aborted the begin frame.
349 EXPECT_VECTOR_EQ(gfx::Vector2d(), root_scroll_layer->ScrollDelta()); 360 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(root_scroll_layer));
350 root_scroll_layer->ScrollBy(impl_scroll_); 361 root_scroll_layer->ScrollBy(impl_scroll_);
351 EXPECT_VECTOR_EQ(impl_scroll_, root_scroll_layer->ScrollDelta()); 362 EXPECT_VECTOR_EQ(impl_scroll_, ScrollDelta(root_scroll_layer));
352 EXPECT_VECTOR_EQ( 363 EXPECT_VECTOR_EQ(
353 gfx::ScrollOffsetWithDelta(initial_scroll_, impl_scroll_), 364 gfx::ScrollOffsetWithDelta(initial_scroll_, impl_scroll_),
354 root_scroll_layer->BaseScrollOffset()); 365 ScrollTreeForLayer(root_scroll_layer)
366 ->GetScrollOffsetBaseForTesting(root_scroll_layer->id()));
355 367
356 EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta()); 368 EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta());
357 EXPECT_EQ(impl_scale_, impl->active_tree()->current_page_scale_factor()); 369 EXPECT_EQ(impl_scale_, impl->active_tree()->current_page_scale_factor());
358 impl->active_tree()->SetPageScaleOnActiveTree(impl_scale_ * impl_scale_); 370 impl->active_tree()->SetPageScaleOnActiveTree(impl_scale_ * impl_scale_);
359 EXPECT_EQ(impl_scale_, impl->active_tree()->page_scale_delta()); 371 EXPECT_EQ(impl_scale_, impl->active_tree()->page_scale_delta());
360 EXPECT_EQ(impl_scale_ * impl_scale_, 372 EXPECT_EQ(impl_scale_ * impl_scale_,
361 impl->active_tree()->current_page_scale_factor()); 373 impl->active_tree()->current_page_scale_factor());
362 374
363 impl->SetNeedsCommit(); 375 impl->SetNeedsCommit();
364 } else if (impl->active_tree()->source_frame_number() == 1) { 376 } else if (impl->active_tree()->source_frame_number() == 1) {
365 // Commit for source frame 1 is aborted. 377 // Commit for source frame 1 is aborted.
366 NOTREACHED(); 378 NOTREACHED();
367 } else if (impl->active_tree()->source_frame_number() == 2 && 379 } else if (impl->active_tree()->source_frame_number() == 2 &&
368 impl->SourceAnimationFrameNumberForTesting() == 3) { 380 impl->SourceAnimationFrameNumberForTesting() == 3) {
369 // Third draw after the second full commit. 381 // Third draw after the second full commit.
370 EXPECT_EQ(root_scroll_layer->ScrollDelta(), gfx::Vector2d()); 382 EXPECT_EQ(ScrollDelta(root_scroll_layer), gfx::Vector2d());
371 root_scroll_layer->ScrollBy(impl_scroll_); 383 root_scroll_layer->ScrollBy(impl_scroll_);
372 impl->SetNeedsCommit(); 384 impl->SetNeedsCommit();
373 EXPECT_VECTOR_EQ(impl_scroll_, root_scroll_layer->ScrollDelta()); 385 EXPECT_VECTOR_EQ(impl_scroll_, ScrollDelta(root_scroll_layer));
374 gfx::Vector2dF delta = impl_scroll_ + impl_scroll_ + second_main_scroll_; 386 gfx::Vector2dF delta = impl_scroll_ + impl_scroll_ + second_main_scroll_;
375 EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(initial_scroll_, delta), 387 EXPECT_VECTOR_EQ(
376 root_scroll_layer->BaseScrollOffset()); 388 gfx::ScrollOffsetWithDelta(initial_scroll_, delta),
389 ScrollTreeForLayer(root_scroll_layer)
390 ->GetScrollOffsetBaseForTesting(root_scroll_layer->id()));
377 } else if (impl->active_tree()->source_frame_number() == 2 && 391 } else if (impl->active_tree()->source_frame_number() == 2 &&
378 impl->SourceAnimationFrameNumberForTesting() == 4) { 392 impl->SourceAnimationFrameNumberForTesting() == 4) {
379 // Final draw after the second aborted commit. 393 // Final draw after the second aborted commit.
380 EXPECT_VECTOR_EQ(gfx::Vector2d(), root_scroll_layer->ScrollDelta()); 394 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(root_scroll_layer));
381 gfx::Vector2dF delta = 395 gfx::Vector2dF delta =
382 impl_scroll_ + impl_scroll_ + impl_scroll_ + second_main_scroll_; 396 impl_scroll_ + impl_scroll_ + impl_scroll_ + second_main_scroll_;
383 EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(initial_scroll_, delta), 397 EXPECT_VECTOR_EQ(
384 root_scroll_layer->BaseScrollOffset()); 398 gfx::ScrollOffsetWithDelta(initial_scroll_, delta),
399 ScrollTreeForLayer(root_scroll_layer)
400 ->GetScrollOffsetBaseForTesting(root_scroll_layer->id()));
385 EndTest(); 401 EndTest();
386 } else { 402 } else {
387 // Commit for source frame 3 is aborted. 403 // Commit for source frame 3 is aborted.
388 NOTREACHED(); 404 NOTREACHED();
389 } 405 }
390 } 406 }
391 407
392 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 408 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
393 const gfx::Vector2dF& outer_delta, 409 const gfx::Vector2dF& outer_delta,
394 const gfx::Vector2dF& elastic_overscroll_delta, 410 const gfx::Vector2dF& elastic_overscroll_delta,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 450
435 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 451 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
436 452
437 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 453 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
438 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); 454 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
439 455
440 // Check that a fractional scroll delta is correctly accumulated over 456 // Check that a fractional scroll delta is correctly accumulated over
441 // multiple commits. 457 // multiple commits.
442 switch (impl->active_tree()->source_frame_number()) { 458 switch (impl->active_tree()->source_frame_number()) {
443 case 0: 459 case 0:
444 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), scroll_layer->BaseScrollOffset()); 460 EXPECT_VECTOR_EQ(
445 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), scroll_layer->ScrollDelta()); 461 gfx::Vector2d(0, 0),
462 ScrollTreeForLayer(scroll_layer)
463 ->GetScrollOffsetBaseForTesting(scroll_layer->id()));
464 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), ScrollDelta(scroll_layer));
446 PostSetNeedsCommitToMainThread(); 465 PostSetNeedsCommitToMainThread();
447 break; 466 break;
448 case 1: 467 case 1:
449 EXPECT_VECTOR_EQ(gfx::ToFlooredVector2d(scroll_amount_), 468 EXPECT_VECTOR_EQ(
450 scroll_layer->BaseScrollOffset()); 469 gfx::ToFlooredVector2d(scroll_amount_),
470 ScrollTreeForLayer(scroll_layer)
471 ->GetScrollOffsetBaseForTesting(scroll_layer->id()));
451 EXPECT_VECTOR_EQ(gfx::Vector2dF(fmod(scroll_amount_.x(), 1.0f), 0.0f), 472 EXPECT_VECTOR_EQ(gfx::Vector2dF(fmod(scroll_amount_.x(), 1.0f), 0.0f),
452 scroll_layer->ScrollDelta()); 473 ScrollDelta(scroll_layer));
453 PostSetNeedsCommitToMainThread(); 474 PostSetNeedsCommitToMainThread();
454 break; 475 break;
455 case 2: 476 case 2:
456 EXPECT_VECTOR_EQ( 477 EXPECT_VECTOR_EQ(
457 gfx::ToFlooredVector2d(scroll_amount_ + scroll_amount_), 478 gfx::ToFlooredVector2d(scroll_amount_ + scroll_amount_),
458 scroll_layer->BaseScrollOffset()); 479 ScrollTreeForLayer(scroll_layer)
480 ->GetScrollOffsetBaseForTesting(scroll_layer->id()));
459 EXPECT_VECTOR_EQ( 481 EXPECT_VECTOR_EQ(
460 gfx::Vector2dF(fmod(2.0f * scroll_amount_.x(), 1.0f), 0.0f), 482 gfx::Vector2dF(fmod(2.0f * scroll_amount_.x(), 1.0f), 0.0f),
461 scroll_layer->ScrollDelta()); 483 ScrollDelta(scroll_layer));
462 EndTest(); 484 EndTest();
463 break; 485 break;
464 } 486 }
465 scroll_layer->ScrollBy(scroll_amount_); 487 scroll_layer->ScrollBy(scroll_amount_);
466 } 488 }
467 489
468 void AfterTest() override {} 490 void AfterTest() override {}
469 491
470 private: 492 private:
471 gfx::Vector2dF scroll_amount_; 493 gfx::Vector2dF scroll_amount_;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 LayerImpl* expected_scroll_layer_impl = NULL; 620 LayerImpl* expected_scroll_layer_impl = NULL;
599 LayerImpl* expected_no_scroll_layer_impl = NULL; 621 LayerImpl* expected_no_scroll_layer_impl = NULL;
600 if (scroll_child_layer_) { 622 if (scroll_child_layer_) {
601 expected_scroll_layer_impl = child_layer_impl; 623 expected_scroll_layer_impl = child_layer_impl;
602 expected_no_scroll_layer_impl = root_scroll_layer_impl; 624 expected_no_scroll_layer_impl = root_scroll_layer_impl;
603 } else { 625 } else {
604 expected_scroll_layer_impl = root_scroll_layer_impl; 626 expected_scroll_layer_impl = root_scroll_layer_impl;
605 expected_no_scroll_layer_impl = child_layer_impl; 627 expected_no_scroll_layer_impl = child_layer_impl;
606 } 628 }
607 629
608 EXPECT_VECTOR_EQ(gfx::Vector2d(), inner_scroll->ScrollDelta()); 630 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(inner_scroll));
609 EXPECT_VECTOR_EQ(gfx::Vector2d(), 631 EXPECT_VECTOR_EQ(gfx::Vector2d(),
610 expected_no_scroll_layer_impl->ScrollDelta()); 632 ScrollDelta(expected_no_scroll_layer_impl));
611 633
612 // Ensure device scale factor matches the active tree. 634 // Ensure device scale factor matches the active tree.
613 EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor()); 635 EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor());
614 switch (impl->active_tree()->source_frame_number()) { 636 switch (impl->active_tree()->source_frame_number()) {
615 case 0: { 637 case 0: {
616 // GESTURE scroll on impl thread. Also tests that the last scrolled 638 // GESTURE scroll on impl thread. Also tests that the last scrolled
617 // layer id is stored even after the scrolling ends. 639 // layer id is stored even after the scrolling ends.
618 gfx::Point scroll_point = 640 gfx::Point scroll_point =
619 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() - 641 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() -
620 gfx::Vector2dF(0.5f, 0.5f)); 642 gfx::Vector2dF(0.5f, 0.5f));
621 InputHandler::ScrollStatus status = impl->ScrollBegin( 643 InputHandler::ScrollStatus status = impl->ScrollBegin(
622 BeginState(scroll_point).get(), InputHandler::GESTURE); 644 BeginState(scroll_point).get(), InputHandler::GESTURE);
623 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 645 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
624 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get()); 646 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get());
625 LayerImpl* scrolling_layer = impl->CurrentlyScrollingLayer(); 647 LayerImpl* scrolling_layer = impl->CurrentlyScrollingLayer();
626 CHECK(scrolling_layer); 648 CHECK(scrolling_layer);
627 impl->ScrollEnd(EndState().get()); 649 impl->ScrollEnd(EndState().get());
628 CHECK(!impl->CurrentlyScrollingLayer()); 650 CHECK(!impl->CurrentlyScrollingLayer());
629 EXPECT_EQ(scrolling_layer->id(), 651 EXPECT_EQ(scrolling_layer->id(),
630 impl->active_tree()->LastScrolledLayerId()); 652 impl->active_tree()->LastScrolledLayerId());
631 653
632 // Check the scroll is applied as a delta. 654 // Check the scroll is applied as a delta.
633 EXPECT_VECTOR_EQ(initial_offset_, 655 EXPECT_VECTOR_EQ(initial_offset_,
634 expected_scroll_layer_impl->BaseScrollOffset()); 656 ScrollTreeForLayer(expected_scroll_layer_impl)
657 ->GetScrollOffsetBaseForTesting(
658 expected_scroll_layer_impl->id()));
635 EXPECT_VECTOR_EQ(scroll_amount_, 659 EXPECT_VECTOR_EQ(scroll_amount_,
636 expected_scroll_layer_impl->ScrollDelta()); 660 ScrollDelta(expected_scroll_layer_impl));
637 break; 661 break;
638 } 662 }
639 case 1: { 663 case 1: {
640 // WHEEL scroll on impl thread. 664 // WHEEL scroll on impl thread.
641 gfx::Point scroll_point = 665 gfx::Point scroll_point =
642 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() + 666 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() +
643 gfx::Vector2dF(0.5f, 0.5f)); 667 gfx::Vector2dF(0.5f, 0.5f));
644 InputHandler::ScrollStatus status = impl->ScrollBegin( 668 InputHandler::ScrollStatus status = impl->ScrollBegin(
645 BeginState(scroll_point).get(), InputHandler::WHEEL); 669 BeginState(scroll_point).get(), InputHandler::WHEEL);
646 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 670 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
647 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get()); 671 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get());
648 impl->ScrollEnd(EndState().get()); 672 impl->ScrollEnd(EndState().get());
649 673
650 // Check the scroll is applied as a delta. 674 // Check the scroll is applied as a delta.
651 EXPECT_VECTOR_EQ(javascript_scroll_, 675 EXPECT_VECTOR_EQ(javascript_scroll_,
652 expected_scroll_layer_impl->BaseScrollOffset()); 676 ScrollTreeForLayer(expected_scroll_layer_impl)
677 ->GetScrollOffsetBaseForTesting(
678 expected_scroll_layer_impl->id()));
653 EXPECT_VECTOR_EQ(scroll_amount_, 679 EXPECT_VECTOR_EQ(scroll_amount_,
654 expected_scroll_layer_impl->ScrollDelta()); 680 ScrollDelta(expected_scroll_layer_impl));
655 break; 681 break;
656 } 682 }
657 case 2: 683 case 2:
658 684
659 EXPECT_VECTOR_EQ( 685 EXPECT_VECTOR_EQ(
660 gfx::ScrollOffsetWithDelta(javascript_scroll_, scroll_amount_), 686 gfx::ScrollOffsetWithDelta(javascript_scroll_, scroll_amount_),
661 expected_scroll_layer_impl->BaseScrollOffset()); 687 ScrollTreeForLayer(expected_scroll_layer_impl)
688 ->GetScrollOffsetBaseForTesting(
689 expected_scroll_layer_impl->id()));
662 EXPECT_VECTOR_EQ(gfx::Vector2d(), 690 EXPECT_VECTOR_EQ(gfx::Vector2d(),
663 expected_scroll_layer_impl->ScrollDelta()); 691 ScrollDelta(expected_scroll_layer_impl));
664 692
665 EndTest(); 693 EndTest();
666 break; 694 break;
667 } 695 }
668 } 696 }
669 697
670 void AfterTest() override { 698 void AfterTest() override {
671 if (scroll_child_layer_) { 699 if (scroll_child_layer_) {
672 EXPECT_EQ(0, num_scrolls_); 700 EXPECT_EQ(0, num_scrolls_);
673 EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(javascript_scroll_, 701 EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(javascript_scroll_,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 859
832 LayerImpl* root = impl->active_tree()->root_layer(); 860 LayerImpl* root = impl->active_tree()->root_layer();
833 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); 861 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
834 LayerImpl* pending_root = 862 LayerImpl* pending_root =
835 impl->active_tree()->FindPendingTreeLayerById(root->id()); 863 impl->active_tree()->FindPendingTreeLayerById(root->id());
836 864
837 switch (impl->active_tree()->source_frame_number()) { 865 switch (impl->active_tree()->source_frame_number()) {
838 case 0: 866 case 0:
839 if (!impl->pending_tree()) { 867 if (!impl->pending_tree()) {
840 impl->BlockNotifyReadyToActivateForTesting(true); 868 impl->BlockNotifyReadyToActivateForTesting(true);
841 EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer->ScrollDelta()); 869 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(scroll_layer));
842 scroll_layer->ScrollBy(impl_thread_scroll1_); 870 scroll_layer->ScrollBy(impl_thread_scroll1_);
843 871
844 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); 872 EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer)
845 EXPECT_VECTOR_EQ(impl_thread_scroll1_, scroll_layer->ScrollDelta()); 873 ->GetScrollOffsetBaseForTesting(
874 scroll_layer->id()));
875 EXPECT_VECTOR_EQ(impl_thread_scroll1_, ScrollDelta(scroll_layer));
846 PostSetNeedsCommitToMainThread(); 876 PostSetNeedsCommitToMainThread();
847 877
848 // CommitCompleteOnThread will trigger this function again 878 // CommitCompleteOnThread will trigger this function again
849 // and cause us to take the else clause. 879 // and cause us to take the else clause.
850 } else { 880 } else {
851 impl->BlockNotifyReadyToActivateForTesting(false); 881 impl->BlockNotifyReadyToActivateForTesting(false);
852 ASSERT_TRUE(pending_root); 882 ASSERT_TRUE(pending_root);
853 EXPECT_EQ(impl->pending_tree()->source_frame_number(), 1); 883 EXPECT_EQ(impl->pending_tree()->source_frame_number(), 1);
854 884
855 scroll_layer->ScrollBy(impl_thread_scroll2_); 885 scroll_layer->ScrollBy(impl_thread_scroll2_);
856 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); 886 EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer)
887 ->GetScrollOffsetBaseForTesting(
888 scroll_layer->id()));
857 EXPECT_VECTOR_EQ(impl_thread_scroll1_ + impl_thread_scroll2_, 889 EXPECT_VECTOR_EQ(impl_thread_scroll1_ + impl_thread_scroll2_,
858 scroll_layer->ScrollDelta()); 890 ScrollDelta(scroll_layer));
859 891
860 LayerImpl* pending_scroll_layer = 892 LayerImpl* pending_scroll_layer =
861 impl->pending_tree()->OuterViewportScrollLayer(); 893 impl->pending_tree()->OuterViewportScrollLayer();
862 EXPECT_VECTOR_EQ( 894 EXPECT_VECTOR_EQ(
863 gfx::ScrollOffsetWithDelta( 895 gfx::ScrollOffsetWithDelta(
864 initial_scroll_, main_thread_scroll_ + impl_thread_scroll1_), 896 initial_scroll_, main_thread_scroll_ + impl_thread_scroll1_),
865 pending_scroll_layer->BaseScrollOffset()); 897 ScrollTreeForLayer(pending_scroll_layer)
898 ->GetScrollOffsetBaseForTesting(pending_scroll_layer->id()));
866 EXPECT_VECTOR_EQ(impl_thread_scroll2_, 899 EXPECT_VECTOR_EQ(impl_thread_scroll2_,
867 pending_scroll_layer->ScrollDelta()); 900 ScrollDelta(pending_scroll_layer));
868 } 901 }
869 break; 902 break;
870 case 1: 903 case 1:
871 EXPECT_FALSE(impl->pending_tree()); 904 EXPECT_FALSE(impl->pending_tree());
872 EXPECT_VECTOR_EQ( 905 EXPECT_VECTOR_EQ(
873 gfx::ScrollOffsetWithDelta( 906 gfx::ScrollOffsetWithDelta(
874 initial_scroll_, main_thread_scroll_ + impl_thread_scroll1_), 907 initial_scroll_, main_thread_scroll_ + impl_thread_scroll1_),
875 scroll_layer->BaseScrollOffset()); 908 ScrollTreeForLayer(scroll_layer)
876 EXPECT_VECTOR_EQ(impl_thread_scroll2_, scroll_layer->ScrollDelta()); 909 ->GetScrollOffsetBaseForTesting(scroll_layer->id()));
910 EXPECT_VECTOR_EQ(impl_thread_scroll2_, ScrollDelta(scroll_layer));
877 EndTest(); 911 EndTest();
878 break; 912 break;
879 } 913 }
880 } 914 }
881 915
882 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 916 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
883 const gfx::Vector2dF& outer_delta, 917 const gfx::Vector2dF& outer_delta,
884 const gfx::Vector2dF& elastic_overscroll_delta, 918 const gfx::Vector2dF& elastic_overscroll_delta,
885 float scale, 919 float scale,
886 float top_controls_delta) override { 920 float top_controls_delta) override {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 LayerImpl* active_scroll_layer = 988 LayerImpl* active_scroll_layer =
955 active_root ? impl->OuterViewportScrollLayer() : NULL; 989 active_root ? impl->OuterViewportScrollLayer() : NULL;
956 LayerImpl* pending_root = impl->pending_tree()->root_layer(); 990 LayerImpl* pending_root = impl->pending_tree()->root_layer();
957 LayerImpl* pending_scroll_layer = 991 LayerImpl* pending_scroll_layer =
958 impl->pending_tree()->OuterViewportScrollLayer(); 992 impl->pending_tree()->OuterViewportScrollLayer();
959 993
960 ASSERT_TRUE(pending_root); 994 ASSERT_TRUE(pending_root);
961 ASSERT_TRUE(pending_scroll_layer); 995 ASSERT_TRUE(pending_scroll_layer);
962 switch (impl->pending_tree()->source_frame_number()) { 996 switch (impl->pending_tree()->source_frame_number()) {
963 case 0: 997 case 0:
964 EXPECT_VECTOR_EQ(initial_scroll_, 998 EXPECT_VECTOR_EQ(
965 pending_scroll_layer->BaseScrollOffset()); 999 initial_scroll_,
966 EXPECT_VECTOR_EQ(gfx::Vector2d(), pending_scroll_layer->ScrollDelta()); 1000 ScrollTreeForLayer(pending_scroll_layer)
1001 ->GetScrollOffsetBaseForTesting(pending_scroll_layer->id()));
1002 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(pending_scroll_layer));
967 EXPECT_FALSE(active_root); 1003 EXPECT_FALSE(active_root);
968 break; 1004 break;
969 case 1: 1005 case 1:
970 // Even though the scroll happened during the commit, both layers 1006 // Even though the scroll happened during the commit, both layers
971 // should have the appropriate scroll delta. 1007 // should have the appropriate scroll delta.
972 EXPECT_VECTOR_EQ(initial_scroll_, 1008 EXPECT_VECTOR_EQ(
973 pending_scroll_layer->BaseScrollOffset()); 1009 initial_scroll_,
1010 ScrollTreeForLayer(pending_scroll_layer)
1011 ->GetScrollOffsetBaseForTesting(pending_scroll_layer->id()));
974 EXPECT_VECTOR_EQ(impl_thread_scroll_, 1012 EXPECT_VECTOR_EQ(impl_thread_scroll_,
975 pending_scroll_layer->ScrollDelta()); 1013 ScrollDelta(pending_scroll_layer));
976 ASSERT_TRUE(active_root); 1014 ASSERT_TRUE(active_root);
977 EXPECT_VECTOR_EQ(initial_scroll_, 1015 EXPECT_VECTOR_EQ(
978 active_scroll_layer->BaseScrollOffset()); 1016 initial_scroll_,
979 EXPECT_VECTOR_EQ(impl_thread_scroll_, 1017 ScrollTreeForLayer(active_scroll_layer)
980 active_scroll_layer->ScrollDelta()); 1018 ->GetScrollOffsetBaseForTesting(active_scroll_layer->id()));
1019 EXPECT_VECTOR_EQ(impl_thread_scroll_, ScrollDelta(active_scroll_layer));
981 break; 1020 break;
982 case 2: 1021 case 2:
983 // On the next commit, this delta should have been sent and applied. 1022 // On the next commit, this delta should have been sent and applied.
984 EXPECT_VECTOR_EQ( 1023 EXPECT_VECTOR_EQ(
985 gfx::ScrollOffsetWithDelta(initial_scroll_, impl_thread_scroll_), 1024 gfx::ScrollOffsetWithDelta(initial_scroll_, impl_thread_scroll_),
986 pending_scroll_layer->BaseScrollOffset()); 1025 ScrollTreeForLayer(pending_scroll_layer)
987 EXPECT_VECTOR_EQ(gfx::Vector2d(), pending_scroll_layer->ScrollDelta()); 1026 ->GetScrollOffsetBaseForTesting(pending_scroll_layer->id()));
1027 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(pending_scroll_layer));
988 break; 1028 break;
989 } 1029 }
990 } 1030 }
991 1031
992 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 1032 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
993 if (impl->pending_tree()) 1033 if (impl->pending_tree())
994 impl->SetNeedsRedraw(); 1034 impl->SetNeedsRedraw();
995 1035
996 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); 1036 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
997 1037
998 switch (impl->active_tree()->source_frame_number()) { 1038 switch (impl->active_tree()->source_frame_number()) {
999 case 0: 1039 case 0:
1000 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); 1040 EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer)
1001 EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer->ScrollDelta()); 1041 ->GetScrollOffsetBaseForTesting(
1042 scroll_layer->id()));
1043 EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(scroll_layer));
1002 EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta()); 1044 EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta());
1003 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); 1045 EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor());
1004 PostSetNeedsCommitToMainThread(); 1046 PostSetNeedsCommitToMainThread();
1005 break; 1047 break;
1006 case 1: 1048 case 1:
1007 EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); 1049 EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer)
1008 EXPECT_VECTOR_EQ(impl_thread_scroll_, scroll_layer->ScrollDelta()); 1050 ->GetScrollOffsetBaseForTesting(
1051 scroll_layer->id()));
1052 EXPECT_VECTOR_EQ(impl_thread_scroll_, ScrollDelta(scroll_layer));
1009 EXPECT_EQ(impl_scale_, impl->active_tree()->page_scale_delta()); 1053 EXPECT_EQ(impl_scale_, impl->active_tree()->page_scale_delta());
1010 EXPECT_EQ(impl_scale_, 1054 EXPECT_EQ(impl_scale_,
1011 impl->active_tree()->current_page_scale_factor()); 1055 impl->active_tree()->current_page_scale_factor());
1012 PostSetNeedsCommitToMainThread(); 1056 PostSetNeedsCommitToMainThread();
1013 break; 1057 break;
1014 case 2: 1058 case 2:
1015 EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta()); 1059 EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta());
1016 EXPECT_EQ(impl_scale_, 1060 EXPECT_EQ(impl_scale_,
1017 impl->active_tree()->current_page_scale_factor()); 1061 impl->active_tree()->current_page_scale_factor());
1018 EndTest(); 1062 EndTest();
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 CreateScrollLayer(root_scroll_layer, &child_scroll_layer_client_); 1350 CreateScrollLayer(root_scroll_layer, &child_scroll_layer_client_);
1307 fake_content_layer_client_.set_bounds(root_layer->bounds()); 1351 fake_content_layer_client_.set_bounds(root_layer->bounds());
1308 } 1352 }
1309 1353
1310 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1354 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1311 1355
1312 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 1356 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1313 LayerImpl* root = impl->OuterViewportScrollLayer(); 1357 LayerImpl* root = impl->OuterViewportScrollLayer();
1314 switch (impl->active_tree()->source_frame_number()) { 1358 switch (impl->active_tree()->source_frame_number()) {
1315 case 0: 1359 case 0:
1316 root->child_at(0)->SetScrollDelta(gfx::Vector2dF(5, 5)); 1360 SetScrollOffsetDelta(root->child_at(0), gfx::Vector2dF(5, 5));
1317 root->child_at(0)->child_at(0)->SetScrollDelta(gfx::Vector2dF(5, 5)); 1361 SetScrollOffsetDelta(root->child_at(0)->child_at(0),
1318 root->child_at(1)->SetScrollDelta(gfx::Vector2dF(5, 5)); 1362 gfx::Vector2dF(5, 5));
1363 SetScrollOffsetDelta(root->child_at(1), gfx::Vector2dF(5, 5));
1319 PostSetNeedsCommitToMainThread(); 1364 PostSetNeedsCommitToMainThread();
1320 break; 1365 break;
1321 case 1: 1366 case 1:
1322 EndTest(); 1367 EndTest();
1323 break; 1368 break;
1324 } 1369 }
1325 } 1370 }
1326 1371
1327 void AfterTest() override {} 1372 void AfterTest() override {}
1328 1373
(...skipping 27 matching lines...) Expand all
1356 scroll_layer->SetBounds(gfx::Size(parent->bounds().width() + 100, 1401 scroll_layer->SetBounds(gfx::Size(parent->bounds().width() + 100,
1357 parent->bounds().height() + 100)); 1402 parent->bounds().height() + 100));
1358 scroll_layer->set_did_scroll_callback(base::Bind( 1403 scroll_layer->set_did_scroll_callback(base::Bind(
1359 &FakeLayerScrollClient::DidScroll, base::Unretained(client))); 1404 &FakeLayerScrollClient::DidScroll, base::Unretained(client)));
1360 client->owner_ = this; 1405 client->owner_ = this;
1361 client->layer_ = scroll_layer.get(); 1406 client->layer_ = scroll_layer.get();
1362 parent->AddChild(scroll_layer); 1407 parent->AddChild(scroll_layer);
1363 return scroll_layer.get(); 1408 return scroll_layer.get();
1364 } 1409 }
1365 1410
1411 static void SetScrollOffsetDelta(LayerImpl* layer_impl,
1412 const gfx::Vector2dF& delta) {
1413 layer_impl->SetCurrentScrollOffset(
1414 layer_impl->synced_scroll_offset()->ActiveBase() +
1415 gfx::ScrollOffset(delta));
1416 }
1417
1366 FakeLayerScrollClient root_scroll_layer_client_; 1418 FakeLayerScrollClient root_scroll_layer_client_;
1367 FakeLayerScrollClient sibling_scroll_layer_client_; 1419 FakeLayerScrollClient sibling_scroll_layer_client_;
1368 FakeLayerScrollClient child_scroll_layer_client_; 1420 FakeLayerScrollClient child_scroll_layer_client_;
1369 1421
1370 FakeContentLayerClient fake_content_layer_client_; 1422 FakeContentLayerClient fake_content_layer_client_;
1371 1423
1372 bool scroll_destroy_whole_tree_; 1424 bool scroll_destroy_whole_tree_;
1373 }; 1425 };
1374 1426
1375 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { 1427 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) {
1376 RunTest(CompositorMode::THREADED, false); 1428 RunTest(CompositorMode::THREADED, false);
1377 } 1429 }
1378 1430
1379 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { 1431 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) {
1380 scroll_destroy_whole_tree_ = true; 1432 scroll_destroy_whole_tree_ = true;
1381 RunTest(CompositorMode::THREADED, false); 1433 RunTest(CompositorMode::THREADED, false);
1382 } 1434 }
1383 1435
1384 } // namespace 1436 } // namespace
1385 } // namespace cc 1437 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_animation_timelines.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698