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

Scrollbar issues in WebView

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8
    • javafx
    • Java 1.8.0ea b113 observed on Windows and Linux

    • web

      I have a static page with an inline svg and styles that allow it to resize the svg proportionally up to a max size. It is all working well except that this scenario seems to confuse the WebView's scrollbars.

      Run the provided test case and observe the following issues:

      1. when the scene appears the vertical scrollbar is party showing but without its dragger. If you mouse over the scrollbar it will finish rendering.

      2. drag the bottom of the stage taller so that the scrollbar disappears and then slowly back up. At one point the page will render like it is expecting the scrollbar to appear but the scrollbar does not render. I believe this is because of the proportional sizing of the svg but really the scrollbar should still render in this scenario and just have little or no room to scroll.

      Test Code
      *****************************************************************
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.StackPane;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      public class WebViewTest extends Application {
         
         @Override public void start(final Stage primaryStage) throws Exception {

            primaryStage.centerOnScreen();
            primaryStage.setHeight(200);
            primaryStage.setWidth(360);
            
            final WebView webView = new WebView();
            String page =
            "<html>" +
            "<head>" +
            "</head>" +
            "<body style='margin: 0px;'>" +
            "<div style='overflow: auto; border-bottom:1px solid black; background-color:#edf3fe;'>" +
            "<div style='margin: 1em auto 1em auto; width:350px; max-width:80%;'>" +
               "<svg style='border: 1px solid black; background-color: white; " +
                  "max-height:100%; max-width:100%;' " +
                  "xmlns='http://www.w3.org/2000/svg&#39; " +
                  "text-rendering='optimizeLegibility'" +
                  "shape-rendering='geometricPrecision'" +
                  "preserveAspectRatio='xMidYMid'" +
                  "version='1.1' width='350' height='200'" +
                  "viewBox='0 0 700 400'>"+
                  "<circle cx='350' cy='200' r='150' fill='blue' />"+
               "</svg>" +
            "</div>" +
            "</div>" +
            "</body>" +
            "</html>";
            webView.getEngine().loadContent(page);
            primaryStage.setScene(new Scene(new StackPane(webView)));
            
            primaryStage.show();

         }
         
         public static void main(String[] args) throws Exception {
            launch(args);
         }

      }

            Unassigned Unassigned
            csmithjfx Charles Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: