• Changwan Ryu's avatar
    Fix focus to scroll input into view consistently · 001d21a7
    Changwan Ryu authored
    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
    here:
    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.
    
    Now we do the following:
    1) Wait until SynchronizeVisualProperties() changes visual viewport.
    2) Detect that blink's scrollable viewport size has changed
    3) Comfirm this signal against the visible display size
    4) Scroll focused editable node into view
    
    This also adds some test and refactors ImeAdapterImpl.
    
    Bug: 920061
    
    Change-Id: Id237fa76c304c92b5459bda4fe6591c96cb804d1
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1562585Reviewed-by: default avatarBo <boliu@chromium.org>
    Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
    Commit-Queue: Changwan Ryu <changwan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#682991}
    001d21a7
ime_adapter_android.cc 18.8 KB