`VirtualFlow` stores the scroll location in two values:
- `position`: a value from `0` to `1`
- `absoluteOffset`: the scroll distance in pixels

These two values can become inconsistent in the following scenario, which is 
exercised by the test:

Given three cells, each 25 pixels high, in a viewport that is 75 pixels high so 
all cells fit. Both scroll values must therefore be zero.
The test asks the VirtualFlow to scroll to the last cell, setting 
`absoluteOffset` to `50`. The VirtualFlow sets `position` to zero because all 
cells still fit.

However, `position` was already zero. Setting it to zero again does not trigger 
the code that updates `absoluteOffset`, and the offset incorrectly stays at 
`50`. The patch is quite easy: it sets `absoluteOffset` to zero when all cells 
fit.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - fix
 - failing test

Changes: https://git.openjdk.org/jfx/pull/2317/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=2317&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8392756
  Stats: 36 lines in 2 files changed: 31 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jfx/pull/2317.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2317/head:pull/2317

PR: https://git.openjdk.org/jfx/pull/2317

Reply via email to