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

Unified Diff: content/renderer/render_view_impl.cc

Issue 595693002: Use the pinch viewport offset for tap disambiguation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index eba0382f3453be34ace76c5ecbc5423274f14451..bb7a36fb281247847e99353125e1283ddfeb1625 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -4049,7 +4049,8 @@ void RenderViewImpl::OnEnableViewSourceMode() {
#if defined(OS_ANDROID)
bool RenderViewImpl::didTapMultipleTargets(
- const blink::WebGestureEvent& event,
+ const WebSize& inner_viewport_offset,
+ const WebRect& touch_rect,
const WebVector<WebRect>& target_rects) {
// Never show a disambiguation popup when accessibility is enabled,
// as this interferes with "touch exploration".
@@ -4061,13 +4062,12 @@ bool RenderViewImpl::didTapMultipleTargets(
if (matches_accessibility_mode_complete)
return false;
- gfx::Rect finger_rect(
- event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2,
- event.data.tap.width, event.data.tap.height);
+ // The touch_rect, target_rects and zoom_rect are in the outer viewport
+ // reference frame.
gfx::Rect zoom_rect;
float new_total_scale =
DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor(
- finger_rect, target_rects, GetSize(),
+ touch_rect, target_rects, GetSize(),
gfx::Rect(webview()->mainFrame()->visibleContentRect()).size(),
device_scale_factor_ * webview()->pageScaleFactor(), &zoom_rect);
if (!new_total_scale)
@@ -4107,8 +4107,13 @@ bool RenderViewImpl::didTapMultipleTargets(
webwidget_->paintCompositedDeprecated(&canvas, zoom_rect);
}
+ gfx::Rect zoom_rect_in_screen =
+ zoom_rect - gfx::Vector2d(inner_viewport_offset.width,
+ inner_viewport_offset.height);
+
gfx::Rect physical_window_zoom_rect = gfx::ToEnclosingRect(
- ClientRectToPhysicalWindowRect(gfx::RectF(zoom_rect)));
+ ClientRectToPhysicalWindowRect(gfx::RectF(zoom_rect_in_screen)));
+
Send(new ViewHostMsg_ShowDisambiguationPopup(routing_id_,
physical_window_zoom_rect,
canvas_size,
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698