RFR: 8364149: Conditional stylesheet imports [v3]
Michael Strauß
mstrauss at openjdk.org
Thu Feb 26 00:56:12 UTC 2026
On Wed, 25 Feb 2026 20:35:07 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>>
>> - Merge branch 'master' into feature/conditional-import
>> - Merge branch 'master' into feature/conditional-import
>> - Conditional stylesheet imports
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/css/media/MediaQueryList.java line 45:
>
>> 43: * Attempts to determine the result of this media query list without a context, and returns
>> 44: * {@link TriState#TRUE} if it matches for all possible contexts, {@link TriState#FALSE} if
>> 45: * it matches for no possible context, or {@link TriState#UNKNOWN} if the result depends on
>
> what does it mean "if it matches for no possible context"? what's a context? maybe provide an example or explain in simpler terms?
>
> it's not a public class so it might be ok, just looks a bit cryptic to me.
I've changed it a little bit, maybe the new version is easier to understand. What this context-free evaluation function is meant to do is to allow the CSS system to statically detect whether an import can never match (or conversely, whether it always matches).
The goal is to eventually be able to remove the hard-coded special theme stylesheets (for example `modena/touch.css`), and instead use conditional imports in the main stylesheet. If you then run the JavaFX application on a machine without touch input, there's no point in adding the overhead of loading touch-related styles. With this method, the CSS system can detect that none of the styles will ever match, and just skip the stylesheet entirely.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2031#discussion_r2856251718
More information about the openjfx-dev
mailing list