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

Gradient Spec is invalid CSS 2.1 expression

XMLWordPrintable

      The current specification of linear/radial gradients is invalid if you take a look at the BNF for CSS 2.1 (http://www.w3.org/TR/CSS21/grammar.html) the problem are the definitions of the points and stops because they are "function-calls" without a function name.

      Ideally linear and radial are function calls like they are in the webkit (old style) and CSS3 spec (http://dev.w3.org/csswg/css3-images/#linear-gradients) because in your current definition we have many different terms making up the linear gradient.

      I'd suggest to deprecate but still support the current gradient definition but switch to a CSS-Spec compatible version:
      a) Support CSS3 syntax (all CSS3-Editors can then support it out of the box)
      b) or use function calls for point definitions and stops

      The spec would change to this then:
      linear from( <size> , <size> ) to( <size> , <size> ) [ stop( <number> , <color> ) ]+ [ repeat | reflect ]?
      linear from(0%,0%) to(100%,100%) stop(0.0,red) stop(1.0,black)

      radial [ center( <size> , <size> ) , ]? <size> [ focus( <size> , <size> ) ] ? [ stop( <number> , <color> ) ]+ [ repeat | reflect ]?
      radial center(25%,25%) , 50% focus(20%,20%) stop(0.0,gray) stop(0.50,darkgray) stop(1.0,dimgray) reflect

        1. RT-14402.apps
          54 kB
        2. RT-14402.deploy
          4 kB
        3. RT-14402.runtime
          90 kB
        4. RT-14402.tests
          5 kB

            dgrieve David Grieve
            tschindl Tom Schindl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: