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. ------------- Commit messages: - Add test to verify the cell position remains constant when new cells are added to the virtualFlow. - Use correct snap method to set cell layout Changes: https://git.openjdk.java.net/jfx/pull/297/files Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=297&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8178297 Stats: 25 lines in 2 files changed: 23 ins; 0 del; 2 mod Patch: https://git.openjdk.java.net/jfx/pull/297.diff Fetch: git fetch https://git.openjdk.java.net/jfx pull/297/head:pull/297 PR: https://git.openjdk.java.net/jfx/pull/297