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 also reuse the existing loop for the `isUserSetFont` check to improve 
the performance a bit

Implementation:
- A new private `CssHelperState` is introduced on `Node`. We need to know 
whether we can trust the `styleHelper`.
- 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.

---

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).


---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - 8388277: [REDO] Looked-up color fails for -fx-background-color in JavaFX CSS 
file

Changes: https://git.openjdk.org/jfx/pull/2225/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=2225&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8388277
  Stats: 723 lines in 5 files changed: 613 ins; 46 del; 64 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

Reply via email to