On Thu, 27 Aug 2026 08:41:58 GMT, Marius Hanl <[email protected]> wrote:

>> I'd expect `snapSize` really, since the minimum width is the size of the 
>> content.
>> 
>> Note that what border pane is doing here is very questionable; it should 
>> have measured these things when its compute methods get called, and stored 
>> this information, as during compute is the only time the `BorderPane` can 
>> adjust its own min/pref/max size.
>
> You mean stored as variable during the `computeXXX` methods? Might be worth 
> fixing in your virtual layout PR?
> 
> Beside that, I was mostly wondering if we can trust the return value of 
> `minWidth(-1)` or `minHeight(-1)` to be always snapped and therefore correct, 
> so we never need to (re)snap it.

We can't trust those, as they delegate to user overridable methods. Also, even 
if they did snapping there, which "isSnapToPixel" would they use?  If they use 
their own, that would be useless for the parent as it may have a different 
setting. If they use their parent's snapToPixel, then you have to deal with 
there being no parent (yet).

Possibly we could include the snapping logic in `Parent` itself (it caches the 
result of the compute methods).  Those methods are final, so can't be changed. 
In that way, everyone would automatically adhere to the rules, and there would 
be no need to resnap these values when queried...  hm....

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

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

Reply via email to