[LayoutNG] CachedOffsetForPosition and CachedPositionForOffset for RTL

This patch enables ComputePositionData() for RTL, and enables
using the data in CachedOffsetForPosition and
CachedPositionForOffset.

Because we use binary search, CharacterPositionData stores
ShapeResultCharacterData in the visual order, so that its
|x_position| is in ascending order.

This patch also adds DCHECKs to ensure Cached and non-Cached
versions return the same data. Cases they don't were
discovered, in LTR and RTL. DCHECKs are limited to when it
passes, and failing cases are to be investigated.

Bug: 636993
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Ifaf3f9f73c7b098e68932e8dc0181a79c1d7778d
Reviewed-on: https://chromium-review.googlesource.com/1148025
Reviewed-by: Emil A Eklund <eae@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577786}
2 files changed