Commit e1186494 authored by Ken Buchanan's avatar Ken Buchanan Committed by Commit Bot

DrawQuad hit testing should query renderer whenever it hits a Surface

SurfaceHittest finds a target Surface for a point and signals whether
there should be additional hit testing done in the renderer.

Currently this only happens if there is a Surface quad and a
non-Surface DrawQuad under the point, in which case the browser
sets query_renderer in order to get a more confident target.

However, in cases where the Surface is occluded by a RenderPass that
has no DrawQuads in that location, it doesn't set query_renderer
because there does not appear to be a reason to do so. Instead, it
incorrectly thinks the RenderPass is the correct target. This is
problematic because layer squashing can create layers that are much
larger than the elements within them.

This CL changes this behavior so that it always queries when there is a
Surface at the given point.

This will increase the number of asynchronous hit tests that are
performed in general.

Bug: 851802
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: I4e878101533e2794fc44cd16f36ea5cd104e59e2
Reviewed-on: https://chromium-review.googlesource.com/1101579Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Ken Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567500}
parent 8a9bb7e9
......@@ -137,13 +137,13 @@ bool SurfaceHittest::GetTargetSurfaceAtPointInternal(
continue;
}
// If a point hits a Surface after hitting a non-Surface quad, we should
// defer to the renderer. Some DrawQuads are not valid hit test targets
// and information needed to distinguish them is not available here.
if (non_surface_was_hit) {
*out_query_renderer = true;
// For any point that hits a Surface, we should defer to the renderer.
// Some DrawQuads are not valid hit test targets and information
// needed to distinguish them is not available here.
*out_query_renderer = true;
if (non_surface_was_hit)
return true;
}
gfx::Transform transform_to_child_space;
if (GetTargetSurfaceAtPointInternal(
......
......@@ -202,13 +202,13 @@ TEST_F(SurfaceHittestTest, Hittest_ChildSurface) {
TestCase tests[] = {{root_surface_id, gfx::Point(10, 10), root_surface_id,
gfx::Point(10, 10), false},
{root_surface_id, gfx::Point(99, 99), root_surface_id,
gfx::Point(99, 99), false},
gfx::Point(99, 99), true},
{root_surface_id, gfx::Point(100, 100), child_surface_id,
gfx::Point(50, 50), true},
{root_surface_id, gfx::Point(199, 199), child_surface_id,
gfx::Point(149, 149), true},
{root_surface_id, gfx::Point(200, 200), root_surface_id,
gfx::Point(200, 200), false},
gfx::Point(200, 200), true},
{root_surface_id, gfx::Point(290, 290), root_surface_id,
gfx::Point(290, 290), false}};
......@@ -237,7 +237,7 @@ TEST_F(SurfaceHittestTest, Hittest_ChildSurface) {
&transform, &query_renderer));
transform.TransformPoint(&point);
EXPECT_EQ(gfx::Point(100, 100), point);
EXPECT_EQ(query_renderer, false);
EXPECT_EQ(query_renderer, true);
gfx::Point point_in_target_space(100, 100);
gfx::Transform target_transform;
......@@ -306,7 +306,7 @@ TEST_F(SurfaceHittestTest, Hittest_OccludedChildSurface) {
{root_surface_id, gfx::Point(199, 199), child_surface_id,
gfx::Point(149, 149), true},
{root_surface_id, gfx::Point(200, 200), root_surface_id,
gfx::Point(200, 200), false},
gfx::Point(200, 200), true},
{root_surface_id, gfx::Point(290, 290), root_surface_id,
gfx::Point(290, 290), false}};
......@@ -364,13 +364,13 @@ TEST_F(SurfaceHittestTest, Hittest_InvalidRenderPassDrawQuad) {
TestCase tests[] = {{root_surface_id, gfx::Point(10, 10), root_surface_id,
gfx::Point(10, 10), false},
{root_surface_id, gfx::Point(99, 99), root_surface_id,
gfx::Point(99, 99), false},
gfx::Point(99, 99), true},
{root_surface_id, gfx::Point(100, 100), child_surface_id,
gfx::Point(50, 50), true},
{root_surface_id, gfx::Point(199, 199), child_surface_id,
gfx::Point(149, 149), true},
{root_surface_id, gfx::Point(200, 200), root_surface_id,
gfx::Point(200, 200), false},
gfx::Point(200, 200), true},
{root_surface_id, gfx::Point(290, 290), root_surface_id,
gfx::Point(290, 290), false}};
......@@ -488,9 +488,9 @@ TEST_F(SurfaceHittestTest, Hittest_SingleSurface_WithInsetsDelegate) {
{root_surface_id, gfx::Point(244, 244), child_surface_id,
gfx::Point(194, 194), true},
{root_surface_id, gfx::Point(50, 50), root_surface_id, gfx::Point(50, 50),
false},
true},
{root_surface_id, gfx::Point(249, 249), root_surface_id,
gfx::Point(249, 249), false},
gfx::Point(249, 249), true},
};
TestSurfaceHittestDelegate empty_delegate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment