| Index: content/browser/renderer_host/input/synthetic_touch_driver.cc
|
| diff --git a/content/browser/renderer_host/input/synthetic_touch_driver.cc b/content/browser/renderer_host/input/synthetic_touch_driver.cc
|
| index 519390d212c289bd0522587ca547c2ef6d137b24..8e0c4574662108a953e335973ee17a16c427d04c 100644
|
| --- a/content/browser/renderer_host/input/synthetic_touch_driver.cc
|
| +++ b/content/browser/renderer_host/input/synthetic_touch_driver.cc
|
| @@ -10,10 +10,14 @@ using blink::WebTouchEvent;
|
|
|
| namespace content {
|
|
|
| -SyntheticTouchDriver::SyntheticTouchDriver() {}
|
| +SyntheticTouchDriver::SyntheticTouchDriver() {
|
| + std::fill(index_map_.begin(), index_map_.end(), -1);
|
| +}
|
|
|
| SyntheticTouchDriver::SyntheticTouchDriver(SyntheticWebTouchEvent touch_event)
|
| - : touch_event_(touch_event) {}
|
| + : touch_event_(touch_event) {
|
| + std::fill(index_map_.begin(), index_map_.end(), -1);
|
| +}
|
|
|
| SyntheticTouchDriver::~SyntheticTouchDriver() {}
|
|
|
| @@ -23,24 +27,26 @@ void SyntheticTouchDriver::DispatchEvent(SyntheticGestureTarget* target,
|
| target->DispatchInputEventToPlatform(touch_event_);
|
| }
|
|
|
| -int SyntheticTouchDriver::Press(float x, float y) {
|
| - int index = touch_event_.PressPoint(x, y);
|
| - return index;
|
| +void SyntheticTouchDriver::Press(float x, float y, int index) {
|
| + int touch_index = touch_event_.PressPoint(x, y);
|
| + index_map_[index] = touch_index;
|
| }
|
|
|
| void SyntheticTouchDriver::Move(float x, float y, int index) {
|
| - touch_event_.MovePoint(index, x, y);
|
| + touch_event_.MovePoint(index_map_[index], x, y);
|
| }
|
|
|
| void SyntheticTouchDriver::Release(int index) {
|
| - touch_event_.ReleasePoint(index);
|
| + touch_event_.ReleasePoint(index_map_[index]);
|
| + index_map_[index] = -1;
|
| }
|
|
|
| bool SyntheticTouchDriver::UserInputCheck(
|
| const SyntheticPointerActionParams& params) const {
|
| - DCHECK_GE(params.index(), -1);
|
| - DCHECK_LT(params.index(), WebTouchEvent::kTouchesLengthCap);
|
| - if (params.gesture_source_type != SyntheticGestureParams::TOUCH_INPUT)
|
| + if (params.index() < 0 || params.index() >= WebTouchEvent::kTouchesLengthCap);
|
| + return false;
|
| +
|
| + if (params.gesture_source_type() != SyntheticGestureParams::TOUCH_INPUT)
|
| return false;
|
|
|
| if (params.pointer_action_type() ==
|
| @@ -50,19 +56,19 @@ bool SyntheticTouchDriver::UserInputCheck(
|
|
|
| if (params.pointer_action_type() ==
|
| SyntheticPointerActionParams::PointerActionType::PRESS &&
|
| - params.index() >= 0) {
|
| + index_map_[params.index()] >= 0) {
|
| return false;
|
| }
|
|
|
| if (params.pointer_action_type() ==
|
| SyntheticPointerActionParams::PointerActionType::MOVE &&
|
| - params.index() == -1) {
|
| + index_map_[params.index()] == -1) {
|
| return false;
|
| }
|
|
|
| if (params.pointer_action_type() ==
|
| SyntheticPointerActionParams::PointerActionType::RELEASE &&
|
| - params.index() == -1) {
|
| + index_map_[params.index()] == -1) {
|
| return false;
|
| }
|
|
|
|
|