Commit d1c093ed authored by tobiasjs's avatar tobiasjs Committed by Commit bot

Revert TouchDevice.hasAnySource optimization.

Android InputDevice sources are not represented by single set bits,
and so or'ing them together is not correct.

BUG=672907

Review-Url: https://codereview.chromium.org/2594733002
Cr-Commit-Position: refs/heads/master@{#439834}
parent 7b308a54
...@@ -65,18 +65,21 @@ public class TouchDevice { ...@@ -65,18 +65,21 @@ public class TouchDevice {
int sources = inputDevice.getSources(); int sources = inputDevice.getSources();
if (hasAnySource(sources, InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_STYLUS if (hasSource(sources, InputDevice.SOURCE_MOUSE)
| InputDevice.SOURCE_TOUCHPAD | InputDevice.SOURCE_TRACKBALL)) { || hasSource(sources, InputDevice.SOURCE_STYLUS)
|| hasSource(sources, InputDevice.SOURCE_TOUCHPAD)
|| hasSource(sources, InputDevice.SOURCE_TRACKBALL)) {
result[0] |= PointerType.FINE; result[0] |= PointerType.FINE;
} else if (hasSource(sources, InputDevice.SOURCE_TOUCHSCREEN)) { } else if (hasSource(sources, InputDevice.SOURCE_TOUCHSCREEN)) {
result[0] |= PointerType.COARSE; result[0] |= PointerType.COARSE;
} }
if (hasAnySource(sources, InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_TOUCHPAD if (hasSource(sources, InputDevice.SOURCE_MOUSE)
| InputDevice.SOURCE_TRACKBALL)) { || hasSource(sources, InputDevice.SOURCE_TOUCHPAD)
|| hasSource(sources, InputDevice.SOURCE_TRACKBALL)) {
result[1] |= HoverType.HOVER; result[1] |= HoverType.HOVER;
} else if (hasAnySource(sources, } else if (hasSource(sources, InputDevice.SOURCE_STYLUS)
InputDevice.SOURCE_STYLUS | InputDevice.SOURCE_TOUCHSCREEN)) { || hasSource(sources, InputDevice.SOURCE_TOUCHSCREEN)) {
result[1] |= HoverType.ON_DEMAND; result[1] |= HoverType.ON_DEMAND;
} }
...@@ -90,10 +93,6 @@ public class TouchDevice { ...@@ -90,10 +93,6 @@ public class TouchDevice {
return result; return result;
} }
private static boolean hasAnySource(int sources, int inputDeviceSources) {
return (sources & inputDeviceSources) != 0;
}
private static boolean hasSource(int sources, int inputDeviceSource) { private static boolean hasSource(int sources, int inputDeviceSource) {
return (sources & inputDeviceSource) == inputDeviceSource; return (sources & inputDeviceSource) == inputDeviceSource;
} }
......
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