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

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

Issue 250663003: Relax touch hit testing in CC to look at all layers under a point (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit test case Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_common.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 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_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "cc/animation/layer_animation_controller.h" 9 #include "cc/animation/layer_animation_controller.h"
10 #include "cc/animation/transform_operations.h" 10 #include "cc/animation/transform_operations.h"
(...skipping 6008 matching lines...) Expand 10 before | Expand all | Expand 10 after
6019 6019
6020 // We should have passed through the no-touch layer and found the layer 6020 // We should have passed through the no-touch layer and found the layer
6021 // behind it. 6021 // behind it.
6022 EXPECT_TRUE(result_layer); 6022 EXPECT_TRUE(result_layer);
6023 6023
6024 host_impl.active_tree()->LayerById(1234)->SetContentsOpaque(true); 6024 host_impl.active_tree()->LayerById(1234)->SetContentsOpaque(true);
6025 result_layer = 6025 result_layer =
6026 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion( 6026 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
6027 test_point, render_surface_layer_list); 6027 test_point, render_surface_layer_list);
6028 6028
6029 // In this case we should abort searching for touch handlers at the opaque 6029 // Even with an opaque layer in the middle, we should still find the layer
6030 // occluder and not find the region behind it. 6030 // with
6031 EXPECT_FALSE(result_layer); 6031 // the touch handler behind it (since we can't assume that opaque layers are
6032 6032 // opaque to hit testing).
6033 host_impl.active_tree()->LayerById(1234)->SetContentsOpaque(true); 6033 EXPECT_TRUE(result_layer);
6034 host_impl.active_tree()->LayerById(1234)->SetScrollClipLayer(1);
6035
6036 result_layer =
6037 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
6038 test_point, render_surface_layer_list);
6039
6040 // In this case we should abort searching for touch handlers at the scroller
6041 // (which is opaque to hit testing) and not find the region behind it.
6042 EXPECT_FALSE(result_layer);
6043 6034
6044 test_point = gfx::Point(35, 15); 6035 test_point = gfx::Point(35, 15);
6045 result_layer = 6036 result_layer =
6046 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion( 6037 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
6047 test_point, render_surface_layer_list); 6038 test_point, render_surface_layer_list);
6048 ASSERT_TRUE(result_layer); 6039 ASSERT_TRUE(result_layer);
6049 EXPECT_EQ(123, result_layer->id()); 6040 EXPECT_EQ(123, result_layer->id());
6050 6041
6051 test_point = gfx::Point(35, 65); 6042 test_point = gfx::Point(35, 65);
6052 result_layer = 6043 result_layer =
(...skipping 4030 matching lines...) Expand 10 before | Expand all | Expand 10 after
10083 10074
10084 // |grand_parent| has a transform that's neither a translation nor a scale. 10075 // |grand_parent| has a transform that's neither a translation nor a scale.
10085 EXPECT_EQ(0.f, grand_parent->last_maximum_animation_contents_scale()); 10076 EXPECT_EQ(0.f, grand_parent->last_maximum_animation_contents_scale());
10086 EXPECT_EQ(0.f, parent_raw->last_maximum_animation_contents_scale()); 10077 EXPECT_EQ(0.f, parent_raw->last_maximum_animation_contents_scale());
10087 EXPECT_EQ(0.f, child_raw->last_maximum_animation_contents_scale()); 10078 EXPECT_EQ(0.f, child_raw->last_maximum_animation_contents_scale());
10088 EXPECT_EQ(0.f, grand_child_raw->last_maximum_animation_contents_scale()); 10079 EXPECT_EQ(0.f, grand_child_raw->last_maximum_animation_contents_scale());
10089 } 10080 }
10090 10081
10091 } // namespace 10082 } // namespace
10092 } // namespace cc 10083 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698