RFR: 8350149: VBox ignores bias of child controls when fillWidth is set to false [v4]

John Hendrikx jhendrikx at openjdk.org
Mon Mar 24 21:30:16 UTC 2025


On Mon, 24 Mar 2025 17:59:03 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java line 2093:
>> 
>>> 2091:         double right = margin != null ? snapSpaceX(margin.getRight(), snap) : 0;
>>> 2092: 
>>> 2093:         return width - left - right;
>> 
>> snap?
>
> @hjohn You may have answered this question in the larger discussion above, but I wanted to double-check.

Yes, sorry, this was addressed in the larger discussion.  I've left this as-is to keep the PR focus'd on one thing.

The calculation here is using 3 snapped values, and one can reasonably assume the result is "nearly" snapped.  If this value is used later with a ceiling function though, then it might ceil to the next higher value if the result is slightly too high due to floating point errors.  This is why it might be a good idea to adjust how our ceiling functions work in all cases; instead of using a tiny epsilon (or ulp), use a much larger value but still tiny in terms of pixels (like 1/10000th of a pixel).  Any "near" snapped values won't accidentally get rounded up to the next higher pixel then when ceil is used.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1723#discussion_r2010949531


More information about the openjfx-dev mailing list