On Sat, 8 Aug 2026 22:30:26 GMT, John Hendrikx <[email protected]> wrote:

>> modules/javafx.graphics/src/main/java/javafx/scene/layout/LayoutSupport.java 
>> line 62:
>> 
>>> 60:             alt = computedBoundedHeight(snapper, child, fillHeight, 
>>> contentHeight);
>>> 61:         }
>>> 62:         return left + snapper.snapSizeX(child.minWidth(alt)) + right;
>> 
>> What I was always wondering here (since this is the same as in `Region`: Why 
>> do we not snap the final value? We especially would also save some cycles if 
>> we do not snap intermediate values and snap them again later. Same on the 
>> other methods - maybe something to improve later?
>
> You are right that the final value should be snapped, although in this case 
> the error will be tiny (I think it snaps `left` and `right` so at least we're 
> not summing snapped and unsnapped values here).
> 
> However, in the interest of proving that this PR doesn't have any functional 
> changes, I didn't do this (slight errors do make some tests fail and they'd 
> need adjusment).
> 
> For similar reasons I haven't switched `Math.round` to `Math.rint` in this 
> PR, even though we really should do that soon (`Math.round` will mess up 
> large double values, and does a conversion to `long` that we really don't 
> need).

There was a discussion about snapping only final values or also intermediate 
values, but I can't recall where. Maybe it was in 
https://github.com/openjdk/jfx/pull/445.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2241#discussion_r3749560108

Reply via email to