1616
1717import static org .htmlunit .BrowserVersionFeatures .JS_INPUT_IGNORE_NEGATIVE_SELECTION_START ;
1818
19- import org .w3c . dom . ranges . Range ;
19+ import org .htmlunit . html . DomNode ;
2020
2121/**
2222 * Contains standard selection-related functionality used by various input elements.
@@ -36,15 +36,15 @@ public class SelectableTextSelectionDelegate implements SelectionDelegate {
3636 private final SelectableTextInput element_ ;
3737
3838 /** The field selection, which is independent of the browsing context's selection. */
39- private final Range selection_ ;
39+ private final SimpleRange selection_ ;
4040
4141 /**
4242 * Creates a new instance for the specified element.
4343 * @param element the owner element
4444 */
4545 public SelectableTextSelectionDelegate (final SelectableTextInput element ) {
4646 element_ = element ;
47- selection_ = new SimpleRange (element , 0 );
47+ selection_ = new SimpleRange (( DomNode ) element , 0 );
4848 }
4949
5050 /**
@@ -85,9 +85,9 @@ public void setSelectionStart(int selectionStart) {
8585
8686 final int length = element_ .getText ().length ();
8787 selectionStart = Math .max (0 , Math .min (selectionStart , length ));
88- selection_ .setStart (element_ , selectionStart );
88+ selection_ .setStart (( DomNode ) element_ , selectionStart );
8989 if (selection_ .getEndOffset () < selectionStart ) {
90- selection_ .setEnd (element_ , selectionStart );
90+ selection_ .setEnd (( DomNode ) element_ , selectionStart );
9191 }
9292 }
9393
@@ -106,9 +106,9 @@ public int getSelectionEnd() {
106106 public void setSelectionEnd (int selectionEnd ) {
107107 final int length = element_ .getText ().length ();
108108 selectionEnd = Math .min (length , Math .max (selectionEnd , 0 ));
109- selection_ .setEnd (element_ , selectionEnd );
109+ selection_ .setEnd (( DomNode ) element_ , selectionEnd );
110110 if (selection_ .getStartOffset () > selectionEnd ) {
111- selection_ .setStart (element_ , selectionEnd );
111+ selection_ .setStart (( DomNode ) element_ , selectionEnd );
112112 }
113113 }
114114}
0 commit comments