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

Kevin Rushforth kcr at openjdk.org
Wed Jan 10 23:25:33 UTC 2024


On Wed, 10 Jan 2024 19:52:22 GMT, Andy Goryachev <angorya 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.
>
> modules/javafx.graphics/src/main/java/javafx/scene/text/Text.java line 1042:
> 
>> 1040:         int runIndex = 0;
>> 1041:         if (runs.length != 0) {
>> 1042:             if (this.getScene().getNodeOrientation() == NodeOrientation.RIGHT_TO_LEFT) {
> 
> I think this should not refer to scene:
> 
> 
> if (getNodeOrientation() == NodeOrientation.RIGHT_TO_LEFT) {

I agree. Using the scene's orientation seems conceptually wrong. Shouldn't this use `Node::getEffectiveNodeOrientation`?

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

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


More information about the openjfx-dev mailing list