RFR: 8267554: Support loading stylesheets from data-URIs [v2]

Michael Strauß mstrauss at openjdk.java.net
Sun Jun 20 00:28:26 UTC 2021


On Fri, 18 Jun 2021 18:43:24 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> * Do you intend to support setting a user agent stylesheet via a data URL? The docs should be explicit about whether or not a data URI can be used for the following methods:
>   
>   * [Application::setUserAgentStylesheet](https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/javafx/application/Application.java#L521)
>   * [Scene::setUserAgentStylesheet](https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/javafx/scene/Scene.java#L1697)
>   * [SubScene::setUserAgentStylesheet](https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/javafx/scene/SubScene.java#L687)

Data URIs also work for user-agent stylesheets. I added documentation to each of the methods.

> modules/javafx.graphics/src/main/java/javafx/css/Stylesheet.java line 301:
> 
>> 299:      * css version or if an I/O error occurs while reading from the stream
>> 300:      */
>> 301:     public static Stylesheet loadBinary(InputStream stream) throws IOException {
> 
> Why do you need to add this public method to the API? I don't see any discussion as to why JavaFX applications need it. It looks like it is just being used internally by `StyleManager`. Unless there is a compelling reason to add this to the API, you will need to make this method package-scope and use an accessor to access it from `StyleManager`.

I don't know why JavaFX applications would need this API. But the argument should be the same argument as for `loadBinary(URL)`, which is also only used internally by `StyleManager`. I think that this isn't opening up any new effective API surface, because it's arguably just another overload of the existing API.

-------------

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


More information about the openjfx-dev mailing list