On Tue, 9 May 2023 18:16:09 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
>> Karthik P K has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Address code review > > modules/javafx.graphics/src/main/java/com/sun/javafx/text/PrismTextLayout.java > line 425: > >> 423: public Hit getHitInfo(float x, float y) { >> 424: int charIndex = -1; >> 425: int insertionIndex = -1; > > [question] > > Currently, there are a few scenarios when a negative insertionIndex is passed > down to HitInfo. This will trigger a similar (and probably incorrect) > computation of the insertion index in HitInfo, see for example > [JDK-8302511](https://bugs.openjdk.org/browse/JDK-8302511). > > My question is - should we instead resolve the insertion index always? After current fix, only scenario where `insertionIndex` not getting initialized will be when `lineIndex >= getLineCount()` is true. So even if `insertionIndex` -1, text will be null and `HitInfo.getInsertionIndex()` will not have any computation to perform. So we can resolve the insertion index always I think. Please let me know your thoughts on this. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1091#discussion_r1190682049