Check the validity of selection range for SmartText selection

It is possible that by the time the surrounding text request reaches
the Renderer the selection range becomes empty (e.g. we have an input
caret). The empty selection range is a valid situation for surrounding
text algorithm which returns a text around the input caret, but
invalid for Android TextClassifier.

This CL checks the indices of the selection in the surrounding
text responce from Blink and treats an empty or invalid range
the same way as an empty text, i.e. bypasses classification.

BUG=751397

Change-Id: I3646a16d701e04627e4729f5226850d2b83993b5
Reviewed-on: https://chromium-review.googlesource.com/601256
Commit-Queue: Tima Vaisburd <[email protected]>
Reviewed-by: Bo <[email protected]>
Reviewed-by: Pedro Amaral <[email protected]>
Cr-Commit-Position: refs/heads/master@{#493201}
1 file changed