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

SVG gradients are not rendered

XMLWordPrintable

    • web
    • x86_64
    • generic

        ADDITIONAL SYSTEM INFORMATION :
        The problem is reproduced in 1.8.0_192 version too.
        This was working in 1.8.0_111 version.
        Apparently, OS is not relevant, it was tested in Windows 7 - 64 with the same behaviour.


        A DESCRIPTION OF THE PROBLEM :
        SVG gradients are not rendered, a solid color is drawn instead the gradient.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Try to render any SVG gradient inside the WebView

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        A gradient is rendered
        ACTUAL -
        A solid color is rendered

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



        public class GradientSVGTest extends Application {
            private Scene scene;
            @Override public void start(Stage stage) {
                scene = new Scene(new WebSVG());
                stage.setScene(scene);
                stage.show();
            }
         
            public static void main(String[] args){
                launch(args);
            }
        }

        class WebSVG extends Region {
         
            final WebView browser = new WebView();
            final WebEngine webEngine = browser.getEngine();
             
            public WebSVG() {
                webEngine.loadContent(
                 "<!DOCTYPE html> " +
                 "<html> " +
                 "<body> " +
                        " " +
                 "<svg height='150' width='400'> " +
                 " <defs> " +
                 " <linearGradient id='grad1' x1='0%' y1='0%' x2='0%' y2='100%'> " +
                 " <stop offset='0%' style='stop-color:red' /> " +
                 " <stop offset='100%' style='stop-color:yellow' /> " +
                 " </linearGradient> " +
                 " </defs> " +
                 " <ellipse cx='200' cy='70' rx='85' ry='55' fill='url(#grad1)' /> " +
                 " Sorry, your browser does not support inline SVG. " +
                 "</svg> " +
                        " " +
                 "</body> " +
                 "</html> "
                 );
                getChildren().add(browser);
         
            }
        }
        ---------- END SOURCE ----------

        FREQUENCY : always


              arajkumar Arunprasad Rajkumar
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: