Commit f0f72552 authored by Alexis Menard's avatar Alexis Menard Committed by Commit Bot

Align any-hover:none behavior to current specification.

The spec was updated some time ago clarifying how
any-hover: none should match (see
https://github.com/w3c/csswg-drafts/commit/98f494677a265df504eee67d587329478b8ce6ba).
This patch aligns the behavior with the spec clarification
by making sure that 'any-hover:none' will only evaluate to
true if there are no pointing devices, or if all the pointing
devices present lack hover capabilities.

The previous implementation was reading the specification
literally by returning the union of the capabilities of
the input devices connected on the machine.

Windows, Linux and Android are now updated in this patch.

This technically has a compatibility impact as we're changing
behavior but @rbyers and myself did a rapid search of top websites
 and didn't find anything relevant to the change.

BUG=778694

Change-Id: I230a44f29707e660515b4d27a1bc88552aa73032
Reviewed-on: https://chromium-review.googlesource.com/803662
Commit-Queue: Alexis Menard <alexis.menard@intel.com>
Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521407}
parent f3a97d84
......@@ -82,9 +82,6 @@ public class TouchDevice {
|| hasSource(sources, InputDevice.SOURCE_TOUCHPAD)
|| hasSource(sources, InputDevice.SOURCE_TRACKBALL)) {
result[1] |= HoverType.HOVER;
} else if (hasSource(sources, InputDevice.SOURCE_STYLUS)
|| hasSource(sources, InputDevice.SOURCE_TOUCHSCREEN)) {
result[1] |= HoverType.NONE;
}
// Remaining InputDevice sources: SOURCE_DPAD, SOURCE_GAMEPAD, SOURCE_JOYSTICK,
......
......@@ -15,7 +15,7 @@ bool IsTouchDevicePresent() {
return !InputDeviceManager::GetInstance()->GetTouchscreenDevices().empty();
}
bool isMouseOrTouchpadPresent() {
bool IsMouseOrTouchpadPresent() {
InputDeviceManager* input_manager = InputDeviceManager::GetInstance();
for (const ui::InputDevice& device : input_manager->GetTouchpadDevices()) {
if (device.enabled)
......@@ -33,7 +33,7 @@ bool isMouseOrTouchpadPresent() {
int GetAvailablePointerTypes() {
int available_pointer_types = 0;
if (isMouseOrTouchpadPresent())
if (IsMouseOrTouchpadPresent())
available_pointer_types |= POINTER_TYPE_FINE;
if (IsTouchDevicePresent())
......@@ -47,10 +47,10 @@ int GetAvailablePointerTypes() {
}
int GetAvailableHoverTypes() {
int available_hover_types = HOVER_TYPE_NONE;
if (isMouseOrTouchpadPresent())
available_hover_types |= HOVER_TYPE_HOVER;
return available_hover_types;
if (IsMouseOrTouchpadPresent())
return HOVER_TYPE_HOVER;
return HOVER_TYPE_NONE;
}
TouchScreensAvailability GetTouchScreensAvailability() {
......
......@@ -57,15 +57,10 @@ int GetAvailableHoverTypes() {
if (base::win::IsTabletDevice(nullptr, ui::GetHiddenWindow()))
return HOVER_TYPE_NONE;
int available_hover_types;
if (GetSystemMetrics(SM_MOUSEPRESENT) != 0) {
available_hover_types = HOVER_TYPE_HOVER;
if (IsTouchDevicePresent())
available_hover_types |= HOVER_TYPE_NONE;
} else
available_hover_types = HOVER_TYPE_NONE;
return available_hover_types;
if (GetSystemMetrics(SM_MOUSEPRESENT) != 0)
return HOVER_TYPE_HOVER;
return HOVER_TYPE_NONE;
}
TouchScreensAvailability GetTouchScreensAvailability() {
......
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