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

In CSS for JavaFX Color-Stop with px-length not working for linear-gradient background

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      In normal CSS with HTML5 you can specify a linear gradient in pixels. In CSS for JavaFX you can specify it, too. But it's not working. For Color-Stops percentage works perfect, but not with pixels (px).



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See "Source code for an executable test case".

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      CSS pixel definition in JavaFX should be work.
      ACTUAL -
      In the JavaFX definition for background color "linear-gradient(to bottom, blue, white 100px, white)" it looks like the parse stops at "100px". It's only a linear gradient from blue to white. The 100px are not respected.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      First a html scalable with fix pixel linear gradient example and second a JavaFX example.

      Simple HTML/CSS Example:

      [test.html]
      <!doctype html>
      <link rel="stylesheet" href="test.css">
      <body><textarea>Bla bla bla</textarea></body>
      </html>

      [test.css]
      html, body, textarea{
          height: 100%;
      }
      textarea {
        background : linear-gradient(to bottom, blue, white 100px, white);
      }


      Failed JavaFX Example:
      [javafx.css]
      .text-area {
        -fx-background-color : linear-gradient(to bottom, blue, white 100px, white);
      }

      [JavaFXLinearGradientTest.java]
      public class JavaFXLinearGradientTest extends Application {
        public static void main(String[] args) {
          launch(args);
        }

        @Override
        public void start(Stage primaryStage) {
          StackPane root = new StackPane();
          root.getChildren().add(new TextArea("Bla blub"));
          Scene scene = new Scene(root);
          scene.setUserAgentStylesheet(ClassLoader.getSystemResource("javafx.css"));
          primaryStage.setScene(scene);
          primaryStage.show();
        }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: