Commit 7e0f0147 authored by Sean Gilhuly's avatar Sean Gilhuly Committed by Commit Bot

Remove surface range check when building hit test data

HitTestDataBuilder is checking that the start() and end() of a surface
range have the same FrameSinkId before including the surface quad in
hit test data. This can prevent OOP-IFs from being clicked during the
first four seconds after a page navigation.

Instead, remove this check. If there is no surface available for the end
FrameSinkId, then an async hit test will be used to target input events.

Bug: 926194
Change-Id: I574bf104cd3524973152035e59701a0105908fa9
Reviewed-on: https://chromium-review.googlesource.com/c/1465078Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Reviewed-by: default avatarRia Jiang <riajiang@chromium.org>
Commit-Queue: Sean Gilhuly <sgilhuly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635738}
parent 1546f782
...@@ -122,9 +122,8 @@ TEST(HitTestDataProviderDrawQuad, HitTestDataRenderer) { ...@@ -122,9 +122,8 @@ TEST(HitTestDataProviderDrawQuad, HitTestDataRenderer) {
hit_test_region_list->regions[0].transform); hit_test_region_list->regions[0].transform);
} }
// Test to ensure that we skip regions with non-invertible transforms and with // Test to ensure that we skip regions with non-invertible transforms when
// updated FrameSinkId between fallback and primary when preparing for hit-test // preparing for hit-test data.
// data.
TEST(HitTestDataProviderDrawQuad, HitTestDataSkipQuads) { TEST(HitTestDataProviderDrawQuad, HitTestDataSkipQuads) {
std::unique_ptr<HitTestDataProvider> hit_test_data_provider = std::unique_ptr<HitTestDataProvider> hit_test_data_provider =
std::make_unique<HitTestDataProviderDrawQuad>( std::make_unique<HitTestDataProviderDrawQuad>(
...@@ -167,53 +166,45 @@ TEST(HitTestDataProviderDrawQuad, HitTestDataSkipQuads) { ...@@ -167,53 +166,45 @@ TEST(HitTestDataProviderDrawQuad, HitTestDataSkipQuads) {
invertible_transform); invertible_transform);
pass_list.push_back(std::move(pass3)); pass_list.push_back(std::move(pass3));
// The draw quad's FrameSinkId changed between fallback and primary. auto pass4_root = RenderPass::Create();
SurfaceId child_surface_id4 = CreateChildSurfaceId(5); pass4_root->output_rect = kFrameRect;
SurfaceId fallback_child_surface_id4 = CreateChildSurfaceId(6); pass4_root->id = 5;
auto pass4 = CreateRenderPassWithChildSurface( auto* shared_quad_state4_root = pass4_root->CreateAndAppendSharedQuadState();
4, child_surface_id4, kFrameRect, child_rect, invertible_transform, gfx::Rect rect4_root(kFrameRect);
invertible_transform, fallback_child_surface_id4); shared_quad_state4_root->SetAll(
pass_list.push_back(std::move(pass4)); gfx::Transform(), /*quad_layer_rect=*/rect4_root,
/*visible_quad_layer_rect=*/rect4_root, /*clip_rect=*/rect4_root,
auto pass5_root = RenderPass::Create();
pass5_root->output_rect = kFrameRect;
pass5_root->id = 5;
auto* shared_quad_state5_root = pass5_root->CreateAndAppendSharedQuadState();
gfx::Rect rect5_root(kFrameRect);
shared_quad_state5_root->SetAll(
gfx::Transform(), /*quad_layer_rect=*/rect5_root,
/*visible_quad_layer_rect=*/rect5_root, /*clip_rect=*/rect5_root,
/*is_clipped=*/false, /*are_contents_opaque=*/false, /*is_clipped=*/false, /*are_contents_opaque=*/false,
/*opacity=*/0.5f, SkBlendMode::kSrcOver, /*sorting_context_id=*/0); /*opacity=*/0.5f, SkBlendMode::kSrcOver, /*sorting_context_id=*/0);
auto* quad5_root_1 = auto* quad4_root_1 =
pass5_root->quad_list.AllocateAndConstruct<RenderPassDrawQuad>(); pass4_root->quad_list.AllocateAndConstruct<RenderPassDrawQuad>();
quad5_root_1->SetNew(shared_quad_state5_root, /*rect=*/rect5_root, quad4_root_1->SetNew(shared_quad_state4_root, /*rect=*/rect4_root,
/*visible_rect=*/rect5_root, /*render_pass_id=*/1, /*visible_rect=*/rect4_root, /*render_pass_id=*/1,
/*mask_resource_id=*/0, gfx::RectF(), gfx::Size(), /*mask_resource_id=*/0, gfx::RectF(), gfx::Size(),
gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF(), false, gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF(), false,
1.0f); 1.0f);
auto* quad5_root_2 = auto* quad4_root_2 =
pass5_root->quad_list.AllocateAndConstruct<RenderPassDrawQuad>(); pass4_root->quad_list.AllocateAndConstruct<RenderPassDrawQuad>();
quad5_root_2->SetNew(shared_quad_state5_root, /*rect=*/rect5_root, quad4_root_2->SetNew(shared_quad_state4_root, /*rect=*/rect4_root,
/*visible_rect=*/rect5_root, /*render_pass_id=*/2, /*visible_rect=*/rect4_root, /*render_pass_id=*/2,
/*mask_resource_id=*/0, gfx::RectF(), gfx::Size(), /*mask_resource_id=*/0, gfx::RectF(), gfx::Size(),
gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF(), false, gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF(), false,
1.0f); 1.0f);
auto* quad5_root_3 = auto* quad4_root_3 =
pass5_root->quad_list.AllocateAndConstruct<RenderPassDrawQuad>(); pass4_root->quad_list.AllocateAndConstruct<RenderPassDrawQuad>();
quad5_root_3->SetNew(shared_quad_state5_root, /*rect=*/rect5_root, quad4_root_3->SetNew(shared_quad_state4_root, /*rect=*/rect4_root,
/*visible_rect=*/rect5_root, /*render_pass_id=*/3, /*visible_rect=*/rect4_root, /*render_pass_id=*/3,
/*mask_resource_id=*/0, gfx::RectF(), gfx::Size(), /*mask_resource_id=*/0, gfx::RectF(), gfx::Size(),
gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF(), false, gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF(), false,
1.0f); 1.0f);
auto* quad5_root_4 = auto* quad4_root_4 =
pass5_root->quad_list.AllocateAndConstruct<RenderPassDrawQuad>(); pass4_root->quad_list.AllocateAndConstruct<RenderPassDrawQuad>();
quad5_root_4->SetNew(shared_quad_state5_root, /*rect=*/rect5_root, quad4_root_4->SetNew(shared_quad_state4_root, /*rect=*/rect4_root,
/*visible_rect=*/rect5_root, /*render_pass_id=*/4, /*visible_rect=*/rect4_root, /*render_pass_id=*/4,
/*mask_resource_id=*/0, gfx::RectF(), gfx::Size(), /*mask_resource_id=*/0, gfx::RectF(), gfx::Size(),
gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF(), false, gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF(), false,
1.0f); 1.0f);
pass_list.push_back(std::move(pass5_root)); pass_list.push_back(std::move(pass4_root));
auto compositor_frame = auto compositor_frame =
CompositorFrameBuilder().SetRenderPassList(std::move(pass_list)).Build(); CompositorFrameBuilder().SetRenderPassList(std::move(pass_list)).Build();
......
...@@ -104,15 +104,6 @@ void AddHitTestDataFromRenderPass(const CompositorFrame& frame, ...@@ -104,15 +104,6 @@ void AddHitTestDataFromRenderPass(const CompositorFrame& frame,
if (surface_quad->ignores_input_event) if (surface_quad->ignores_input_event)
continue; continue;
// Skip the quad if the FrameSinkId between fallback and primary is not
// the same, because we don't know which FrameSinkId would be used to
// draw this quad.
if (surface_quad->surface_range.start() &&
surface_quad->surface_range.start()->frame_sink_id() !=
surface_quad->surface_range.end().frame_sink_id()) {
continue;
}
// Skip the quad if the transform is not invertible (i.e. it will not // Skip the quad if the transform is not invertible (i.e. it will not
// be able to receive events). // be able to receive events).
gfx::Transform quad_to_target_transform = gfx::Transform quad_to_target_transform =
...@@ -125,6 +116,9 @@ void AddHitTestDataFromRenderPass(const CompositorFrame& frame, ...@@ -125,6 +116,9 @@ void AddHitTestDataFromRenderPass(const CompositorFrame& frame,
gfx::Transform hit_test_region_transform = gfx::Transform hit_test_region_transform =
target_to_quad_transform * transform_from_root_target; target_to_quad_transform * transform_from_root_target;
// If |surface_range|.begin() and end() have different frame sinks, use
// end(). If there is no surface submitted for this FrameSinkId at
// aggregation time, an async hit test query will be sent to the client.
const auto& filters = render_pass->filters; const auto& filters = render_pass->filters;
std::vector<gfx::Rect> filter_regions = ExtractAlphaRects( std::vector<gfx::Rect> filter_regions = ExtractAlphaRects(
filters, surface_quad->rect, quad_to_target_transform, filters, surface_quad->rect, quad_to_target_transform,
......
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