On Sat, 20 Sep 2025 00:21:16 GMT, Michael Strauß <[email protected]> wrote:

> Given a media query with more than one rule:
> 
> 
> @media (prefers-color-scheme: dark) {
>     .foo1 {
>         -fx-background-color: black;
>     }
>     .foo2 {
>         -fx-background-color: white;
>     }
> }
> 
> 
> The following CSS parser error is encountered: `Expected RBRACE`
> 
> The reason for this bug is that the CSS parser mistakenly expects that after 
> the first rule was parsed, the media query should be terminated with a 
> closing curly brace. This is obviously incorrect, the fix is relatively 
> simple.

The change looks good, verified with the monkey tester on macOS 15.6.1 M1.

Question:
When I supply a stylesheet with two missing close braces, the master branch 
complains about `Expected RBRACE at [3,0]` to stderr, the code in this PR does 
not.

Here is my CSS:

@media (prefers-reduced-motion: reduce) {
  .root { -fx-accent: yellow; }
  .foo { bar: bax; }
    @media (prefers-color-scheme: light) {
      .foo { bar: baxss; }
      .root { -fx-accent: red; }
    }
    @media (prefers-color-scheme: dark) {
      .foo { bar: baxss; }
      .root { -fx-accent: green; }


(the css is updated via `Scene::getStylesheets`)

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

PR Comment: https://git.openjdk.org/jfx/pull/1915#issuecomment-3321821697

Reply via email to