RFR: 8306447: Adding an element to a long existing list may cause the first visible element to jump [v2]
Andy Goryachev
angorya at openjdk.org
Mon May 1 17:11:32 UTC 2023
On Sat, 29 Apr 2023 20:05:52 GMT, Johan Vos <jvos at openjdk.org> wrote:
>> Calculate position of first visible element before propagating changes.
>> Make sure to restore the position of said element after the changes are done.
>>
>> Fix JDK-8306447
>
> Johan Vos has updated the pull request incrementally with one additional commit since the last revision:
>
> Make sure not to change index and offset when the cell count change.
> Use the old cellcount when doing initial calculations, as the estimated
> cell size will otherwise be wrong.
>
> Extend the testcase for this, by adding 9 cells instead of just 1
It looks like there might be another case, but it might be unrelated to the current issue.
When clicking on Jump w/VirtualFlow button in the Monkey Tester, the following action is performed:
protected void jump() {
int sz = control.getItems().size();
int ix = sz / 2;
control.getSelectionModel().select(ix);
VirtualFlow f = findVirtualFlow(control);
f.scrollTo(ix);
f.scrollPixels(-1.0);
}
It is expected that second and any subsequent click on the button should not have an impact, i.e. the scroll position would be the same, but it is not (the view scrolls by 1 pixel on each click).
It is a very minor issue though.
video:
https://user-images.githubusercontent.com/107069028/235493278-dd07b56f-2078-4936-9a95-4c7a412177f1.mp4
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1099#issuecomment-1529955425
More information about the openjfx-dev
mailing list