On Tue, 23 Dec 2025 13:26:36 GMT, Cormac Redmond <[email protected]> wrote:
>> Fix overflow menu triggering due to floating-point precision error.
>>
>> At 1.25 display scaling on Windows, floating-point comparison errors (e.g.
>> 109.60000000000001 > 109.6) cause the overflow menu to appear when the
>> lefthand value is regarded as larger than the righthand value.
>>
>> These should be treated as equal (and therefore not display the overflow
>> menu).
>>
>> This bug can happen in both horizontal and vertical toolbar orientation.
>>
>> The new tests added fail without this fix, and pass with it. An existing
>> test has been re-factored slightly to allow re-use and more flexibility in
>> specifying the scene's root node.
>
> Cormac Redmond has updated the pull request incrementally with one additional
> commit since the last revision:
>
> 8366739: minor test comment improvement
modules/javafx.controls/src/main/java/javafx/scene/control/skin/ToolBarSkin.java
line 702:
> 700: } else {
> 701: x = snapPositionX(x + snapSizeX(node.prefWidth(-1))
> + getSpacing());
> 702: length = snapPositionX(length);
Two things here:
- You're snapping `length` each time through the loop, I would just put that
outside the loop
- You're modifying an argument to the method; it might be clearer to use
`snappedLength` here (but that's just me, I don't like modifying arguments to
methods).
If you're worried about the `getSkinnable` and `getOrientation` call, these
should be constant through-out this loop (so that can be factored out as well
if you want).
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2016#discussion_r2643339618