javafxports / openjdk-jfx

The openjfx repo has moved to:
https://github.com/openjdk/jfx
GNU General Public License v2.0
1.01k stars 145 forks source link

JDK-8228453: FlowPane resizes children to row height when rowValignment is BASELINE #348

Open SiddheshRane opened 5 years ago

SiddheshRane commented 5 years ago

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

nlisker commented 5 years ago

@kevinrushforth Is this a docs issue or a behavioral issue?

kevinrushforth commented 5 years ago

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.

kevinrushforth commented 5 years ago

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).

kevinrushforth commented 5 years ago

This is now tracked in JBS: https://bugs.openjdk.java.net/browse/JDK-8228453