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

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

Issue 1775013004: Rename InputHandler::GESTURE to InputHandler::TOUCHSCREEN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_regression_3
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 // Ensure device scale factor matches the active tree. 612 // Ensure device scale factor matches the active tree.
613 EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor()); 613 EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor());
614 switch (impl->active_tree()->source_frame_number()) { 614 switch (impl->active_tree()->source_frame_number()) {
615 case 0: { 615 case 0: {
616 // GESTURE scroll on impl thread. Also tests that the last scrolled 616 // GESTURE scroll on impl thread. Also tests that the last scrolled
617 // layer id is stored even after the scrolling ends. 617 // layer id is stored even after the scrolling ends.
618 gfx::Point scroll_point = 618 gfx::Point scroll_point =
619 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() - 619 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() -
620 gfx::Vector2dF(0.5f, 0.5f)); 620 gfx::Vector2dF(0.5f, 0.5f));
621 InputHandler::ScrollStatus status = impl->ScrollBegin( 621 InputHandler::ScrollStatus status = impl->ScrollBegin(
622 BeginState(scroll_point).get(), InputHandler::GESTURE); 622 BeginState(scroll_point).get(), InputHandler::TOUCHSCREEN);
623 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 623 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
624 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get()); 624 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get());
625 LayerImpl* scrolling_layer = impl->CurrentlyScrollingLayer(); 625 LayerImpl* scrolling_layer = impl->CurrentlyScrollingLayer();
626 CHECK(scrolling_layer); 626 CHECK(scrolling_layer);
627 impl->ScrollEnd(EndState().get()); 627 impl->ScrollEnd(EndState().get());
628 CHECK(!impl->CurrentlyScrollingLayer()); 628 CHECK(!impl->CurrentlyScrollingLayer());
629 EXPECT_EQ(scrolling_layer->id(), 629 EXPECT_EQ(scrolling_layer->id(),
630 impl->active_tree()->LastScrolledLayerId()); 630 impl->active_tree()->LastScrolledLayerId());
631 631
632 // Check the scroll is applied as a delta. 632 // Check the scroll is applied as a delta.
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); 1048 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100));
1049 impl->active_tree()->property_trees()->needs_rebuild = true; 1049 impl->active_tree()->property_trees()->needs_rebuild = true;
1050 impl->active_tree()->BuildPropertyTreesForTesting(); 1050 impl->active_tree()->BuildPropertyTreesForTesting();
1051 1051
1052 ScrollTree& scroll_tree = 1052 ScrollTree& scroll_tree =
1053 impl->active_tree()->property_trees()->scroll_tree; 1053 impl->active_tree()->property_trees()->scroll_tree;
1054 ScrollNode* scroll_node = 1054 ScrollNode* scroll_node =
1055 scroll_tree.Node(scroll_layer->scroll_tree_index()); 1055 scroll_tree.Node(scroll_layer->scroll_tree_index());
1056 1056
1057 InputHandler::ScrollStatus status = 1057 InputHandler::ScrollStatus status =
1058 impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, 1058 impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN,
1059 scroll_tree, scroll_node); 1059 scroll_tree, scroll_node);
1060 1060
1061 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1061 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1062 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 1062 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1063 status.main_thread_scrolling_reasons); 1063 status.main_thread_scrolling_reasons);
1064 1064
1065 // Set max_scroll_offset = (0, 0). 1065 // Set max_scroll_offset = (0, 0).
1066 scroll_layer->SetBounds(root->bounds()); 1066 scroll_layer->SetBounds(root->bounds());
1067 impl->active_tree()->property_trees()->needs_rebuild = true; 1067 impl->active_tree()->property_trees()->needs_rebuild = true;
1068 impl->active_tree()->BuildPropertyTreesForTesting(); 1068 impl->active_tree()->BuildPropertyTreesForTesting();
1069 scroll_tree = impl->active_tree()->property_trees()->scroll_tree; 1069 scroll_tree = impl->active_tree()->property_trees()->scroll_tree;
1070 scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index()); 1070 scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index());
1071 status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, 1071 status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN,
1072 scroll_tree, scroll_node); 1072 scroll_tree, scroll_node);
1073 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); 1073 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
1074 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable, 1074 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
1075 status.main_thread_scrolling_reasons); 1075 status.main_thread_scrolling_reasons);
1076 1076
1077 // Set max_scroll_offset = (-100, -100). 1077 // Set max_scroll_offset = (-100, -100).
1078 scroll_layer->SetBounds(gfx::Size()); 1078 scroll_layer->SetBounds(gfx::Size());
1079 impl->active_tree()->property_trees()->needs_rebuild = true; 1079 impl->active_tree()->property_trees()->needs_rebuild = true;
1080 impl->active_tree()->BuildPropertyTreesForTesting(); 1080 impl->active_tree()->BuildPropertyTreesForTesting();
1081 scroll_tree = impl->active_tree()->property_trees()->scroll_tree; 1081 scroll_tree = impl->active_tree()->property_trees()->scroll_tree;
1082 scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index()); 1082 scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index());
1083 status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, 1083 status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN,
1084 scroll_tree, scroll_node); 1084 scroll_tree, scroll_node);
1085 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); 1085 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
1086 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable, 1086 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
1087 status.main_thread_scrolling_reasons); 1087 status.main_thread_scrolling_reasons);
1088 1088
1089 EndTest(); 1089 EndTest();
1090 } 1090 }
1091 1091
1092 void AfterTest() override {} 1092 void AfterTest() override {}
1093 }; 1093 };
(...skipping 23 matching lines...) Expand all
1117 1117
1118 ScrollTree& scroll_tree = 1118 ScrollTree& scroll_tree =
1119 impl->active_tree()->property_trees()->scroll_tree; 1119 impl->active_tree()->property_trees()->scroll_tree;
1120 ScrollNode* scroll_node = 1120 ScrollNode* scroll_node =
1121 scroll_tree.Node(scroll_layer->scroll_tree_index()); 1121 scroll_tree.Node(scroll_layer->scroll_tree_index());
1122 1122
1123 // Verify that the scroll layer's scroll offset is taken into account when 1123 // Verify that the scroll layer's scroll offset is taken into account when
1124 // checking whether the screen space point is inside the non-fast 1124 // checking whether the screen space point is inside the non-fast
1125 // scrollable region. 1125 // scrollable region.
1126 1126
1127 InputHandler::ScrollStatus status = impl->TryScroll( 1127 InputHandler::ScrollStatus status =
1128 gfx::PointF(1.f, 1.f), InputHandler::GESTURE, scroll_tree, scroll_node); 1128 impl->TryScroll(gfx::PointF(1.f, 1.f), InputHandler::TOUCHSCREEN,
1129 scroll_tree, scroll_node);
1129 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread); 1130 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread);
1130 EXPECT_EQ(MainThreadScrollingReason::kNonFastScrollableRegion, 1131 EXPECT_EQ(MainThreadScrollingReason::kNonFastScrollableRegion,
1131 status.main_thread_scrolling_reasons); 1132 status.main_thread_scrolling_reasons);
1132 1133
1133 status = impl->TryScroll(gfx::PointF(21.f, 21.f), InputHandler::GESTURE, 1134 status = impl->TryScroll(gfx::PointF(21.f, 21.f), InputHandler::TOUCHSCREEN,
1134 scroll_tree, scroll_node); 1135 scroll_tree, scroll_node);
1135 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1136 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1136 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 1137 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1137 status.main_thread_scrolling_reasons); 1138 status.main_thread_scrolling_reasons);
1138 1139
1139 EndTest(); 1140 EndTest();
1140 } 1141 }
1141 1142
1142 void AfterTest() override {} 1143 void AfterTest() override {}
1143 }; 1144 };
(...skipping 20 matching lines...) Expand all
1164 LayerImpl* outer_scroll_layer = impl->OuterViewportScrollLayer(); 1165 LayerImpl* outer_scroll_layer = impl->OuterViewportScrollLayer();
1165 1166
1166 ScrollTree& scroll_tree = 1167 ScrollTree& scroll_tree =
1167 impl->active_tree()->property_trees()->scroll_tree; 1168 impl->active_tree()->property_trees()->scroll_tree;
1168 ScrollNode* inner_scroll_node = 1169 ScrollNode* inner_scroll_node =
1169 scroll_tree.Node(inner_scroll_layer->scroll_tree_index()); 1170 scroll_tree.Node(inner_scroll_layer->scroll_tree_index());
1170 ScrollNode* outer_scroll_node = 1171 ScrollNode* outer_scroll_node =
1171 scroll_tree.Node(outer_scroll_layer->scroll_tree_index()); 1172 scroll_tree.Node(outer_scroll_layer->scroll_tree_index());
1172 1173
1173 InputHandler::ScrollStatus status = 1174 InputHandler::ScrollStatus status =
1174 impl->TryScroll(gfx::PointF(1.f, 1.f), InputHandler::GESTURE, 1175 impl->TryScroll(gfx::PointF(1.f, 1.f), InputHandler::TOUCHSCREEN,
1175 scroll_tree, inner_scroll_node); 1176 scroll_tree, inner_scroll_node);
1176 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread); 1177 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread);
1177 EXPECT_EQ(MainThreadScrollingReason::kEventHandlers, 1178 EXPECT_EQ(MainThreadScrollingReason::kEventHandlers,
1178 status.main_thread_scrolling_reasons); 1179 status.main_thread_scrolling_reasons);
1179 1180
1180 status = impl->TryScroll(gfx::PointF(1.f, 1.f), InputHandler::GESTURE, 1181 status = impl->TryScroll(gfx::PointF(1.f, 1.f), InputHandler::TOUCHSCREEN,
1181 scroll_tree, outer_scroll_node); 1182 scroll_tree, outer_scroll_node);
1182 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1183 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1183 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 1184 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1184 status.main_thread_scrolling_reasons); 1185 status.main_thread_scrolling_reasons);
1185 EndTest(); 1186 EndTest();
1186 } 1187 }
1187 1188
1188 void AfterTest() override {} 1189 void AfterTest() override {}
1189 }; 1190 };
1190 1191
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 RunTest(CompositorMode::THREADED, false); 1377 RunTest(CompositorMode::THREADED, false);
1377 } 1378 }
1378 1379
1379 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { 1380 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) {
1380 scroll_destroy_whole_tree_ = true; 1381 scroll_destroy_whole_tree_ = true;
1381 RunTest(CompositorMode::THREADED, false); 1382 RunTest(CompositorMode::THREADED, false);
1382 } 1383 }
1383 1384
1384 } // namespace 1385 } // namespace
1385 } // namespace cc 1386 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698