Chromium Code Reviews| 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..2fb699c09c03fe2a47f56724f13a18e9ef58e3fb 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 ModifiersFromEvent(const WebInputEvent& event) { |
|
tdresser
2016/06/22 14:16:26
This function is named a bit strangely.
Perhaps |
dgozman
2016/06/22 19:07:55
Done.
|
| + 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 = ModifiersFromEvent(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 = ModifiersFromEvent(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 = ModifiersFromEvent(mouse_event); |
| WebTouchEventTraits::ResetTypeAndTouchStates( |
| eventType, mouse_event.timeStampSeconds, &touch_event_); |