> It proved that `ScrollPane.layout` depends on the result of > `WScrollPanePeer.childResized`, specifically on `setSpans` which recalculates > the spans and sets the insets. > > https://github.com/openjdk/jdk/blob/b285ed72aebe2d802fa9c071372cea6c09870b9a/src/java.desktop/share/classes/java/awt/ScrollPane.java#L514-L521 > > After the fix for [JDK-8297923](https://bugs.openjdk.org/browse/JDK-8297923), > `setSpans` that is called in `childResized` is run asynchronously on the > toolkit thread. Therefore `getViewportSize` uses the wrong insets which don't > take into account the size of the scroll bar. Because of it, the > `visibleAmount` field of adjustables is also wrong, and the scroll pane > cannot display a portion of its child component. > > I overlooked this dependency even when I was fixing the first regression, > [JDK-8310054](https://bugs.openjdk.org/browse/JDK-8310054). Had I followed > Harshitha's advice in #14478, I would've fixed this problem too. Similarly, > Phil's intuition was right: `setSpans` should be synchronous. @honkar-jdk > @prrace > > **Fix** > > The fix is to run `AwtScrollPane::_SetSpans` synchronously using > `AwtToolkit::InvokeFunction`. > > I also addressed [Sergey's > concern](https://github.com/openjdk/jdk/pull/14478#discussion_r1239049983): > `VerifyState` is now called after `SetInsets`. @mrserb > > Client tests are green.
Alexey Ivanov has updated the pull request incrementally with one additional commit since the last revision: Add Robot.waitForIdle It ensures getViewportSize in the test is called after AwtScrollPane::_SetSpans completes on the toolkit thread. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14815/files - new: https://git.openjdk.org/jdk/pull/14815/files/f9e59211..f40921ca Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14815&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14815&range=00-01 Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14815.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14815/head:pull/14815 PR: https://git.openjdk.org/jdk/pull/14815
