On Mon, 21 Sep 2026 15:48:15 GMT, Michael Strauß <[email protected]> wrote:

> `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).

Fix and test look good.
I wonder if the logic can be improved in the future so that `absoluteOffset` 
and the position are always synced correctly.

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

Marked as reviewed by mhanl (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/2317#pullrequestreview-5291675777

Reply via email to