On Mon, 18 Aug 2025 18:00:39 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:
> > If the node is unmanaged, why does it need a relayout in practice? > > The unmanaged node does not need relayout, but its potentially managed > children do. Just like a Scene does not need layout, but its root does. A > node being unmanaged affects its **parent** (the parent must skip it for > layout calculations), but does not free it from doing layout on its own > children (if I interpret the documentation correctly). > > Let's take this hierarchy: > > ``` > Region > StackPane (unmanaged) > ImageView > ``` > > The Region will not lay out the stack pane as it is unmanaged, so I position > the unmanaged child manually with `resizeRelocate`. The StackPane now has a > defined position and size. When I add children to it, the StackPane's > `layout` (and conversely `layoutChildren`) should still be called to ensure > the children nicely fill the StackPane's space. > > JavaFX currently will do steps 1 and 2, but does not do step 3: > > 1. Another child is added to the StackPane (an overlay for the ImageView) > this triggers a requestLayout on that child which marks it as needing layout > > 2. This propagates to the parent, which is also marked as needing layout, > but it is considered to be a layout root, so no further propagation occurs > > 3. Since a layout root was encountered, it should be added to the list of > dirty layout roots (implemented in this PR). This will clear all the needs > layout flags (otherwise they stay `true` and never go back to `false` again). > > > The documentation however seems quite clear that step 3 is also supposed to > be done. So, as of now unmanaged parents do not layout their children? I thought they did. <img width="1346" height="924" alt="immagine" src="https://github.com/user-attachments/assets/a1e3c93c-7855-4591-a8df-504d48f6da60" /> Am I getting something wrong? ------------- PR Comment: https://git.openjdk.org/jfx/pull/1874#issuecomment-3213393789