RFR: 8345348: CSS media feature queries [v21]
Andy Goryachev
angorya at openjdk.org
Mon May 5 20:46:54 UTC 2025
On Sat, 3 May 2025 08:56:07 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> Implementation of [CSS media queries](https://gist.github.com/mstr2/cbb93bff03e073ec0c32aac317b22de7).
>
> Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 30 commits:
>
> - Merge branch 'master' into feature/media-queries
> - cssref doc
> - Merge branch 'master' into feature/media-queries
> - reorder fields
> - remove ReadOnlyBooleanWrapper
> - Scene preferences only actively observe platform preferences when the scene is showing
> - formatting
> - typo
> - use equality instead of identity
> - rename TokenStream methods
> - ... and 20 more: https://git.openjdk.org/jfx/compare/498b7e4c...626a904d
Should this work?
@media (prefers-color-scheme: dark) and not (prefers-persistent-scrollbars) {
.root {
-fx-accent: yellow;
}
}
(it does not, writes to stderr):
WARNING: CSS Error parsing '@media (prefers-color-scheme: dark) and not (prefers-persistent-scrollbars) {
.root {
-fx-accent: yellow;
}
}: Expected LPAREN at [1,40]
modules/javafx.graphics/src/test/java/test/com/sun/javafx/css/media/MediaQuerySerializerTest.java line 46:
> 44: import static org.junit.jupiter.api.Assertions.*;
> 45:
> 46: public class MediaQuerySerializerTest {
just a thought: this could have been a parameterized test (this version is ok though).
modules/javafx.graphics/src/test/java/test/com/sun/javafx/css/parser/CssLexerTest.java line 47:
> 45: }
> 46:
> 47: private void checkTokens(List<Token> resultTokens, Token... expectedTokens) {
should there be new tests in `CssLexerTest` for the `@media` queries?
modules/javafx.graphics/src/test/java/test/javafx/css/CssParser_mediaQuery_Test.java line 185:
> 183: @Test
> 184: void disjunctionAndConjunctionCanNotBeCombined() {
> 185: Stylesheet stylesheet = new CssParser().parse("""
could we also test for "or not" and "and not" ?
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1655#issuecomment-2852289887
PR Review Comment: https://git.openjdk.org/jfx/pull/1655#discussion_r2074112314
PR Review Comment: https://git.openjdk.org/jfx/pull/1655#discussion_r2074118560
PR Review Comment: https://git.openjdk.org/jfx/pull/1655#discussion_r2074127483
More information about the openjfx-dev
mailing list