On Thu, 27 Aug 2026 16:55:14 GMT, Michael Strauß <[email protected]> wrote:

>>> Possibly we could include the snapping logic in `Parent` itself (it caches 
>>> the result of the compute methods)
>> 
>> interesting idea, might be worth to explore.
>
>> I'd expect `snapSize` really, since the minimum width is the size of the 
>> content.
> 
> This is the available size, not a content allocation. For example, if the 
> pane has an available size of 100.01, then we shouldn't snapSize this value 
> and arrive at an available size of 101.

Ah, I thought this was a call to some child...

So what we have here is that the border pane is given some width by its parent 
(say 100.34) and then instead of living with that value, border pane decides 
that ain't good enough and replaces that with its own min width calculation 
(which the parent should have taken into account already). I would think a 
plain `Math.max` would suffice here; rounding it just runs the risk of going 
below the width set by the parent.

I never quite liked this code, and I still think it's odd that BorderPane is 
one of the few layouts that is 2nd guessing what the parent sets for it.

But is pre-existing; I just wonder if rounding this is a good idea at all, as 
you may go below the actual width given and thus create a gap in between 
components that has nothing filling it.  So if minWidth is only 90, then it 
will take 100.34 -> 100.0 after rounding, leaving a .34 pixel gap that may show 
up in some bright color from some background leaking through.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2262#discussion_r3876300500

Reply via email to