RFR: 8267554: Support loading stylesheets from data-URIs [v3]
Kevin Rushforth
kcr at openjdk.java.net
Tue Jun 22 22:47:29 UTC 2021
On Mon, 21 Jun 2021 15:04:26 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> An overloaded method with a new signature is still a new method that adds to the public API, although in an easy to understand way. I agree that the same argument could be made for it as for `loadBinary(URL)`, but if neither are needed, then maybe we would be better off to deprecate the existing method (not as part of this enhancement, of course), rather than adding a similar one that also isn't needed as part of the public API. On the other hand, if there is a good reason, I don't see a problem adding this new method.
>>
>> If you do propose to add this API, you will need to add an appropriate `@since` tag, and you should write an API-level test for this method as part of `StylesheetTest`.
>
> It seems to me that the only useful thing an application developer could do with a `Stylesheet` instance is to inspect its contents (the relevant APIs in javafx.css are public, after all). That seems like a niche use case, but to the extent that there are applications out there that inspect binary stylesheets, having the option to load them from a stream seems at least marginally useful.
>
> I slightly lean towards adding this public API also to not having to introducing a new helper class _just_ for this one benign method. If you have a stronger opinion on this, please go ahead and make the call.
Avoiding the need for an accessor isn't sufficient reason, but I do like the symmetry with the existing `loadBinary(URL)` method. Also, one can create a `Stylesheet` by parsing a text file using the various `parse` methods of `CssParser`, so there is ample precedent for doing this. I have no objection to the public method.
-------------
PR: https://git.openjdk.java.net/jfx/pull/536
More information about the openjfx-dev
mailing list