Index: content/renderer/pepper/event_conversion.cc |
diff --git a/content/renderer/pepper/event_conversion.cc b/content/renderer/pepper/event_conversion.cc |
index 1a8344ef40a2607b9bba7ec213f3f37069c2e217..3674ee7a189fe2da0a09a6679eb68456777315e6 100644 |
--- a/content/renderer/pepper/event_conversion.cc |
+++ b/content/renderer/pepper/event_conversion.cc |
@@ -215,11 +215,26 @@ void AppendMouseWheelEvent(const WebInputEvent& event, |
result_events->push_back(result); |
} |
+enum IncludedTouchPointTypes { |
+ ACTIVE, // Only pointers that are currently down. |
+ CHANGED // Only pointers that have changed since the previous event. |
+}; |
void SetPPTouchPoints(const WebTouchPoint* touches, |
uint32_t touches_length, |
+ IncludedTouchPointTypes included_types, |
std::vector<PP_TouchPoint>* result) { |
for (uint32_t i = 0; i < touches_length; i++) { |
const WebTouchPoint& touch_point = touches[i]; |
+ if (included_types == ACTIVE && |
+ (touch_point.state == WebTouchPoint::StateReleased || |
+ touch_point.state == WebTouchPoint::StateCancelled)) { |
+ continue; |
+ } |
+ if (included_types == CHANGED && |
+ (touch_point.state == WebTouchPoint::StateUndefined || |
+ touch_point.state == WebTouchPoint::StateStationary)) { |
+ continue; |
+ } |
PP_TouchPoint pp_pt; |
pp_pt.id = touch_point.id; |
pp_pt.position.x = touch_point.position.x; |
@@ -239,13 +254,11 @@ void AppendTouchEvent(const WebInputEvent& event, |
InputEventData result = GetEventWithCommonFieldsAndType(event); |
SetPPTouchPoints( |
- touch_event.touches, touch_event.touchesLength, &result.touches); |
- SetPPTouchPoints(touch_event.changedTouches, |
- touch_event.changedTouchesLength, |
+ touch_event.touches, touch_event.touchesLength, ACTIVE, &result.touches); |
+ SetPPTouchPoints(touch_event.touches, |
+ touch_event.touchesLength, |
+ CHANGED, |
&result.changed_touches); |
- SetPPTouchPoints(touch_event.targetTouches, |
- touch_event.targetTouchesLength, |
- &result.target_touches); |
result_events->push_back(result); |
} |
@@ -319,29 +332,15 @@ WebTouchEvent* BuildTouchEvent(const InputEventData& event) { |
for (uint32_t i = 0; i < event.changed_touches.size(); i++) |
states_map[event.changed_touches[i].id] = state; |
- SetWebTouchPoints(event.changed_touches, |
- states_map, |
- web_event->changedTouches, |
- &web_event->changedTouchesLength); |
- |
SetWebTouchPoints( |
event.touches, states_map, web_event->touches, &web_event->touchesLength); |
bokan
2014/09/09 20:17:38
Where do the InputEventData events come from? Will
jdduke (slow)
2014/09/09 20:52:24
We're not sure, so we have the branch below. I thi
|
- SetWebTouchPoints(event.target_touches, |
- states_map, |
- web_event->targetTouches, |
- &web_event->targetTouchesLength); |
- |
if (web_event->type == WebInputEvent::TouchEnd || |
web_event->type == WebInputEvent::TouchCancel) { |
SetWebTouchPoints(event.changed_touches, |
bokan
2014/09/09 20:17:38
Same question again, are we sure ToucheEnd/Cancel
jdduke (slow)
2014/09/09 20:52:24
Ah, you're right, I thought SetWebTouchPoints chec
|
states_map, |
web_event->touches, |
&web_event->touchesLength); |
- SetWebTouchPoints(event.changed_touches, |
- states_map, |
- web_event->targetTouches, |
- &web_event->targetTouchesLength); |
} |
return web_event; |