- 
    Bug 
- 
    Resolution: Fixed
- 
     P3 P3
- 
    jfx11.0.11, 8u291, jfx17, jfx18
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8292183 | jfx17.0.5 | Ambarish Rapte | P3 | Resolved | Fixed | |
| JDK-8290430 | 8u351 | Kevin Rushforth | P3 | Resolved | Fixed | b03 | 
| JDK-8292552 | jfx11.0.17 | Ambarish Rapte | P3 | Resolved | Fixed | 
WebView web = new WebView();
web.getEngine().loadContent("<head></head><body><input type=\"color\" value=\"#000000\"></body>");
fails with the exception:
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Color.rgb's red parameter (-16776961) expects color values 0-255
at javafx.graphics@19-internal/javafx.scene.paint.Color.checkRGB(Color.java:232)
at javafx.graphics@19-internal/javafx.scene.paint.Color.rgb(Color.java:179)
at javafx.web@19-internal/com.sun.webkit.ColorChooser.fwkCreateAndShowColorChooser(ColorChooser.java:71)
at javafx.web@19-internal/com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
at javafx.web@19-internal/com.sun.webkit.WebPage.dispatchMouseEvent(WebPage.java:843)
at javafx.web@19-internal/javafx.scene.web.WebView.processMouseEvent(WebView.java:1098)
It works fine since JavaFX 11 up until 16, starts failing with any JavaFX 17+ and LTS JavaFX 11.0.11+.
This narrows it down to
In particular, in ColorChooserJava.cpp, the call to fwkCreateAndShowColorChooser changed from using
color.red(), color.green(), color.blue(), to use the constants color.red, color.green, color.blue, which are defined as:
static constexpr auto red = SRGBA<uint8_t> { 255, 0, 0 };
static constexpr auto green = SRGBA<uint8_t> { 0, 255, 0 };
static constexpr auto blue = SRGBA<uint8_t> { 0, 0, 255 };
Therefore, not only the conversion from SRGBA to int passes always the same three values:
r = -16776961, g = -16711936, b = -65536
to fwkCreateAndShowColorChooser in ColorChooser.java, no matter the "value" set in the html input, but also it throws the above exception, as these three values are out of range for Color.rgb(r, g, b);
- backported by
- 
                    JDK-8290430 IllegalArgumentException: Color.rgb's red parameter (-16776961) expects color values 0-255 -           
- Resolved
 
-         
- 
                    JDK-8292183 IllegalArgumentException: Color.rgb's red parameter (-16776961) expects color values 0-255 -           
- Resolved
 
-         
- 
                    JDK-8292552 IllegalArgumentException: Color.rgb's red parameter (-16776961) expects color values 0-255 -           
- Resolved
 
-         
- links to
- 
                     Commit
        openjdk/jfx11u/d3e8fe12 Commit
        openjdk/jfx11u/d3e8fe12
- 
                     Commit
        openjdk/jfx17u/525e854f Commit
        openjdk/jfx17u/525e854f
- 
                     Commit
        openjdk/jfx/fc6a6023 Commit
        openjdk/jfx/fc6a6023
- 
                     Review
        openjdk/jfx11u/106 Review
        openjdk/jfx11u/106
- 
                     Review
        openjdk/jfx17u/74 Review
        openjdk/jfx17u/74
- 
                     Review
        openjdk/jfx/809 Review
        openjdk/jfx/809