RFR: 8244647: Wrong first layout pass of Scrollbar controls on touch supported devices

Ajit Ghaisas aghaisas at openjdk.java.net
Wed May 13 09:18:10 UTC 2020


On Fri, 8 May 2020 11:25:03 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> There is a visual glitch when the scrollbar controls are laid out on touch enabled devices.
> 
> The first time they are laid out in the wrong location (20 px from right or bottom), while the next passes are correct
> (8 px from right or bottom).
> The reason for this glitch is the use of `getWidth()` or `getHeight()` in the `resizeRelocate` calls to relocate the
> bars before the controls have been properly resized yet: The initial w/h values are set to the default (20 px / 100
> px), while the pref values are correctly set to 8 px.  This PR fixes that, by using the same prefWidth/prefHeight for
> both resizing and relocating.
> It has been tested on Mac OS and Linux (with `-Dcom.sun.javafx.touch=true`), and on Android and iOS.

The changes look fine.
I have a minor comment on code formatting.

modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java line 2449:

> 2448:                     double prefHeight = hbar.prefHeight(viewportBreadth);
> 2449:                     hbar.resizeRelocate(0, viewportLength-prefHeight,
> 2450:                             viewportBreadth, prefHeight);

Minor : Code formatting convention: Add spaces around '-' at 4 places in your changes.
It was not followed in earlier version, but let's correct it while touching these lines.

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

PR: https://git.openjdk.java.net/jfx/pull/215


More information about the openjfx-dev mailing list