Animated GIFs do not animate in WebView (regression in JavaFX 24)

XMLWordPrintable

    • web
    • b02
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Broken in JavaFX 24. Last worked in JavaFX 23.

      A DESCRIPTION OF THE PROBLEM :
      Animated GIF images displayed in a WebView show only the first frame and do not animate. This occurs regardless of how the GIF is loaded:

      <img> tag with file:/// URL via WebEngine.loadContent()
      <img> tag with file:/// URL via WebEngine.load() loading an HTML file
      <object> and <iframe> tags

      This is distinct from JDK-8167675, which was fixed in Java 9.
      The regression may be related to the BitmapImageSource refactoring at WebKit commit 276827@main, which changed how animated image decoding and frame advancement works. OpenJFX's rendering integration may not be handling the new animation callbacks correctly after the WebKit 619.1 upgrade (JDK-8328994).

      REGRESSION : Java version that customer using for 24.02



      REGRESSION : Last worked in version 23.02

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a WebView
      2. Load HTML containing an animated GIF via either loadContent() or load():

      <html><body><img src="file:///path/to/animated.gif"/></body></html>

      3. Observe that only the first frame is displayed

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

      public class AnimatedGifTest extends Application
      {
        @Override
        public void start(Stage stage)
        {
          WebView webView = new WebView();
          WebEngine engine = webView.getEngine();

          engine.loadContent(
            "<html><body>" +
            "<p>The image below should be animating:</p>" +
            "<img src=\"<LINK>\"/>" +
            "</body></html>");

          stage.setScene(new Scene(webView, 600, 400));
          stage.setTitle("Animated GIF Test");
          stage.show();
        }

        public static void main(String[] args)
        {
          launch(args);
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None

      FREQUENCY :
      ALWAYS

            Assignee:
            Jay Bhaskar
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: