openjdk-jfx
openjdk-jfx copied to clipboard
JDK-8228453: FlowPane resizes children to row height when rowValignment is BASELINE
https://github.com/javafxports/openjdk-jfx/blob/ed109a33dcda3aee9033ed463e861fd669643fcc/modules/javafx.graphics/src/main/java/javafx/scene/layout/FlowPane.java#L532
The observed behaviour is not as documented, as children are made to fill row height. Attached is a minimal fxml file for observing this behaviour. Resize the window to smaller width to observe. flowpane-baseline-bug.fxml.txt
This requirement has not been coded as is evident from the final layoutChildren line below https://github.com/javafxports/openjdk-jfx/blob/ed109a33dcda3aee9033ed463e861fd669643fcc/modules/javafx.graphics/src/main/java/javafx/scene/layout/FlowPane.java#L802
Incorrect documentation must be removed
@kevinrushforth Is this a docs issue or a behavioral issue?
I'd need to test it and also compare it with HBox, but my guess is that this is a behavioral bug rather than a docs issue.
I can confirm that this is a functional bug in FlowPane and not a doc bug. I will file a Bug to fix in JavaFX 14.
HBox has a similar concept, where an alignment of BASELINE_* will override the default behavior of filling each child to the height of the HBox, and instead size all children to their pref height. This override is working properly for HBox. FlowPane also resizes each child to fill the height of each row. A rowValignment value of BASELINE is documented to override this behavior, but does not.
On a related note, HBox has a fillHeight property that can be set to false as a way to override the default fill behavior of the HBox. We could consider an enhancement to add such a property to FlowPane in the future (although not until the BASELINE bug is fixed).
This is now tracked in JBS: https://bugs.openjdk.java.net/browse/JDK-8228453