-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8185887: TableRowSkinBase fails to correctly virtualize cells in horizontal direction #1644
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back mhanl! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@Maran23 |
62f46c6
to
e811572
Compare
@Maran23 Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
/reviewers 2 |
@andy-goryachev-oracle |
We will need to check that this doesn't impact accessibility, since there are some "interesting" cases where cells are requested and a layout pass is done even when they aren't visible. @arapte As I recall, you were looking into VirtualFlow in connection with an a11y at one point. Can you test this? |
@johanvos You may want to take a look since this touches VirtualFlow. |
/issue add JDK-8252566 same issue as https://bugs.openjdk.org/browse/JDK-8276326, but for the |
@Maran23 |
Good point! Checking |
I tested the PR changes with a few a11y scenarios, and did not observe any issues. |
there seems to be a merge conflict, please sync up with the latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing on macOS 14.7.1 with the latest Monkey Tester (where I've added 200 columns case for Tree/TableView,
https://github.com/andy-goryachev-oracle/MonkeyTest )
looks good.
It feels like the horizontal scrolling has improved a bit, the vertical exhibits the same slight hiccups as with the master branch.
modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableRowSkin.java
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableRowSkin.java
Outdated
Show resolved
Hide resolved
I've got an exception on the TreeTableView page in the monkey tester after clicking a cell and then pressing control+command+RIGHT_ARROW with the VoiceOver on:
UPD: seems unrelated, the issue can be reproduced with the master branch. UPD2: the problem seems to be with the MenuBar. In the monkey tester, press |
Is this reproducible? Does it happen without this fix? If this is a regression then it needs to be fixed. UPDATE: nm, I just read Andy's updated comment. |
Created JDK-8235989 for the a11y exception issue. |
Yes, especially if you try with many columns (> 100), scrolling up and down is much faster (especially when scrolled completely to the left). When you scroll completely to the right, it is just a little bit faster than master. I have also some ideas how to improve vertical scrolling with many items, but for another day. :) |
Thank you for testing! |
@Maran23 this pull request can not be integrated into git checkout 8185887-virtualization
git fetch https://git.openjdk.org/jfx.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
By the way, a Tree/TableView with 500 columns is barely usable - locks up the UI giving me a macOS spinning beach ball quite often. Not that it's a reasonable use case. 200 is ok. May be the 500 case can be used for profiling? Speaking of the vertical scrolling - I could not use the idea implemented by the VirtualFlow in the RichTextArea as it won't work in the case of very large models. So instead it uses approximation, see Line 665 in 7ed4e6e
|
…virtualization # Conflicts: # modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableRowSkinBase.java # modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableRowSkin.java # modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java
With fixed cell size, it seems okay to me. How is your table configured?
There is a lot of stuff that can improved in the You can for example check AG-Grid, which is a pretty nicely implemented table that is very fast and has a nice API design: We only have the fixed cell size implemented, but it is not the default (and too late to change). This helps a lot since the math is very easy then. |
I checked the changes in VirtualFlow and those are ok. In absence of those tests, I believe this PR is a good step in the good direction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks!
scrolling performance is not an issue: the horizontal one has improved, and the vertical one is on par with the master.
This PR fixes the horizontal virtualization performed in the
TableRowSkinBase
, which significantly improves performance with many columns (and thus many cells). Scrolling up and down as well as scrolling left and right feels much more snappy.In order to do that, there are multiple things needed:
the
isColumnPartiallyOrFullyVisible
needs to be fixed to take theVirtualFlow
into account, not theTableView
. Since rows are inside theVirtualFlow
, we need to use the width from thereTo improve performance,
isColumnPartiallyOrFullyVisible
was refactored to take in everything that is needed directly, without reiterating through all columnsAs before, the
TableRow
adds or removes cells that are visible or not.Note that this is only done when a fixed cell size is set.
The reason for that is that we always know the row height. If not set, we need all cells so we can iterate over them to get the max height. I'm not sure if this can be improved, but this is not the goal of this PR and can be checked later
The other issue mentioned in JDK-8276326 happens only when a fixed cell size is set (empty rows). This is related and also fixed:
requestLayout
) while all cells in the viewport will receive them. As soon as they are reused, they are visually outdated and not updated, leading to empty cellsFix is to request layout to those cells as well, and as soon as they are reused, they will layout themself
VirtualFlow
sheet (as children). This will cause them to actually do the layout when requested, and especially when the height of theTableView
changed drastically (e.g. from 50 visible cells to just 10), we have 40 cells laying around, receiving the layout request I added to fix JDK-8276326, as mentioned aboveThe fix is to remove those cells from the viewport when not needed anymore.
NOTE: The
VirtualFlow
does a lot of 'clean up everything and decide which cells are visible', so I chose a performant fix (instead of removing all cells and readding them again)NOTE2: This makes the logic to make cells invisible and visible again obsolete. This was there so those unused cells laying around in the
VirtualFlow
does not receive any Mouse or KeyEvents. This can be cleaned up in a follow up PRConsiderations:
removeAll
), as the scenario that mostly happens is:Testing:
TreeTableRow
code, which before addedLabeledText
sometimes (fromLabeledSkinBase
), although it was not needed, leading to code that need to count that particular node in, in some testsVirtualFlowTestUtils.BLOCK_STAGE_LOADER_DISPOSE
which was hacky and replaced it with the normalStageLoader
mechanism (as we use pretty much everywhere else)/issue add JDK-8276326
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1644/head:pull/1644
$ git checkout pull/1644
Update a local copy of the PR:
$ git checkout pull/1644
$ git pull https://git.openjdk.org/jfx.git pull/1644/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1644
View PR using the GUI difftool:
$ git pr show -t 1644
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1644.diff
Using Webrev
Link to Webrev Comment