Do not scroll invisible selection into view.

When we call focus() on an <input> element, we would scroll the element
into view, then the selected text in it into view. However, if the
<input> element has a selection that is not currently visible, it will
first scroll the <input> into view, then try to scroll an empty
LayoutRect(0, 0, 0x0) into view, which might cause the <input> out of
view at last.

In this patch, we would check whether the selection's visible rect is
empty before scrolling it into view.

Bug: 796880
Change-Id: Id5f7783a4efe137b180771280bd0c0c9dd1ab1ad
Reviewed-on: https://chromium-review.googlesource.com/854779
Commit-Queue: Sandra Sun <[email protected]>
Reviewed-by: David Bokan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#529638}
2 files changed