Commit 186fe2cb authored by Ted Choc's avatar Ted Choc Committed by Commit Bot

Fix mouse access for the android omnibox dropdown.

The issue is that the MotionEvent (ACTION_BUTTON_PRESS) was bleeding through
the view hierarchy and being consumed by the underlying web contents, which
would request focus away from the omnibox triggering an ACTION_CANCEL to
be dispatched.

The solution is to have the suggestion list consume any previously unconsumed
mouse click events to ensure they do not bleed through to the sibling yet
lower in the Z-axis views.

BUG=968414

Change-Id: Ic29114419708a1bf4d7b4ccb03b7cd0144d6bcd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1987073Reviewed-by: default avatarEnder <ender@google.com>
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728360}
parent ad6ce1b6
......@@ -10,7 +10,9 @@ import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.support.v4.view.ViewCompat;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
......@@ -226,4 +228,19 @@ public class OmniboxSuggestionsList extends ListView {
mAlignmentView.removeOnLayoutChangeListener(mAlignmentViewLayoutListener);
}
}
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
// Consume mouse events to ensure clicks do not bleed through to sibling views that
// are obscured by the list. crbug.com/968414
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0
&& event.getToolType(0) == MotionEvent.TOOL_TYPE_MOUSE) {
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_BUTTON_PRESS
|| action == MotionEvent.ACTION_BUTTON_RELEASE) {
return true;
}
}
return super.onGenericMotionEvent(event);
}
}
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