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

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

Issue 2742473002: gpu benchmarking swipe for touchpad
Patch Set: Update direction in tests that use swipeElement/Page to maintain the same behavior. Created 3 years, 8 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: content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
index 95382879e80814d9abf298874db380485e8eb9b0..ec9c0f1ffa09d08bfefe28dc27a1b29c63582083 100644
--- a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
+++ b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
@@ -20,6 +20,7 @@
using blink::WebTouchEvent;
using blink::WebMouseWheelEvent;
+using blink::WebGestureEvent;
namespace content {
@@ -67,9 +68,11 @@ void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform(
void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform(
const blink::WebMouseWheelEvent& web_wheel,
const ui::LatencyInfo&) {
+ base::TimeTicks timestamp =
+ ui::EventTimeStampFromSeconds(web_wheel.TimeStampSeconds());
ui::MouseWheelEvent wheel_event(
gfx::Vector2d(web_wheel.delta_x, web_wheel.delta_y), gfx::Point(),
- gfx::Point(), ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
+ gfx::Point(), timestamp, ui::EF_NONE, ui::EF_NONE);
gfx::PointF location(web_wheel.PositionInWidget().x * device_scale_factor_,
web_wheel.PositionInWidget().y * device_scale_factor_);
wheel_event.set_location_f(location);
@@ -168,6 +171,36 @@ void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
return;
}
+// This function generates a synthetic ui event which aligns with ChromeOS
+// event stream for handling touchpad fling.
+void SyntheticGestureTargetAura::DispatchTouchpadGestureFlingStartToPlatform(
+ const blink::WebGestureEvent& web_gesture,
+ const ui::LatencyInfo& latency_info) {
+ DCHECK_EQ(web_gesture.GetType(), blink::WebInputEvent::kGestureFlingStart);
+
+ float velocity_x = web_gesture.data.fling_start.velocity_x;
+ float velocity_y = web_gesture.data.fling_start.velocity_y;
+ DCHECK(velocity_x || velocity_y);
+
+ base::TimeTicks timestamp =
+ ui::EventTimeStampFromSeconds(web_gesture.TimeStampSeconds());
+ ui::ScrollEvent fling_event(ui::ET_SCROLL_FLING_START, gfx::Point(),
+ timestamp, ui::EF_NONE, velocity_x, velocity_y,
+ velocity_x, velocity_y,
+ 2); // finger_count
+ gfx::PointF location(web_gesture.x * device_scale_factor_,
+ web_gesture.y * device_scale_factor_);
+ fling_event.set_location_f(location);
+ fling_event.set_root_location_f(location);
+
+ aura::Window* window = GetWindow();
+ fling_event.ConvertLocationToTarget(window, window->GetRootWindow());
+ ui::EventDispatchDetails details =
+ window->GetHost()->event_sink()->OnEventFromSource(&fling_event);
+ if (details.dispatcher_destroyed)
+ return;
+}
+
SyntheticGestureParams::GestureSourceType
SyntheticGestureTargetAura::GetDefaultSyntheticGestureSourceType() const {
return SyntheticGestureParams::TOUCH_INPUT;

Powered by Google App Engine
This is Rietveld 408576698