Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8306083

Text.hitTest is incorrect when more than one Text node in TextFlow

XMLWordPrintable

    • b15
    • generic
    • generic

      When hitTest() is invoked for the Text node in a TextFlow with more than one Text child, the character index and the insertion index values obtained are not correct.

      User monkey tester app to reproduce the issue: https://github.com/andy-goryachev-oracle/Test/blob/main/src/goryachev/monkey/MonkeyTesterApp.java

      Steps to reproduce the issue:
      1. Open Monkey Tester app and select TextFlow.
      2. From Text dropdown on the right side, select Rich Text and Font Size 48.
      3. Start hovering mouse on the text "BOLD" and observe the hitTest values of Text on the right side. When the mouse is hovered over trailing side of "O", character index returned is 2 which should have been 1. When cursor is hovered over letter "D", character index returned is 5 whereas expected char index is 3.

      The issue is because of the bug in the logic of looping through the array of text runs in getHitInfo method of PrismTextLayout.java which results in calculating character index value using wrong text run for the given Text node.

            kpk Karthik P K
            kpk Karthik P K
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: