Make ScrollFocusedEditableNodeIntoRect work with OOPIFs

This CL introduces a temporary fix for ScrollFocusedEditableNodeIntoRect. This
command which is issued by the browser for various input and IME related tasks
(on touch platforms only) is expected to scale and scroll the current editable
element into view. The legacy implementation lives in RenderViewImpl and
WebViewImpl. This, however, is no longer relevant.

The change involves two major parts:
  1) Bookkeeping of whether scrolling for a focused node was complete (OOPIFs).
  2) Actually scrolling the focused editable node into view.

The first part was potentially broken for OOPIFs because
RenderViewImpl::ScrollFocusedEditableNodeIntoRect would not complete all its
tasks if WebView::ScrollFocusedEditableNodeIntoRect would return false; and it
would return false for OOPIFs due to MainFrameImpl() == nullptr.

The second part of the change is the major problem here since editable elements
inside OOPIFs were not actually being scrolled at all. The core cause is that
this API require finding a proper zoom and scroll point for each element and
then set the scroll top accordingly. This is not directly applicable to OOPIFs
(at least not trivially) given that OOPIFs do not know their root-layer
coordinates in the renderer and furthermore, they cannot directly scroll
themselves in the parent process.

To temporarily resolve the second problem, this CL uses the best approximation
at hand for the desired behavior, that is, scrolling the focused editable node
into view through recursive scrolling of a rectangle to visible. The behavior,
at least when PageScaleFactor() == 1, is reasonably close to that of in-process
frames.

The CL also adds a browser test to make sure the implemented feature works as
expected.

Bug: 676037, 784982
Change-Id: Id27db87237c52084d19c69010caba03183e37d5f
Reviewed-on: https://chromium-review.googlesource.com/772430
Reviewed-by: Rick Byers <[email protected]>
Reviewed-by: David Bokan <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Commit-Queue: Ehsan Karamad <[email protected]>
Cr-Commit-Position: refs/heads/master@{#518995}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index d8bb604..fd4ac59 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -782,6 +782,8 @@
 }
 
 void RenderWidget::OnResize(const ResizeParams& params) {
+  gfx::Size old_visible_viewport_size = visible_viewport_size_;
+
   if (resizing_mode_selector_->ShouldAbortOnResize(this, params))
     return;
 
@@ -791,6 +793,11 @@
   }
 
   Resize(params);
+
+  if (old_visible_viewport_size != visible_viewport_size_) {
+    for (auto& render_frame : render_frames_)
+      render_frame.DidChangeVisibleViewport();
+  }
 }
 
 void RenderWidget::OnSetLocalSurfaceIdForAutoResize(