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

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

Issue 2838393002: Assert the location is correct when processing a tap request. (Closed)
Patch Set: Add layout test 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/synthetic-events/tap-on-scaled-screen.html » ('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 431636ebcbb69fec0688c43f60a0297a3d96cfa0..d5836a8179efe7a1e6b7ffd35b74f5d5ce454ad7 100644
--- a/content/renderer/gpu/gpu_benchmarking_extension.cc
+++ b/content/renderer/gpu/gpu_benchmarking_extension.cc
@@ -974,11 +974,18 @@ bool GpuBenchmarking::Tap(gin::Arguments* args) {
return false;
}
- std::unique_ptr<SyntheticTapGestureParams> gesture_params(
- new SyntheticTapGestureParams);
-
// Convert coordinates from CSS pixels to density independent pixels (DIPs).
float page_scale_factor = context.web_view()->PageScaleFactor();
+ gfx::Rect rect = context.render_view_impl()->GetWidget()->ViewRect();
+ rect -= rect.OffsetFromOrigin();
+ if (!rect.Contains(position_x * page_scale_factor,
+ position_y * page_scale_factor)) {
+ args->ThrowError();
+ return false;
+ }
+
+ std::unique_ptr<SyntheticTapGestureParams> gesture_params(
+ new SyntheticTapGestureParams);
gesture_params->position.SetPoint(position_x * page_scale_factor,
position_y * page_scale_factor);
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/synthetic-events/tap-on-scaled-screen.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698