Skip to content
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

8178297: TableView scrolls slightly when adding new elements #297

Closed
wants to merge 3 commits into from

Conversation

jperedadnr
Copy link
Collaborator

@jperedadnr jperedadnr commented Sep 7, 2020

This PR fixes an issue that happens when adding new items to a TableView or any other control that uses VirtualFlow, if the scroll position is not 0: the virtual flow is slightly shifted down.

For instance, let's say that a cell has a layoutY of -10.0. After adding a new item to the table, during the layout pass the new value is initially modified to -9.999999999999996 (VirtualFlow::adjustByPixelAmount) , and then, after calling VirtualFlow::positionCell (that uses snapSizeY(position)) the layoutY is modified to -9.5, causing an undesired positive shift of 0.5 pixels.

Region has different snap methods: snapSizeX/Y are used to snap node dimension values, like width or height, by ceiling to the nearest pixel (which explains the -9.5 value), while snapSpaceX/Y are used to snap position values like insets, by rounding to the nearest pixel (this will give the expected -10.0).

Therefore, this PR modifies VirtualFlow::positionCell to use the snapSpaceX/Y methods, since these are being used to set the layout of the cell and not its size.

Test: A unity test has been included. It simulates the case of adding new items to the virtual flow after an initial scroll.
It currently fails after adding a few items, and it passes with the changes of this PR.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8178297: TableView scrolls slightly when adding new elements

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jfx pull/297/head:pull/297
$ git checkout pull/297

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 7, 2020

👋 Welcome back jpereda! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Ready for review label Sep 7, 2020
@mlbridge
Copy link

mlbridge bot commented Sep 7, 2020

Webrevs

@kevinrushforth
Copy link
Member

/reviewers 2

@openjdk
Copy link

openjdk bot commented Sep 8, 2020

@kevinrushforth
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@openjdk
Copy link

openjdk bot commented Sep 23, 2020

@jperedadnr this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout 8178297-virtualflow
git fetch https://git.openjdk.java.net/jfx master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed rfr Ready for review labels Sep 23, 2020
@openjdk openjdk bot added rfr Ready for review and removed merge-conflict Pull request has merge conflict with target branch labels Sep 23, 2020
Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@openjdk
Copy link

openjdk bot commented Oct 12, 2020

@jperedadnr This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8178297: TableView scrolls slightly when adding new elements

Reviewed-by: kcr, aghaisas

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 7 new commits pushed to the master branch:

  • a56ba63: 8254255: Remove obsolete .hgignore file
  • 184f12c: 8252192: Update to Visual Studio 2019 version 16.7.2
  • 7857022: 8251946: ObservableList.setAll does not conform to specification
  • 1c485a3: 8252191: Update to gcc 10.2 on Linux
  • 15e52d8: 8253696: WebEngine refuses to load local "file:///" CSS stylesheets when using JDK 15
  • 5b42b64: 8252236: TabPane: must keep header of selected tab visible
  • 77a183e: 8209788: Left/Right/Ctrl+A keys not working in editor of ComboBox if popup showing

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label Oct 12, 2020
@jperedadnr
Copy link
Collaborator Author

/integrate

@openjdk openjdk bot closed this Oct 12, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Ready to be integrated rfr Ready for review labels Oct 12, 2020
@openjdk
Copy link

openjdk bot commented Oct 12, 2020

@jperedadnr Since your change was applied there have been 7 commits pushed to the master branch:

  • a56ba63: 8254255: Remove obsolete .hgignore file
  • 184f12c: 8252192: Update to Visual Studio 2019 version 16.7.2
  • 7857022: 8251946: ObservableList.setAll does not conform to specification
  • 1c485a3: 8252191: Update to gcc 10.2 on Linux
  • 15e52d8: 8253696: WebEngine refuses to load local "file:///" CSS stylesheets when using JDK 15
  • 5b42b64: 8252236: TabPane: must keep header of selected tab visible
  • 77a183e: 8209788: Left/Right/Ctrl+A keys not working in editor of ComboBox if popup showing

Your commit was automatically rebased without conflicts.

Pushed as commit 205e4b9.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
3 participants