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

Karthik P K kpk at openjdk.org
Fri Jun 23 04:25:13 UTC 2023


On Wed, 21 Jun 2023 06:34:00 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.

The cause for above mentioned issue is that, the `line.getRuns()` call in line no.439 in PrismTextLayout.java returns text runs only for the first Text node. Because of this issue correct character index is not calculated.
It looks like the issue is in line creation. I will fix this issue along with the character index issue we are fixing already in this PR.

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

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


More information about the openjfx-dev mailing list