OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostDamageTestForcedFullDamage); | 513 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostDamageTestForcedFullDamage); |
514 | 514 |
515 class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest { | 515 class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest { |
516 virtual void SetupTree() OVERRIDE { | 516 virtual void SetupTree() OVERRIDE { |
517 scoped_refptr<Layer> root_layer = Layer::Create(); | 517 scoped_refptr<Layer> root_layer = Layer::Create(); |
518 root_layer->SetBounds(gfx::Size(400, 400)); | 518 root_layer->SetBounds(gfx::Size(400, 400)); |
519 root_layer->SetMasksToBounds(true); | 519 root_layer->SetMasksToBounds(true); |
520 layer_tree_host()->SetRootLayer(root_layer); | 520 layer_tree_host()->SetRootLayer(root_layer); |
521 | 521 |
522 scoped_refptr<Layer> content_layer = FakeContentLayer::Create(&client_); | 522 scoped_refptr<Layer> content_layer = FakeContentLayer::Create(&client_); |
523 content_layer->SetScrollable(true); | 523 content_layer->SetScrollable(root_layer.get()); // WJM |
524 content_layer->SetScrollOffset(gfx::Vector2d(10, 20)); | 524 content_layer->SetScrollOffset(gfx::Vector2d(10, 20)); |
525 content_layer->SetMaxScrollOffset(gfx::Vector2d(30, 50)); | 525 // content_layer->SetMaxScrollOffset(gfx::Vector2d(30, 50)); |
526 content_layer->SetBounds(gfx::Size(100, 200)); | 526 content_layer->SetBounds(gfx::Size(100, 200)); |
527 root_layer->AddChild(content_layer); | 527 root_layer->AddChild(content_layer); |
528 | 528 |
529 scoped_refptr<Layer> scrollbar_layer = | 529 scoped_refptr<Layer> scrollbar_layer = |
530 FakePaintedScrollbarLayer::Create(false, true, content_layer->id()); | 530 FakePaintedScrollbarLayer::Create(false, true, content_layer.get()); |
531 scrollbar_layer->SetPosition(gfx::Point(300, 300)); | 531 scrollbar_layer->SetPosition(gfx::Point(300, 300)); |
532 scrollbar_layer->SetBounds(gfx::Size(10, 100)); | 532 scrollbar_layer->SetBounds(gfx::Size(10, 100)); |
533 root_layer->AddChild(scrollbar_layer); | 533 root_layer->AddChild(scrollbar_layer); |
534 | 534 |
535 gfx::RectF content_rect(content_layer->position(), | 535 gfx::RectF content_rect(content_layer->position(), |
536 content_layer->bounds()); | 536 content_layer->bounds()); |
537 gfx::RectF scrollbar_rect(scrollbar_layer->position(), | 537 gfx::RectF scrollbar_rect(scrollbar_layer->position(), |
538 scrollbar_layer->bounds()); | 538 scrollbar_layer->bounds()); |
539 EXPECT_FALSE(content_rect.Intersects(scrollbar_rect)); | 539 EXPECT_FALSE(content_rect.Intersects(scrollbar_rect)); |
540 | 540 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 // scrolling) won't damage the scrollbar. | 594 // scrolling) won't damage the scrollbar. |
595 scroll_layer->SetPosition(gfx::Point(1, 1)); | 595 scroll_layer->SetPosition(gfx::Point(1, 1)); |
596 scroll_layer->SetScrollOffset(scroll_layer->scroll_offset()); | 596 scroll_layer->SetScrollOffset(scroll_layer->scroll_offset()); |
597 host_impl->SetNeedsRedraw(); | 597 host_impl->SetNeedsRedraw(); |
598 break; | 598 break; |
599 case 2: | 599 case 2: |
600 scroll_layer->ScrollBy(gfx::Vector2dF(10.f, 10.f)); | 600 scroll_layer->ScrollBy(gfx::Vector2dF(10.f, 10.f)); |
601 host_impl->SetNeedsRedraw(); | 601 host_impl->SetNeedsRedraw(); |
602 break; | 602 break; |
603 case 3: | 603 case 3: |
604 scroll_layer->SetMaxScrollOffset(gfx::Vector2d(60, 100)); | 604 // scroll_layer->SetMaxScrollOffset(gfx::Vector2d(60, 100)); // WJM |
605 host_impl->SetNeedsRedraw(); | 605 host_impl->SetNeedsRedraw(); |
606 break; | 606 break; |
607 } | 607 } |
608 } | 608 } |
609 | 609 |
610 virtual void AfterTest() OVERRIDE { | 610 virtual void AfterTest() OVERRIDE { |
611 EXPECT_EQ(4, did_swaps_); | 611 EXPECT_EQ(4, did_swaps_); |
612 } | 612 } |
613 | 613 |
614 int did_swaps_; | 614 int did_swaps_; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 FakeContentLayerClient client_; | 783 FakeContentLayerClient client_; |
784 int swap_count_; | 784 int swap_count_; |
785 int prepare_to_draw_count_; | 785 int prepare_to_draw_count_; |
786 int update_visible_tile_count_; | 786 int update_visible_tile_count_; |
787 }; | 787 }; |
788 | 788 |
789 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestVisibleTilesStillTriggerDraws); | 789 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestVisibleTilesStillTriggerDraws); |
790 | 790 |
791 } // namespace | 791 } // namespace |
792 } // namespace cc | 792 } // namespace cc |
OLD | NEW |