> Another much better try to fix the issue. > I recommend to read: https://github.com/openjdk/jfx/pull/2201 first. All > tests from there are included. > I added some new ones that succeed before and after, a first step for more > CSS tests as discussed in: > https://github.com/openjdk/jfx/pull/2218#issuecomment-5094495306 > > My new idea is now the following constraint, which I think is also a much > better approach: > - A `CssStyleHelper` always has a correct `firstStyleableAncestor`. We can at > any time trust and rely on it. > - We will build and reuse a 'styleable chain' > - We will restart when the node structure changed > > Implementation: > - We now save flags to exactly know in which CSS state the `Node` is. > - We will collect all `Node`s in the scene tree once and then reuse the list > when we need to process a stale `styleHelper` from a parent. > - This will make sure we do no process the parent again and again > - Not every `Node` has a `styleHelper` - it is only created when needed, so > we can not attach the flag in there. > > This fixes the issue while a deep (optionally unstyled) scene graph has no > performance penality. > The approach is similar than my previous PR, but more smart. And with the set > constraint mentioned above. > > --- > > I do think we can improve the `CssStyleHelper` more. But for another day. > ~Maybe at one point, with more tests and when all requirements are clear, we > can find a way without `CssHelperState` and without creating an empty > `CssStyleHelper` just to hold trigger states (because of that, we need to > check `styleHelper.cacheContainer != null` a lot of times).~ -> Fixed in > https://github.com/openjdk/jfx/pull/2333 > > > --------- > - [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 incrementally with three additional commits since the last revision: - Simplify the code a little bit - New approach: Reset cssProperties on transitionToState. This fixes basically all weird cases we could have where listeners run during StyleHelper creation to break all our assumptions. transitionToState already handled all cases where css properties must be reset except one: When the property disappeared from the new style map entirely (e.g. changed style class). This is now changed. This makes it actually more CSS spec compliant for transitions and in general, improves the behavior by letting one method do, well the transition. - corner case ------------- Changes: - all: https://git.openjdk.org/jfx/pull/2225/files - new: https://git.openjdk.org/jfx/pull/2225/files/bad4e88c..a78f7ea2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jfx&pr=2225&range=09 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=2225&range=08-09 Stats: 371 lines in 6 files changed: 112 ins; 154 del; 105 mod Patch: https://git.openjdk.org/jfx/pull/2225.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/2225/head:pull/2225 PR: https://git.openjdk.org/jfx/pull/2225
