RFR: 8319844 : Text/TextFlow.hitTest() is incorrect in RTL orientation [v13]

John Hendrikx jhendrikx at openjdk.org
Sun Feb 25 13:19:01 UTC 2024


On Wed, 21 Feb 2024 10:01:37 GMT, Karthik P K <kpk at openjdk.org> wrote:

>> In the `getHitInfo()` method of PrismTextLayout, RTL node orientation conditions were not considered, hence hit test values such as character index and insertion index values were incorrect.
>> 
>> Added checks for RTL orientation of nodes and  fixed the issue in `getHitInfo()` to calculate correct hit test values.
>> 
>> Added system tests to validate the changes.
>
> Karthik P K has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision:
> 
>  - Merge branch 'master' into rtl_hittest_issue
>  - Code refactoring
>  - Review comments
>  - Fix emoji issue
>  - Inline node issue fix
>  - Code review changes
>  - Fix issue with multiline text
>  - Fix issue with RTL text within LTR text
>  - Review changes
>  - Fix multiline text insertion index calculation issue
>  - ... and 3 more: https://git.openjdk.org/jfx/compare/72fd0ef9...e3812732

tests/system/src/test/java/test/robot/javafx/scene/RTLTextFlowCharacterIndexTest.java line 238:

> 236: 
> 237:     @Test
> 238:     public void testTextAndTextFlowHitInfoForRTLEnglishText() throws Exception {

I just replaced `PrismTextLayout#getHitInfo` with `return new Hit(0, 0, true);` and this test, and all the others still pass.

I think the tests should check for a given range of x values if the correct character is being returned as the hit, perhaps more inspired by the tests in https://github.com/openjdk/jfx/pull/1236

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1323#discussion_r1501819474


More information about the openjfx-dev mailing list