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

On Mac OS X call to GlassViewEventHandler.getInputMethodCandidatePos() provides strange coordinates

    XMLWordPrintable

    Details

      Description

      On Mac OS X when we call this method we do not receive actual text position so suggested input window is being placed in the wrong way.
      Sometimes, when system asks us for a position in an empty string we got exception

      java.lang.IllegalArgumentException: Both width and height must be >= 0
           [java] at javafx.geometry.Rectangle2D.<init>(Rectangle2D.java:100)
           [java] at com.sun.javafx.scene.control.skin.TextFieldSkin.getCharacterBounds(TextFieldSkin.java:625)
           [java] at com.sun.javafx.scene.control.skin.TextInputControlSkin$14.getTextLocation(TextInputControlSkin.java:352)
           [java] at javafx.scene.Scene$InputMethodRequestsDelegate.getTextLocation(Scene.java:3339)
           [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler.getInputMethodCandidatePos(GlassViewEventHandler.java:365)
           [java] at com.sun.glass.ui.View.getInputMethodCandidatePos(View.java:660)
           [java] at com.sun.glass.ui.View.notifyInputMethodCandidatePosRequest(View.java:951)

      or when we changing focus with Command-tab while entering text with complex input methods we sometimes get the exception

      java.lang.StringIndexOutOfBoundsException: String index out of range: 14
           [java] at java.lang.String.substring(String.java:1934)
           [java] at com.sun.javafx.sg.prism.NGTextHelper.getRangeShapeImpl(NGTextHelper.java:1681)
           [java] at com.sun.javafx.sg.prism.NGTextHelper.getRangeShape(NGTextHelper.java:1563)
           [java] at com.sun.javafx.sg.prism.NGTextHelper.getRangeShape(NGTextHelper.java:28)
           [java] at javafx.scene.text.Text.impl_getRangeShape(Text.java:1126)
           [java] at com.sun.javafx.scene.control.skin.TextFieldSkin.getCharacterBounds(TextFieldSkin.java:611)
           [java] at com.sun.javafx.scene.control.skin.TextInputControlSkin$14.getTextLocation(TextInputControlSkin.java:352)
           [java] at javafx.scene.Scene$InputMethodRequestsDelegate.getTextLocation(Scene.java:3339)
           [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler.getInputMethodCandidatePos(GlassViewEventHandler.java:365)
           [java] at com.sun.glass.ui.View.getInputMethodCandidatePos(View.java:660)
           [java] at com.sun.glass.ui.View.notifyInputMethodCandidatePosRequest(View.java:951)

      I think i have a workaround for the later case but not for the first exception and coordinates are definitely wrong.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              leifs Leif Samuelsson (Inactive)
              Reporter:
              kizune Alexander Zuev
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: