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 11:31:52 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.
The fix in https://bugs.openjdk.org/browse/JDK-8137252 is only "solving" the problem because now a relayout **always** occurs (until nobody modifies layout X/Y to different values). The `isCurrentLayoutChild` check never returns `true` for a `StackPane` or any other layout container, because they don't update the current layout child before positioning said child. The code in `Parent::layoutChildren` is a red herring and will not apply this logic magically to all other layout containers.
So, yes, https://bugs.openjdk.org/browse/JDK-8137252 fixes the problem, but it does so at the cost of an extra layout pass in all cases. In the sample application, even if there was only a Label in that stack pane and no Ellipse, then the first time it is laid out, it will do a 2nd pass because **Label's** layout X/Y was modified...
I'm now looking further how this problem relates to `Shape` and its subtypes, as this fix is not a problem for node types based on `Parent`.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1945#issuecomment-3450810439
More information about the openjfx-dev
mailing list