RFR: 8276167: VirtualFlow.scrollToTop doesn't scroll to the top of the last element [v3]
    eduardsdv 
    duke at openjdk.java.net
       
    Fri Dec 10 13:38:20 UTC 2021
    
    
  
On Fri, 10 Dec 2021 12:33:19 GMT, Johan Vos <jvos at openjdk.org> wrote:
>> 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?
This part was originally copied from the 'VirtualContainerBase'. There was this comment: _special-case the 'greater than row count' condition to have it be perfectly at position 1_.
Maybe to avoid throwing the IndexOutOfBoundsException or simply to scroll to the end.
-------------
PR: https://git.openjdk.java.net/jfx/pull/656
    
    
More information about the openjfx-dev
mailing list