On Thu, 10 Sep 2026 14:30:27 GMT, Florian Kirmaier <[email protected]> 
wrote:

> growOrShrinkRowHeights and growOrShrinkColumnWidths need the other dimension 
> to compute the min-limits correctly.
> Adding them leads to some follow-up changes in adjustColumnWidths and 
> adjustRowHeights.
> 
> The fix is covered by two tests that fail before and pass after the change.
> A test application can be found in the ticket.
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

I hope this PR does not clash much with #2312

modules/javafx.graphics/src/main/java/javafx/scene/layout/GridPane.java line 
1853:

> 1851:     }
> 1852: 
> 1853:     private double adjustRowHeights(final CompositeSize heights, double 
> height, CompositeSize widths) {

don't need `final` here

modules/javafx.graphics/src/main/java/javafx/scene/layout/GridPane.java line 
1888:

> 1886:                 double remaining = 
> growToMultiSpanPreferredHeights(heights, heightAvailable);
> 1887:                 remaining = growOrShrinkRowHeights(heights, 
> Priority.ALWAYS, remaining, widths);
> 1888:                 remaining = growOrShrinkRowHeights(heights, 
> Priority.SOMETIMES, remaining, widths);

might be pre-existing: computes twice if the layout height is below minimum

modules/javafx.graphics/src/main/java/javafx/scene/layout/GridPane.java line 
2050:

> 2048:         boolean isPositive = wasPositive;
> 2049: 
> 2050:         CompositeSize limitSize = shrinking? computeMinHeights(widths) :

this might produce wrong results with baseline-aligned nodes (we might want to 
add VPos.BASELINE case to the tests).

example: narrow pane with 
- baseline-aligned TextFlow at row 0
- Region min height=30, prefHeight=100 at row 1

modules/javafx.graphics/src/main/java/javafx/scene/layout/GridPane.java line 
2098:

> 2096:     }
> 2097: 
> 2098:     private double adjustColumnWidths(final CompositeSize widths, 
> double width, CompositeSize heights) {

final

modules/javafx.graphics/src/main/java/javafx/scene/layout/GridPane.java line 
2298:

> 2296:         boolean isPositive = wasPositive;
> 2297: 
> 2298:         CompositeSize limitSize = shrinking? computeMinWidths(heights) :

maybe add a space before ?

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

PR Review: https://git.openjdk.org/jfx/pull/2313#pullrequestreview-5509331499
PR Review Comment: https://git.openjdk.org/jfx/pull/2313#discussion_r4263475538
PR Review Comment: https://git.openjdk.org/jfx/pull/2313#discussion_r4264132708
PR Review Comment: https://git.openjdk.org/jfx/pull/2313#discussion_r4264118101
PR Review Comment: https://git.openjdk.org/jfx/pull/2313#discussion_r4263479917
PR Review Comment: https://git.openjdk.org/jfx/pull/2313#discussion_r4263485562

Reply via email to