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/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 1030 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
1031 LayerImpl* root = impl->active_tree()->root_layer(); | 1031 LayerImpl* root = impl->active_tree()->root_layer(); |
1032 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); | 1032 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); |
1033 scroll_layer->SetScrollClipLayer(root->children()[0]->id()); | 1033 scroll_layer->SetScrollClipLayer(root->children()[0]->id()); |
1034 | 1034 |
1035 // Set max_scroll_offset = (100, 100). | 1035 // Set max_scroll_offset = (100, 100). |
1036 scroll_layer->SetBounds( | 1036 scroll_layer->SetBounds( |
1037 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); | 1037 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); |
1038 | 1038 |
1039 InputHandler::ScrollStatus status = scroll_layer->TryScroll( | 1039 InputHandler::ScrollStatus status = scroll_layer->TryScroll( |
1040 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); | 1040 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE); |
1041 | 1041 |
1042 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); | 1042 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); |
1043 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, | 1043 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, |
1044 status.main_thread_scrolling_reasons); | 1044 status.main_thread_scrolling_reasons); |
1045 | 1045 |
1046 // Set max_scroll_offset = (0, 0). | 1046 // Set max_scroll_offset = (0, 0). |
1047 scroll_layer->SetBounds(root->bounds()); | 1047 scroll_layer->SetBounds(root->bounds()); |
1048 status = scroll_layer->TryScroll( | 1048 status = scroll_layer->TryScroll( |
1049 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); | 1049 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE); |
1050 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); | 1050 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); |
1051 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable, | 1051 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable, |
1052 status.main_thread_scrolling_reasons); | 1052 status.main_thread_scrolling_reasons); |
1053 | 1053 |
1054 // Set max_scroll_offset = (-100, -100). | 1054 // Set max_scroll_offset = (-100, -100). |
1055 scroll_layer->SetBounds(gfx::Size()); | 1055 scroll_layer->SetBounds(gfx::Size()); |
1056 status = scroll_layer->TryScroll( | 1056 status = scroll_layer->TryScroll( |
1057 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); | 1057 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE); |
1058 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); | 1058 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); |
1059 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable, | 1059 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable, |
1060 status.main_thread_scrolling_reasons); | 1060 status.main_thread_scrolling_reasons); |
1061 | 1061 |
1062 EndTest(); | 1062 EndTest(); |
1063 } | 1063 } |
1064 | 1064 |
1065 void AfterTest() override {} | 1065 void AfterTest() override {} |
1066 }; | 1066 }; |
1067 | 1067 |
(...skipping 18 matching lines...) Expand all Loading... |
1086 } | 1086 } |
1087 | 1087 |
1088 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 1088 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
1089 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); | 1089 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); |
1090 | 1090 |
1091 // Verify that the scroll layer's scroll offset is taken into account when | 1091 // Verify that the scroll layer's scroll offset is taken into account when |
1092 // checking whether the screen space point is inside the non-fast | 1092 // checking whether the screen space point is inside the non-fast |
1093 // scrollable region. | 1093 // scrollable region. |
1094 | 1094 |
1095 InputHandler::ScrollStatus status = scroll_layer->TryScroll( | 1095 InputHandler::ScrollStatus status = scroll_layer->TryScroll( |
1096 gfx::PointF(1.f, 1.f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); | 1096 gfx::PointF(1.f, 1.f), InputHandler::GESTURE); |
1097 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread); | 1097 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread); |
1098 EXPECT_EQ(MainThreadScrollingReason::kNonFastScrollableRegion, | 1098 EXPECT_EQ(MainThreadScrollingReason::kNonFastScrollableRegion, |
1099 status.main_thread_scrolling_reasons); | 1099 status.main_thread_scrolling_reasons); |
1100 | 1100 |
1101 status = scroll_layer->TryScroll( | 1101 status = scroll_layer->TryScroll( |
1102 gfx::PointF(21.f, 21.f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); | 1102 gfx::PointF(21.f, 21.f), InputHandler::GESTURE); |
1103 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); | 1103 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); |
1104 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, | 1104 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, |
1105 status.main_thread_scrolling_reasons); | 1105 status.main_thread_scrolling_reasons); |
1106 | 1106 |
1107 EndTest(); | 1107 EndTest(); |
1108 } | 1108 } |
1109 | 1109 |
1110 void AfterTest() override {} | 1110 void AfterTest() override {} |
1111 }; | 1111 }; |
1112 | 1112 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 RunTest(CompositorMode::Threaded, false); | 1297 RunTest(CompositorMode::Threaded, false); |
1298 } | 1298 } |
1299 | 1299 |
1300 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1300 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
1301 scroll_destroy_whole_tree_ = true; | 1301 scroll_destroy_whole_tree_ = true; |
1302 RunTest(CompositorMode::Threaded, false); | 1302 RunTest(CompositorMode::Threaded, false); |
1303 } | 1303 } |
1304 | 1304 |
1305 } // namespace | 1305 } // namespace |
1306 } // namespace cc | 1306 } // namespace cc |
OLD | NEW |