summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authordominikg@chromium.org <dominikg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-07 20:34:20 +0000
committerdominikg@chromium.org <dominikg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-07 20:34:20 +0000
commit7f38fdafdc6d48e97c5bd81b65671af7b4f2fe0b (patch)
tree95f41c8626d8691857a8860c66896a19f32663be /content
parent77be6ddb578c4641eb8a972f101d237a319eaa16 (diff)
downloadchromium_src-7f38fdafdc6d48e97c5bd81b65671af7b4f2fe0b.zip
chromium_src-7f38fdafdc6d48e97c5bd81b65671af7b4f2fe0b.tar.gz
chromium_src-7f38fdafdc6d48e97c5bd81b65671af7b4f2fe0b.tar.bz2
Convert all synthetic gesture coordinates from CSS pixels to DIPs.
There is currently some inconsistency about the units of pixels being passed to synthetic gestures, some are CSS pixels and some are density independent pixels (DIPs). The internal classes expect DIPs but the scroll distance is being passed in CSS pixels, causing us to scroll too far on pages with page scale factors > 1. This patch clarifies the interface between the JS functions for gestures and the internal classes. The JS functions expect coordinates to be in CSS pixels which are then converted to DIPs before being passed to the gesture objects. BUG=313669 Review URL: https://codereview.chromium.org/56093002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/renderer/gpu/gpu_benchmarking_extension.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/content/renderer/gpu/gpu_benchmarking_extension.cc b/content/renderer/gpu/gpu_benchmarking_extension.cc
index 7acb6c6..f8365dc 100644
--- a/content/renderer/gpu/gpu_benchmarking_extension.cc
+++ b/content/renderer/gpu/gpu_benchmarking_extension.cc
@@ -482,7 +482,10 @@ class GpuBenchmarkingWrapper : public v8::Extension {
callback_local,
context.web_frame()->mainWorldScriptContext());
- int pixels_to_scroll = args[2]->IntegerValue();
+ // Convert coordinates from CSS pixels to density independent pixels (DIPs).
+ float page_scale_factor = context.web_view()->pageScaleFactor();
+
+ int pixels_to_scroll = args[2]->IntegerValue() * page_scale_factor;
int mouse_event_x = 0;
int mouse_event_y = 0;
@@ -499,10 +502,8 @@ class GpuBenchmarkingWrapper : public v8::Extension {
return;
}
- mouse_event_x = args[3]->IntegerValue() *
- context.web_view()->pageScaleFactor();
- mouse_event_y = args[4]->IntegerValue() *
- context.web_view()->pageScaleFactor();
+ mouse_event_x = args[3]->IntegerValue() * page_scale_factor;
+ mouse_event_y = args[4]->IntegerValue() * page_scale_factor;
}
// TODO(nduca): If the render_view_impl is destroyed while the gesture is in
@@ -536,10 +537,13 @@ class GpuBenchmarkingWrapper : public v8::Extension {
return;
}
+ // Convert coordinates from CSS pixels to density independent pixels (DIPs).
+ float page_scale_factor = context.web_view()->pageScaleFactor();
+
bool zoom_in = args[0]->BooleanValue();
- int pixels_to_move = args[1]->IntegerValue();
- int anchor_x = args[2]->IntegerValue();
- int anchor_y = args[3]->IntegerValue();
+ int pixels_to_move = args[1]->IntegerValue() * page_scale_factor;
+ int anchor_x = args[2]->IntegerValue() * page_scale_factor;
+ int anchor_y = args[3]->IntegerValue() * page_scale_factor;
v8::Local<v8::Function> callback_local =
v8::Local<v8::Function>::Cast(args[4]);