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

Marius Hanl mhanl at openjdk.org
Wed Jan 21 12:56:56 UTC 2026


On Thu, 15 Jan 2026 22:36:31 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

> 1. Pulse starts
> 2. Pre-layout listeners called
>    
>    * View controls add/remove children, call `updateItem` based on their current size
>      
>      * `updateItem` can do whatever it wants, including modifying styles, adding/removing children, user code need not worry about layout semantics
> 3. CSS pass
> 
> LAYOUT STARTS -- refrain from doing "more" work besides positioning/sizing
> 
> 4. Sizes get computed (by `resizeRootToPreferredSize`) down to leafs
> 5. Layout methods are called (according to dirty status) down to leafs
> 
> LAYOUT ENDS
> 
> 6. Either during layout or in a post-layout listener, the View class discovers it did not have enough cells, it asks for a new layout
> 7. After post layout listeners have run, check if another layout is needed immediately, go to step 2 (unless limit exceeded)
> 8. Pulse ends
> 
> In this way we can prevent unnecessary layouts, and also prevent doing dangerous things during layout.

Could we streamline this process with e.g. a new protected method (initially empty / delegating to `skinBase`) that is called (instead of setting pre-layout listeners everywhere). Something like `prelayout()`. We then can start shifting update logic there for `Controls`, together as an Umbrella Task? Probably need to discuss this first in the mailing list, but I agree this would be a nice idea. When doing, we should also document that, maybe in `docs` folder like the jdk has (was already discussed at one point in the mailing list at one point, so we may should just start).

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

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


More information about the openjfx-dev mailing list