OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 virtual void SetUp() OVERRIDE { | 77 virtual void SetUp() OVERRIDE { |
78 LayerTreeSettings settings; | 78 LayerTreeSettings settings; |
79 settings.minimum_occlusion_tracking_size = gfx::Size(); | 79 settings.minimum_occlusion_tracking_size = gfx::Size(); |
80 | 80 |
81 host_impl_ = LayerTreeHostImpl::Create(settings, | 81 host_impl_ = LayerTreeHostImpl::Create(settings, |
82 this, | 82 this, |
83 &proxy_, | 83 &proxy_, |
84 &stats_instrumentation_); | 84 &stats_instrumentation_); |
85 host_impl_->InitializeRenderer(CreateOutputSurface()); | 85 host_impl_->InitializeRenderer(CreateOutputSurface()); |
86 host_impl_->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 86 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
87 } | 87 } |
88 | 88 |
89 virtual void TearDown() OVERRIDE {} | 89 virtual void TearDown() OVERRIDE {} |
90 | 90 |
91 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} | 91 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} |
92 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} | 92 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} |
93 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, | 93 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, |
94 base::TimeDelta interval) OVERRIDE {} | 94 base::TimeDelta interval) OVERRIDE {} |
95 virtual void DidVSync(base::TimeTicks frame_time) OVERRIDE {} | 95 virtual void DidVSync(base::TimeTicks frame_time) OVERRIDE {} |
96 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { | 96 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 LayerTreeSettings settings; | 132 LayerTreeSettings settings; |
133 settings.minimum_occlusion_tracking_size = gfx::Size(); | 133 settings.minimum_occlusion_tracking_size = gfx::Size(); |
134 settings.partial_swap_enabled = partial_swap; | 134 settings.partial_swap_enabled = partial_swap; |
135 | 135 |
136 host_impl_ = LayerTreeHostImpl::Create(settings, | 136 host_impl_ = LayerTreeHostImpl::Create(settings, |
137 this, | 137 this, |
138 &proxy_, | 138 &proxy_, |
139 &stats_instrumentation_); | 139 &stats_instrumentation_); |
140 | 140 |
141 host_impl_->InitializeRenderer(output_surface.Pass()); | 141 host_impl_->InitializeRenderer(output_surface.Pass()); |
142 host_impl_->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 142 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
143 } | 143 } |
144 | 144 |
145 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { | 145 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { |
146 root->SetAnchorPoint(gfx::PointF()); | 146 root->SetAnchorPoint(gfx::PointF()); |
147 root->SetPosition(gfx::PointF()); | 147 root->SetPosition(gfx::PointF()); |
148 root->SetBounds(gfx::Size(10, 10)); | 148 root->SetBounds(gfx::Size(10, 10)); |
149 root->SetContentBounds(gfx::Size(10, 10)); | 149 root->SetContentBounds(gfx::Size(10, 10)); |
150 root->SetDrawsContent(true); | 150 root->SetDrawsContent(true); |
151 root->draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10); | 151 root->draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10); |
152 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 152 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 EXPECT_FALSE(host_impl_->CanDraw()); | 283 EXPECT_FALSE(host_impl_->CanDraw()); |
284 EXPECT_TRUE(on_can_draw_state_changed_called_); | 284 EXPECT_TRUE(on_can_draw_state_changed_called_); |
285 on_can_draw_state_changed_called_ = false; | 285 on_can_draw_state_changed_called_ = false; |
286 | 286 |
287 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 287 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
288 EXPECT_TRUE(host_impl_->CanDraw()); | 288 EXPECT_TRUE(host_impl_->CanDraw()); |
289 EXPECT_TRUE(on_can_draw_state_changed_called_); | 289 EXPECT_TRUE(on_can_draw_state_changed_called_); |
290 on_can_draw_state_changed_called_ = false; | 290 on_can_draw_state_changed_called_ = false; |
291 | 291 |
292 // Toggle the device viewport size to make sure it toggles can_draw. | 292 // Toggle the device viewport size to make sure it toggles can_draw. |
293 host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size()); | 293 host_impl_->SetViewportSize(gfx::Size()); |
294 EXPECT_FALSE(host_impl_->CanDraw()); | 294 EXPECT_FALSE(host_impl_->CanDraw()); |
295 EXPECT_TRUE(on_can_draw_state_changed_called_); | 295 EXPECT_TRUE(on_can_draw_state_changed_called_); |
296 on_can_draw_state_changed_called_ = false; | 296 on_can_draw_state_changed_called_ = false; |
297 | 297 |
298 host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 298 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
299 EXPECT_TRUE(host_impl_->CanDraw()); | 299 EXPECT_TRUE(host_impl_->CanDraw()); |
300 EXPECT_TRUE(on_can_draw_state_changed_called_); | 300 EXPECT_TRUE(on_can_draw_state_changed_called_); |
301 on_can_draw_state_changed_called_ = false; | 301 on_can_draw_state_changed_called_ = false; |
302 | 302 |
303 // Toggle contents textures purged without causing any evictions, | 303 // Toggle contents textures purged without causing any evictions, |
304 // and make sure that it does not change can_draw. | 304 // and make sure that it does not change can_draw. |
305 set_reduce_memory_result(false); | 305 set_reduce_memory_result(false); |
306 host_impl_->SetManagedMemoryPolicy(ManagedMemoryPolicy( | 306 host_impl_->SetManagedMemoryPolicy(ManagedMemoryPolicy( |
307 host_impl_->memory_allocation_limit_bytes() - 1)); | 307 host_impl_->memory_allocation_limit_bytes() - 1)); |
308 EXPECT_TRUE(host_impl_->CanDraw()); | 308 EXPECT_TRUE(host_impl_->CanDraw()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 EXPECT_VECTOR_EQ(root->sent_scroll_delta(), scroll_delta + scroll_delta2); | 387 EXPECT_VECTOR_EQ(root->sent_scroll_delta(), scroll_delta + scroll_delta2); |
388 ExpectContains(*scroll_info, root->id(), scroll_delta + scroll_delta2); | 388 ExpectContains(*scroll_info, root->id(), scroll_delta + scroll_delta2); |
389 | 389 |
390 root->ScrollBy(gfx::Vector2d()); | 390 root->ScrollBy(gfx::Vector2d()); |
391 scroll_info = host_impl_->ProcessScrollDeltas(); | 391 scroll_info = host_impl_->ProcessScrollDeltas(); |
392 EXPECT_EQ(root->sent_scroll_delta(), scroll_delta + scroll_delta2); | 392 EXPECT_EQ(root->sent_scroll_delta(), scroll_delta + scroll_delta2); |
393 } | 393 } |
394 | 394 |
395 TEST_F(LayerTreeHostImplTest, ScrollRootCallsCommitAndRedraw) { | 395 TEST_F(LayerTreeHostImplTest, ScrollRootCallsCommitAndRedraw) { |
396 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 396 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
397 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 397 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
398 InitializeRendererAndDrawFrame(); | 398 InitializeRendererAndDrawFrame(); |
399 | 399 |
400 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 400 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
401 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); | 401 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); |
402 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | 402 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
403 host_impl_->ScrollEnd(); | 403 host_impl_->ScrollEnd(); |
404 EXPECT_TRUE(did_request_redraw_); | 404 EXPECT_TRUE(did_request_redraw_); |
405 EXPECT_TRUE(did_request_commit_); | 405 EXPECT_TRUE(did_request_commit_); |
406 } | 406 } |
407 | 407 |
408 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) { | 408 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) { |
409 // We should not crash when trying to scroll an empty layer tree. | 409 // We should not crash when trying to scroll an empty layer tree. |
410 EXPECT_EQ(InputHandlerClient::ScrollIgnored, | 410 EXPECT_EQ(InputHandlerClient::ScrollIgnored, |
411 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); | 411 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); |
412 } | 412 } |
413 | 413 |
414 TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) { | 414 TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) { |
415 LayerTreeSettings settings; | 415 LayerTreeSettings settings; |
416 host_impl_ = LayerTreeHostImpl::Create(settings, | 416 host_impl_ = LayerTreeHostImpl::Create(settings, |
417 this, | 417 this, |
418 &proxy_, | 418 &proxy_, |
419 &stats_instrumentation_); | 419 &stats_instrumentation_); |
420 | 420 |
421 // Initialization will fail here. | 421 // Initialization will fail here. |
422 host_impl_->InitializeRenderer(FakeOutputSurface::Create3d( | 422 host_impl_->InitializeRenderer(FakeOutputSurface::Create3d( |
423 scoped_ptr<WebKit::WebGraphicsContext3D>( | 423 scoped_ptr<WebKit::WebGraphicsContext3D>( |
424 new TestWebGraphicsContext3DMakeCurrentFails)) | 424 new TestWebGraphicsContext3DMakeCurrentFails)) |
425 .PassAs<OutputSurface>()); | 425 .PassAs<OutputSurface>()); |
426 host_impl_->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 426 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
427 | 427 |
428 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 428 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
429 | 429 |
430 // We should not crash when trying to scroll after the renderer initialization | 430 // We should not crash when trying to scroll after the renderer initialization |
431 // fails. | 431 // fails. |
432 EXPECT_EQ(InputHandlerClient::ScrollIgnored, | 432 EXPECT_EQ(InputHandlerClient::ScrollIgnored, |
433 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); | 433 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); |
434 } | 434 } |
435 | 435 |
436 TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) { | 436 TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) { |
437 int scroll_layer_id = 1; | 437 int scroll_layer_id = 1; |
438 | 438 |
439 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 439 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
440 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 440 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
441 InitializeRendererAndDrawFrame(); | 441 InitializeRendererAndDrawFrame(); |
442 | 442 |
443 // We should not crash if the tree is replaced while we are scrolling. | 443 // We should not crash if the tree is replaced while we are scrolling. |
444 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 444 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
445 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); | 445 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); |
446 host_impl_->active_tree()->DetachLayerTree(); | 446 host_impl_->active_tree()->DetachLayerTree(); |
447 | 447 |
448 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 448 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
449 | 449 |
450 // We should still be scrolling, because the scrolled layer also exists in the | 450 // We should still be scrolling, because the scrolled layer also exists in the |
451 // new tree. | 451 // new tree. |
452 gfx::Vector2d scroll_delta(0, 10); | 452 gfx::Vector2d scroll_delta(0, 10); |
453 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 453 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
454 host_impl_->ScrollEnd(); | 454 host_impl_->ScrollEnd(); |
455 scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); | 455 scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); |
456 ExpectContains(*scroll_info, scroll_layer_id, scroll_delta); | 456 ExpectContains(*scroll_info, scroll_layer_id, scroll_delta); |
457 } | 457 } |
458 | 458 |
459 TEST_F(LayerTreeHostImplTest, ClearRootRenderSurfaceAndScroll) { | 459 TEST_F(LayerTreeHostImplTest, ClearRootRenderSurfaceAndScroll) { |
460 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 460 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
461 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 461 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
462 InitializeRendererAndDrawFrame(); | 462 InitializeRendererAndDrawFrame(); |
463 | 463 |
464 // We should be able to scroll even if the root layer loses its render surface | 464 // We should be able to scroll even if the root layer loses its render surface |
465 // after the most recent render. | 465 // after the most recent render. |
466 host_impl_->active_tree()->root_layer()->ClearRenderSurface(); | 466 host_impl_->active_tree()->root_layer()->ClearRenderSurface(); |
467 host_impl_->active_tree()->set_needs_update_draw_properties(); | 467 host_impl_->active_tree()->set_needs_update_draw_properties(); |
468 | 468 |
469 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 469 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
470 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); | 470 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); |
471 } | 471 } |
472 | 472 |
473 TEST_F(LayerTreeHostImplTest, WheelEventHandlers) { | 473 TEST_F(LayerTreeHostImplTest, WheelEventHandlers) { |
474 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 474 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
475 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 475 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
476 InitializeRendererAndDrawFrame(); | 476 InitializeRendererAndDrawFrame(); |
477 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 477 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
478 | 478 |
479 root->SetHaveWheelEventHandlers(true); | 479 root->SetHaveWheelEventHandlers(true); |
480 | 480 |
481 // With registered event handlers, wheel scrolls have to go to the main | 481 // With registered event handlers, wheel scrolls have to go to the main |
482 // thread. | 482 // thread. |
483 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, | 483 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, |
484 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); | 484 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); |
485 | 485 |
486 // But gesture scrolls can still be handled. | 486 // But gesture scrolls can still be handled. |
487 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 487 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
488 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Gesture)); | 488 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Gesture)); |
489 } | 489 } |
490 | 490 |
491 TEST_F(LayerTreeHostImplTest, ShouldScrollOnMainThread) { | 491 TEST_F(LayerTreeHostImplTest, ShouldScrollOnMainThread) { |
492 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 492 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
493 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 493 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
494 InitializeRendererAndDrawFrame(); | 494 InitializeRendererAndDrawFrame(); |
495 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 495 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
496 | 496 |
497 root->SetShouldScrollOnMainThread(true); | 497 root->SetShouldScrollOnMainThread(true); |
498 | 498 |
499 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, | 499 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, |
500 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); | 500 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Wheel)); |
501 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, | 501 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, |
502 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Gesture)); | 502 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Gesture)); |
503 } | 503 } |
504 | 504 |
505 TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) { | 505 TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) { |
506 SetupScrollAndContentsLayers(gfx::Size(200, 200)); | 506 SetupScrollAndContentsLayers(gfx::Size(200, 200)); |
507 host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 507 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
508 | 508 |
509 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 509 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
510 root->SetContentsScale(2.f, 2.f); | 510 root->SetContentsScale(2.f, 2.f); |
511 root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); | 511 root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); |
512 | 512 |
513 InitializeRendererAndDrawFrame(); | 513 InitializeRendererAndDrawFrame(); |
514 | 514 |
515 // All scroll types inside the non-fast scrollable region should fail. | 515 // All scroll types inside the non-fast scrollable region should fail. |
516 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, | 516 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, |
517 host_impl_->ScrollBegin(gfx::Point(25, 25), | 517 host_impl_->ScrollBegin(gfx::Point(25, 25), |
(...skipping 10 matching lines...) Expand all Loading... |
528 host_impl_->ScrollEnd(); | 528 host_impl_->ScrollEnd(); |
529 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 529 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
530 host_impl_->ScrollBegin(gfx::Point(75, 75), | 530 host_impl_->ScrollBegin(gfx::Point(75, 75), |
531 InputHandlerClient::Gesture)); | 531 InputHandlerClient::Gesture)); |
532 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | 532 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
533 host_impl_->ScrollEnd(); | 533 host_impl_->ScrollEnd(); |
534 } | 534 } |
535 | 535 |
536 TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) { | 536 TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) { |
537 SetupScrollAndContentsLayers(gfx::Size(200, 200)); | 537 SetupScrollAndContentsLayers(gfx::Size(200, 200)); |
538 host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 538 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
539 | 539 |
540 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 540 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
541 root->SetContentsScale(2.f, 2.f); | 541 root->SetContentsScale(2.f, 2.f); |
542 root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); | 542 root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); |
543 root->SetPosition(gfx::PointF(-25.f, 0.f)); | 543 root->SetPosition(gfx::PointF(-25.f, 0.f)); |
544 | 544 |
545 InitializeRendererAndDrawFrame(); | 545 InitializeRendererAndDrawFrame(); |
546 | 546 |
547 // This point would fall into the non-fast scrollable region except that we've | 547 // This point would fall into the non-fast scrollable region except that we've |
548 // moved the layer down by 25 pixels. | 548 // moved the layer down by 25 pixels. |
549 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 549 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
550 host_impl_->ScrollBegin(gfx::Point(40, 10), | 550 host_impl_->ScrollBegin(gfx::Point(40, 10), |
551 InputHandlerClient::Wheel)); | 551 InputHandlerClient::Wheel)); |
552 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 1)); | 552 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 1)); |
553 host_impl_->ScrollEnd(); | 553 host_impl_->ScrollEnd(); |
554 | 554 |
555 // This point is still inside the non-fast region. | 555 // This point is still inside the non-fast region. |
556 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, | 556 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, |
557 host_impl_->ScrollBegin(gfx::Point(10, 10), | 557 host_impl_->ScrollBegin(gfx::Point(10, 10), |
558 InputHandlerClient::Wheel)); | 558 InputHandlerClient::Wheel)); |
559 } | 559 } |
560 | 560 |
561 TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) { | 561 TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) { |
562 SetupScrollAndContentsLayers(gfx::Size(200, 200)); | 562 SetupScrollAndContentsLayers(gfx::Size(200, 200)); |
563 host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 563 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
564 | 564 |
565 InitializeRendererAndDrawFrame(); | 565 InitializeRendererAndDrawFrame(); |
566 | 566 |
567 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 567 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
568 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Gesture)); | 568 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Gesture)); |
569 | 569 |
570 // Trying to scroll to the left/top will not succeed. | 570 // Trying to scroll to the left/top will not succeed. |
571 EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); | 571 EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); |
572 EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10))); | 572 EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10))); |
573 EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10))); | 573 EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10))); |
(...skipping 12 matching lines...) Expand all Loading... |
586 EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, -10))); | 586 EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, -10))); |
587 EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); | 587 EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); |
588 EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 10))); | 588 EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 10))); |
589 | 589 |
590 // Trying to scroll more than the available space will also succeed. | 590 // Trying to scroll more than the available space will also succeed. |
591 EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(5000, 5000))); | 591 EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(5000, 5000))); |
592 } | 592 } |
593 | 593 |
594 TEST_F(LayerTreeHostImplTest, ScrollVerticallyByPageReturnsCorrectValue) { | 594 TEST_F(LayerTreeHostImplTest, ScrollVerticallyByPageReturnsCorrectValue) { |
595 SetupScrollAndContentsLayers(gfx::Size(200, 2000)); | 595 SetupScrollAndContentsLayers(gfx::Size(200, 2000)); |
596 host_impl_->SetViewportSize(gfx::Size(100, 1000), gfx::Size(100, 1000)); | 596 host_impl_->SetViewportSize(gfx::Size(100, 1000)); |
597 | 597 |
598 InitializeRendererAndDrawFrame(); | 598 InitializeRendererAndDrawFrame(); |
599 | 599 |
600 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 600 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
601 host_impl_->ScrollBegin(gfx::Point(), | 601 host_impl_->ScrollBegin(gfx::Point(), |
602 InputHandlerClient::Wheel)); | 602 InputHandlerClient::Wheel)); |
603 | 603 |
604 // Trying to scroll without a vertical scrollbar will fail. | 604 // Trying to scroll without a vertical scrollbar will fail. |
605 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( | 605 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( |
606 gfx::Point(), WebKit::WebScrollbar::ScrollForward)); | 606 gfx::Point(), WebKit::WebScrollbar::ScrollForward)); |
(...skipping 13 matching lines...) Expand all Loading... |
620 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( | 620 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( |
621 gfx::Point(), WebKit::WebScrollbar::ScrollForward)); | 621 gfx::Point(), WebKit::WebScrollbar::ScrollForward)); |
622 EXPECT_FLOAT_EQ(875.f, host_impl_->RootScrollLayer()->scroll_delta().y()); | 622 EXPECT_FLOAT_EQ(875.f, host_impl_->RootScrollLayer()->scroll_delta().y()); |
623 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( | 623 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( |
624 gfx::Point(), WebKit::WebScrollbar::ScrollBackward)); | 624 gfx::Point(), WebKit::WebScrollbar::ScrollBackward)); |
625 } | 625 } |
626 | 626 |
627 TEST_F(LayerTreeHostImplTest, | 627 TEST_F(LayerTreeHostImplTest, |
628 ClearRootRenderSurfaceAndHitTestTouchHandlerRegion) { | 628 ClearRootRenderSurfaceAndHitTestTouchHandlerRegion) { |
629 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 629 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
630 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 630 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
631 InitializeRendererAndDrawFrame(); | 631 InitializeRendererAndDrawFrame(); |
632 | 632 |
633 // We should be able to hit test for touch event handlers even if the root | 633 // We should be able to hit test for touch event handlers even if the root |
634 // layer loses its render surface after the most recent render. | 634 // layer loses its render surface after the most recent render. |
635 host_impl_->active_tree()->root_layer()->ClearRenderSurface(); | 635 host_impl_->active_tree()->root_layer()->ClearRenderSurface(); |
636 host_impl_->active_tree()->set_needs_update_draw_properties(); | 636 host_impl_->active_tree()->set_needs_update_draw_properties(); |
637 | 637 |
638 EXPECT_EQ(host_impl_->HaveTouchEventHandlersAt(gfx::Point()), false); | 638 EXPECT_EQ(host_impl_->HaveTouchEventHandlersAt(gfx::Point()), false); |
639 } | 639 } |
640 | 640 |
641 TEST_F(LayerTreeHostImplTest, ImplPinchZoom) { | 641 TEST_F(LayerTreeHostImplTest, ImplPinchZoom) { |
642 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 642 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
643 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 643 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
644 InitializeRendererAndDrawFrame(); | 644 InitializeRendererAndDrawFrame(); |
645 | 645 |
646 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); | 646 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); |
647 DCHECK(scroll_layer); | 647 DCHECK(scroll_layer); |
648 | 648 |
649 float min_page_scale = 1.f, max_page_scale = 4.f; | 649 float min_page_scale = 1.f, max_page_scale = 4.f; |
650 gfx::Transform identity_scale_transform; | 650 gfx::Transform identity_scale_transform; |
651 | 651 |
652 // The impl-based pinch zoom should adjust the max scroll position. | 652 // The impl-based pinch zoom should adjust the max scroll position. |
653 { | 653 { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 scoped_ptr<ScrollAndScaleSet> scroll_info = | 698 scoped_ptr<ScrollAndScaleSet> scroll_info = |
699 host_impl_->ProcessScrollDeltas(); | 699 host_impl_->ProcessScrollDeltas(); |
700 ExpectContains(*scroll_info.get(), | 700 ExpectContains(*scroll_info.get(), |
701 host_impl_->active_tree()->root_layer()->id(), | 701 host_impl_->active_tree()->root_layer()->id(), |
702 scroll_delta); | 702 scroll_delta); |
703 } | 703 } |
704 } | 704 } |
705 | 705 |
706 TEST_F(LayerTreeHostImplTest, PinchGesture) { | 706 TEST_F(LayerTreeHostImplTest, PinchGesture) { |
707 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 707 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
708 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 708 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
709 InitializeRendererAndDrawFrame(); | 709 InitializeRendererAndDrawFrame(); |
710 | 710 |
711 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); | 711 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); |
712 DCHECK(scroll_layer); | 712 DCHECK(scroll_layer); |
713 | 713 |
714 float min_page_scale = 1.f; | 714 float min_page_scale = 1.f; |
715 float max_page_scale = 4.f; | 715 float max_page_scale = 4.f; |
716 gfx::Transform identity_scale_transform; | 716 gfx::Transform identity_scale_transform; |
717 | 717 |
718 // Basic pinch zoom in gesture | 718 // Basic pinch zoom in gesture |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 | 815 |
816 scoped_ptr<ScrollAndScaleSet> scroll_info = | 816 scoped_ptr<ScrollAndScaleSet> scroll_info = |
817 host_impl_->ProcessScrollDeltas(); | 817 host_impl_->ProcessScrollDeltas(); |
818 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); | 818 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); |
819 ExpectContains(*scroll_info, scroll_layer->id(), gfx::Vector2d(-10, -10)); | 819 ExpectContains(*scroll_info, scroll_layer->id(), gfx::Vector2d(-10, -10)); |
820 } | 820 } |
821 } | 821 } |
822 | 822 |
823 TEST_F(LayerTreeHostImplTest, PageScaleAnimation) { | 823 TEST_F(LayerTreeHostImplTest, PageScaleAnimation) { |
824 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 824 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
825 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 825 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
826 InitializeRendererAndDrawFrame(); | 826 InitializeRendererAndDrawFrame(); |
827 | 827 |
828 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); | 828 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); |
829 DCHECK(scroll_layer); | 829 DCHECK(scroll_layer); |
830 | 830 |
831 float min_page_scale = 0.5f; | 831 float min_page_scale = 0.5f; |
832 float max_page_scale = 4.f; | 832 float max_page_scale = 4.f; |
833 base::TimeTicks start_time = base::TimeTicks() + | 833 base::TimeTicks start_time = base::TimeTicks() + |
834 base::TimeDelta::FromSeconds(1); | 834 base::TimeDelta::FromSeconds(1); |
835 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); | 835 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 scoped_ptr<ScrollAndScaleSet> scroll_info = | 880 scoped_ptr<ScrollAndScaleSet> scroll_info = |
881 host_impl_->ProcessScrollDeltas(); | 881 host_impl_->ProcessScrollDeltas(); |
882 EXPECT_EQ(scroll_info->page_scale_delta, min_page_scale); | 882 EXPECT_EQ(scroll_info->page_scale_delta, min_page_scale); |
883 // Pushed to (0,0) via clamping against contents layer size. | 883 // Pushed to (0,0) via clamping against contents layer size. |
884 ExpectContains(*scroll_info, scroll_layer->id(), gfx::Vector2d(-50, -50)); | 884 ExpectContains(*scroll_info, scroll_layer->id(), gfx::Vector2d(-50, -50)); |
885 } | 885 } |
886 } | 886 } |
887 | 887 |
888 TEST_F(LayerTreeHostImplTest, PageScaleAnimationNoOp) { | 888 TEST_F(LayerTreeHostImplTest, PageScaleAnimationNoOp) { |
889 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 889 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
890 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 890 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
891 InitializeRendererAndDrawFrame(); | 891 InitializeRendererAndDrawFrame(); |
892 | 892 |
893 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); | 893 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); |
894 DCHECK(scroll_layer); | 894 DCHECK(scroll_layer); |
895 | 895 |
896 float min_page_scale = 0.5f; | 896 float min_page_scale = 0.5f; |
897 float max_page_scale = 4.f; | 897 float max_page_scale = 4.f; |
898 base::TimeTicks start_time = base::TimeTicks() + | 898 base::TimeTicks start_time = base::TimeTicks() + |
899 base::TimeDelta::FromSeconds(1); | 899 base::TimeDelta::FromSeconds(1); |
900 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); | 900 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); |
(...skipping 21 matching lines...) Expand all Loading... |
922 | 922 |
923 scoped_ptr<ScrollAndScaleSet> scroll_info = | 923 scoped_ptr<ScrollAndScaleSet> scroll_info = |
924 host_impl_->ProcessScrollDeltas(); | 924 host_impl_->ProcessScrollDeltas(); |
925 EXPECT_EQ(scroll_info->page_scale_delta, 1); | 925 EXPECT_EQ(scroll_info->page_scale_delta, 1); |
926 ExpectNone(*scroll_info, scroll_layer->id()); | 926 ExpectNone(*scroll_info, scroll_layer->id()); |
927 } | 927 } |
928 } | 928 } |
929 | 929 |
930 TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) { | 930 TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) { |
931 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 931 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
932 host_impl_->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 932 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
933 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); | 933 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); |
934 InitializeRendererAndDrawFrame(); | 934 InitializeRendererAndDrawFrame(); |
935 { | 935 { |
936 CompositorFrameMetadata metadata = | 936 CompositorFrameMetadata metadata = |
937 host_impl_->MakeCompositorFrameMetadata(); | 937 host_impl_->MakeCompositorFrameMetadata(); |
938 EXPECT_EQ(gfx::Vector2dF(), metadata.root_scroll_offset); | 938 EXPECT_EQ(gfx::Vector2dF(), metadata.root_scroll_offset); |
939 EXPECT_EQ(1.f, metadata.page_scale_factor); | 939 EXPECT_EQ(1.f, metadata.page_scale_factor); |
940 EXPECT_EQ(gfx::SizeF(50.f, 50.f), metadata.viewport_size); | 940 EXPECT_EQ(gfx::SizeF(50.f, 50.f), metadata.viewport_size); |
941 EXPECT_EQ(gfx::SizeF(100.f, 100.f), metadata.root_layer_size); | 941 EXPECT_EQ(gfx::SizeF(100.f, 100.f), metadata.root_layer_size); |
942 EXPECT_EQ(0.5f, metadata.min_page_scale_factor); | 942 EXPECT_EQ(0.5f, metadata.min_page_scale_factor); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 host_impl_->DidDrawAllLayers(frame); | 1078 host_impl_->DidDrawAllLayers(frame); |
1079 | 1079 |
1080 EXPECT_TRUE(layer->will_draw_called()); | 1080 EXPECT_TRUE(layer->will_draw_called()); |
1081 EXPECT_TRUE(layer->did_draw_called()); | 1081 EXPECT_TRUE(layer->did_draw_called()); |
1082 | 1082 |
1083 EXPECT_FALSE(layer->visible_content_rect().IsEmpty()); | 1083 EXPECT_FALSE(layer->visible_content_rect().IsEmpty()); |
1084 } | 1084 } |
1085 | 1085 |
1086 TEST_F(LayerTreeHostImplTest, WillDrawNotCalledOnOccludedLayer) { | 1086 TEST_F(LayerTreeHostImplTest, WillDrawNotCalledOnOccludedLayer) { |
1087 gfx::Size big_size(1000, 1000); | 1087 gfx::Size big_size(1000, 1000); |
1088 host_impl_->SetViewportSize(big_size, big_size); | 1088 host_impl_->SetViewportSize(big_size); |
1089 | 1089 |
1090 host_impl_->active_tree()->SetRootLayer( | 1090 host_impl_->active_tree()->SetRootLayer( |
1091 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); | 1091 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); |
1092 DidDrawCheckLayer* root = | 1092 DidDrawCheckLayer* root = |
1093 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 1093 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
1094 | 1094 |
1095 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); | 1095 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); |
1096 DidDrawCheckLayer* occluded_layer = | 1096 DidDrawCheckLayer* occluded_layer = |
1097 static_cast<DidDrawCheckLayer*>(root->children()[0]); | 1097 static_cast<DidDrawCheckLayer*>(root->children()[0]); |
1098 | 1098 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 TEST_F(LayerTreeHostImplTest, ScrollNonScrollableRootWithTopControls) { | 1290 TEST_F(LayerTreeHostImplTest, ScrollNonScrollableRootWithTopControls) { |
1291 LayerTreeSettings settings; | 1291 LayerTreeSettings settings; |
1292 settings.calculate_top_controls_position = true; | 1292 settings.calculate_top_controls_position = true; |
1293 settings.top_controls_height = 50; | 1293 settings.top_controls_height = 50; |
1294 | 1294 |
1295 host_impl_ = LayerTreeHostImpl::Create(settings, | 1295 host_impl_ = LayerTreeHostImpl::Create(settings, |
1296 this, | 1296 this, |
1297 &proxy_, | 1297 &proxy_, |
1298 &stats_instrumentation_); | 1298 &stats_instrumentation_); |
1299 host_impl_->InitializeRenderer(CreateOutputSurface()); | 1299 host_impl_->InitializeRenderer(CreateOutputSurface()); |
1300 host_impl_->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 1300 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
1301 | 1301 |
1302 gfx::Size layer_size(5, 5); | 1302 gfx::Size layer_size(5, 5); |
1303 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 1303 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
1304 root->SetScrollable(true); | 1304 root->SetScrollable(true); |
1305 root->SetMaxScrollOffset(gfx::Vector2d(layer_size.width(), | 1305 root->SetMaxScrollOffset(gfx::Vector2d(layer_size.width(), |
1306 layer_size.height())); | 1306 layer_size.height())); |
1307 root->SetBounds(layer_size); | 1307 root->SetBounds(layer_size); |
1308 root->SetContentBounds(layer_size); | 1308 root->SetContentBounds(layer_size); |
1309 root->SetPosition(gfx::PointF()); | 1309 root->SetPosition(gfx::PointF()); |
1310 root->SetAnchorPoint(gfx::PointF()); | 1310 root->SetAnchorPoint(gfx::PointF()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 scroll_layer->SetScrollable(true); | 1346 scroll_layer->SetScrollable(true); |
1347 scroll_layer->SetMaxScrollOffset(gfx::Vector2d(surface_size.width(), | 1347 scroll_layer->SetMaxScrollOffset(gfx::Vector2d(surface_size.width(), |
1348 surface_size.height())); | 1348 surface_size.height())); |
1349 scroll_layer->SetBounds(surface_size); | 1349 scroll_layer->SetBounds(surface_size); |
1350 scroll_layer->SetContentBounds(surface_size); | 1350 scroll_layer->SetContentBounds(surface_size); |
1351 scroll_layer->SetPosition(gfx::PointF()); | 1351 scroll_layer->SetPosition(gfx::PointF()); |
1352 scroll_layer->SetAnchorPoint(gfx::PointF()); | 1352 scroll_layer->SetAnchorPoint(gfx::PointF()); |
1353 scroll_layer->AddChild(content_layer.Pass()); | 1353 scroll_layer->AddChild(content_layer.Pass()); |
1354 | 1354 |
1355 host_impl_->active_tree()->SetRootLayer(scroll_layer.Pass()); | 1355 host_impl_->active_tree()->SetRootLayer(scroll_layer.Pass()); |
1356 host_impl_->SetViewportSize(surface_size, surface_size); | 1356 host_impl_->SetViewportSize(surface_size); |
1357 InitializeRendererAndDrawFrame(); | 1357 InitializeRendererAndDrawFrame(); |
1358 | 1358 |
1359 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1359 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1360 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1360 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1361 InputHandlerClient::Wheel)); | 1361 InputHandlerClient::Wheel)); |
1362 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | 1362 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
1363 host_impl_->ScrollEnd(); | 1363 host_impl_->ScrollEnd(); |
1364 EXPECT_TRUE(did_request_redraw_); | 1364 EXPECT_TRUE(did_request_redraw_); |
1365 EXPECT_TRUE(did_request_commit_); | 1365 EXPECT_TRUE(did_request_commit_); |
1366 } | 1366 } |
1367 | 1367 |
1368 TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) { | 1368 TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) { |
1369 gfx::Size surface_size(10, 10); | 1369 gfx::Size surface_size(10, 10); |
1370 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 1370 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
1371 root->SetBounds(surface_size); | 1371 root->SetBounds(surface_size); |
1372 root->SetContentBounds(surface_size); | 1372 root->SetContentBounds(surface_size); |
1373 root->AddChild(CreateScrollableLayer(2, surface_size)); | 1373 root->AddChild(CreateScrollableLayer(2, surface_size)); |
1374 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1374 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1375 host_impl_->SetViewportSize(surface_size, surface_size); | 1375 host_impl_->SetViewportSize(surface_size); |
1376 InitializeRendererAndDrawFrame(); | 1376 InitializeRendererAndDrawFrame(); |
1377 | 1377 |
1378 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1378 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1379 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1379 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1380 InputHandlerClient::Wheel)); | 1380 InputHandlerClient::Wheel)); |
1381 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | 1381 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
1382 host_impl_->ScrollEnd(); | 1382 host_impl_->ScrollEnd(); |
1383 EXPECT_TRUE(did_request_redraw_); | 1383 EXPECT_TRUE(did_request_redraw_); |
1384 EXPECT_TRUE(did_request_commit_); | 1384 EXPECT_TRUE(did_request_commit_); |
1385 } | 1385 } |
1386 | 1386 |
1387 TEST_F(LayerTreeHostImplTest, ScrollMissesChild) { | 1387 TEST_F(LayerTreeHostImplTest, ScrollMissesChild) { |
1388 gfx::Size surface_size(10, 10); | 1388 gfx::Size surface_size(10, 10); |
1389 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 1389 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
1390 root->AddChild(CreateScrollableLayer(2, surface_size)); | 1390 root->AddChild(CreateScrollableLayer(2, surface_size)); |
1391 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1391 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1392 host_impl_->SetViewportSize(surface_size, surface_size); | 1392 host_impl_->SetViewportSize(surface_size); |
1393 InitializeRendererAndDrawFrame(); | 1393 InitializeRendererAndDrawFrame(); |
1394 | 1394 |
1395 // Scroll event is ignored because the input coordinate is outside the layer | 1395 // Scroll event is ignored because the input coordinate is outside the layer |
1396 // boundaries. | 1396 // boundaries. |
1397 EXPECT_EQ(InputHandlerClient::ScrollIgnored, | 1397 EXPECT_EQ(InputHandlerClient::ScrollIgnored, |
1398 host_impl_->ScrollBegin(gfx::Point(15, 5), | 1398 host_impl_->ScrollBegin(gfx::Point(15, 5), |
1399 InputHandlerClient::Wheel)); | 1399 InputHandlerClient::Wheel)); |
1400 EXPECT_FALSE(did_request_redraw_); | 1400 EXPECT_FALSE(did_request_redraw_); |
1401 EXPECT_FALSE(did_request_commit_); | 1401 EXPECT_FALSE(did_request_commit_); |
1402 } | 1402 } |
1403 | 1403 |
1404 TEST_F(LayerTreeHostImplTest, ScrollMissesBackfacingChild) { | 1404 TEST_F(LayerTreeHostImplTest, ScrollMissesBackfacingChild) { |
1405 gfx::Size surface_size(10, 10); | 1405 gfx::Size surface_size(10, 10); |
1406 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 1406 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
1407 scoped_ptr<LayerImpl> child = CreateScrollableLayer(2, surface_size); | 1407 scoped_ptr<LayerImpl> child = CreateScrollableLayer(2, surface_size); |
1408 host_impl_->SetViewportSize(surface_size, surface_size); | 1408 host_impl_->SetViewportSize(surface_size); |
1409 | 1409 |
1410 gfx::Transform matrix; | 1410 gfx::Transform matrix; |
1411 matrix.RotateAboutXAxis(180.0); | 1411 matrix.RotateAboutXAxis(180.0); |
1412 child->SetTransform(matrix); | 1412 child->SetTransform(matrix); |
1413 child->SetDoubleSided(false); | 1413 child->SetDoubleSided(false); |
1414 | 1414 |
1415 root->AddChild(child.Pass()); | 1415 root->AddChild(child.Pass()); |
1416 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1416 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1417 InitializeRendererAndDrawFrame(); | 1417 InitializeRendererAndDrawFrame(); |
1418 | 1418 |
1419 // Scroll event is ignored because the scrollable layer is not facing the | 1419 // Scroll event is ignored because the scrollable layer is not facing the |
1420 // viewer and there is nothing scrollable behind it. | 1420 // viewer and there is nothing scrollable behind it. |
1421 EXPECT_EQ(InputHandlerClient::ScrollIgnored, | 1421 EXPECT_EQ(InputHandlerClient::ScrollIgnored, |
1422 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1422 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1423 InputHandlerClient::Wheel)); | 1423 InputHandlerClient::Wheel)); |
1424 EXPECT_FALSE(did_request_redraw_); | 1424 EXPECT_FALSE(did_request_redraw_); |
1425 EXPECT_FALSE(did_request_commit_); | 1425 EXPECT_FALSE(did_request_commit_); |
1426 } | 1426 } |
1427 | 1427 |
1428 TEST_F(LayerTreeHostImplTest, ScrollBlockedByContentLayer) { | 1428 TEST_F(LayerTreeHostImplTest, ScrollBlockedByContentLayer) { |
1429 gfx::Size surface_size(10, 10); | 1429 gfx::Size surface_size(10, 10); |
1430 scoped_ptr<LayerImpl> content_layer = CreateScrollableLayer(1, surface_size); | 1430 scoped_ptr<LayerImpl> content_layer = CreateScrollableLayer(1, surface_size); |
1431 content_layer->SetShouldScrollOnMainThread(true); | 1431 content_layer->SetShouldScrollOnMainThread(true); |
1432 content_layer->SetScrollable(false); | 1432 content_layer->SetScrollable(false); |
1433 | 1433 |
1434 scoped_ptr<LayerImpl> scroll_layer = CreateScrollableLayer(2, surface_size); | 1434 scoped_ptr<LayerImpl> scroll_layer = CreateScrollableLayer(2, surface_size); |
1435 scroll_layer->AddChild(content_layer.Pass()); | 1435 scroll_layer->AddChild(content_layer.Pass()); |
1436 | 1436 |
1437 host_impl_->active_tree()->SetRootLayer(scroll_layer.Pass()); | 1437 host_impl_->active_tree()->SetRootLayer(scroll_layer.Pass()); |
1438 host_impl_->SetViewportSize(surface_size, surface_size); | 1438 host_impl_->SetViewportSize(surface_size); |
1439 InitializeRendererAndDrawFrame(); | 1439 InitializeRendererAndDrawFrame(); |
1440 | 1440 |
1441 // Scrolling fails because the content layer is asking to be scrolled on the | 1441 // Scrolling fails because the content layer is asking to be scrolled on the |
1442 // main thread. | 1442 // main thread. |
1443 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, | 1443 EXPECT_EQ(InputHandlerClient::ScrollOnMainThread, |
1444 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1444 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1445 InputHandlerClient::Wheel)); | 1445 InputHandlerClient::Wheel)); |
1446 } | 1446 } |
1447 | 1447 |
1448 TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) { | 1448 TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) { |
1449 gfx::Size surface_size(10, 10); | 1449 gfx::Size surface_size(10, 10); |
1450 float page_scale = 2.f; | 1450 float page_scale = 2.f; |
1451 scoped_ptr<LayerImpl> root = CreateScrollableLayer(1, surface_size); | 1451 scoped_ptr<LayerImpl> root = CreateScrollableLayer(1, surface_size); |
1452 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1452 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1453 host_impl_->active_tree()->DidBecomeActive(); | 1453 host_impl_->active_tree()->DidBecomeActive(); |
1454 host_impl_->SetViewportSize(surface_size, surface_size); | 1454 host_impl_->SetViewportSize(surface_size); |
1455 InitializeRendererAndDrawFrame(); | 1455 InitializeRendererAndDrawFrame(); |
1456 | 1456 |
1457 gfx::Vector2d scroll_delta(0, 10); | 1457 gfx::Vector2d scroll_delta(0, 10); |
1458 gfx::Vector2d expected_scroll_delta = scroll_delta; | 1458 gfx::Vector2d expected_scroll_delta = scroll_delta; |
1459 gfx::Vector2d expected_max_scroll = | 1459 gfx::Vector2d expected_max_scroll = |
1460 host_impl_->active_tree()->root_layer()->max_scroll_offset(); | 1460 host_impl_->active_tree()->root_layer()->max_scroll_offset(); |
1461 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1461 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1462 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1462 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1463 InputHandlerClient::Wheel)); | 1463 InputHandlerClient::Wheel)); |
1464 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 1464 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 host_impl_->active_tree()->root_layer()-> | 1533 host_impl_->active_tree()->root_layer()-> |
1534 impl_transform().matrix().getDouble(3, 3)); | 1534 impl_transform().matrix().getDouble(3, 3)); |
1535 } | 1535 } |
1536 | 1536 |
1537 TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnImplThread) { | 1537 TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnImplThread) { |
1538 gfx::Size surface_size(10, 10); | 1538 gfx::Size surface_size(10, 10); |
1539 float page_scale = 2.f; | 1539 float page_scale = 2.f; |
1540 scoped_ptr<LayerImpl> root = CreateScrollableLayer(1, surface_size); | 1540 scoped_ptr<LayerImpl> root = CreateScrollableLayer(1, surface_size); |
1541 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1541 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1542 host_impl_->active_tree()->DidBecomeActive(); | 1542 host_impl_->active_tree()->DidBecomeActive(); |
1543 host_impl_->SetViewportSize(surface_size, surface_size); | 1543 host_impl_->SetViewportSize(surface_size); |
1544 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, page_scale); | 1544 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, page_scale); |
1545 InitializeRendererAndDrawFrame(); | 1545 InitializeRendererAndDrawFrame(); |
1546 | 1546 |
1547 gfx::Vector2d scroll_delta(0, 10); | 1547 gfx::Vector2d scroll_delta(0, 10); |
1548 gfx::Vector2d expected_scroll_delta = scroll_delta; | 1548 gfx::Vector2d expected_scroll_delta = scroll_delta; |
1549 gfx::Vector2d expected_max_scroll = | 1549 gfx::Vector2d expected_max_scroll = |
1550 host_impl_->active_tree()->root_layer()->max_scroll_offset(); | 1550 host_impl_->active_tree()->root_layer()->max_scroll_offset(); |
1551 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1551 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1552 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1552 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1553 InputHandlerClient::Wheel)); | 1553 InputHandlerClient::Wheel)); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 gfx::Size surface_size(10, 10); | 1629 gfx::Size surface_size(10, 10); |
1630 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 1630 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
1631 root->SetBounds(surface_size); | 1631 root->SetBounds(surface_size); |
1632 root->SetContentBounds(surface_size); | 1632 root->SetContentBounds(surface_size); |
1633 // Also mark the root scrollable so it becomes the root scroll layer. | 1633 // Also mark the root scrollable so it becomes the root scroll layer. |
1634 root->SetScrollable(true); | 1634 root->SetScrollable(true); |
1635 int scroll_layer_id = 2; | 1635 int scroll_layer_id = 2; |
1636 root->AddChild(CreateScrollableLayer(scroll_layer_id, surface_size)); | 1636 root->AddChild(CreateScrollableLayer(scroll_layer_id, surface_size)); |
1637 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1637 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1638 host_impl_->active_tree()->DidBecomeActive(); | 1638 host_impl_->active_tree()->DidBecomeActive(); |
1639 host_impl_->SetViewportSize(surface_size, surface_size); | 1639 host_impl_->SetViewportSize(surface_size); |
1640 InitializeRendererAndDrawFrame(); | 1640 InitializeRendererAndDrawFrame(); |
1641 | 1641 |
1642 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; | 1642 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; |
1643 | 1643 |
1644 gfx::Vector2d scroll_delta(0, 10); | 1644 gfx::Vector2d scroll_delta(0, 10); |
1645 gfx::Vector2d expected_scroll_delta(scroll_delta); | 1645 gfx::Vector2d expected_scroll_delta(scroll_delta); |
1646 gfx::Vector2d expected_max_scroll(child->max_scroll_offset()); | 1646 gfx::Vector2d expected_max_scroll(child->max_scroll_offset()); |
1647 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1647 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1648 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1648 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1649 InputHandlerClient::Wheel)); | 1649 InputHandlerClient::Wheel)); |
(...skipping 29 matching lines...) Expand all Loading... |
1679 scoped_ptr<LayerImpl> grand_child = CreateScrollableLayer(3, surface_size); | 1679 scoped_ptr<LayerImpl> grand_child = CreateScrollableLayer(3, surface_size); |
1680 grand_child->SetScrollOffset(gfx::Vector2d(0, 5)); | 1680 grand_child->SetScrollOffset(gfx::Vector2d(0, 5)); |
1681 | 1681 |
1682 scoped_ptr<LayerImpl> child = CreateScrollableLayer(2, surface_size); | 1682 scoped_ptr<LayerImpl> child = CreateScrollableLayer(2, surface_size); |
1683 child->SetScrollOffset(gfx::Vector2d(3, 0)); | 1683 child->SetScrollOffset(gfx::Vector2d(3, 0)); |
1684 child->AddChild(grand_child.Pass()); | 1684 child->AddChild(grand_child.Pass()); |
1685 | 1685 |
1686 root->AddChild(child.Pass()); | 1686 root->AddChild(child.Pass()); |
1687 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1687 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1688 host_impl_->active_tree()->DidBecomeActive(); | 1688 host_impl_->active_tree()->DidBecomeActive(); |
1689 host_impl_->SetViewportSize(surface_size, surface_size); | 1689 host_impl_->SetViewportSize(surface_size); |
1690 InitializeRendererAndDrawFrame(); | 1690 InitializeRendererAndDrawFrame(); |
1691 { | 1691 { |
1692 gfx::Vector2d scroll_delta(-8, -7); | 1692 gfx::Vector2d scroll_delta(-8, -7); |
1693 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1693 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1694 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1694 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1695 InputHandlerClient::Wheel)); | 1695 InputHandlerClient::Wheel)); |
1696 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 1696 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
1697 host_impl_->ScrollEnd(); | 1697 host_impl_->ScrollEnd(); |
1698 | 1698 |
1699 scoped_ptr<ScrollAndScaleSet> scroll_info = | 1699 scoped_ptr<ScrollAndScaleSet> scroll_info = |
(...skipping 18 matching lines...) Expand all Loading... |
1718 scoped_ptr<LayerImpl> grand_child = CreateScrollableLayer(3, surface_size); | 1718 scoped_ptr<LayerImpl> grand_child = CreateScrollableLayer(3, surface_size); |
1719 grand_child->SetScrollOffset(gfx::Vector2d(0, 2)); | 1719 grand_child->SetScrollOffset(gfx::Vector2d(0, 2)); |
1720 | 1720 |
1721 scoped_ptr<LayerImpl> child = CreateScrollableLayer(2, surface_size); | 1721 scoped_ptr<LayerImpl> child = CreateScrollableLayer(2, surface_size); |
1722 child->SetScrollOffset(gfx::Vector2d(0, 3)); | 1722 child->SetScrollOffset(gfx::Vector2d(0, 3)); |
1723 child->AddChild(grand_child.Pass()); | 1723 child->AddChild(grand_child.Pass()); |
1724 | 1724 |
1725 root->AddChild(child.Pass()); | 1725 root->AddChild(child.Pass()); |
1726 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1726 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1727 host_impl_->active_tree()->DidBecomeActive(); | 1727 host_impl_->active_tree()->DidBecomeActive(); |
1728 host_impl_->SetViewportSize(surface_size, surface_size); | 1728 host_impl_->SetViewportSize(surface_size); |
1729 InitializeRendererAndDrawFrame(); | 1729 InitializeRendererAndDrawFrame(); |
1730 { | 1730 { |
1731 gfx::Vector2d scroll_delta(0, -10); | 1731 gfx::Vector2d scroll_delta(0, -10); |
1732 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1732 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1733 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1733 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1734 InputHandlerClient::NonBubblingGesture)); | 1734 InputHandlerClient::NonBubblingGesture)); |
1735 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 1735 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
1736 host_impl_->ScrollEnd(); | 1736 host_impl_->ScrollEnd(); |
1737 | 1737 |
1738 scoped_ptr<ScrollAndScaleSet> scroll_info = | 1738 scoped_ptr<ScrollAndScaleSet> scroll_info = |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 // When we try to scroll a non-scrollable child layer, the scroll delta | 1810 // When we try to scroll a non-scrollable child layer, the scroll delta |
1811 // should be applied to one of its ancestors if possible. | 1811 // should be applied to one of its ancestors if possible. |
1812 gfx::Size surface_size(10, 10); | 1812 gfx::Size surface_size(10, 10); |
1813 gfx::Size content_size(20, 20); | 1813 gfx::Size content_size(20, 20); |
1814 scoped_ptr<LayerImpl> root = CreateScrollableLayer(1, content_size); | 1814 scoped_ptr<LayerImpl> root = CreateScrollableLayer(1, content_size); |
1815 scoped_ptr<LayerImpl> child = CreateScrollableLayer(2, content_size); | 1815 scoped_ptr<LayerImpl> child = CreateScrollableLayer(2, content_size); |
1816 | 1816 |
1817 child->SetScrollable(false); | 1817 child->SetScrollable(false); |
1818 root->AddChild(child.Pass()); | 1818 root->AddChild(child.Pass()); |
1819 | 1819 |
1820 host_impl_->SetViewportSize(surface_size, surface_size); | 1820 host_impl_->SetViewportSize(surface_size); |
1821 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1821 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1822 host_impl_->active_tree()->DidBecomeActive(); | 1822 host_impl_->active_tree()->DidBecomeActive(); |
1823 InitializeRendererAndDrawFrame(); | 1823 InitializeRendererAndDrawFrame(); |
1824 { | 1824 { |
1825 gfx::Vector2d scroll_delta(0, 4); | 1825 gfx::Vector2d scroll_delta(0, 4); |
1826 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1826 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1827 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1827 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1828 InputHandlerClient::Wheel)); | 1828 InputHandlerClient::Wheel)); |
1829 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 1829 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
1830 host_impl_->ScrollEnd(); | 1830 host_impl_->ScrollEnd(); |
1831 | 1831 |
1832 scoped_ptr<ScrollAndScaleSet> scroll_info = | 1832 scoped_ptr<ScrollAndScaleSet> scroll_info = |
1833 host_impl_->ProcessScrollDeltas(); | 1833 host_impl_->ProcessScrollDeltas(); |
1834 | 1834 |
1835 // Only the root should have scrolled. | 1835 // Only the root should have scrolled. |
1836 ASSERT_EQ(scroll_info->scrolls.size(), 1u); | 1836 ASSERT_EQ(scroll_info->scrolls.size(), 1u); |
1837 ExpectContains(*scroll_info.get(), | 1837 ExpectContains(*scroll_info.get(), |
1838 host_impl_->active_tree()->root_layer()->id(), | 1838 host_impl_->active_tree()->root_layer()->id(), |
1839 scroll_delta); | 1839 scroll_delta); |
1840 } | 1840 } |
1841 } | 1841 } |
1842 | 1842 |
1843 TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) { | 1843 TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) { |
1844 gfx::Size surface_size(10, 10); | 1844 gfx::Size surface_size(10, 10); |
1845 host_impl_->active_tree()->SetRootLayer( | 1845 host_impl_->active_tree()->SetRootLayer( |
1846 CreateScrollableLayer(1, surface_size)); | 1846 CreateScrollableLayer(1, surface_size)); |
1847 host_impl_->active_tree()->DidBecomeActive(); | 1847 host_impl_->active_tree()->DidBecomeActive(); |
1848 host_impl_->SetViewportSize(surface_size, surface_size); | 1848 host_impl_->SetViewportSize(surface_size); |
1849 | 1849 |
1850 // Draw one frame and then immediately rebuild the layer tree to mimic a tree | 1850 // Draw one frame and then immediately rebuild the layer tree to mimic a tree |
1851 // synchronization. | 1851 // synchronization. |
1852 InitializeRendererAndDrawFrame(); | 1852 InitializeRendererAndDrawFrame(); |
1853 host_impl_->active_tree()->DetachLayerTree(); | 1853 host_impl_->active_tree()->DetachLayerTree(); |
1854 host_impl_->active_tree()->SetRootLayer( | 1854 host_impl_->active_tree()->SetRootLayer( |
1855 CreateScrollableLayer(2, surface_size)); | 1855 CreateScrollableLayer(2, surface_size)); |
1856 host_impl_->active_tree()->DidBecomeActive(); | 1856 host_impl_->active_tree()->DidBecomeActive(); |
1857 | 1857 |
1858 // Scrolling should still work even though we did not draw yet. | 1858 // Scrolling should still work even though we did not draw yet. |
1859 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1859 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1860 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1860 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1861 InputHandlerClient::Wheel)); | 1861 InputHandlerClient::Wheel)); |
1862 } | 1862 } |
1863 | 1863 |
1864 TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) { | 1864 TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) { |
1865 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 1865 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
1866 | 1866 |
1867 // Rotate the root layer 90 degrees counter-clockwise about its center. | 1867 // Rotate the root layer 90 degrees counter-clockwise about its center. |
1868 gfx::Transform rotate_transform; | 1868 gfx::Transform rotate_transform; |
1869 rotate_transform.Rotate(-90.0); | 1869 rotate_transform.Rotate(-90.0); |
1870 host_impl_->active_tree()->root_layer()->SetTransform(rotate_transform); | 1870 host_impl_->active_tree()->root_layer()->SetTransform(rotate_transform); |
1871 | 1871 |
1872 gfx::Size surface_size(50, 50); | 1872 gfx::Size surface_size(50, 50); |
1873 host_impl_->SetViewportSize(surface_size, surface_size); | 1873 host_impl_->SetViewportSize(surface_size); |
1874 InitializeRendererAndDrawFrame(); | 1874 InitializeRendererAndDrawFrame(); |
1875 | 1875 |
1876 // Scroll to the right in screen coordinates with a gesture. | 1876 // Scroll to the right in screen coordinates with a gesture. |
1877 gfx::Vector2d gesture_scroll_delta(10, 0); | 1877 gfx::Vector2d gesture_scroll_delta(10, 0); |
1878 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1878 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1879 host_impl_->ScrollBegin(gfx::Point(), | 1879 host_impl_->ScrollBegin(gfx::Point(), |
1880 InputHandlerClient::Gesture)); | 1880 InputHandlerClient::Gesture)); |
1881 host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta); | 1881 host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta); |
1882 host_impl_->ScrollEnd(); | 1882 host_impl_->ScrollEnd(); |
1883 | 1883 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 rotate_transform.Translate(-50.0, -50.0); | 1916 rotate_transform.Translate(-50.0, -50.0); |
1917 rotate_transform.Rotate(child_layer_angle); | 1917 rotate_transform.Rotate(child_layer_angle); |
1918 rotate_transform.Translate(50.0, 50.0); | 1918 rotate_transform.Translate(50.0, 50.0); |
1919 child->SetTransform(rotate_transform); | 1919 child->SetTransform(rotate_transform); |
1920 | 1920 |
1921 // Only allow vertical scrolling. | 1921 // Only allow vertical scrolling. |
1922 child->SetMaxScrollOffset(gfx::Vector2d(0, child->content_bounds().height())); | 1922 child->SetMaxScrollOffset(gfx::Vector2d(0, child->content_bounds().height())); |
1923 host_impl_->active_tree()->root_layer()->AddChild(child.Pass()); | 1923 host_impl_->active_tree()->root_layer()->AddChild(child.Pass()); |
1924 | 1924 |
1925 gfx::Size surface_size(50, 50); | 1925 gfx::Size surface_size(50, 50); |
1926 host_impl_->SetViewportSize(surface_size, surface_size); | 1926 host_impl_->SetViewportSize(surface_size); |
1927 InitializeRendererAndDrawFrame(); | 1927 InitializeRendererAndDrawFrame(); |
1928 { | 1928 { |
1929 // Scroll down in screen coordinates with a gesture. | 1929 // Scroll down in screen coordinates with a gesture. |
1930 gfx::Vector2d gesture_scroll_delta(0, 10); | 1930 gfx::Vector2d gesture_scroll_delta(0, 10); |
1931 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1931 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
1932 host_impl_->ScrollBegin(gfx::Point(), | 1932 host_impl_->ScrollBegin(gfx::Point(), |
1933 InputHandlerClient::Gesture)); | 1933 InputHandlerClient::Gesture)); |
1934 host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta); | 1934 host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta); |
1935 host_impl_->ScrollEnd(); | 1935 host_impl_->ScrollEnd(); |
1936 | 1936 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) { | 1984 TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) { |
1985 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 1985 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
1986 | 1986 |
1987 // Scale the layer to twice its normal size. | 1987 // Scale the layer to twice its normal size. |
1988 int scale = 2; | 1988 int scale = 2; |
1989 gfx::Transform scale_transform; | 1989 gfx::Transform scale_transform; |
1990 scale_transform.Scale(scale, scale); | 1990 scale_transform.Scale(scale, scale); |
1991 host_impl_->active_tree()->root_layer()->SetTransform(scale_transform); | 1991 host_impl_->active_tree()->root_layer()->SetTransform(scale_transform); |
1992 | 1992 |
1993 gfx::Size surface_size(50, 50); | 1993 gfx::Size surface_size(50, 50); |
1994 host_impl_->SetViewportSize(surface_size, surface_size); | 1994 host_impl_->SetViewportSize(surface_size); |
1995 InitializeRendererAndDrawFrame(); | 1995 InitializeRendererAndDrawFrame(); |
1996 | 1996 |
1997 // Scroll down in screen coordinates with a gesture. | 1997 // Scroll down in screen coordinates with a gesture. |
1998 gfx::Vector2d scroll_delta(0, 10); | 1998 gfx::Vector2d scroll_delta(0, 10); |
1999 EXPECT_EQ(InputHandlerClient::ScrollStarted, | 1999 EXPECT_EQ(InputHandlerClient::ScrollStarted, |
2000 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Gesture)); | 2000 host_impl_->ScrollBegin(gfx::Point(), InputHandlerClient::Gesture)); |
2001 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 2001 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
2002 host_impl_->ScrollEnd(); | 2002 host_impl_->ScrollEnd(); |
2003 | 2003 |
2004 // The layer should have scrolled down in its local coordinates, but half the | 2004 // The layer should have scrolled down in its local coordinates, but half the |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2344 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 2344 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
2345 EXPECT_TRUE(layer1->quads_appended()); | 2345 EXPECT_TRUE(layer1->quads_appended()); |
2346 host_impl_->DidDrawAllLayers(frame); | 2346 host_impl_->DidDrawAllLayers(frame); |
2347 } | 2347 } |
2348 | 2348 |
2349 TEST_F(LayerTreeHostImplTest, ViewportCovered) { | 2349 TEST_F(LayerTreeHostImplTest, ViewportCovered) { |
2350 host_impl_->InitializeRenderer(CreateOutputSurface()); | 2350 host_impl_->InitializeRenderer(CreateOutputSurface()); |
2351 host_impl_->active_tree()->set_background_color(SK_ColorGRAY); | 2351 host_impl_->active_tree()->set_background_color(SK_ColorGRAY); |
2352 | 2352 |
2353 gfx::Size viewport_size(1000, 1000); | 2353 gfx::Size viewport_size(1000, 1000); |
2354 host_impl_->SetViewportSize(viewport_size, viewport_size); | 2354 host_impl_->SetViewportSize(viewport_size); |
2355 | 2355 |
2356 host_impl_->active_tree()->SetRootLayer( | 2356 host_impl_->active_tree()->SetRootLayer( |
2357 LayerImpl::Create(host_impl_->active_tree(), 1)); | 2357 LayerImpl::Create(host_impl_->active_tree(), 1)); |
2358 host_impl_->active_tree()->root_layer()->AddChild( | 2358 host_impl_->active_tree()->root_layer()->AddChild( |
2359 BlendStateCheckLayer::Create(host_impl_->active_tree(), | 2359 BlendStateCheckLayer::Create(host_impl_->active_tree(), |
2360 2, | 2360 2, |
2361 host_impl_->resource_provider())); | 2361 host_impl_->resource_provider())); |
2362 BlendStateCheckLayer* child = static_cast<BlendStateCheckLayer*>( | 2362 BlendStateCheckLayer* child = static_cast<BlendStateCheckLayer*>( |
2363 host_impl_->active_tree()->root_layer()->children()[0]); | 2363 host_impl_->active_tree()->root_layer()->children()[0]); |
2364 child->SetExpectation(false, false); | 2364 child->SetExpectation(false, false); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 // This test creates its own LayerTreeHostImpl, so | 2526 // This test creates its own LayerTreeHostImpl, so |
2527 // that we can force partial swap enabled. | 2527 // that we can force partial swap enabled. |
2528 LayerTreeSettings settings; | 2528 LayerTreeSettings settings; |
2529 settings.partial_swap_enabled = true; | 2529 settings.partial_swap_enabled = true; |
2530 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = | 2530 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = |
2531 LayerTreeHostImpl::Create(settings, | 2531 LayerTreeHostImpl::Create(settings, |
2532 this, | 2532 this, |
2533 &proxy_, | 2533 &proxy_, |
2534 &stats_instrumentation_); | 2534 &stats_instrumentation_); |
2535 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); | 2535 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); |
2536 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500), | 2536 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); |
2537 gfx::Size(500, 500)); | |
2538 | 2537 |
2539 scoped_ptr<LayerImpl> root = | 2538 scoped_ptr<LayerImpl> root = |
2540 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 2539 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
2541 scoped_ptr<LayerImpl> child = | 2540 scoped_ptr<LayerImpl> child = |
2542 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); | 2541 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); |
2543 child->SetPosition(gfx::PointF(12.f, 13.f)); | 2542 child->SetPosition(gfx::PointF(12.f, 13.f)); |
2544 child->SetAnchorPoint(gfx::PointF()); | 2543 child->SetAnchorPoint(gfx::PointF()); |
2545 child->SetBounds(gfx::Size(14, 15)); | 2544 child->SetBounds(gfx::Size(14, 15)); |
2546 child->SetContentBounds(gfx::Size(14, 15)); | 2545 child->SetContentBounds(gfx::Size(14, 15)); |
2547 child->SetDrawsContent(true); | 2546 child->SetDrawsContent(true); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2579 actual_swap_rect = partial_swap_tracker->partial_swap_rect(); | 2578 actual_swap_rect = partial_swap_tracker->partial_swap_rect(); |
2580 expected_swap_rect = gfx::Rect(0, 500-28, 26, 28); | 2579 expected_swap_rect = gfx::Rect(0, 500-28, 26, 28); |
2581 EXPECT_EQ(expected_swap_rect.x(), actual_swap_rect.x()); | 2580 EXPECT_EQ(expected_swap_rect.x(), actual_swap_rect.x()); |
2582 EXPECT_EQ(expected_swap_rect.y(), actual_swap_rect.y()); | 2581 EXPECT_EQ(expected_swap_rect.y(), actual_swap_rect.y()); |
2583 EXPECT_EQ(expected_swap_rect.width(), actual_swap_rect.width()); | 2582 EXPECT_EQ(expected_swap_rect.width(), actual_swap_rect.width()); |
2584 EXPECT_EQ(expected_swap_rect.height(), actual_swap_rect.height()); | 2583 EXPECT_EQ(expected_swap_rect.height(), actual_swap_rect.height()); |
2585 | 2584 |
2586 // Make sure that partial swap is constrained to the viewport dimensions | 2585 // Make sure that partial swap is constrained to the viewport dimensions |
2587 // expected damage rect: gfx::Rect(500, 500); | 2586 // expected damage rect: gfx::Rect(500, 500); |
2588 // expected swap rect: flipped damage rect, but also clamped to viewport | 2587 // expected swap rect: flipped damage rect, but also clamped to viewport |
2589 layer_tree_host_impl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 2588 layer_tree_host_impl->SetViewportSize(gfx::Size(10, 10)); |
2590 // This will damage everything. | 2589 // This will damage everything. |
2591 layer_tree_host_impl->active_tree()->root_layer()->SetOpacity(0.7f); | 2590 layer_tree_host_impl->active_tree()->root_layer()->SetOpacity(0.7f); |
2592 EXPECT_TRUE(layer_tree_host_impl->PrepareToDraw(&frame, gfx::Rect())); | 2591 EXPECT_TRUE(layer_tree_host_impl->PrepareToDraw(&frame, gfx::Rect())); |
2593 layer_tree_host_impl->DrawLayers(&frame, base::TimeTicks::Now()); | 2592 layer_tree_host_impl->DrawLayers(&frame, base::TimeTicks::Now()); |
2594 host_impl_->DidDrawAllLayers(frame); | 2593 host_impl_->DidDrawAllLayers(frame); |
2595 layer_tree_host_impl->SwapBuffers(frame); | 2594 layer_tree_host_impl->SwapBuffers(frame); |
2596 actual_swap_rect = partial_swap_tracker->partial_swap_rect(); | 2595 actual_swap_rect = partial_swap_tracker->partial_swap_rect(); |
2597 expected_swap_rect = gfx::Rect(10, 10); | 2596 expected_swap_rect = gfx::Rect(10, 10); |
2598 EXPECT_EQ(expected_swap_rect.x(), actual_swap_rect.x()); | 2597 EXPECT_EQ(expected_swap_rect.x(), actual_swap_rect.x()); |
2599 EXPECT_EQ(expected_swap_rect.y(), actual_swap_rect.y()); | 2598 EXPECT_EQ(expected_swap_rect.y(), actual_swap_rect.y()); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2852 RenderingStatsInstrumentation* stats_instrumentation) { | 2851 RenderingStatsInstrumentation* stats_instrumentation) { |
2853 scoped_ptr<OutputSurface> output_surface = | 2852 scoped_ptr<OutputSurface> output_surface = |
2854 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( | 2853 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( |
2855 new PartialSwapContext)).PassAs<OutputSurface>(); | 2854 new PartialSwapContext)).PassAs<OutputSurface>(); |
2856 | 2855 |
2857 LayerTreeSettings settings; | 2856 LayerTreeSettings settings; |
2858 settings.partial_swap_enabled = partial_swap; | 2857 settings.partial_swap_enabled = partial_swap; |
2859 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 2858 scoped_ptr<LayerTreeHostImpl> my_host_impl = |
2860 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation); | 2859 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation); |
2861 my_host_impl->InitializeRenderer(output_surface.Pass()); | 2860 my_host_impl->InitializeRenderer(output_surface.Pass()); |
2862 my_host_impl->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 2861 my_host_impl->SetViewportSize(gfx::Size(100, 100)); |
2863 | 2862 |
2864 /* | 2863 /* |
2865 Layers are created as follows: | 2864 Layers are created as follows: |
2866 | 2865 |
2867 +--------------------+ | 2866 +--------------------+ |
2868 | 1 | | 2867 | 1 | |
2869 | +-----------+ | | 2868 | +-----------+ | |
2870 | | 2 | | | 2869 | | 2 | | |
2871 | | +-------------------+ | 2870 | | +-------------------+ |
2872 | | | 3 | | 2871 | | | 3 | |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3123 LayerImpl*& root_ptr, | 3122 LayerImpl*& root_ptr, |
3124 LayerImpl*& intermediate_layer_ptr, | 3123 LayerImpl*& intermediate_layer_ptr, |
3125 LayerImpl*& surface_layer_ptr, | 3124 LayerImpl*& surface_layer_ptr, |
3126 LayerImpl*& child_ptr, | 3125 LayerImpl*& child_ptr, |
3127 gfx::Size root_size) { | 3126 gfx::Size root_size) { |
3128 scoped_ptr<OutputSurface> output_surface = | 3127 scoped_ptr<OutputSurface> output_surface = |
3129 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( | 3128 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( |
3130 new PartialSwapContext)).PassAs<OutputSurface>(); | 3129 new PartialSwapContext)).PassAs<OutputSurface>(); |
3131 | 3130 |
3132 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); | 3131 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); |
3133 layer_tree_host_impl->SetViewportSize(root_size, root_size); | 3132 layer_tree_host_impl->SetViewportSize(root_size); |
3134 | 3133 |
3135 scoped_ptr<LayerImpl> root = | 3134 scoped_ptr<LayerImpl> root = |
3136 LayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 3135 LayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
3137 root_ptr = root.get(); | 3136 root_ptr = root.get(); |
3138 | 3137 |
3139 root->SetAnchorPoint(gfx::PointF()); | 3138 root->SetAnchorPoint(gfx::PointF()); |
3140 root->SetPosition(gfx::PointF()); | 3139 root->SetPosition(gfx::PointF()); |
3141 root->SetBounds(root_size); | 3140 root->SetBounds(root_size); |
3142 root->SetContentBounds(root_size); | 3141 root->SetContentBounds(root_size); |
3143 root->SetDrawsContent(true); | 3142 root->SetDrawsContent(true); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3204 LayerImpl* layer_s1_ptr; | 3203 LayerImpl* layer_s1_ptr; |
3205 LayerImpl* layer_s2_ptr; | 3204 LayerImpl* layer_s2_ptr; |
3206 | 3205 |
3207 scoped_ptr<OutputSurface> output_surface = | 3206 scoped_ptr<OutputSurface> output_surface = |
3208 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( | 3207 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( |
3209 new PartialSwapContext)).PassAs<OutputSurface>(); | 3208 new PartialSwapContext)).PassAs<OutputSurface>(); |
3210 | 3209 |
3211 gfx::Size root_size(1000, 1000); | 3210 gfx::Size root_size(1000, 1000); |
3212 | 3211 |
3213 my_host_impl->InitializeRenderer(output_surface.Pass()); | 3212 my_host_impl->InitializeRenderer(output_surface.Pass()); |
3214 my_host_impl->SetViewportSize(root_size, root_size); | 3213 my_host_impl->SetViewportSize(root_size); |
3215 | 3214 |
3216 scoped_ptr<LayerImpl> root = | 3215 scoped_ptr<LayerImpl> root = |
3217 LayerImpl::Create(my_host_impl->active_tree(), 1); | 3216 LayerImpl::Create(my_host_impl->active_tree(), 1); |
3218 root_ptr = root.get(); | 3217 root_ptr = root.get(); |
3219 | 3218 |
3220 root->SetAnchorPoint(gfx::PointF()); | 3219 root->SetAnchorPoint(gfx::PointF()); |
3221 root->SetPosition(gfx::PointF()); | 3220 root->SetPosition(gfx::PointF()); |
3222 root->SetBounds(root_size); | 3221 root->SetBounds(root_size); |
3223 root->SetContentBounds(root_size); | 3222 root->SetContentBounds(root_size); |
3224 root->SetDrawsContent(true); | 3223 root->SetDrawsContent(true); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3323 LayerImpl* layer_s1_ptr; | 3322 LayerImpl* layer_s1_ptr; |
3324 LayerImpl* layer_s2_ptr; | 3323 LayerImpl* layer_s2_ptr; |
3325 | 3324 |
3326 scoped_ptr<OutputSurface> output_surface = | 3325 scoped_ptr<OutputSurface> output_surface = |
3327 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( | 3326 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( |
3328 new PartialSwapContext)).PassAs<OutputSurface>(); | 3327 new PartialSwapContext)).PassAs<OutputSurface>(); |
3329 | 3328 |
3330 gfx::Size root_size(1000, 1000); | 3329 gfx::Size root_size(1000, 1000); |
3331 | 3330 |
3332 my_host_impl->InitializeRenderer(output_surface.Pass()); | 3331 my_host_impl->InitializeRenderer(output_surface.Pass()); |
3333 my_host_impl->SetViewportSize(root_size, root_size); | 3332 my_host_impl->SetViewportSize(root_size); |
3334 | 3333 |
3335 scoped_ptr<LayerImpl> root = | 3334 scoped_ptr<LayerImpl> root = |
3336 LayerImpl::Create(my_host_impl->active_tree(), 1); | 3335 LayerImpl::Create(my_host_impl->active_tree(), 1); |
3337 root_ptr = root.get(); | 3336 root_ptr = root.get(); |
3338 | 3337 |
3339 root->SetAnchorPoint(gfx::PointF()); | 3338 root->SetAnchorPoint(gfx::PointF()); |
3340 root->SetPosition(gfx::PointF()); | 3339 root->SetPosition(gfx::PointF()); |
3341 root->SetBounds(root_size); | 3340 root->SetBounds(root_size); |
3342 root->SetContentBounds(root_size); | 3341 root->SetContentBounds(root_size); |
3343 root->SetDrawsContent(true); | 3342 root->SetDrawsContent(true); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3444 LayerImpl* layer_s1_ptr; | 3443 LayerImpl* layer_s1_ptr; |
3445 LayerImpl* layer_s2_ptr; | 3444 LayerImpl* layer_s2_ptr; |
3446 | 3445 |
3447 scoped_ptr<OutputSurface> output_surface = | 3446 scoped_ptr<OutputSurface> output_surface = |
3448 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( | 3447 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( |
3449 new PartialSwapContext)).PassAs<OutputSurface>(); | 3448 new PartialSwapContext)).PassAs<OutputSurface>(); |
3450 | 3449 |
3451 gfx::Size root_size(1000, 1000); | 3450 gfx::Size root_size(1000, 1000); |
3452 | 3451 |
3453 my_host_impl->InitializeRenderer(output_surface.Pass()); | 3452 my_host_impl->InitializeRenderer(output_surface.Pass()); |
3454 my_host_impl->SetViewportSize(root_size, root_size); | 3453 my_host_impl->SetViewportSize(root_size); |
3455 | 3454 |
3456 scoped_ptr<LayerImpl> root = | 3455 scoped_ptr<LayerImpl> root = |
3457 LayerImpl::Create(my_host_impl->active_tree(), 1); | 3456 LayerImpl::Create(my_host_impl->active_tree(), 1); |
3458 root_ptr = root.get(); | 3457 root_ptr = root.get(); |
3459 | 3458 |
3460 root->SetAnchorPoint(gfx::PointF()); | 3459 root->SetAnchorPoint(gfx::PointF()); |
3461 root->SetPosition(gfx::PointF()); | 3460 root->SetPosition(gfx::PointF()); |
3462 root->SetBounds(root_size); | 3461 root->SetBounds(root_size); |
3463 root->SetContentBounds(root_size); | 3462 root->SetContentBounds(root_size); |
3464 root->SetDrawsContent(true); | 3463 root->SetDrawsContent(true); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3534 LayerImpl* root_ptr; | 3533 LayerImpl* root_ptr; |
3535 LayerImpl* layer_s1_ptr; | 3534 LayerImpl* layer_s1_ptr; |
3536 | 3535 |
3537 scoped_ptr<OutputSurface> output_surface = | 3536 scoped_ptr<OutputSurface> output_surface = |
3538 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( | 3537 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( |
3539 new PartialSwapContext)).PassAs<OutputSurface>(); | 3538 new PartialSwapContext)).PassAs<OutputSurface>(); |
3540 | 3539 |
3541 gfx::Size root_size(1000, 1000); | 3540 gfx::Size root_size(1000, 1000); |
3542 | 3541 |
3543 my_host_impl->InitializeRenderer(output_surface.Pass()); | 3542 my_host_impl->InitializeRenderer(output_surface.Pass()); |
3544 my_host_impl->SetViewportSize(root_size, root_size); | 3543 my_host_impl->SetViewportSize(root_size); |
3545 | 3544 |
3546 scoped_ptr<LayerImpl> root = | 3545 scoped_ptr<LayerImpl> root = |
3547 LayerImpl::Create(my_host_impl->active_tree(), 1); | 3546 LayerImpl::Create(my_host_impl->active_tree(), 1); |
3548 root_ptr = root.get(); | 3547 root_ptr = root.get(); |
3549 | 3548 |
3550 root->SetAnchorPoint(gfx::PointF()); | 3549 root->SetAnchorPoint(gfx::PointF()); |
3551 root->SetPosition(gfx::PointF()); | 3550 root->SetPosition(gfx::PointF()); |
3552 root->SetBounds(root_size); | 3551 root->SetBounds(root_size); |
3553 root->SetContentBounds(root_size); | 3552 root->SetContentBounds(root_size); |
3554 root->SetDrawsContent(true); | 3553 root->SetDrawsContent(true); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3625 LayerImpl* layer_s1_ptr; | 3624 LayerImpl* layer_s1_ptr; |
3626 LayerImpl* layer_s2_ptr; | 3625 LayerImpl* layer_s2_ptr; |
3627 | 3626 |
3628 scoped_ptr<OutputSurface> output_surface = | 3627 scoped_ptr<OutputSurface> output_surface = |
3629 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( | 3628 FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( |
3630 new PartialSwapContext)).PassAs<OutputSurface>(); | 3629 new PartialSwapContext)).PassAs<OutputSurface>(); |
3631 | 3630 |
3632 gfx::Size root_size(1000, 1000); | 3631 gfx::Size root_size(1000, 1000); |
3633 | 3632 |
3634 my_host_impl->InitializeRenderer(output_surface.Pass()); | 3633 my_host_impl->InitializeRenderer(output_surface.Pass()); |
3635 my_host_impl->SetViewportSize(root_size, root_size); | 3634 my_host_impl->SetViewportSize(root_size); |
3636 | 3635 |
3637 scoped_ptr<LayerImpl> root = | 3636 scoped_ptr<LayerImpl> root = |
3638 LayerImpl::Create(my_host_impl->active_tree(), 1); | 3637 LayerImpl::Create(my_host_impl->active_tree(), 1); |
3639 root_ptr = root.get(); | 3638 root_ptr = root.get(); |
3640 | 3639 |
3641 root->SetAnchorPoint(gfx::PointF()); | 3640 root->SetAnchorPoint(gfx::PointF()); |
3642 root->SetPosition(gfx::PointF()); | 3641 root->SetPosition(gfx::PointF()); |
3643 root->SetBounds(root_size); | 3642 root->SetBounds(root_size); |
3644 root->SetContentBounds(root_size); | 3643 root->SetContentBounds(root_size); |
3645 root->SetDrawsContent(true); | 3644 root->SetDrawsContent(true); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3787 grand_child->SetBounds(grand_child_rect.size()); | 3786 grand_child->SetBounds(grand_child_rect.size()); |
3788 grand_child->SetContentBounds(grand_child->bounds()); | 3787 grand_child->SetContentBounds(grand_child->bounds()); |
3789 grand_child->SetDrawsContent(true); | 3788 grand_child->SetDrawsContent(true); |
3790 | 3789 |
3791 TiledLayerImpl* child_ptr = child.get(); | 3790 TiledLayerImpl* child_ptr = child.get(); |
3792 RenderPass::Id child_pass_id(child_ptr->id(), 0); | 3791 RenderPass::Id child_pass_id(child_ptr->id(), 0); |
3793 | 3792 |
3794 child->AddChild(grand_child.Pass()); | 3793 child->AddChild(grand_child.Pass()); |
3795 root->AddChild(child.PassAs<LayerImpl>()); | 3794 root->AddChild(child.PassAs<LayerImpl>()); |
3796 my_host_impl->active_tree()->SetRootLayer(root.Pass()); | 3795 my_host_impl->active_tree()->SetRootLayer(root.Pass()); |
3797 my_host_impl->SetViewportSize(root_rect.size(), root_rect.size()); | 3796 my_host_impl->SetViewportSize(root_rect.size()); |
3798 | 3797 |
3799 EXPECT_FALSE(my_host_impl->renderer()->HaveCachedResourcesForRenderPassId( | 3798 EXPECT_FALSE(my_host_impl->renderer()->HaveCachedResourcesForRenderPassId( |
3800 child_pass_id)); | 3799 child_pass_id)); |
3801 { | 3800 { |
3802 LayerTreeHostImpl::FrameData frame; | 3801 LayerTreeHostImpl::FrameData frame; |
3803 host_impl_->SetFullRootLayerDamage(); | 3802 host_impl_->SetFullRootLayerDamage(); |
3804 EXPECT_TRUE(my_host_impl->PrepareToDraw(&frame, gfx::Rect())); | 3803 EXPECT_TRUE(my_host_impl->PrepareToDraw(&frame, gfx::Rect())); |
3805 my_host_impl->DrawLayers(&frame, base::TimeTicks::Now()); | 3804 my_host_impl->DrawLayers(&frame, base::TimeTicks::Now()); |
3806 my_host_impl->DidDrawAllLayers(frame); | 3805 my_host_impl->DidDrawAllLayers(frame); |
3807 } | 3806 } |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4814 mask_layer->SetBounds(scaling_layer_size); | 4813 mask_layer->SetBounds(scaling_layer_size); |
4815 mask_layer->SetContentBounds(scaling_layer_size); | 4814 mask_layer->SetContentBounds(scaling_layer_size); |
4816 mask_layer->SetPosition(gfx::PointF()); | 4815 mask_layer->SetPosition(gfx::PointF()); |
4817 mask_layer->SetAnchorPoint(gfx::PointF()); | 4816 mask_layer->SetAnchorPoint(gfx::PointF()); |
4818 mask_layer->SetDrawsContent(true); | 4817 mask_layer->SetDrawsContent(true); |
4819 | 4818 |
4820 | 4819 |
4821 // Check that the tree scaling is correctly taken into account for the mask, | 4820 // Check that the tree scaling is correctly taken into account for the mask, |
4822 // that should fully map onto the quad. | 4821 // that should fully map onto the quad. |
4823 float device_scale_factor = 1.f; | 4822 float device_scale_factor = 1.f; |
4824 host_impl_->SetViewportSize(root_size, root_size); | 4823 host_impl_->SetViewportSize(root_size); |
4825 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 4824 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
4826 { | 4825 { |
4827 LayerTreeHostImpl::FrameData frame; | 4826 LayerTreeHostImpl::FrameData frame; |
4828 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); | 4827 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); |
4829 | 4828 |
4830 ASSERT_EQ(1u, frame.render_passes.size()); | 4829 ASSERT_EQ(1u, frame.render_passes.size()); |
4831 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 4830 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
4832 ASSERT_EQ(DrawQuad::RENDER_PASS, | 4831 ASSERT_EQ(DrawQuad::RENDER_PASS, |
4833 frame.render_passes[0]->quad_list[0]->material); | 4832 frame.render_passes[0]->quad_list[0]->material); |
4834 const RenderPassDrawQuad* render_pass_quad = | 4833 const RenderPassDrawQuad* render_pass_quad = |
4835 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); | 4834 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); |
4836 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), | 4835 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), |
4837 render_pass_quad->rect.ToString()); | 4836 render_pass_quad->rect.ToString()); |
4838 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), | 4837 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
4839 render_pass_quad->mask_uv_rect.ToString()); | 4838 render_pass_quad->mask_uv_rect.ToString()); |
4840 | 4839 |
4841 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 4840 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
4842 host_impl_->DidDrawAllLayers(frame); | 4841 host_impl_->DidDrawAllLayers(frame); |
4843 } | 4842 } |
4844 | 4843 |
4845 | 4844 |
4846 // Applying a DSF should change the render surface size, but won't affect | 4845 // Applying a DSF should change the render surface size, but won't affect |
4847 // which part of the mask is used. | 4846 // which part of the mask is used. |
4848 device_scale_factor = 2.f; | 4847 device_scale_factor = 2.f; |
4849 gfx::Size device_viewport = | 4848 gfx::Size device_viewport = |
4850 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor)); | 4849 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor)); |
4851 host_impl_->SetViewportSize(root_size, device_viewport); | 4850 host_impl_->SetViewportSize(device_viewport); |
4852 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 4851 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
4853 host_impl_->active_tree()->set_needs_update_draw_properties(); | 4852 host_impl_->active_tree()->set_needs_update_draw_properties(); |
4854 { | 4853 { |
4855 LayerTreeHostImpl::FrameData frame; | 4854 LayerTreeHostImpl::FrameData frame; |
4856 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); | 4855 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); |
4857 | 4856 |
4858 ASSERT_EQ(1u, frame.render_passes.size()); | 4857 ASSERT_EQ(1u, frame.render_passes.size()); |
4859 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 4858 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
4860 ASSERT_EQ(DrawQuad::RENDER_PASS, | 4859 ASSERT_EQ(DrawQuad::RENDER_PASS, |
4861 frame.render_passes[0]->quad_list[0]->material); | 4860 frame.render_passes[0]->quad_list[0]->material); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4936 gfx::Size mask_size(100, 100); | 4935 gfx::Size mask_size(100, 100); |
4937 mask_layer->SetBounds(mask_size); | 4936 mask_layer->SetBounds(mask_size); |
4938 mask_layer->SetContentBounds(mask_size); | 4937 mask_layer->SetContentBounds(mask_size); |
4939 mask_layer->SetPosition(gfx::PointF()); | 4938 mask_layer->SetPosition(gfx::PointF()); |
4940 mask_layer->SetAnchorPoint(gfx::PointF()); | 4939 mask_layer->SetAnchorPoint(gfx::PointF()); |
4941 mask_layer->SetDrawsContent(true); | 4940 mask_layer->SetDrawsContent(true); |
4942 | 4941 |
4943 | 4942 |
4944 // Check that the mask fills the surface. | 4943 // Check that the mask fills the surface. |
4945 float device_scale_factor = 1.f; | 4944 float device_scale_factor = 1.f; |
4946 host_impl_->SetViewportSize(root_size, root_size); | 4945 host_impl_->SetViewportSize(root_size); |
4947 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 4946 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
4948 { | 4947 { |
4949 LayerTreeHostImpl::FrameData frame; | 4948 LayerTreeHostImpl::FrameData frame; |
4950 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); | 4949 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); |
4951 | 4950 |
4952 ASSERT_EQ(1u, frame.render_passes.size()); | 4951 ASSERT_EQ(1u, frame.render_passes.size()); |
4953 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 4952 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
4954 ASSERT_EQ(DrawQuad::RENDER_PASS, | 4953 ASSERT_EQ(DrawQuad::RENDER_PASS, |
4955 frame.render_passes[0]->quad_list[0]->material); | 4954 frame.render_passes[0]->quad_list[0]->material); |
4956 const RenderPassDrawQuad* render_pass_quad = | 4955 const RenderPassDrawQuad* render_pass_quad = |
4957 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); | 4956 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); |
4958 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), | 4957 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), |
4959 render_pass_quad->rect.ToString()); | 4958 render_pass_quad->rect.ToString()); |
4960 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), | 4959 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
4961 render_pass_quad->mask_uv_rect.ToString()); | 4960 render_pass_quad->mask_uv_rect.ToString()); |
4962 | 4961 |
4963 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 4962 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
4964 host_impl_->DidDrawAllLayers(frame); | 4963 host_impl_->DidDrawAllLayers(frame); |
4965 } | 4964 } |
4966 | 4965 |
4967 | 4966 |
4968 // Applying a DSF should change the render surface size, but won't affect | 4967 // Applying a DSF should change the render surface size, but won't affect |
4969 // which part of the mask is used. | 4968 // which part of the mask is used. |
4970 device_scale_factor = 2.f; | 4969 device_scale_factor = 2.f; |
4971 gfx::Size device_viewport = | 4970 gfx::Size device_viewport = |
4972 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor)); | 4971 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor)); |
4973 host_impl_->SetViewportSize(root_size, device_viewport); | 4972 host_impl_->SetViewportSize(device_viewport); |
4974 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 4973 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
4975 host_impl_->active_tree()->set_needs_update_draw_properties(); | 4974 host_impl_->active_tree()->set_needs_update_draw_properties(); |
4976 { | 4975 { |
4977 LayerTreeHostImpl::FrameData frame; | 4976 LayerTreeHostImpl::FrameData frame; |
4978 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); | 4977 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); |
4979 | 4978 |
4980 ASSERT_EQ(1u, frame.render_passes.size()); | 4979 ASSERT_EQ(1u, frame.render_passes.size()); |
4981 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 4980 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
4982 ASSERT_EQ(DrawQuad::RENDER_PASS, | 4981 ASSERT_EQ(DrawQuad::RENDER_PASS, |
4983 frame.render_passes[0]->quad_list[0]->material); | 4982 frame.render_passes[0]->quad_list[0]->material); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5043 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), | 5042 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
5044 render_pass_quad->mask_uv_rect.ToString()); | 5043 render_pass_quad->mask_uv_rect.ToString()); |
5045 | 5044 |
5046 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 5045 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
5047 host_impl_->DidDrawAllLayers(frame); | 5046 host_impl_->DidDrawAllLayers(frame); |
5048 } | 5047 } |
5049 } | 5048 } |
5050 | 5049 |
5051 } // namespace | 5050 } // namespace |
5052 } // namespace cc | 5051 } // namespace cc |
OLD | NEW |