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 "base/containers/hash_tables.h" | 5 #include "base/containers/hash_tables.h" |
6 #include "base/thread_task_runner_handle.h" | 6 #include "base/thread_task_runner_handle.h" |
7 #include "cc/animation/scrollbar_animation_controller.h" | 7 #include "cc/animation/scrollbar_animation_controller.h" |
8 #include "cc/layers/append_quads_data.h" | 8 #include "cc/layers/append_quads_data.h" |
9 #include "cc/layers/painted_scrollbar_layer.h" | 9 #include "cc/layers/painted_scrollbar_layer.h" |
10 #include "cc/layers/painted_scrollbar_layer_impl.h" | 10 #include "cc/layers/painted_scrollbar_layer_impl.h" |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 layer_tree_root->AddChild(content_layer); | 707 layer_tree_root->AddChild(content_layer); |
708 layer_tree_root->AddChild(scrollbar_layer); | 708 layer_tree_root->AddChild(scrollbar_layer); |
709 | 709 |
710 layer_tree_host_->SetRootLayer(layer_tree_root); | 710 layer_tree_host_->SetRootLayer(layer_tree_root); |
711 | 711 |
712 scrollbar_layer->SetIsDrawable(true); | 712 scrollbar_layer->SetIsDrawable(true); |
713 scrollbar_layer->SetBounds(gfx::Size(100, 100)); | 713 scrollbar_layer->SetBounds(gfx::Size(100, 100)); |
714 layer_tree_root->SetScrollOffset(gfx::ScrollOffset(10, 20)); | 714 layer_tree_root->SetScrollOffset(gfx::ScrollOffset(10, 20)); |
715 layer_tree_root->SetBounds(gfx::Size(100, 200)); | 715 layer_tree_root->SetBounds(gfx::Size(100, 200)); |
716 content_layer->SetBounds(gfx::Size(100, 200)); | 716 content_layer->SetBounds(gfx::Size(100, 200)); |
717 scrollbar_layer->draw_properties().visible_content_rect = | 717 scrollbar_layer->draw_properties().visible_layer_rect = |
718 gfx::Rect(0, 0, 100, 200); | 718 gfx::Rect(0, 0, 100, 200); |
719 scrollbar_layer->CreateRenderSurface(); | 719 scrollbar_layer->CreateRenderSurface(); |
720 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); | 720 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); |
721 | 721 |
722 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 722 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
723 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); | 723 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); |
724 | 724 |
725 ResourceUpdateQueue queue; | 725 ResourceUpdateQueue queue; |
726 | 726 |
727 scrollbar_layer->SavePaintProperties(); | 727 scrollbar_layer->SavePaintProperties(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 layer_tree_root->AddChild(scrollbar_layer); | 772 layer_tree_root->AddChild(scrollbar_layer); |
773 | 773 |
774 layer_tree_host_->SetRootLayer(layer_tree_root); | 774 layer_tree_host_->SetRootLayer(layer_tree_root); |
775 | 775 |
776 scrollbar_layer->SetIsDrawable(true); | 776 scrollbar_layer->SetIsDrawable(true); |
777 scrollbar_layer->SetBounds(gfx::Size(100, 15)); | 777 scrollbar_layer->SetBounds(gfx::Size(100, 15)); |
778 scrollbar_layer->SetPosition(scrollbar_location); | 778 scrollbar_layer->SetPosition(scrollbar_location); |
779 layer_tree_root->SetBounds(gfx::Size(100, 200)); | 779 layer_tree_root->SetBounds(gfx::Size(100, 200)); |
780 content_layer->SetBounds(gfx::Size(100, 200)); | 780 content_layer->SetBounds(gfx::Size(100, 200)); |
781 | 781 |
782 scrollbar_layer->draw_properties().visible_content_rect = | 782 scrollbar_layer->draw_properties().visible_layer_rect = |
783 gfx::Rect(0, 0, 100, 200); | 783 gfx::Rect(0, 0, 100, 200); |
784 | 784 |
785 scrollbar_layer->CreateRenderSurface(); | 785 scrollbar_layer->CreateRenderSurface(); |
786 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); | 786 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); |
787 | 787 |
788 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 788 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
789 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); | 789 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); |
790 | 790 |
791 ResourceUpdateQueue queue; | 791 ResourceUpdateQueue queue; |
792 size_t resource_count; | 792 size_t resource_count; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 layer_tree_root->AddChild(content_layer); | 906 layer_tree_root->AddChild(content_layer); |
907 layer_tree_root->AddChild(scrollbar_layer); | 907 layer_tree_root->AddChild(scrollbar_layer); |
908 | 908 |
909 layer_tree_host_->SetRootLayer(layer_tree_root); | 909 layer_tree_host_->SetRootLayer(layer_tree_root); |
910 | 910 |
911 scrollbar_layer->SetIsDrawable(true); | 911 scrollbar_layer->SetIsDrawable(true); |
912 scrollbar_layer->SetBounds(gfx::Size(100, 15)); | 912 scrollbar_layer->SetBounds(gfx::Size(100, 15)); |
913 scrollbar_layer->SetPosition(scrollbar_location); | 913 scrollbar_layer->SetPosition(scrollbar_location); |
914 layer_tree_root->SetBounds(gfx::Size(100, 200)); | 914 layer_tree_root->SetBounds(gfx::Size(100, 200)); |
915 content_layer->SetBounds(gfx::Size(100, 200)); | 915 content_layer->SetBounds(gfx::Size(100, 200)); |
916 scrollbar_layer->draw_properties().visible_content_rect = | 916 scrollbar_layer->draw_properties().visible_layer_rect = |
917 gfx::Rect(scrollbar_location, scrollbar_layer->bounds()); | 917 gfx::Rect(scrollbar_location, scrollbar_layer->bounds()); |
918 scrollbar_layer->CreateRenderSurface(); | 918 scrollbar_layer->CreateRenderSurface(); |
919 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); | 919 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); |
920 | 920 |
921 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 921 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
922 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); | 922 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); |
923 | 923 |
924 layer_tree_host_->SetDeviceScaleFactor(test_scale); | 924 layer_tree_host_->SetDeviceScaleFactor(test_scale); |
925 | 925 |
926 ResourceUpdateQueue queue; | 926 ResourceUpdateQueue queue; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 has_thumb, layer_tree_root->id()); | 969 has_thumb, layer_tree_root->id()); |
970 | 970 |
971 layer_tree_root->AddChild(scrollbar_layer); | 971 layer_tree_root->AddChild(scrollbar_layer); |
972 | 972 |
973 layer_tree_host_->SetRootLayer(layer_tree_root); | 973 layer_tree_host_->SetRootLayer(layer_tree_root); |
974 | 974 |
975 scrollbar_layer->SetBounds(scrollbar_rect.size()); | 975 scrollbar_layer->SetBounds(scrollbar_rect.size()); |
976 scrollbar_layer->SetPosition(scrollbar_rect.origin()); | 976 scrollbar_layer->SetPosition(scrollbar_rect.origin()); |
977 scrollbar_layer->fake_scrollbar()->set_location(scrollbar_rect.origin()); | 977 scrollbar_layer->fake_scrollbar()->set_location(scrollbar_rect.origin()); |
978 scrollbar_layer->fake_scrollbar()->set_track_rect(scrollbar_rect); | 978 scrollbar_layer->fake_scrollbar()->set_track_rect(scrollbar_rect); |
979 scrollbar_layer->draw_properties().visible_content_rect = scrollbar_rect; | 979 scrollbar_layer->draw_properties().visible_layer_rect = scrollbar_rect; |
980 | 980 |
981 layer_tree_host_->SetDeviceScaleFactor(test_scale); | 981 layer_tree_host_->SetDeviceScaleFactor(test_scale); |
982 | 982 |
983 ResourceUpdateQueue queue; | 983 ResourceUpdateQueue queue; |
984 gfx::Rect screen_space_clip_rect; | 984 gfx::Rect screen_space_clip_rect; |
985 scrollbar_layer->SavePaintProperties(); | 985 scrollbar_layer->SavePaintProperties(); |
986 | 986 |
987 scrollbar_layer->Update(&queue); | 987 scrollbar_layer->Update(&queue); |
988 | 988 |
989 UIResourceBitmap* bitmap = layer_tree_host_->ui_resource_bitmap( | 989 UIResourceBitmap* bitmap = layer_tree_host_->ui_resource_bitmap( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1031 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
1032 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1032 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
1033 | 1033 |
1034 // Horizontal Scrollbars. | 1034 // Horizontal Scrollbars. |
1035 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1035 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
1036 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1036 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
1037 } | 1037 } |
1038 | 1038 |
1039 } // namespace | 1039 } // namespace |
1040 } // namespace cc | 1040 } // namespace cc |
OLD | NEW |