RFR: 8090547: Allow for transparent backgrounds in WebView [v9]

Jose Pereda jpereda at openjdk.java.net
Sat Sep 11 16:40:54 UTC 2021

On Fri, 10 Sep 2021 18:15:21 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:
>   Fix test to pass all 3 platforms

Thanks for testing it, I can reproduce the issue indeed. 

I had my interactive test too which doesn't fail with alpha = 0, and comparing both tests I realise now that in my case I was using a transparent VBox instead of a Group as a container for the WebView, and later on when I created the system test, I removed such container. 

If you try:


var root = new VBox();
root.setStyle("-fx-background-color: transparent");

that should work for you as well...

Obviously there is an issue with alpha = 0 in case we use Group or not container at all, vs when we use a Region. 

The comment at [Region::doComputeGeomBounds](https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java#L3310) my be relevant though?

> the geom bounds forms the basis of the dirty regions


PR: https://git.openjdk.java.net/jfx/pull/563

More information about the openjfx-dev mailing list