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

Unified Diff: components/test_runner/event_sender.cc

Issue 1557993002: Add scroll units in GestureEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix layout test on Mac Created 4 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/touch/gesture/gesture-scroll-by-page.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/event_sender.cc
diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc
index a5fcc7bfb56d49e10f2b016055f8f898fb6bf77a..fdcc7f3519944c66340a034dede057f41822d5af 100644
--- a/components/test_runner/event_sender.cc
+++ b/components/test_runner/event_sender.cc
@@ -408,6 +408,30 @@ bool IsSystemKeyEvent(const WebKeyboardEvent& event) {
#endif
}
+bool GetScrollUnits(gin::Arguments* args, WebGestureEvent::ScrollUnits* units) {
+ std::string units_string;
+ if (!args->PeekNext().IsEmpty()) {
+ if (args->PeekNext()->IsString())
+ args->GetNext(&units_string);
+ if (units_string == "Page") {
+ *units = WebGestureEvent::Page;
+ return true;
+ } else if (units_string == "Pixels") {
+ *units = WebGestureEvent::Pixels;
+ return true;
+ } else if (units_string == "PrecisePixels") {
+ *units = WebGestureEvent::PrecisePixels;
+ return true;
+ } else {
+ args->ThrowError();
+ return false;
+ }
+ } else {
+ *units = WebGestureEvent::PrecisePixels;
+ return true;
+ }
+}
+
const char* kSourceDeviceStringTouchpad = "touchpad";
const char* kSourceDeviceStringTouchscreen = "touchscreen";
@@ -2142,6 +2166,8 @@ void EventSender::GestureEvent(WebInputEvent::Type type,
return;
}
}
+ if (!GetScrollUnits(args, &event.data.scrollUpdate.deltaUnits))
+ return;
event.data.scrollUpdate.deltaX = static_cast<float>(x);
event.data.scrollUpdate.deltaY = static_cast<float>(y);
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/touch/gesture/gesture-scroll-by-page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698