On Thu, 22 Oct 2026 13:20:08 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
>   Floor the last-row in multi-span portion to whole device pixels

thank you for parameterizing scales and gaps!

who is sandec-bot?  :-)

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

> 1939:                         }
> 1940:                         double curLength = 
> heights.computeTotal(interval.begin, interval.end);
> 1941:                         actualPortion = 
> Math.min(ScaledMath.floor(Math.max(0, (ms.getValue() - curLength) / 
> intervalRows), scale),

potential regression:

- scale=1.5, no gaps
- three rows, pref=10, priorities ALWAYS, ALWAYS, NEVER
- child spanning three rows pref=36
- size grid to 36.5

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

> 2007:                         double curLength = 
> heights.computeTotal(interval.begin, interval.end);
> 2008:                         double missing = Math.max(0, ms.getValue() - 
> curLength);
> 2009:                         actualPortion = Math.min(isSnapToPixel() ? 
> ScaledMath.floor(missing, scale) : missing,

there might be a problem with fractional max constraints (here and L2255):

- scale=100%
- two rows with child's pref=20 and 10
- limit the first row at 10.25
- add spanning child with pref=40
- resize grid to height 100

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

> 2117:                         remainder = (-1.0) + remainder;
> 2118:                     }
> 2119:                     widths.setSize(i, size / scale);

another possible issue:

- scale=1.5, no gaps
- 4 columns at 25% each
- resizeable Region spanning all columns
resizde grid to 38, Region snapping exceeds the grid width

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

> 2666:                     if (i.contains(position)) {
> 2667:                         double total = multiSizes.get(i) - 
> computeGaps(i.begin, i.end);
> 2668:                         double propSize = segment(total, i, position, 
> pixelSize);

minimum constraint can be violated:

- scale=1.0, no gaps
- 4 rows with pref=200, minimums 20, 0, 34, 0
- a child spanning last three rows, min=100
- resize the grid to 120

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

PR Review: https://git.openjdk.org/jfx/pull/2312#pullrequestreview-5617955632
PR Review Comment: https://git.openjdk.org/jfx/pull/2312#discussion_r4351435857
PR Review Comment: https://git.openjdk.org/jfx/pull/2312#discussion_r4351210951
PR Review Comment: https://git.openjdk.org/jfx/pull/2312#discussion_r4351604608
PR Review Comment: https://git.openjdk.org/jfx/pull/2312#discussion_r4351308077

Reply via email to