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

Unified Diff: components/test_runner/event_sender.cc

Issue 1989623002: Suppressed MEs for gestures from cancelled PEs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a comment. Created 4 years, 7 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
Index: components/test_runner/event_sender.cc
diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc
index 7501c3fd3836aebfab8d9945aada772fb24678ef..d6fe794a86e469564c3a052c652655dc038224f6 100644
--- a/components/test_runner/event_sender.cc
+++ b/components/test_runner/event_sender.cc
@@ -1882,37 +1882,48 @@ void EventSender::GestureScrollFirstPoint(int x, int y) {
}
bool EventSender::GetMovedBeyondSlopRegionArg(gin::Arguments* args) {
- std::string arg;
if (args->PeekNext().IsEmpty())
return false;
+ std::string arg;
if(args->PeekNext()->IsString() && args->GetNext(&arg)) {
if (arg == "movedBeyondSlopRegion")
return true;
}
- args->ThrowError();
return false;
}
+uint32_t EventSender::GetUniqueTouchEventId(gin::Arguments* args) {
+ uint32_t unique_touch_event_id;
+ if(!args->PeekNext().IsEmpty() && args->GetNext(&unique_touch_event_id))
+ return unique_touch_event_id;
+
+ return 0;
+}
+
void EventSender::TouchStart(gin::Arguments* args) {
SendCurrentTouchEvent(WebInputEvent::TouchStart,
- GetMovedBeyondSlopRegionArg(args));
+ GetMovedBeyondSlopRegionArg(args),
+ GetUniqueTouchEventId(args));
}
void EventSender::TouchMove(gin::Arguments* args) {
SendCurrentTouchEvent(WebInputEvent::TouchMove,
- GetMovedBeyondSlopRegionArg(args));
+ GetMovedBeyondSlopRegionArg(args),
+ GetUniqueTouchEventId(args));
}
void EventSender::TouchCancel(gin::Arguments* args) {
SendCurrentTouchEvent(WebInputEvent::TouchCancel,
- GetMovedBeyondSlopRegionArg(args));
+ GetMovedBeyondSlopRegionArg(args),
+ GetUniqueTouchEventId(args));
}
void EventSender::TouchEnd(gin::Arguments* args) {
SendCurrentTouchEvent(WebInputEvent::TouchEnd,
- GetMovedBeyondSlopRegionArg(args));
+ GetMovedBeyondSlopRegionArg(args),
+ GetUniqueTouchEventId(args));
}
void EventSender::NotifyStartOfTouchScroll() {
@@ -2168,7 +2179,8 @@ void EventSender::DoLeapForward(int milliseconds) {
}
void EventSender::SendCurrentTouchEvent(WebInputEvent::Type type,
- bool movedBeyondSlopRegion) {
+ bool movedBeyondSlopRegion,
+ uint32_t uniqueTouchEventId) {
DCHECK_GT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap),
touch_points_.size());
if (force_layout_on_events_)
@@ -2182,6 +2194,7 @@ void EventSender::SendCurrentTouchEvent(WebInputEvent::Type type,
: WebInputEvent::EventNonBlocking;
touch_event.timeStampSeconds = GetCurrentEventTimeSec();
touch_event.movedBeyondSlopRegion = movedBeyondSlopRegion;
+ touch_event.uniqueTouchEventId = uniqueTouchEventId;
touch_event.touchesLength = touch_points_.size();
for (size_t i = 0; i < touch_points_.size(); ++i)
touch_event.touches[i] = touch_points_[i];
@@ -2379,25 +2392,6 @@ void EventSender::GestureEvent(WebInputEvent::Type type,
event.y = y;
break;
case WebInputEvent::GestureLongPress:
- event.x = x;
- event.y = y;
- if (!args->PeekNext().IsEmpty()) {
- float width;
- if (!args->GetNext(&width)) {
- args->ThrowError();
- return;
- }
- event.data.longPress.width = width;
- if (!args->PeekNext().IsEmpty()) {
- float height;
- if (!args->GetNext(&height)) {
- args->ThrowError();
- return;
- }
- event.data.longPress.height = height;
- }
- }
- break;
case WebInputEvent::GestureLongTap:
event.x = x;
event.y = y;
@@ -2442,6 +2436,15 @@ void EventSender::GestureEvent(WebInputEvent::Type type,
NOTREACHED();
}
+ if (!args->PeekNext().IsEmpty()) {
+ float unique_touch_event_id;
+ if (!args->GetNext(&unique_touch_event_id)) {
+ args->ThrowError();
+ return;
+ }
+ event.uniqueTouchEventId = unique_touch_event_id;
+ }
+
event.globalX = event.x;
event.globalY = event.y;
event.timeStampSeconds = GetCurrentEventTimeSec();

Powered by Google App Engine
This is Rietveld 408576698