[ExtendedTextMetrics] Fix mixed bidi caretPositionFromPoint
Mixed bidi text runs are always challenging when it comes to
PositionFromOffset and related methods, because a particular
location where the direction changes is the start of two runs
or the end of two runs. The choice of which index to return
depends on what the offset is going to be used for.
This CL changes caretPositionFromPoint to adjust the position
returned when at the end of a text run that does not match the
overall text direction. The position is moved to a neighboring
run to match the behavior of the DOM method, which in this case
is also probably better for building selection and insert behavior.
Fixed: 364332944
Change-Id: I742f567cdf0e9a116d5d430d47d952a0f7c04301
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5889819
Reviewed-by: Andres Ricardo Perez andresrperez@chromium.org
Commit-Queue: Stephen Chenney schenney@chromium.org
Cr-Commit-Position: refs/heads/main@{#1363262}