RFR: 8090547: Allow for transparent backgrounds in WebView [v6]
kcr at openjdk.java.net
Fri Sep 3 21:32:27 UTC 2021
On Fri, 27 Aug 2021 17:01:00 GMT, Jose Pereda <jpereda at openjdk.org> wrote:
>> Currently, `WebPage` has already a public `setBackgroundColor()` method, but the class is not public. Therefore, public API is needed in `WebView` to allow developers access to it.
>> In line with the `fontSmoothingType` property, this PR provides public support for setting the background color of a WebPage, by adding a `pageFill` property, and a CSR is required.
>> The color for the background, that can be opaque, transparent or with any level of opacity, can be set via code or via CSS using `-fx-page-fill`.
>> Unit tests and a system test are provided.
> Jose Pereda has updated the pull request incrementally with one additional commit since the last revision:
> Use color to int32 converter instead of hash
I just have a couple remaining comments.
modules/javafx.web/src/main/java/com/sun/webkit/WebPage.java line 97:
> 96: private int fontSmoothingType;
> 97: private Color backgroundColor = Color.WHITE;
This might be a problem, since there are code paths that bypass `setBackgroundColor(Color)`. I might recommend storing the converted 32-bit color, and then checking that for transparency. Either that or you will need to derive a `Color` from a 32-bit int in the cases that set a 32-bit int color directly. The former is probably easier.
More information about the openjfx-dev