[LayoutNG] Stop getClientRects/getBoundingClientRects from adding unnecessary collapsed rects

Currently the two functions adds rects from all text fragments intersecting
the input range, even if they only touch at boundaries. For example:

Text fragments:  ABC  DEF  GHI
Text offsets:    012  345  678
Input range: start = 3, end = 6

The current implementation returns three rects, one from each fragment,
even though the rects from "ABC" and "GHI" are collapsed.

This patch stops the inclusion of such collapsed rects; they are included
only when we can't find non-collapsed rects.

Bug: 755750
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I1ca65d1aee02e1eb33b8c72605daca4d6dbd119b
Reviewed-on: https://chromium-review.googlesource.com/1142685
Reviewed-by: Koji Ishii <kojii@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576935}
2 files changed