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

[SWT] No possibility to select text in FX content by using mouse dragging

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8u25
    • Fix Version/s: 8u60
    • Component/s: javafx
    • Environment:

      Windows7, JRE 8u25, (org.eclipse.swt_3.6.2.v3659c / org.eclipse.swt_3.103.1.v20140903-1938)

    • Subcomponent:
    • Verification:
      Not verified

      Description

      When Browser content is loaded I am not able to select any text on it by using mouse dragging.
      There is one case when text is selecting and highlighting (mouse double click on any word selecting it).

      Tested with 8u25 and
      - org.eclipse.swt_3.6.2.v3659c
      - org.eclipse.swt_3.103.1.v20140903-1938.jar

      It is blocker for me. I can't deliver solution base on Webkit which has no possibility to select text by dragging mouse over the text.

      I am providing short simple example which allows to reproduce that bug.

      {code:title=DragSelectionWebkitIssue.java|borderStyle=solid}
      import javafx.beans.value.ChangeListener;
      import javafx.beans.value.ObservableValue;
      import javafx.concurrent.Worker.State;
      import javafx.embed.swt.FXCanvas;
      import javafx.scene.Scene;
      import javafx.scene.web.WebView;
      import org.eclipse.swt.SWT;
      import org.eclipse.swt.layout.FillLayout;
      import org.eclipse.swt.widgets.Display;
      import org.eclipse.swt.widgets.Shell;

      public class DragSelectionWebkitIssue
      {
          public static void main(String[] args)
          {
              Display display = new Display();
              Shell shell = new Shell(display);
              shell.setLayout(new FillLayout());
              FXCanvas canvas = new FXCanvas(shell, SWT.NONE);

              WebView webView = new WebView();
              Scene scene = new Scene(webView);
              canvas.setScene(scene);

              webView.getEngine().getLoadWorker().stateProperty()
                  .addListener(getInitialProgressListener(webView));
              webView.getEngine().load("http://www.google.com");

              shell.setSize((int) scene.getWidth(), (int) scene.getHeight());
              shell.open();

              while (!shell.isDisposed())
              {
                  if (!display.readAndDispatch())
                  {
                      display.sleep();
                  }
              }
              display.dispose();
          }

          private static ChangeListener <? super State> getInitialProgressListener(WebView webView)
          {
              return new ChangeListener <State>()
              {

                  @Override
                  public void changed(ObservableValue <? extends State> observable, State oldState,
                      State newState)
                  {
                      String location = webView.getEngine().getLocation();
                      System.out.println("Loading: " + location + " - " + newState);
                  }
              };
          }
      }
      {code}

        Attachments

          Activity

            People

            • Assignee:
              kcr Kevin Rushforth
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: