Fix focus to scroll input into view consistently

Focus gain causes virtual keyboard to show. Then virtual keyboard takes
the bottom inset and causes the window and view size to shrink, on
chrome and sometimes on webview.
At this point, the bottom inset may occlude the input form,
i.e. the input form is behind the keyboard and is not visible.

We have the following auto-scrolling logic to mitigate the inconvenience
1) Check the size of visible display size after showing keyboard.
2) Wait for the view height change after showing keyboard.
3) Change the viewport size
4) Scroll focused editable node into view.

In the browser, this is in order. However, in the renderer, the order
of 3) and 4) sometimes gets reversed.
I suspect that this happens because the two messages are going through
different IPC channels.

The fix is as follows:
- Do not send scroll as a separate message, but send it as a parameter
  in SynchronizeVisualProperties. Luckily, we already have it.
- Change ImeAdapterImpl::UpdateAfterSizeChange() to
  UpdateSizeChangeForScroll() which returns a boolean.
- Move SynchronizeVisualProperties() call from WCVA into RWHVA such that
  we can pass shouldScrollIntoView as a parameter.
  (Both OnSizeChanged() calls in WCVA and RWHVA come from ViewAndroid.)
- Minor plumbing to add a new parameter to the function.

Bug: 920061
Change-Id: Ibe4bc70b5f5710cc8622b3f24d0f71c4c29989c9
Reviewed-by: Bo <>
Reviewed-by: Ted Choc <>
Commit-Queue: Changwan Ryu <>
Cr-Commit-Position: refs/heads/master@{#623773}
9 files changed