On Mon, 24 Mar 2025 17:59:03 GMT, Kevin Rushforth <k...@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

Reply via email to