RFR: 8276167: VirtualFlow.scrollToTop doesn't scroll to the top of the last element [v3]

Johan Vos jvos at openjdk.java.net
Fri Dec 10 12:36:16 UTC 2021


On Mon, 6 Dec 2021 14:58:52 GMT, eduardsdv <duke at openjdk.java.net> wrote:

>> Fix VirtualFlow.scrollToTop(int) doesn't scroll to the top of the last element but to the bottom of the last element.
>
> eduardsdv has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8276170: Add junit for VirtualFlow.scrollToTop(int)

modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java line 1584:

> 1582:         boolean posSet = false;
> 1583: 
> 1584:         if (index > getCellCount() - 1) {

I agree that the previous code violates the contract that the flow should show the specified cell aligned to the top.

I wonder though if this test is needed at all. What is the goal of providing an index that is larger than getCellCount() -1?

modules/javafx.controls/src/test/java/test/javafx/scene/control/ListViewKeyInputTest.java line 1844:

> 1842:         }
> 1843:         listView.setPrefHeight(130); // roughly room for four rows
> 1844:         Toolkit.getToolkit().firePulse();

Why is this needed here?

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

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


More information about the openjfx-dev mailing list