jfx icon indicating copy to clipboard operation
jfx copied to clipboard

8318095: TextArea/TextFlow: wrong layout in RTL mode

Open Ziad-Mid opened this issue 1 month ago • 9 comments

Fixed issue with TextArea/TextFlow added a check isMirrored() in PrismTextLayout.setWrapWidth which makes the text right aligned in RTL. Tested with monkeyTester and the test in the bug


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8318095: TextArea/TextFlow: wrong layout in RTL mode (Bug - P3)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1995/head:pull/1995
$ git checkout pull/1995

Update a local copy of the PR:
$ git checkout pull/1995
$ git pull https://git.openjdk.org/jfx.git pull/1995/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1995

View PR using the GUI difftool:
$ git pr show -t 1995

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1995.diff

Using Webrev

Link to Webrev Comment

Ziad-Mid avatar Dec 03 '25 13:12 Ziad-Mid

Working on a JUnit Test for this bug.

Ziad-Mid avatar Dec 03 '25 13:12 Ziad-Mid

:wave: Welcome back zelmidaoui! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Dec 03 '25 13:12 bridgekeeper[bot]

@Ziad-Mid This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8318095: TextArea/TextFlow: wrong layout in RTL mode

Reviewed-by: angorya

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 12 new commits pushed to the master branch:

  • 32e667dfca9c5e9a19cb20f0bdd0553ca1ff765f: 8373193: RichTextArea: exceptions specifying position beyond the document end
  • 843338e7fdd2a0d3fe306b1a8a69f405948f0906: 8359759: Remove the FXPermission class
  • e776b3728f6f5710376870cf84e01f05a503b616: 8371855: Time stamps are missing on zip bundles with gradle 9
  • ... and 9 more: https://git.openjdk.org/jfx/compare/43d392040595cded591126e801c4747f72330905...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

openjdk[bot] avatar Dec 03 '25 13:12 openjdk[bot]

Webrevs

mlbridge[bot] avatar Dec 03 '25 14:12 mlbridge[bot]

@Ziad-Mid this looks much better, almost complete! I would like to ask you to test it not only with TextArea, but also with TextFlow - you can use this reproducer https://github.com/andy-goryachev-oracle/Test/blob/main/src/goryachev/bugs/TextFlow_ExtraSpace_8330559.java

Notice how the layout is still not right in some places when the window is resized (the screenshots are from a combined branch of this PR + #1988 but the result is still the same, I think):

Screenshot 2025-12-03 at 13 27 21 Screenshot 2025-12-03 at 13 27 29

Also, could you try using the monkey tester and try TextArea/TextFlow (and possibly Text/TextField as well) with RTL as well as mixed text. Please see if you can verify that the layout info is reported correctly, and the shapes are correct.

andy-goryachev-oracle avatar Dec 03 '25 22:12 andy-goryachev-oracle

Another thing you might want to check is whether the LayoutInfo and related APIs (caretShape, etc) report correct information.

Using the updated Monkey Tester from https://github.com/andy-goryachev-oracle/MonkeyTest :

Screenshot 2025-12-03 at 15 12 24

andy-goryachev-oracle avatar Dec 03 '25 23:12 andy-goryachev-oracle

Forgot to mention: the text layout geometry depends on the padding/borders, please make sure they are taken into account.

andy-goryachev-oracle avatar Dec 04 '25 03:12 andy-goryachev-oracle

Notice how the layout is still not right in some places when the window is resized (the screenshots are from a combined branch of this PR + #1988 but the result is still the same, I think):

I have fixed this issue could you please re-review

Ziad-Mid avatar Dec 11 '25 15:12 Ziad-Mid

Another thing you might want to check is whether the LayoutInfo and related APIs (caretShape, etc) report correct information.

There is another bug for this issue JDK-8319050 which I'm still working on

Ziad-Mid avatar Dec 11 '25 15:12 Ziad-Mid

Thank you for review Andy. I guess we should merge this PR too https://github.com/openjdk/jfx/pull/1988

Ziad-Mid avatar Dec 12 '25 20:12 Ziad-Mid

you could merge, but then it will complain about unrelated changes.

since the two are independent, you can integrate this first, once this PR is integrated, you can simply sync up #1988 with the master branch.

andy-goryachev-oracle avatar Dec 12 '25 20:12 andy-goryachev-oracle

Thank you for reviewing !

Ziad-Mid avatar Dec 13 '25 03:12 Ziad-Mid

/integrate

Ziad-Mid avatar Dec 13 '25 03:12 Ziad-Mid

Going to push as commit 8e49ea4af53376583e3cb9ce4288caa3f275ab93. Since your change was applied there have been 12 commits pushed to the master branch:

  • 32e667dfca9c5e9a19cb20f0bdd0553ca1ff765f: 8373193: RichTextArea: exceptions specifying position beyond the document end
  • 843338e7fdd2a0d3fe306b1a8a69f405948f0906: 8359759: Remove the FXPermission class
  • e776b3728f6f5710376870cf84e01f05a503b616: 8371855: Time stamps are missing on zip bundles with gradle 9
  • ... and 9 more: https://git.openjdk.org/jfx/compare/43d392040595cded591126e801c4747f72330905...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Dec 13 '25 03:12 openjdk[bot]

@Ziad-Mid Pushed as commit 8e49ea4af53376583e3cb9ce4288caa3f275ab93.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Dec 13 '25 03:12 openjdk[bot]