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

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

Issue 1066053002: [Android] Allow custom ActionMode creation via ContentViewClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix null check Created 5 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
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 159b69fa4fe935bf3fa8212ffd3c3be1c971ed2e..7815e8b31f924c991502740d2526747b48253e23 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -340,6 +340,16 @@ ui::SelectionBound ConvertSelectionBound(
return ui_bound;
}
+gfx::RectF GetSelectionRect(const ui::TouchSelectionController& controller) {
+ gfx::RectF rect = controller.GetRectBetweenBounds();
+ if (rect.IsEmpty())
+ return rect;
+
+ rect.Union(controller.GetStartHandleRect());
+ rect.Union(controller.GetEndHandleRect());
+ return rect;
+}
+
} // anonymous namespace
ReadbackRequest::ReadbackRequest(float scale,
@@ -1342,16 +1352,18 @@ void RenderWidgetHostViewAndroid::SelectBetweenCoordinates(
}
void RenderWidgetHostViewAndroid::OnSelectionEvent(
- ui::SelectionEventType event,
- const gfx::PointF& position) {
+ ui::SelectionEventType event) {
DCHECK(content_view_core_);
+ DCHECK(selection_controller_);
// Showing the selection action bar can alter the current View coordinates in
// such a way that the current MotionEvent stream is suddenly shifted in
// space. Avoid the associated scroll jump by pre-emptively cancelling gesture
// detection; scrolling after the selection is activated is unnecessary.
if (event == ui::SelectionEventType::SELECTION_SHOWN)
ResetGestureDetection();
- content_view_core_->OnSelectionEvent(event, position);
+ content_view_core_->OnSelectionEvent(
+ event, selection_controller_->GetStartPosition(),
+ GetSelectionRect(*selection_controller_));
}
scoped_ptr<ui::TouchHandleDrawable>

Powered by Google App Engine
This is Rietveld 408576698