Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Unified Diff: content/browser/renderer_host/input/touch_emulator.cc

Issue 2084043003: Touch emulator: clear mouse buttons modifiers on emulated touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, renamed function Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_emulator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/touch_emulator.cc
diff --git a/content/browser/renderer_host/input/touch_emulator.cc b/content/browser/renderer_host/input/touch_emulator.cc
index cdbc77da53e43b4ef5d218b667589b96fe3d46b3..f09716a68c8e3ec8019d51afffcd99cd12dac98e 100644
--- a/content/browser/renderer_host/input/touch_emulator.cc
+++ b/content/browser/renderer_host/input/touch_emulator.cc
@@ -39,6 +39,12 @@ ui::GestureProvider::Config GetEmulatorGestureProviderConfig(
return config;
}
+int ModifiersWithoutMouseButtons(const WebInputEvent& event) {
+ const int all_buttons = WebInputEvent::LeftButtonDown |
+ WebInputEvent::MiddleButtonDown | WebInputEvent::RightButtonDown;
+ return event.modifiers & ~all_buttons;
+}
+
// Time between two consecutive mouse moves, during which second mouse move
// is not converted to touch.
const double kMouseMoveDropIntervalSeconds = 5.f / 1000;
@@ -398,7 +404,7 @@ void TouchEmulator::PinchEnd(const WebGestureEvent& event) {
void TouchEmulator::FillPinchEvent(const WebInputEvent& event) {
pinch_event_.timeStampSeconds = event.timeStampSeconds;
- pinch_event_.modifiers = event.modifiers;
+ pinch_event_.modifiers = ModifiersWithoutMouseButtons(event);
pinch_event_.sourceDevice = blink::WebGestureDeviceTouchscreen;
pinch_event_.x = pinch_anchor_.x();
pinch_event_.y = pinch_anchor_.y();
@@ -407,7 +413,7 @@ void TouchEmulator::FillPinchEvent(const WebInputEvent& event) {
void TouchEmulator::ScrollEnd(const WebGestureEvent& event) {
WebGestureEvent scroll_event;
scroll_event.timeStampSeconds = event.timeStampSeconds;
- scroll_event.modifiers = event.modifiers;
+ scroll_event.modifiers = ModifiersWithoutMouseButtons(event);
scroll_event.sourceDevice = blink::WebGestureDeviceTouchscreen;
scroll_event.type = WebInputEvent::GestureScrollEnd;
client_->ForwardEmulatedGestureEvent(scroll_event);
@@ -430,7 +436,7 @@ void TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) {
NOTREACHED() << "Invalid event for touch emulation: " << mouse_event.type;
}
touch_event_.touchesLength = 1;
- touch_event_.modifiers = mouse_event.modifiers;
+ touch_event_.modifiers = ModifiersWithoutMouseButtons(mouse_event);
WebTouchEventTraits::ResetTypeAndTouchStates(
eventType, mouse_event.timeStampSeconds, &touch_event_);
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_emulator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698