Skip to content

Commit 3ceee69

Browse files
Jose Peredaaghaisas
Jose Pereda
authored andcommitted
8245499: Text input controls should show handles on iOS
Reviewed-by: aghaisas, jvos
1 parent 8914bd2 commit 3ceee69

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed

modules/javafx.controls/src/ios/resources/com/sun/javafx/scene/control/skin/caspian/ios.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,8 @@
5151
-fx-skin: "javafx.scene.control.skin.TextAreaSkinIos";
5252
}
5353

54+
.selection-handle {
55+
-fx-shape: "M100,100m-75,0a75,75,0,1,0,150,0a75,75,0,1,0,-150,0";
56+
-fx-pref-width: 12;
57+
-fx-pref-height: 12;
58+
}

modules/javafx.controls/src/ios/resources/com/sun/javafx/scene/control/skin/modena/ios.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,8 @@
5151
-fx-skin: "javafx.scene.control.skin.TextAreaSkinIos";
5252
}
5353

54+
.selection-handle {
55+
-fx-shape: "M100,100m-75,0a75,75,0,1,0,150,0a75,75,0,1,0,-150,0";
56+
-fx-pref-width: 12;
57+
-fx-pref-height: 12;
58+
}

modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@
7777
public abstract class TextInputControlBehavior<T extends TextInputControl> extends BehaviorBase<T> {
7878

7979
/**
80-
* Specifies whether we ought to show handles. We should do it on touch platforms, but not
81-
* iOS (and maybe not Android either?)
80+
* Specifies whether we ought to show handles. We should do it on touch platforms
8281
*/
83-
static final boolean SHOW_HANDLES = Properties.IS_TOUCH_SUPPORTED && !PlatformUtil.isIOS();
82+
static final boolean SHOW_HANDLES = Properties.IS_TOUCH_SUPPORTED;
8483

8584
public static final String DISABLE_FORWARD_TO_PARENT = "TextInputControlBehavior.disableForwardToParent";
8685

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TextInputControlSkin.java

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,9 @@ public static enum Direction { LEFT, RIGHT, UP, DOWN, BEGINNING, END };
129129
}
130130

131131
/**
132-
* Specifies whether we ought to show handles. We should do it on touch platforms, but not
133-
* iOS (and maybe not Android either?)
132+
* Specifies whether we ought to show handles. We should do it on touch platforms
134133
*/
135-
static final boolean SHOW_HANDLES = Properties.IS_TOUCH_SUPPORTED && !PlatformUtil.isIOS();
134+
static final boolean SHOW_HANDLES = Properties.IS_TOUCH_SUPPORTED;
136135

137136
private final static boolean IS_FXVK_SUPPORTED = Platform.isSupported(ConditionalFeature.VIRTUAL_KEYBOARD);
138137

@@ -219,17 +218,25 @@ public TextInputControlSkin(final T control) {
219218
selectionHandle1.setManaged(false);
220219
selectionHandle2.setManaged(false);
221220

222-
caretHandle.visibleProperty().bind(new BooleanBinding() {
223-
{ bind(control.focusedProperty(), control.anchorProperty(),
224-
control.caretPositionProperty(), control.disabledProperty(),
225-
control.editableProperty(), control.lengthProperty(), displayCaret);}
226-
@Override protected boolean computeValue() {
227-
return (displayCaret.get() && control.isFocused() &&
228-
control.getCaretPosition() == control.getAnchor() &&
229-
!control.isDisabled() && control.isEditable() &&
230-
control.getLength() > 0);
231-
}
232-
});
221+
if (PlatformUtil.isIOS()) {
222+
caretHandle.setVisible(false);
223+
} else {
224+
caretHandle.visibleProperty().bind(new BooleanBinding() {
225+
{
226+
bind(control.focusedProperty(), control.anchorProperty(),
227+
control.caretPositionProperty(), control.disabledProperty(),
228+
control.editableProperty(), control.lengthProperty(), displayCaret);
229+
}
230+
231+
@Override
232+
protected boolean computeValue() {
233+
return (displayCaret.get() && control.isFocused() &&
234+
control.getCaretPosition() == control.getAnchor() &&
235+
!control.isDisabled() && control.isEditable() &&
236+
control.getLength() > 0);
237+
}
238+
});
239+
}
233240

234241

235242
selectionHandle1.visibleProperty().bind(new BooleanBinding() {

0 commit comments

Comments
 (0)