New issue
Advanced search Search tips

Issue 923087 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Task

Blocking:
issue 894651



Sign in to add a comment

[BidiCaretAffinity] Caret display and hit test location mismatch issues

Project Member Reported by xiaoche...@chromium.org, Jan 17 (5 days ago)

Issue description

This is the umbrella bug for all issues that hit test location and caret display location mismatch when bidi caret affinity is enabled.
 

Comment 1 by xiaoche...@chromium.org, Jan 17 (5 days ago)

Two bugs found on ToT r623074. Both require BidiCaretAffinity enabled and EditingNG disabled.

Bug 1:

HTML: <div contenteditable>foo     ABC</div>
Rendered as: "foo CBA"

When clicking the right edge of "A", caret is displayed at "foo |CBA" instead

 Bug 2 :

HTML: <div contenteditable>foo ABC DEFGHIJKLMN</div>
Rendered as two lines:
"foo CBA"
"NMLKJIHGFED"

When clicking the left edge of "C", caret is shown at "foo CBA|" instead.
Project Member

Comment 2 by bugdroid1@chromium.org, Yesterday (25 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/426bd2af7f4e16ff1fe20573e3382d355a27192c

commit 426bd2af7f4e16ff1fe20573e3382d355a27192c
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Tue Jan 22 05:20:02 2019

[BidiCaretAffinity] Fix caret rect calculation in legacy layout when after collapsed space

When caret is after collapsed spaces, e.g., "foo  |ABC", VisiblePosition
canonicalizes to "foo | ABC" instead. However, the downstream caret
should be displayed at "foo CBA|" instead of "foo |CBA".

Current implementation fails to do so because it fails to find the
correct InlineTextBox whose offset range contains the canonicalized
offset. This patch fixes that by also checking the nearest text boxes
that are out of range.

The newly added layout test currently doesn't pass with bidi caret
affinity, as it requires NGCaretNavigator to handle line wrap info.
It will be fixed in a follow up patch.

Note: the root cause seems to be in VisiblePosition canonicalization,
which however might be too complex or risky to fix. This patch works
around it instead.

Bug: 923087
Change-Id: I0a1ab862a9f0ffc72a6fd6503ab48fe88190e3cf
Reviewed-on: https://chromium-review.googlesource.com/c/1419265
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#624730}
[modify] https://crrev.com/426bd2af7f4e16ff1fe20573e3382d355a27192c/third_party/blink/renderer/core/editing/inline_box_position.cc
[modify] https://crrev.com/426bd2af7f4e16ff1fe20573e3382d355a27192c/third_party/blink/web_tests/TestExpectations
[add] https://crrev.com/426bd2af7f4e16ff1fe20573e3382d355a27192c/third_party/blink/web_tests/editing/caret/bidi_hit_test_caret_consistency.html

Sign in to add a comment