Add DidStopFlinging support for TouchSelection Editing in OOPIFs.
This CL adds handlers to notify RenderWidgetHostViewChildFrame and its
TouchSelectionControllerClientChildFrame when main-thread flings complete
in an oopif renderer.
This is necessary for correct operation of the touch selection editing
handles during touch scroll.
Bug: 756184
Change-Id: Ibb4cff0e09119c5c95cd36d6f3ab6737a59be7b3
Reviewed-on: https://chromium-review.googlesource.com/647827
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: James MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#499294}
diff --git a/content/browser/renderer_host/input/touch_selection_controller_client_aura.cc b/content/browser/renderer_host/input/touch_selection_controller_client_aura.cc
index 8d1cd81..1a213a8 100644
--- a/content/browser/renderer_host/input/touch_selection_controller_client_aura.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller_client_aura.cc
@@ -191,6 +191,10 @@
return false;
}
+void TouchSelectionControllerClientAura::DidStopFlinging() {
+ OnScrollCompleted();
+}
+
void TouchSelectionControllerClientAura::UpdateClientSelectionBounds(
const gfx::SelectionBound& start,
const gfx::SelectionBound& end) {
diff --git a/content/browser/renderer_host/input/touch_selection_controller_client_aura.h b/content/browser/renderer_host/input/touch_selection_controller_client_aura.h
index 69b1111..700ed1c1 100644
--- a/content/browser/renderer_host/input/touch_selection_controller_client_aura.h
+++ b/content/browser/renderer_host/input/touch_selection_controller_client_aura.h
@@ -55,6 +55,7 @@
const gfx::SelectionBound& end);
// TouchSelectionControllerClientManager.
+ void DidStopFlinging() override;
void UpdateClientSelectionBounds(
const gfx::SelectionBound& start,
const gfx::SelectionBound& end,
diff --git a/content/browser/renderer_host/input/touch_selection_controller_client_child_frame.cc b/content/browser/renderer_host/input/touch_selection_controller_client_child_frame.cc
index af448629..884a3c0 100644
--- a/content/browser/renderer_host/input/touch_selection_controller_client_child_frame.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller_client_child_frame.cc
@@ -31,6 +31,10 @@
manager_->InvalidateClient(this);
}
+void TouchSelectionControllerClientChildFrame::DidStopFlinging() {
+ manager_->DidStopFlinging();
+}
+
void TouchSelectionControllerClientChildFrame::UpdateSelectionBoundsIfNeeded(
const cc::Selection<gfx::SelectionBound>& selection,
float device_scale_factor) {
diff --git a/content/browser/renderer_host/input/touch_selection_controller_client_child_frame.h b/content/browser/renderer_host/input/touch_selection_controller_client_child_frame.h
index 4f8137e..9a9af966 100644
--- a/content/browser/renderer_host/input/touch_selection_controller_client_child_frame.h
+++ b/content/browser/renderer_host/input/touch_selection_controller_client_child_frame.h
@@ -31,6 +31,7 @@
TouchSelectionControllerClientManager* manager);
~TouchSelectionControllerClientChildFrame() override;
+ void DidStopFlinging();
void UpdateSelectionBoundsIfNeeded(
const cc::Selection<gfx::SelectionBound>& selection,
float device_scale_factor);
diff --git a/content/browser/renderer_host/input/touch_selection_controller_client_manager_android.cc b/content/browser/renderer_host/input/touch_selection_controller_client_manager_android.cc
index c2b3251..de89ada 100644
--- a/content/browser/renderer_host/input/touch_selection_controller_client_manager_android.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller_client_manager_android.cc
@@ -43,6 +43,10 @@
} // namespace
// TouchSelectionControllerClientManager implementation.
+void TouchSelectionControllerClientManagerAndroid::DidStopFlinging() {
+ // TODO(wjmaclean): determine what, if anything, needs to happen here.
+}
+
void TouchSelectionControllerClientManagerAndroid::UpdateClientSelectionBounds(
const gfx::SelectionBound& start,
const gfx::SelectionBound& end,
diff --git a/content/browser/renderer_host/input/touch_selection_controller_client_manager_android.h b/content/browser/renderer_host/input/touch_selection_controller_client_manager_android.h
index ff406582..27349a8 100644
--- a/content/browser/renderer_host/input/touch_selection_controller_client_manager_android.h
+++ b/content/browser/renderer_host/input/touch_selection_controller_client_manager_android.h
@@ -25,6 +25,7 @@
float page_scale_factor() { return page_scale_factor_; }
// TouchSelectionControllerClientManager implementation.
+ void DidStopFlinging() override;
void UpdateClientSelectionBounds(
const gfx::SelectionBound& start,
const gfx::SelectionBound& end,
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.cc b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
index ab01b8c..fc5197ab 100644
--- a/content/browser/renderer_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
@@ -590,6 +590,11 @@
frame_connector_->ForwardProcessAckedTouchEvent(touch, ack_result);
}
+void RenderWidgetHostViewChildFrame::DidStopFlinging() {
+ if (selection_controller_client_)
+ selection_controller_client_->DidStopFlinging();
+}
+
bool RenderWidgetHostViewChildFrame::LockMouse() {
if (frame_connector_)
return frame_connector_->LockMouse();
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.h b/content/browser/renderer_host/render_widget_host_view_child_frame.h
index 7a6cb8fb..e994ab27f 100644
--- a/content/browser/renderer_host/render_widget_host_view_child_frame.h
+++ b/content/browser/renderer_host/render_widget_host_view_child_frame.h
@@ -127,6 +127,7 @@
gfx::Rect GetBoundsInRootWindow() override;
void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch,
InputEventAckState ack_result) override;
+ void DidStopFlinging() override;
bool LockMouse() override;
void UnlockMouse() override;
viz::FrameSinkId GetFrameSinkId() override;
diff --git a/content/public/browser/touch_selection_controller_client_manager.h b/content/public/browser/touch_selection_controller_client_manager.h
index 7b62d91..01460afe 100644
--- a/content/public/browser/touch_selection_controller_client_manager.h
+++ b/content/public/browser/touch_selection_controller_client_manager.h
@@ -26,6 +26,8 @@
public:
virtual ~TouchSelectionControllerClientManager() {}
+ virtual void DidStopFlinging() = 0;
+
// The manager uses this class' methods to notify observers about important
// events.
class CONTENT_EXPORT Observer {