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

Unified Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 1157093002: Add smoothness test for hover during trackpad scrolling [perf implications] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pay attention to page_scale_factor. Created 5 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
« no previous file with comments | « no previous file | tools/perf/page_sets/key_desktop_move_cases.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/gpu_benchmarking_extension.cc
diff --git a/content/renderer/gpu/gpu_benchmarking_extension.cc b/content/renderer/gpu/gpu_benchmarking_extension.cc
index 366d0a8b68aa219db1eab3446ce393848b4eefc8..27038d732042457f92bb8ef9693ad3bfb8a3848b 100644
--- a/content/renderer/gpu/gpu_benchmarking_extension.cc
+++ b/content/renderer/gpu/gpu_benchmarking_extension.cc
@@ -289,6 +289,22 @@ bool BeginSmoothScroll(v8::Isolate* isolate,
if (!context.Init(false))
return false;
+ // Convert coordinates from CSS pixels to density independent pixels (DIPs).
+ float page_scale_factor = context.web_view()->pageScaleFactor();
+
+ if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) {
+ // Ensure the mouse is centered and visible, in case it will
+ // trigger any hover or mousemove effects.
+ blink::WebRect contentRect =
+ context.web_view()->mainFrame()->visibleContentRect();
+ blink::WebMouseEvent mouseMove;
+ mouseMove.type = blink::WebInputEvent::MouseMove;
+ mouseMove.x = (contentRect.x + contentRect.width / 2) * page_scale_factor;
+ mouseMove.y = (contentRect.y + contentRect.height / 2) * page_scale_factor;
+ context.web_view()->handleInputEvent(mouseMove);
+ context.web_view()->setCursorVisibilityState(true);
+ }
+
scoped_refptr<CallbackAndContext> callback_and_context =
new CallbackAndContext(
isolate, callback, context.web_frame()->mainWorldScriptContext());
@@ -296,9 +312,6 @@ bool BeginSmoothScroll(v8::Isolate* isolate,
scoped_ptr<SyntheticSmoothScrollGestureParams> gesture_params(
new SyntheticSmoothScrollGestureParams);
- // Convert coordinates from CSS pixels to density independent pixels (DIPs).
- float page_scale_factor = context.web_view()->pageScaleFactor();
-
if (gesture_source_type < 0 ||
gesture_source_type > SyntheticGestureParams::GESTURE_SOURCE_TYPE_MAX) {
return false;
« no previous file with comments | « no previous file | tools/perf/page_sets/key_desktop_move_cases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698