When ContextMenu.show(node, side, x, y) is executed, the CSS is evaluated 
multiple times.
Of these 3 times, 2 process a non-final CSS state.
This leads to temporary, unnecessary changes.

This is fixed by properly defining the stylesheets and the 
ownerWindow/ownerNode properties of the context menu
before applyCss is called. The previous solution was incomplete and resulted in 
unnecessary CSS calls.

Slightly related to my other PR: https://github.com/openjdk/jfx/pull/2213
But it is fixed in a way that works independently of it.

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

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

Commit messages:
 - 8388313: worked in some comments and mixed improvements.
 - 8388313: readded accidentally removed line.
 - 8388313: Fix redundant evaluation of css when 
ContextMenu.show(Node,Side,x.y) is called

Changes: https://git.openjdk.org/jfx/pull/2215/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=2215&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8388313
  Stats: 65 lines in 5 files changed: 61 ins; 3 del; 1 mod
  Patch: https://git.openjdk.org/jfx/pull/2215.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2215/head:pull/2215

PR: https://git.openjdk.org/jfx/pull/2215

Reply via email to