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

Kevin Rushforth kcr at openjdk.org
Tue Oct 28 17:51:48 UTC 2025


On Tue, 28 Oct 2025 17:12:50 GMT, Johan Vos <jvos at openjdk.org> wrote:

> > It's not a bad idea to just run layout again if after running layout the root is still dirty.
> 
> There must be historical reasons why this is not the case. @kevinrushforth might have more background info. I would guess that the original design goal was to keep a pulse as short as possible, and the `requestNextPulse` inside a pulse would be useless with this approach. I think the `requestNextPulse` was created for this reason: don't stop the world for too long, render what we have, and try to render again as soon as possible (in the next pulse). This prevents the pulse runnable from lock the JavaFX Application Thread for too long -- as said above, there are other users for this Thread.

>From what I can remember, that was indeed the main reason.  Most of the layout stabilizes pretty quickly (1-3 passes), but as Johan points out, there can be cases where ~ 10 are needed. It is better for responsiveness to do run event handlers, app Runnables (via runLater), and allow animation to proceed after each layout + CSS pass than iterate until stable.

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

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


More information about the openjfx-dev mailing list