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

Unified Diff: content/renderer/render_view_impl.cc

Issue 19256012: Allow zoom-in as alternative to popup when tapping multiple targets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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/public/common/renderer_preferences.cc ('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 7f2efd89b77b28957981ce8b302dd153136f6b1f..b332b7fdfe209193153a47c5860e3a6078bfeb50 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -6220,37 +6220,45 @@ bool RenderViewImpl::didTapMultipleTargets(
if (!new_total_scale)
return false;
- gfx::Size canvas_size = gfx::ToCeiledSize(gfx::ScaleSize(zoom_rect.size(),
- new_total_scale));
- TransportDIB* transport_dib = NULL;
- {
- scoped_ptr<skia::PlatformCanvas> canvas(
- RenderProcess::current()->GetDrawingCanvas(&transport_dib,
- gfx::Rect(canvas_size)));
- if (!canvas)
- return false;
-
- // TODO(trchen): Cleanup the device scale factor mess.
- // device scale will be applied in WebKit
- // --> zoom_rect doesn't include device scale,
- // but WebKit will still draw on zoom_rect * device_scale_factor_
- canvas->scale(new_total_scale / device_scale_factor_,
- new_total_scale / device_scale_factor_);
- canvas->translate(-zoom_rect.x() * device_scale_factor_,
- -zoom_rect.y() * device_scale_factor_);
-
- webwidget_->paint(
- canvas.get(),
- zoom_rect,
- WebWidget::ForceSoftwareRenderingAndIgnoreGPUResidentContent);
- }
-
- gfx::Rect physical_window_zoom_rect = gfx::ToEnclosingRect(
- ClientRectToPhysicalWindowRect(gfx::RectF(zoom_rect)));
- Send(new ViewHostMsg_ShowDisambiguationPopup(routing_id_,
- physical_window_zoom_rect,
- canvas_size,
- transport_dib->id()));
+ TapMultipleTargetsStrategy multitarget_strategy =
+ renderer_preferences_.tap_multiple_targets_strategy;
+ if (multitarget_strategy == TAP_MULTIPLE_TARGETS_STRATEGY_ZOOM) {
+ return webview()->zoomToMultipleTargetsRect(zoom_rect);
+ } else if (multitarget_strategy == TAP_MULTIPLE_TARGETS_STRATEGY_POPUP) {
+ gfx::Size canvas_size =
+ gfx::ToCeiledSize(gfx::ScaleSize(zoom_rect.size(), new_total_scale));
+ TransportDIB* transport_dib = NULL;
+ {
+ scoped_ptr<skia::PlatformCanvas> canvas(
+ RenderProcess::current()->GetDrawingCanvas(&transport_dib,
+ gfx::Rect(canvas_size)));
+ if (!canvas)
+ return false;
+
+ // TODO(trchen): Cleanup the device scale factor mess.
+ // device scale will be applied in WebKit
+ // --> zoom_rect doesn't include device scale,
+ // but WebKit will still draw on zoom_rect * device_scale_factor_
+ canvas->scale(new_total_scale / device_scale_factor_,
+ new_total_scale / device_scale_factor_);
+ canvas->translate(-zoom_rect.x() * device_scale_factor_,
+ -zoom_rect.y() * device_scale_factor_);
+
+ webwidget_->paint(
+ canvas.get(),
+ zoom_rect,
+ WebWidget::ForceSoftwareRenderingAndIgnoreGPUResidentContent);
+ }
+
+ gfx::Rect physical_window_zoom_rect = gfx::ToEnclosingRect(
+ ClientRectToPhysicalWindowRect(gfx::RectF(zoom_rect)));
+ Send(new ViewHostMsg_ShowDisambiguationPopup(routing_id_,
+ physical_window_zoom_rect,
+ canvas_size,
+ transport_dib->id()));
+ } else {
+ return false;
+ }
return true;
}
« no previous file with comments | « content/public/common/renderer_preferences.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698