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

Implement CSS3 colors and selectors uniformly on JavaFX



    • Type: Enhancement
    • Status: Open
    • Priority: P5
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:


      Currently, JavaFX supports a subset of the CSS2 spec with some proprietary pseudo-classes and attributes that are roughly equivalent to some CSS3 functionality. Unlike CSS2, CSS3 is broken up in to a number of individual modules, each of which progress through the standardization process more or less independently. The current status of these modules can be observed at http://www.css3.info/modules/. In this list, only 3 modules are presently W3C Recommendations, meaning that they are final and meant for wide adoption. These three are CSS Color (with additions of HSL, HSLA, and RGBA formats), CSS Namespaces (with applicability to styling XML documents), and Selectors. Of these, CSS Color and CSS Selectors are of immediately and obvious interest, while CSS Namespaces are not immediately applicable (although we do have an XML Document format, FXML, none of the FXML name space information is preserved in the Scene Graph, and thus, no namespace support in CSS is applicable for JavaFX).

      A number of additional modules are in Public Review or are Candidate Recommendations (which suggest they are close to being accepted), such as Media Queries, CSS Style Attributes, CSS Backgrounds and Borders, CSS Marquee, CSS Multi-column layout, and CSS Speech. Another long list of CSS3 modules are only working drafts, meaning that, although many of them have been implemented in some form by browsers, they are still some ways off from being stable recommendations. This includes such popular modules as CSS 2D Transformations, CSS 3D Transformations, CSS Transitions, and CSS Animations. Even CSS Fonts Level 3 is only in "Last Call".

      JavaFX supports CSS both for styling the Scene Graph (including especially UI Controls) and also for use within the embedded WebView node (a WebKit browser which can be used within the Scene Graph). However the level of CSS support used between these two environments is not consistent. For example, the WebView supports CSS 3D Transformations, whereas JavaFX CSS for the scene graph does not (despite the fact that the Scene Graph does itself support 3D transformations!).

      Developers are therefore left with fragmentation -- some CSS works in one part of the platform but not in other parts of the platform. Although some of this is unavoidable, the differences should be natural as opposed to arbitrary. At present, much CSS functionality is not supported for the Scene Graph simply because we have not yet implemented it.

      This requirement for a consistent look and feel has also been requested by customers such as the Royal Bank of Scotland and BlackRock. This requirement is in addition to the existing CSS requirement (Support CSS Animations)


          JavaFX must support the CSS3 Colors module in its entirety
          JavaFX must support all of the CSS3 Selectors module, except for:
          JavaFX must allow the use of one CSS stylesheet to style both JavaFX and WebView content in the same application
          If any of the existing proprietary CSS pseudo classes are made redundant by implementing the standard CSS3 classes they should be tagged as "deprecated" in our documentation to encourage the adoption of the standard classes but must remain supported for backward compatibility at least for one major release after they are tagged as "deprecated"

      Note that it is expected that the usage of some selectors and pseudo classes in a CSS document may lead to performance degradation in the application. However, the support for additional selectors must not negatively impact performance for an application which does not use that functionality.


          Issue Links



              Unassigned Unassigned
              bcbeck Brian Beck (Inactive)
              1 Vote for this issue
              5 Start watching this issue