RFR: 8306083: Text.hitTest is incorrect when Text node is present in TextFlow [v6]
Andy Goryachev
angorya at openjdk.org
Mon Aug 21 14:46:33 UTC 2023
On Mon, 21 Aug 2023 14:01:06 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:
>
> Review comments
looks good, have some very minor comments.
tests/system/src/test/java/test/robot/javafx/scene/TextCharacterIndexTest.java line 139:
> 137: Window st = scene.getWindow();
> 138: robot.mouseMove((int) (st.getX() + scene.getX() + x),
> 139: (int) (st.getY() + scene.getY() + y));
two things:
1. May be `Window w` would be better than `st`
2. Should it be (int) or (int)Math.round(...) (or (int)Math.rint(...) ?)
-------------
PR Review: https://git.openjdk.org/jfx/pull/1157#pullrequestreview-1587162856
PR Review Comment: https://git.openjdk.org/jfx/pull/1157#discussion_r1300212822
More information about the openjfx-dev
mailing list