RFR: 8306083: Text.hitTest is incorrect when Text node is present in TextFlow [v4]

Andy Goryachev angorya at openjdk.org
Fri Jun 30 17:37:59 UTC 2023


On Fri, 30 Jun 2023 14:40:14 GMT, Karthik P K <kpk at openjdk.org> wrote:

>> The text run selected in `PrismTextLayout::getHitInfo()` method for character index calculation was not correct when Text node was embedded in TextFlow. Hence wrong character index value was calculated for the same.
>> 
>> Since only x, y coordinates were available in the above mentioned method, sending the text as a parameter to this method is necessary so as to know if the text run selected for character index calculation is correct. Along with this change modified the `PrismTextLayout::getHitInfo()` method to calculate the correct character index.
>> 
>> Added tests to validate the changes.
>
> Karthik P K has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix character index calculation issue

Part of the issue seems fixed, but i noticed an irregularity with the tone skin emoji.  Now we do not support grapheme clusters (yet), but still, the insertion index reported by Text suddenly jumps from a correct value to what looks like a too big of a value.

In the following screenshots, if the mouse pointer is hovering to the left of the red caret line, the insertion index is 4.  But if you move it to the right side, the index jumps to 33 which does not look right.

Mouse to the left of the line:
![Screenshot 2023-06-30 at 10 14 53](https://github.com/openjdk/jfx/assets/107069028/6339dc66-5305-42e7-a06a-994aa4e3c000)

Mouse to the right of the line:

![Screenshot 2023-06-30 at 10 15 00](https://github.com/openjdk/jfx/assets/107069028/bbb29e2d-ed51-462b-9731-9a14acec77eb)

I can tell that the red line on the screenshots corresponds to a boundary between two different Text instances (see TextFlowPage:204).

The TextFlow portion does seem to work correctly.

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

PR Comment: https://git.openjdk.org/jfx/pull/1157#issuecomment-1614967666


More information about the openjfx-dev mailing list