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

Side by Side Diff: content/shell/renderer/test_runner/event_sender.cc

Issue 729533003: Remove GestureScrollUpdateWithoutPropagation event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove hard count from the test Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/renderer/test_runner/event_sender.h" 5 #include "content/shell/renderer/test_runner/event_sender.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "content/public/common/page_zoom.h" 10 #include "content/public/common/page_zoom.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 void TouchCancel(); 379 void TouchCancel();
380 void TouchEnd(); 380 void TouchEnd();
381 void LeapForward(int milliseconds); 381 void LeapForward(int milliseconds);
382 void BeginDragWithFiles(const std::vector<std::string>& files); 382 void BeginDragWithFiles(const std::vector<std::string>& files);
383 void AddTouchPoint(gin::Arguments* args); 383 void AddTouchPoint(gin::Arguments* args);
384 void MouseDragBegin(); 384 void MouseDragBegin();
385 void MouseDragEnd(); 385 void MouseDragEnd();
386 void GestureScrollBegin(gin::Arguments* args); 386 void GestureScrollBegin(gin::Arguments* args);
387 void GestureScrollEnd(gin::Arguments* args); 387 void GestureScrollEnd(gin::Arguments* args);
388 void GestureScrollUpdate(gin::Arguments* args); 388 void GestureScrollUpdate(gin::Arguments* args);
389 //TODO: Remove GestureScrollUpdateWithoutPropagation once CL 732483003 has
390 // landed
389 void GestureScrollUpdateWithoutPropagation(gin::Arguments* args); 391 void GestureScrollUpdateWithoutPropagation(gin::Arguments* args);
390 void GestureTap(gin::Arguments* args); 392 void GestureTap(gin::Arguments* args);
391 void GestureTapDown(gin::Arguments* args); 393 void GestureTapDown(gin::Arguments* args);
392 void GestureShowPress(gin::Arguments* args); 394 void GestureShowPress(gin::Arguments* args);
393 void GestureTapCancel(gin::Arguments* args); 395 void GestureTapCancel(gin::Arguments* args);
394 void GestureLongPress(gin::Arguments* args); 396 void GestureLongPress(gin::Arguments* args);
395 void GestureLongTap(gin::Arguments* args); 397 void GestureLongTap(gin::Arguments* args);
396 void GestureTwoFingerTap(gin::Arguments* args); 398 void GestureTwoFingerTap(gin::Arguments* args);
397 void ContinuousMouseScrollBy(gin::Arguments* args); 399 void ContinuousMouseScrollBy(gin::Arguments* args);
398 void MouseMoveTo(gin::Arguments* args); 400 void MouseMoveTo(gin::Arguments* args);
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 1741
1740 void EventSender::GestureScrollEnd(gin::Arguments* args) { 1742 void EventSender::GestureScrollEnd(gin::Arguments* args) {
1741 GestureEvent(WebInputEvent::GestureScrollEnd, args); 1743 GestureEvent(WebInputEvent::GestureScrollEnd, args);
1742 } 1744 }
1743 1745
1744 void EventSender::GestureScrollUpdate(gin::Arguments* args) { 1746 void EventSender::GestureScrollUpdate(gin::Arguments* args) {
1745 GestureEvent(WebInputEvent::GestureScrollUpdate, args); 1747 GestureEvent(WebInputEvent::GestureScrollUpdate, args);
1746 } 1748 }
1747 1749
1748 void EventSender::GestureScrollUpdateWithoutPropagation(gin::Arguments* args) { 1750 void EventSender::GestureScrollUpdateWithoutPropagation(gin::Arguments* args) {
1749 GestureEvent(WebInputEvent::GestureScrollUpdateWithoutPropagation, args); 1751 GestureEvent(WebInputEvent::GestureScrollUpdate, args, true);
1750 } 1752 }
1751 1753
1752 void EventSender::GestureTap(gin::Arguments* args) { 1754 void EventSender::GestureTap(gin::Arguments* args) {
1753 GestureEvent(WebInputEvent::GestureTap, args); 1755 GestureEvent(WebInputEvent::GestureTap, args);
1754 } 1756 }
1755 1757
1756 void EventSender::GestureTapDown(gin::Arguments* args) { 1758 void EventSender::GestureTapDown(gin::Arguments* args) {
1757 GestureEvent(WebInputEvent::GestureTapDown, args); 1759 GestureEvent(WebInputEvent::GestureTapDown, args);
1758 } 1760 }
1759 1761
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 for (size_t i = 0; i < touch_points_.size(); ++i) { 1945 for (size_t i = 0; i < touch_points_.size(); ++i) {
1944 WebTouchPoint* touch_point = &touch_points_[i]; 1946 WebTouchPoint* touch_point = &touch_points_[i];
1945 if (touch_point->state == WebTouchPoint::StateReleased) { 1947 if (touch_point->state == WebTouchPoint::StateReleased) {
1946 touch_points_.erase(touch_points_.begin() + i); 1948 touch_points_.erase(touch_points_.begin() + i);
1947 --i; 1949 --i;
1948 } else 1950 } else
1949 touch_point->state = WebTouchPoint::StateStationary; 1951 touch_point->state = WebTouchPoint::StateStationary;
1950 } 1952 }
1951 } 1953 }
1952 1954
1955 //TODO Remove preventPropagation from arguments once CL 732483003 has landed
1953 void EventSender::GestureEvent(WebInputEvent::Type type, 1956 void EventSender::GestureEvent(WebInputEvent::Type type,
1954 gin::Arguments* args) { 1957 gin::Arguments* args,
1958 bool preventPropagation) {
1955 double x; 1959 double x;
1956 double y; 1960 double y;
1957 if (!args->GetNext(&x) || !args->GetNext(&y)) { 1961 if (!args->GetNext(&x) || !args->GetNext(&y)) {
1958 args->ThrowError(); 1962 args->ThrowError();
1959 return; 1963 return;
1960 } 1964 }
1961 1965
1962 WebGestureEvent event; 1966 WebGestureEvent event;
1963 event.type = type; 1967 event.type = type;
1964 1968
1965 switch (type) { 1969 switch (type) {
1966 case WebInputEvent::GestureScrollUpdate: 1970 case WebInputEvent::GestureScrollUpdate:
1967 case WebInputEvent::GestureScrollUpdateWithoutPropagation: 1971 {
1972 if (!preventPropagation && !args->PeekNext().IsEmpty()) {
1973 if (!args->GetNext(&preventPropagation)) {
1974 args->ThrowError();
1975 return;
1976 }
1977 }
1978
1968 event.data.scrollUpdate.deltaX = static_cast<float>(x); 1979 event.data.scrollUpdate.deltaX = static_cast<float>(x);
1969 event.data.scrollUpdate.deltaY = static_cast<float>(y); 1980 event.data.scrollUpdate.deltaY = static_cast<float>(y);
1981 event.data.scrollUpdate.preventPropagation = preventPropagation;
1970 event.x = current_gesture_location_.x; 1982 event.x = current_gesture_location_.x;
1971 event.y = current_gesture_location_.y; 1983 event.y = current_gesture_location_.y;
1972 current_gesture_location_.x = 1984 current_gesture_location_.x =
1973 current_gesture_location_.x + event.data.scrollUpdate.deltaX; 1985 current_gesture_location_.x + event.data.scrollUpdate.deltaX;
1974 current_gesture_location_.y = 1986 current_gesture_location_.y =
1975 current_gesture_location_.y + event.data.scrollUpdate.deltaY; 1987 current_gesture_location_.y + event.data.scrollUpdate.deltaY;
1976 break; 1988 break;
1989 }
1977 case WebInputEvent::GestureScrollBegin: 1990 case WebInputEvent::GestureScrollBegin:
1978 current_gesture_location_ = WebPoint(x, y); 1991 current_gesture_location_ = WebPoint(x, y);
1979 event.x = current_gesture_location_.x; 1992 event.x = current_gesture_location_.x;
1980 event.y = current_gesture_location_.y; 1993 event.y = current_gesture_location_.y;
1981 break; 1994 break;
1982 case WebInputEvent::GestureScrollEnd: 1995 case WebInputEvent::GestureScrollEnd:
1983 case WebInputEvent::GestureFlingStart: 1996 case WebInputEvent::GestureFlingStart:
1984 event.x = current_gesture_location_.x; 1997 event.x = current_gesture_location_.x;
1985 event.y = current_gesture_location_.y; 1998 event.y = current_gesture_location_.y;
1986 break; 1999 break;
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 } 2335 }
2323 default: 2336 default:
2324 NOTREACHED(); 2337 NOTREACHED();
2325 } 2338 }
2326 } 2339 }
2327 2340
2328 replaying_saved_events_ = false; 2341 replaying_saved_events_ = false;
2329 } 2342 }
2330 2343
2331 } // namespace content 2344 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/event_sender.h ('k') | content/shell/renderer/test_runner/test_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698