RFR: 8366739: ToolBar: overflow menu with fractional scale (2)

Marius Hanl mhanl at openjdk.org
Sun Dec 21 21:02:13 UTC 2025


On Sun, 21 Dec 2025 02:42:12 GMT, Cormac Redmond <duke at openjdk.org> 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.

Looks good to me too. Snapping fix makes sense, as we did the same thing in `ScrollPaneSkin`.

modules/javafx.controls/src/test/java/test/javafx/scene/control/skin/ToolBarSkinTest.java line 113:

> 111: 
> 112:         BorderPane bp = new BorderPane();
> 113:         bp.setTop(new HBox(toolBar));

Is it possible to use the `HBox` directly, like the other test? 
The `BorderPane` setup is fine, I'm just asking since if we don't need it to reproduce it, we can also remove it to minify the test setup.

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

Marked as reviewed by mhanl (Committer).

PR Review: https://git.openjdk.org/jfx/pull/2016#pullrequestreview-3601916762
PR Review Comment: https://git.openjdk.org/jfx/pull/2016#discussion_r2637986769


More information about the openjfx-dev mailing list