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

Unified Diff: content/renderer/pepper/event_conversion.cc

Issue 2403313002: pepper: Report proper touch end event for lifting stylus (Closed)
Patch Set: Created 4 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/event_conversion.cc
diff --git a/content/renderer/pepper/event_conversion.cc b/content/renderer/pepper/event_conversion.cc
index 14cd38821d8e42cc28a52694ec0120bf4d86d024..d21f0cf908eacd49311c8706da046bd89be897c4 100644
--- a/content/renderer/pepper/event_conversion.cc
+++ b/content/renderer/pepper/event_conversion.cc
@@ -99,18 +99,18 @@ bool IsStylusEvent(const WebInputEvent& event) {
PP_InputEvent_Type ConvertEventTypes(const WebInputEvent& event) {
if (IsStylusEvent(event)) {
+ const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event);
+ if (mouse_event.button != blink::WebMouseEvent::Button::Left &&
+ !(mouse_event.modifiers & blink::WebInputEvent::LeftButtonDown))
+ return PP_INPUTEVENT_TYPE_UNDEFINED;
+
switch (event.type) {
case WebInputEvent::MouseDown:
return PP_INPUTEVENT_TYPE_TOUCHSTART;
case WebInputEvent::MouseUp:
return PP_INPUTEVENT_TYPE_TOUCHEND;
- case WebInputEvent::MouseMove: {
- const WebMouseEvent& mouse_event =
- static_cast<const WebMouseEvent&>(event);
- return (mouse_event.modifiers & blink::WebInputEvent::LeftButtonDown)
- ? PP_INPUTEVENT_TYPE_TOUCHMOVE
- : PP_INPUTEVENT_TYPE_UNDEFINED;
- }
+ case WebInputEvent::MouseMove:
+ return PP_INPUTEVENT_TYPE_TOUCHMOVE;
default:
return PP_INPUTEVENT_TYPE_UNDEFINED;
}
@@ -225,23 +225,21 @@ void AppendStylusTouchEvent(const WebInputEvent& event,
InputEventData result = GetEventWithCommonFieldsAndType(event);
result.event_modifiers = ConvertEventModifiers(event.modifiers);
-
- if (mouse_event.modifiers & blink::WebInputEvent::LeftButtonDown &&
- (mouse_event.type == WebInputEvent::MouseDown ||
- mouse_event.type == WebInputEvent::MouseMove)) {
- PP_TouchPoint touch_point;
- touch_point.id = 0;
- touch_point.position.x = mouse_event.x;
- touch_point.position.y = mouse_event.y;
- touch_point.pressure = mouse_event.force;
-
+ if (result.event_type == PP_INPUTEVENT_TYPE_UNDEFINED)
+ return;
+
+ PP_TouchPoint touch_point;
+ touch_point.id = 0;
+ touch_point.position.x = mouse_event.x;
+ touch_point.position.y = mouse_event.y;
+ touch_point.pressure = mouse_event.force;
+
+ result.changed_touches.push_back(touch_point);
+ result.target_touches.push_back(touch_point);
+ if (result.event_type != PP_INPUTEVENT_TYPE_TOUCHEND)
result.touches.push_back(touch_point);
- result.changed_touches.push_back(touch_point);
- result.target_touches.push_back(touch_point);
- }
- if (result.event_type != PP_INPUTEVENT_TYPE_UNDEFINED)
- result_events->push_back(result);
+ result_events->push_back(result);
}
void AppendMouseEvent(const WebInputEvent& event,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698