On Wed, 26 Aug 2026 08:17:53 GMT, Marius Hanl <[email protected]> wrote:

>> BorderPane's measurement and layout calculations are not correct when 
>> pixel-snapping is enabled. Here is what's wrong with BorderPane, and what 
>> consequently needs to be fixed:
>> 
>> 1. Insets are not snapped:
>>    * all measurement methods use raw insets
>>    * `layoutChildren()` also uses raw insets
>> 3. Content-biased children use the wrong dependent dimension:
>>    * top and bottom children call `prefHeight(adjustedWidth)` before their 
>> final width is established; left and right have the same problem with height
>>    * measurement and layout can disagree because
>>        - constrained measurement passes the pane's total width/height 
>> without first removing its snapped insets
>>        - `getAreaWidth` uses `fillHeight=false`, while left/right/center 
>> layout uses `fillHeight=true`
>> 5. Arithmetic results are not re-snapped.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> modules/javafx.graphics/src/main/java/javafx/scene/layout/BorderPane.java 
> line 502:
> 
>> 500:             final double minWidth = minWidth(-1);
>> 501:             final double minHeight = minHeight(-1);
>> 502:             width = snapSpaceX(Math.max(width, minWidth));
> 
> Is it really needed to `snapSpace` the result of `minWidth` or `minHeight` ?

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.

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

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

Reply via email to