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

JavaFX WebView canvas intermittently stops rendering shapes

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u212, openjfx11, openjfx13
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Subcomponent:
      web
    • CPU:
      x86
    • OS:
      os_x

      Description

      ADDITIONAL SYSTEM INFORMATION :
      macOS 10.14.6
      AdoptOpenJDK 12.0.2
      JavaFX 11.0.2

      A DESCRIPTION OF THE PROBLEM :
      Within a JavaFX WebView, When a sufficiently large number of shapes are drawn on the canvas some subset of them will not be rendered. This phenomenon is most easily seen when a drawing large grid of shapes.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Initialize the JavaFX thread
      2. On the JavaFX thread, initialize a WebView.
      3. Create a Stage and set the scene to a new Scene wrapping the WebView.
      4. Retrieve the WebEngine from the WebView.
      5. Load HTML content into the WebEngine that contains a single canvas element.
      6. Use the engine to execute a JavaScript script that draws a large grid of shapes that fills the canvas element.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A window opens showing a canvas completely full of a grid of shapes.
      ACTUAL -
      A window opens showing a canvas partially full of a grid of shapes. There is a large section in the middle where no shapes were drawn.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Platform;
      import javafx.scene.Scene;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      class Bug {
          public static void main (String args[]) {
              Platform.startup(() -> {});
              Platform.runLater(() -> {
                      WebView webView = new WebView();
                      Stage stage = new Stage();
                      stage.setScene(new Scene(webView));
                      stage.setAlwaysOnTop(true);
                      stage.setWidth(620);
                      stage.setHeight(640);
                      WebEngine engine = webView.getEngine();
                      engine.loadContent("<html><body><canvas id=\"canvas\" width=\"600\" height=\"600\" style=\"border: 1px solid red;\"></canvas></body></html>");
                      engine.executeScript("window.onload = function() {"
                                           + " var canvas = document.getElementById('canvas');"
                                           + " var c = canvas.getContext('2d');"
                                           + " var size = 4;"
                                           + " var step = size + 2;"
                                           + " for (var y = 0; y <= canvas.height; y = y + step) {"
                                           + " for (var x = 0; x <= canvas.width; x = x + step) {"
                                           + " c.fillRect(x, y, size, size);"
                                           + " }"
                                           + " }"
                                           + "}");
                      stage.show();
                  });
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              ajoseph Arun Joseph
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: