RFR: 8313709: Wrong layout of a FlowPane in a BorderPane in a ScrollPane, if padding is too big [v2]

Andy Goryachev angorya at openjdk.org
Fri Aug 18 17:50:30 UTC 2023


On Fri, 18 Aug 2023 17:34:28 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/javafx/scene/layout/BorderPane.java line 395:
>> 
>>> 393: 
>>> 394:             double middleAreaHeight = Math.max(0,
>>> 395:                     height - insets.getTop() - insets.getBottom() - topPrefHeight - bottomPrefHeight);
>> 
>> should these be snapped?  snappedBottomInset() etc.?
>
> You might be right. 
> 
> In this case, `topPrefHeight` comes from `getAreaHeight()`, that calls `computeChildPrefAreaHeight()` that ultimately uses `snapSpaceY()`. 
> 
> However, this would also mean that the returned value should use snapped insets as well?
> 
> return insets.getLeft() +
>                 Math.max(leftPrefWidth + centerMinWidth + rightPrefWidth, Math.max(topMinWidth,bottomMinWidth)) +
>                 insets.getRight();
> 
> and also for the layout call?

Following the great insight @hjohn vocalized in one of the earlier PRs, at the end we are always dealing with integer pixel coordinates.  

so, to be correct, any computation that returns pixel coordinates must use snapped values.  (it also means that any computation that does not result in pixel coordinates, might use unsnapped values, such as when we try to distribute a single pixel among many columns or nodes).

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1203#discussion_r1298708502


More information about the openjfx-dev mailing list