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

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

Issue 2336803003: Make SyntheticPointerAction to flush the pointer action sequence (Closed)
Patch Set: controller Created 4 years 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
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..7ce4ddfa7d49f5ec1e80ec05c9509a70363f09c5 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,32 @@ 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) {
+ DCHECK_GE(index, 0);
+ DCHECK_LT(index, WebTouchEvent::kTouchesLengthCap);
+ int touch_index = touch_event_.PressPoint(x, y);
+ index_map_[index] = touch_index;
Navid Zolghadr 2016/12/09 16:04:47 I wonder if the debug check is enough. When users
}
void SyntheticTouchDriver::Move(float x, float y, int index) {
- touch_event_.MovePoint(index, x, y);
+ DCHECK_GE(index, 0);
+ DCHECK_LT(index, WebTouchEvent::kTouchesLengthCap);
+ touch_event_.MovePoint(index_map_[index], x, y);
}
void SyntheticTouchDriver::Release(int index) {
- touch_event_.ReleasePoint(index);
+ DCHECK_GE(index, 0);
+ DCHECK_LT(index, WebTouchEvent::kTouchesLengthCap);
+ touch_event_.ReleasePoint(index_map_[index]);
+ index_map_[index] = -1;
}
bool SyntheticTouchDriver::UserInputCheck(
const SyntheticPointerActionParams& params) const {
- DCHECK_GE(params.index(), -1);
+ DCHECK_GE(params.index(), 0);
DCHECK_LT(params.index(), WebTouchEvent::kTouchesLengthCap);
- if (params.gesture_source_type != SyntheticGestureParams::TOUCH_INPUT)
+
+ if (params.gesture_source_type() != SyntheticGestureParams::TOUCH_INPUT)
return false;
if (params.pointer_action_type() ==
@@ -50,19 +62,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;
}

Powered by Google App Engine
This is Rietveld 408576698