> The third split PR of the CSS saga™. > > In this episode, I have a cornercase, but still a valid bug, found in > https://github.com/openjdk/jfx/pull/2225. > > In JavaFX, there is this rule where `USER < AUTHOR` style. That is, CSS will > set the property value, e.g. opacity, to the value defined in the `Scene` > stylesheet and ignore if the value was set by a setter. > > It is still possible to overwrite such value by a setter, but it will be > reapplied in the very next CSS pass. > > Now, when we apply a style in a listener which is called during CSS reset, > this style may override the CSS value. > This only happens when you style a property that is defined before the > property you are listening to. > > A CSS style reset is the operation to set the property value to the original > value because it is not styled anymore (e.g. because we removed or added a > `PseudoClass`). > > --- > > Example: `Node`'s `CssMetaData` adds `OPACITY` first and later `TRANSLATE_X`. > > So opacity is reset first, then `translateX`. If we now set the `opacity` in > a `translateX` listener, we can successfully override the `opacity`. > > The very next CSS pass will however recover this (e.g. calling `applyCss` > again). > This is not needed anymore with the fix. > > --- > > I added two tests, they are basically the same, just the order is changed. > - The first test failed before, because it sets the `opacity` in a > `translateX` listener > - The second test succeeds before and after, because it sets the `translateX` > in a `opacity` listener > > Again, shows: `OPACITY` is processed first, later `TRANSLATE_X`, which with > the fix does not matter anymore. > I reused the existing reset property logic. It is now called like before, and > as part of this fix. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
Marius Hanl 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 five additional commits since the last revision: - Merge branch 'master' of https://github.com/openjdk/jfx into 8394228-Property-value-set-by-a-listener-during-CSS-reset-is-not-overridden-by-its-style - change var - (re)track a property after reset failed. Add as CSS error. - unsettable property - 8394228: Property value set by a listener during CSS reset is not overridden by its style ------------- Changes: - all: https://git.openjdk.org/jfx/pull/2343/files - new: https://git.openjdk.org/jfx/pull/2343/files/239b3859..a90ed959 Webrevs: - full: https://webrevs.openjdk.org/?repo=jfx&pr=2343&range=04 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=2343&range=03-04 Stats: 15824 lines in 194 files changed: 10976 ins; 2145 del; 2703 mod Patch: https://git.openjdk.org/jfx/pull/2343.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/2343/head:pull/2343 PR: https://git.openjdk.org/jfx/pull/2343
