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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 481683003: Support for Adaptive Handle Orientation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 2 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
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index f321f5594405c7e536d8f7f5988ac26b4304d745..c182e2982a386ead45fdc64039a74409dc498795 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -269,6 +269,9 @@ scoped_ptr<ui::TouchSelectionController> CreateSelectionController(
gfx::ViewConfiguration::GetLongPressTimeoutInMs());
config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInDips();
config.show_on_tap_for_empty_editable = false;
+ config.enable_adaptive_handle_orientation =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableAdaptiveSelectionHandleOrientation);
config.enable_longpress_drag_selection =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableLongpressDragSelection);
@@ -1318,6 +1321,15 @@ void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated(
selection_controller_->OnSelectionBoundsChanged(
ConvertSelectionBound(frame_metadata.selection.start),
ConvertSelectionBound(frame_metadata.selection.end));
+
+ // Set parameters for adaptive handle orientation.
+ gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size);
+ viewport_size.Scale(frame_metadata.page_scale_factor);
+ gfx::RectF viewport_rect(
+ frame_metadata.location_bar_content_translation.x(),
+ frame_metadata.location_bar_content_translation.y(),
+ viewport_size.width(), viewport_size.height());
+ selection_controller_->OnViewportChanged(viewport_rect);
}
UpdateBackgroundColor(frame_metadata.root_background_color);

Powered by Google App Engine
This is Rietveld 408576698