Commit d74bc3e1 authored by lanwei's avatar lanwei Committed by Commit bot

Experiment with emulating mouse hover with touch hover capable devices

We enable the hover feature on touchscreens on Samsung Galaxy S4, S5 by
turning on a hover feature switch, which simulated a mouse over event.

BUG=418188

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

Cr-Commit-Position: refs/heads/master@{#306704}
parent 1605706c
......@@ -15286,6 +15286,13 @@ Do you accept?
<message name="IDS_HOTWORD_NOTIFICATION_BUTTON" desc="The text displayed on the button of the hotword notification. ">
Enable "Ok Google"
</message>
<message name="IDS_FLAGS_ENABLE_TOUCH_HOVER_NAME" desc="Name of the 'Enable support for hover capable touchscreens' flag.">
Enable support for hover capable touchscreens.
</message>
<message name="IDS_FLAGS_ENABLE_TOUCH_HOVER_DESCRIPTION" desc="Description of the 'Enable support for hover capable touchscreens' flag.">
Enables hover feature by holding your finger just over the screen to experience a mouseover event.
</message>
</messages>
</release>
</grit>
......@@ -2050,6 +2050,13 @@ const Experiment kExperiments[] = {
SINGLE_VALUE_TYPE(switches::kEnableSeccompFilterSandbox)
},
#endif
{
"enable-touch-hover",
IDS_FLAGS_ENABLE_TOUCH_HOVER_NAME,
IDS_FLAGS_ENABLE_TOUCH_HOVER_DESCRIPTION,
kOsAndroid,
SINGLE_VALUE_TYPE("enable-touch-hover")
},
// NOTE: Adding new command-line switches requires adding corresponding
// entries to enum "LoginCustomFlags" in histograms.xml. See note in
......
......@@ -513,6 +513,9 @@ public class ContentViewCore
// A ViewAndroidDelegate that delegates to the current container view.
private ContentViewAndroidDelegate mViewAndroidDelegate;
// A flag to determine if we enable hover feature or not.
private Boolean mEnableTouchHover;
/**
* Constructs a new ContentViewCore. Embedders must call initialize() after constructing
* a ContentViewCore and before using it.
......@@ -1608,6 +1611,15 @@ public class ContentViewCore
*/
public boolean onHoverEvent(MotionEvent event) {
TraceEvent.begin("onHoverEvent");
// TODO(lanwei): Remove this switch once experimentation is complete -
// crbug.com/418188
if (event.getToolType(0) == MotionEvent.TOOL_TYPE_FINGER) {
if (mEnableTouchHover == null) {
mEnableTouchHover =
CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TOUCH_HOVER);
}
if (!mEnableTouchHover.booleanValue()) return false;
}
MotionEvent offset = createOffsetMotionEvent(event);
try {
if (mBrowserAccessibilityManager != null) {
......
......@@ -70,6 +70,9 @@ public abstract class ContentSwitches {
public static final String FORCE_DEVICE_SCALE_FACTOR =
"force-device-scale-factor";
// Enable mouse hover emulation by holding your finger just over the screen.
public static final String ENABLE_TOUCH_HOVER = "enable-touch-hover";
// Prevent instantiation.
private ContentSwitches() {}
}
......@@ -49102,6 +49102,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="1966730288" label="disable-threaded-compositing"/>
<int value="1969604362" label="enable-pinch-virtual-viewport"/>
<int value="1980011075" label="debug-packed-apps"/>
<int value="2000091128" label="enable-touch-hover"/>
<int value="2004829262" label="enable-webgl-draft-extensions"/>
<int value="2037756154" label="enable-impl-side-painting"/>
<int value="2059322877" label="new-avatar-menu"/>
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