Commit d69e3bac authored by Ria Jiang's avatar Ria Jiang Committed by Commit Bot

Handle slow path case kHitTestAsk in HitTestQuery.

1. If the target hit-test region we find in HitTestQuery has kHitTestAsk
flag set, we need to fall back to the slow path - ask renderer to do the
targeting. Return the viz::Target we find with kHitTestAsk in that case.

2. In RenderWidgetHostInputEventRouter::FindViewAtLocation, set
RenderWidgetTargetResult::should_query_view to be true if kHitTestAsk is
set in the target we received.

Bug: 803548
Test: viz_unittests
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: I7df66f2e09a15308ee02ee4918ab1f43077b1fbd
Reviewed-on: https://chromium-review.googlesource.com/876997Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Commit-Queue: Ria Jiang <riajiang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531060}
parent 7181b3d4
......@@ -121,16 +121,12 @@ bool HitTestQuery::FindTargetInRegionForLocation(
: (region->flags & mojom::kHitTestMouse) != 0u;
if (!match_touch_or_mouse_region)
return false;
if (region->flags & mojom::kHitTestMine) {
if (region->flags & (mojom::kHitTestMine | mojom::kHitTestAsk)) {
target->frame_sink_id = region->frame_sink_id;
target->location_in_target = location_in_target;
target->flags = region->flags;
return true;
}
if (region->flags & mojom::kHitTestAsk) {
target->flags = region->flags;
return true;
}
return false;
}
......
......@@ -928,8 +928,8 @@ TEST_F(HitTestQueryTest, RootHitTestAskFlag) {
// point1 is inside e but we have to ask clients for targeting.
Target target1 =
hit_test_query().FindTargetForLocation(EventSource::MOUSE, point1);
EXPECT_EQ(target1.frame_sink_id, FrameSinkId());
EXPECT_EQ(target1.location_in_target, gfx::Point());
EXPECT_EQ(target1.frame_sink_id, e_id);
EXPECT_EQ(target1.location_in_target, point1);
EXPECT_EQ(target1.flags, mojom::kHitTestAsk | mojom::kHitTestMouse);
// point2 is on the bounds of e so no target found.
......@@ -992,8 +992,8 @@ TEST_F(HitTestQueryTest, ChildHitTestAskFlag) {
// shouldn't go back to e.
Target target3 =
hit_test_query().FindTargetForLocation(EventSource::MOUSE, point3);
EXPECT_EQ(target3.frame_sink_id, FrameSinkId());
EXPECT_EQ(target3.location_in_target, gfx::Point());
EXPECT_EQ(target3.frame_sink_id, c2_id);
EXPECT_EQ(target3.location_in_target, gfx::Point(100, 100));
EXPECT_EQ(target3.flags, mojom::kHitTestAsk | mojom::kHitTestMouse);
}
......
......@@ -19,6 +19,7 @@
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/common/frame_messages.h"
#include "services/viz/public/interfaces/hit_test/hit_test_region_list.mojom.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
namespace {
......@@ -308,6 +309,8 @@ RenderWidgetTargetResult RenderWidgetHostInputEventRouter::FindViewAtLocation(
} else {
*transformed_point = point;
}
if (target.flags & viz::mojom::kHitTestAsk)
query_renderer = true;
} else {
// Short circuit if owner_map has only one RenderWidgetHostView, no need for
// hit testing.
......
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