RFR: 8274137: TableView scrollbar/header misaligned when reloading data
kcr at openjdk.java.net
Thu Sep 23 16:52:13 UTC 2021
On Thu, 23 Sep 2021 13:48:44 GMT, Robert Lichtenberger <rlichten at openjdk.org> wrote:
> This PR fixes JDK-8274137 by removing the optimization from updateHbar() that will no-op the method in case the VirtualFlow is invisible or currently has no scene.
> Since changes to the hBar's value can happen even if the VirtualFlow is not currently visible, the synchronisation between hBar and clipX must happen all the time.
> A test agains VirtualFlow has been added that will fail before the change and pass afterwards.
I am hesitant to take this fix "as is". At least not without more evaluation and testing.
First, this has the potential to hurt performance for applications that do a lot of setup on tables that aren't visible. There are several places where we defer updating and the usual way we address any such problems is to validate when "something" changes. In this case, the "something" should include becoming visible or the scene going to non-null (or alternatively being "treeVisible", which means visible and part of a scene that is showing).
Second, the code you propose to remove was added as part of the fix for [JDK-8112072](https://bugs.openjdk.java.net/browse/JDK-8112072), and while I doubt it was added to ensure correctness, it will need to be tested.
Third, I prefer that tests not check a specific implementation detail such as ensuring that derived values are computed when the scene is null or the node is invisible. Rather, it is better to check that a change made while the node is not visible (or the scene is null), is valid _after_ making it visible on an active scene.
More information about the openjfx-dev