RFR: 8276313: ScrollPane scroll delta incorrectly depends on content height [v2]
Michael Strauß
mstrauss at openjdk.java.net
Thu Dec 2 22:49:48 UTC 2021
On Thu, 2 Dec 2021 21:51:59 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Handle division by zero
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/ScrollPaneSkin.java line 895:
>
>> 893: double vRange = getSkinnable().getVmax()-getSkinnable().getVmin();
>> 894: double vPixelValue = vRange / (nodeHeight - contentHeight);
>> 895: vPixelValue = Double.isFinite(vPixelValue) ? vPixelValue : 0.0;
>
> I liked the previous logic better and would have just changed the comparison to check `(nodeHeight - contentHeight) > 0.0` (possibly saving the adjusted width or height in a local various to avoid doing it twice). As it is, this is replacing an explicit check on the source values with an out of range check on the result, which seems less intuitive. Also, the previous code did a `> 0` test and the new code effectively does a `!= 0` test.
I changed it to check the denominator values instead.
-------------
PR: https://git.openjdk.java.net/jfx/pull/660
More information about the openjfx-dev
mailing list