On Tue, 13 Oct 2026 10:20:00 GMT, Florian Kirmaier <[email protected]> 
wrote:

>> Follow-up to JDK-8092379: since then a gap is only rendered before a 
>> row/column in which a child starts, but two places still assumed a gap 
>> between every row/column.
>> 
>> adjustRowHeights / adjustColumnWidths reserved a gap before every row/column 
>> before distributing the percentages. They now reserve only the rendered gaps.
>> 
>> CompositeSize.getProportionalMinOrMaxSize divided the size of a spanning 
>> child by the number of rows/columns without subtracting the gaps inside the 
>> span. It now subtracts them.
>> 
>> Each fix is covered by 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).
>
> Florian Kirmaier has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   JDK-8392158
>   Small test cleanup

Hope it does not clash with #2312 .
For the failing scenarios, I think we might want to add tests.  What do you 
think?

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

> 1852:         final double top = snapSpaceY(getInsets().getTop());
> 1853:         final double bottom = snapSpaceY(getInsets().getBottom());
> 1854:         final double vgaps = heights.computeGaps(0, 
> heights.getLength());

`computeTotalWithMultiSize` L2727 computes min and pref sizes without reserving 
gaps

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

> 2065:                     final double change = Math.abs(limit) <= 
> Math.abs(portion)? limit : portion;
> 2066:                     heights.setSize(index, isSnapToPixel() ? 
> ScaledMath.rint(heights.getSize(index) + change, getSnapScaleY(this)) : 
> heights.getSize(index) + change);
> 2067:                     available = isSnapToPixel() ? Math.rint((available 
> - change) / pixelSize) * pixelSize : available - change;

`change` is not rounded, this might fail at scales != 100%

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

> 2076:              } else {
> 2077:                 // Handle the remainder
> 2078:                 portion = (int)(isSnapToPixel() ? Math.rint(available / 
> pixelSize) : available) % adjusting.size();

with snapping off, two rows constrained at 100px and a 0.5px gap should shrink 
to 47.75px each.  instead, it sizes both to 100.5 px due to rounding

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

PR Review: https://git.openjdk.org/jfx/pull/2312#pullrequestreview-5510451163
PR Review Comment: https://git.openjdk.org/jfx/pull/2312#discussion_r4264429081
PR Review Comment: https://git.openjdk.org/jfx/pull/2312#discussion_r4264446400
PR Review Comment: https://git.openjdk.org/jfx/pull/2312#discussion_r4264466118

Reply via email to