Skip to content

Commit

Permalink
8245499: Text input controls should show handles on iOS
Browse files Browse the repository at this point in the history
Reviewed-by: aghaisas, jvos
  • Loading branch information
Jose Pereda authored and aghaisas committed May 27, 2020
1 parent 8914bd2 commit 3ceee69
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@
-fx-skin: "javafx.scene.control.skin.TextAreaSkinIos";
}

.selection-handle {
-fx-shape: "M100,100m-75,0a75,75,0,1,0,150,0a75,75,0,1,0,-150,0";
-fx-pref-width: 12;
-fx-pref-height: 12;
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@
-fx-skin: "javafx.scene.control.skin.TextAreaSkinIos";
}

.selection-handle {
-fx-shape: "M100,100m-75,0a75,75,0,1,0,150,0a75,75,0,1,0,-150,0";
-fx-pref-width: 12;
-fx-pref-height: 12;
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@
public abstract class TextInputControlBehavior<T extends TextInputControl> extends BehaviorBase<T> {

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ public static enum Direction { LEFT, RIGHT, UP, DOWN, BEGINNING, END };
}

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

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

Expand Down Expand Up @@ -219,17 +218,25 @@ public TextInputControlSkin(final T control) {
selectionHandle1.setManaged(false);
selectionHandle2.setManaged(false);

caretHandle.visibleProperty().bind(new BooleanBinding() {
{ bind(control.focusedProperty(), control.anchorProperty(),
control.caretPositionProperty(), control.disabledProperty(),
control.editableProperty(), control.lengthProperty(), displayCaret);}
@Override protected boolean computeValue() {
return (displayCaret.get() && control.isFocused() &&
control.getCaretPosition() == control.getAnchor() &&
!control.isDisabled() && control.isEditable() &&
control.getLength() > 0);
}
});
if (PlatformUtil.isIOS()) {
caretHandle.setVisible(false);
} else {
caretHandle.visibleProperty().bind(new BooleanBinding() {
{
bind(control.focusedProperty(), control.anchorProperty(),
control.caretPositionProperty(), control.disabledProperty(),
control.editableProperty(), control.lengthProperty(), displayCaret);
}

@Override
protected boolean computeValue() {
return (displayCaret.get() && control.isFocused() &&
control.getCaretPosition() == control.getAnchor() &&
!control.isDisabled() && control.isEditable() &&
control.getLength() > 0);
}
});
}


selectionHandle1.visibleProperty().bind(new BooleanBinding() {
Expand Down

0 comments on commit 3ceee69

Please sign in to comment.