[Mac] Validate the selection range before using it for text suggestions.

It looks like Blink can report an invalid selection range back to the
browser. This change treats invalid ranges like the empty string for the
purpose of generating suggestions, and adds a DCHECK for this condition.

Bug: 893038
Change-Id: I2afa5065d7eeebb6cc61030277f86b488a69388b
Reviewed-on: https://chromium-review.googlesource.com/c/1351530
Commit-Queue: Sidney San Martín <sdy@chromium.org>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612882}
2 files changed