RFR: 8089589: [ListView] ScrollBar content moves toward-backward during scrolling. [v2]

Kevin Rushforth kcr at openjdk.java.net
Fri Apr 16 12:23:41 UTC 2021


On Fri, 16 Apr 2021 08:46:49 GMT, Johan Vos <jvos at openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java line 1305:
>> 
>>> 1303:             // Otherwise, our goal is to leave the index of the cell at the
>>> 1304:             // top consistent, with the same translation etc.
>>> 1305:             if (position != 0 && position != 1 && (currentIndex >= cellCount)) {
>> 
>> Comparing a double for equality or inequality is not the best coding practice. Anyway, I see this pattern throughout this file. We can live with it for now.
>
> The comparison was already in the code. I agree though it is brittle in general, although it can probably be proved that in this case, the value of position will never be e.g. 1+\delta with \delta as small as possible.
> But it would be good practice for a follow-up issue to remove the equality checks on doubles in this file (and others).

I agree that this shouldn't be changed as part of this fix, since it is preexisting. Filing one or more follow-on issues to address this more globally seems good.

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

PR: https://git.openjdk.java.net/jfx/pull/398


More information about the openjfx-dev mailing list