RFR: 8370498: Improve how Node detects whether a layout property change requires a new layout pass [v2]

John Hendrikx jhendrikx at openjdk.org
Mon Oct 27 14:25:02 UTC 2025


On Thu, 23 Oct 2025 16:55:32 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> This new check is much more accurate to detect whether a parent is currently laying out its children. The previous code almost never worked, resulting in additional unnecessary layouts.
>
> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix ToolBarSkinTest
>   
>   Reusing a toolbar as part of several scenes, in combination with the StubToolkit that doesn't handle pulses makes this test fail with the relayout detection fix.

IMHO there are now two ways forward:

1. We wish to support this rather odd program in https://bugs.openjdk.org/browse/JDK-8137252 despite it **requiring** two layout passes (with a visible UI jump).  This is possible by allowing only non-resizable containers to unconditionally trigger the relayout logic (instead of having everything trigger it because of the current disfunctional `isCurrentLayoutChild` logic):

                    if (!isResizable() || (p != null && !p.inLayoutChildren())) {

2. We don't want to support this, as IMHO, it is bad practice to bind to layout properties as this will inevitably lead to multiple layout passes and jumps (which makes JavaFX UI's appear flakey).

I've already written a couple of tests that nicely capture the advantage of this fix.  The tests clearly show that only one layout pass now occurs with this fix.

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

PR Comment: https://git.openjdk.org/jfx/pull/1945#issuecomment-3451549609


More information about the openjfx-dev mailing list