RFR: 8358450: Viewport characteristics media features [v10]
Michael Strauß
mstrauss at openjdk.org
Tue Dec 16 01:59:12 UTC 2025
On Mon, 15 Dec 2025 21:39:38 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 pull request now contains 14 commits:
>>
>> - Merge branch 'master' into feature/media-features-viewport-characteristics
>> - resolve merge conflicts
>> - Merge branch 'master' into feature/media-features-viewport-characteristics
>>
>> # Conflicts:
>> # modules/javafx.graphics/src/test/java/test/javafx/css/CssParser_mediaQuery_Test.java
>> - update cssref.html
>> - Merge branch 'master' into feature/media-features-viewport-characteristics
>> - whitespace, add final modifier
>> - Merge branch 'master' into feature/media-features-viewport-characteristics
>> - Refactor context awareness
>> - Merge branch 'master' into feature/media-features-viewport-characteristics
>> - Merge branch 'master' into feature/media-features-viewport-characteristics
>> - ... and 4 more: https://git.openjdk.org/jfx/compare/32e667df...19cdaeaa
>
> modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html line 969:
>
>> 967: <tr>
>> 968: <td class="value">display-mode</td>
>> 969: <td class="value">fullscreen | standalone</td>
>
> what does "standalone" mean?
>
> also, "fullscreen" applies to a window, but earlier it's mentioned that the media queries apply to Scene.
>
> I don't see the fullscreen styles change when I use the monkey tester Stage page (the one that allows me to set the fullscreen `Stage` bit) with the following CSS:
>
>
> @media (display-mode: fullscreen) {
> .button {
> -fx-background-color: red;
> }
> }
"Standalone" matches when "fullscreen" doesn't match. The relevant part of the [specification](https://www.w3.org/TR/mediaqueries-5/#display-modes) says that it is a window with "[...] standard system UI elements, such as window decorations, a system status bar, and/or a system back button [...]".
"Fullscreen" matches when none of that is available and the scene extends across the entire display, which is the case when the scene is hosted in a full-screen window.
Note that media queries don't change CSS precedence rules. In your example, you could check whether another rule that sets `-fx-background-color` has a higher precedence. You could try adding `!important` to quickly figure out whether the rule has any effect at all.
> modules/javafx.graphics/src/main/java/com/sun/javafx/css/media/SizeQueryType.java line 60:
>
>> 58: }
>> 59:
>> 60: private static final SizeQueryType[] VALUES = values();
>
> is this really needed?
It's not strictly needed. If we remove it, then the enum will allocate a new array on every iteration over its `values()`.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1844#discussion_r2621478173
PR Review Comment: https://git.openjdk.org/jfx/pull/1844#discussion_r2621479522
More information about the openjfx-dev
mailing list