Commit 2816a742 authored by wjmaclean's avatar wjmaclean Committed by Commit bot

Ignore gesture sequences that have no target.

This CL implements a speculative fix for the associated bug, on the
theory that sequences associated with context menus (triggered by
GestureLongPress) may not be properly suppressed on Windows, leading
to the observation of sequences without any target in
RenderWidgetHostInputEventRouter. If this hypothesis is correct, then
we should be correct in ignoring such sequences, and this CL implements
that.

This CL also removes the code for collecting debug data introduced in
https://codereview.chromium.org/1783533002/.

BUG=592319

Review URL: https://codereview.chromium.org/1810693002

Cr-Commit-Position: refs/heads/master@{#381540}
parent 4caf5d6f
......@@ -4,7 +4,6 @@
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "base/debug/dump_without_crashing.h"
#include "cc/quads/surface_draw_quad.h"
#include "cc/surfaces/surface_id_allocator.h"
#include "cc/surfaces/surface_manager.h"
......@@ -26,18 +25,6 @@ void TransformEventTouchPositions(blink::WebTouchEvent* event,
namespace content {
// Code to assist debugging https://crbug.com/592319.
RenderWidgetHostInputEventRouter::GestureQueueDebugData::GestureQueueDebugData()
: number_of_gesture_targets_enqueued(0),
number_of_gesture_targets_dequeued(0),
next_gesture_event_index(0),
next_touch_event_index(0) {
for (unsigned i = 0; i < kNumLastEventTypes; ++i) {
last_gesture_event_types[i] = blink::WebInputEvent::Undefined;
last_touch_event_types[i] = blink::WebInputEvent::Undefined;
}
}
void RenderWidgetHostInputEventRouter::OnRenderWidgetHostViewBaseDestroyed(
RenderWidgetHostViewBase* view) {
view->RemoveObserver(this);
......@@ -184,11 +171,11 @@ void RenderWidgetHostInputEventRouter::RouteGestureEvent(
// fling.
if (event->type == blink::WebInputEvent::GestureTapDown) {
if (gesture_target_queue_.empty()) {
// Collect data to assist debugging https://crbug.com/592319.
// We'll assume for now if there's no target that we should just ignore
// the event.
LOG(ERROR) << "Gesture sequence start detected with no target available.";
base::debug::DumpWithoutCrashing();
// Ignore this gesture sequence as no target is available.
// TODO(wjmaclean): this only happens on Windows, and should not happen.
// https://crbug.com/595422
gesture_target_ = nullptr;
return;
}
......@@ -196,16 +183,8 @@ void RenderWidgetHostInputEventRouter::RouteGestureEvent(
gesture_target_ = data.target;
gesture_delta_ = data.delta;
gesture_target_queue_.pop_front();
// Code to assist debugging https://crbug.com/592319.
debug_data_.number_of_gesture_targets_dequeued++;
}
// Code to assist debugging https://crbug.com/592319.
debug_data_.last_gesture_event_types[debug_data_.next_gesture_event_index] =
event->type;
debug_data_.next_gesture_event_index =
(debug_data_.next_gesture_event_index + 1) % kNumLastEventTypes;
if (!gesture_target_)
return;
......@@ -218,12 +197,6 @@ void RenderWidgetHostInputEventRouter::RouteTouchEvent(
RenderWidgetHostViewBase* root_view,
blink::WebTouchEvent* event,
const ui::LatencyInfo& latency) {
// Code to assist debugging https://crbug.com/592319.
debug_data_.last_touch_event_types[debug_data_.next_touch_event_index] =
event->type;
debug_data_.next_touch_event_index =
(debug_data_.next_touch_event_index + 1) % kNumLastEventTypes;
switch (event->type) {
case blink::WebInputEvent::TouchStart: {
if (!active_touches_) {
......@@ -243,8 +216,6 @@ void RenderWidgetHostInputEventRouter::RouteTouchEvent(
// for the duration of the sequence.
touch_delta_ = transformed_point - original_point;
gesture_target_queue_.emplace_back(touch_target_, touch_delta_);
// Code to assist debugging https://crbug.com/592319.
debug_data_.number_of_gesture_targets_enqueued++;
if (!touch_target_)
return;
......
......@@ -121,22 +121,6 @@ class CONTENT_EXPORT RenderWidgetHostInputEventRouter
std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>
hittest_data_;
// Debugging data for https://crbug.com/592319.
// Data types declared here to simplify later removal, and understanding of
// the code while it's in this intermediate state.
static const unsigned kNumLastEventTypes = 5;
struct GestureQueueDebugData {
unsigned long number_of_gesture_targets_enqueued;
unsigned long number_of_gesture_targets_dequeued;
int last_gesture_event_types[kNumLastEventTypes];
int last_touch_event_types[kNumLastEventTypes];
unsigned next_gesture_event_index;
unsigned next_touch_event_index;
GestureQueueDebugData();
};
GestureQueueDebugData debug_data_;
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostInputEventRouter);
FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
InputEventRouterGestureTargetQueueTest);
......
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