8325564: ComboBox popup does not correctly resize after update when on display#2052
8325564: ComboBox popup does not correctly resize after update when on display#2052Ziad-Mid wants to merge 9 commits into
Conversation
|
👋 Welcome back zelmidaoui! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
Webrevs
|
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
The fix does not look right: I don't think the new flag is needed, but instead the popup should be properly sized.
On top of that, the fixed code does not work: the first update shows a tiny popup where most of the area is covered with scrollbars, and the second update (after 2 seconds) still displays scrollbars. The scrollbars should not be there at all:
(on macOS retina, scale=2)
there is more: on an external monitor at scale=1, if I press the [Update] button then quickly click on the combo box, the popup is shown but very small, and it does not change:
| final Point2D p = getPrefPopupPosition(); | ||
|
|
||
| final Node popupContent = getPopupContent(); | ||
| if (popupResize && popupContent instanceof Region) { |
There was a problem hiding this comment.
minor stylistic suggestion:
if (popupResize && popupContent instanceof Region r) {
r.setMinSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
r.setPrefSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
}
There was a problem hiding this comment.
also, look in sizePopup(), there is if (popupContent instanceof Region) { with the else clause which handles other cases.
Should any possible fix be in sizePopup() instead?
| popupResize = false; | ||
| } | ||
|
|
||
| final void requestPopupLayout() { |
There was a problem hiding this comment.
misnomer: the name suggests it's a request, but in fact it does much more by calling
reconfigurePopup();
sizePopup();
|
/reviewers 2 |
|
@andy-goryachev-oracle |
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
The last change is a step in the right direction. Three issues:
- Please merge the latest master, there was a change in sizePopup() which makes your code fail to compile. In general, it's a good idea to merge the latest master if your PR is long going or there was a change in a related area.
- The reproducer shows the popup in the body of the first
KeyFrameviacomboBox.show();. Once the popup is shown, the second background update does not resize the popup and you see the scrollbars. - If you remove the
comboBox.show();line, the expectation is that the popup will not be shown, but it is, resulting in this:
Also, I've noticed the size of the popup control in the step 2 changes (also present in the master branch, so I guess it's expected)
|
@crschnick would you be able to review this PR? |
|
Looks much better! Two things:
On my primary retina display I get the scrollbars first time around. The scrollbars disappear on second showing:
|
|
@Ziad-Mid This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a |
|
@Ziad-Mid This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the |
Sorry, I didn't see this comment until now. I can take a look Also what happened to bridgekeeper? That inactivity timeout looks wrong |
|
@andy-goryachev-oracle Can I still review this? |
|
Let me check with @Ziad-Mid ... |
Yes, this looks like a hiccup of some sort. The initial "inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes..." was correct. The "hey it's been 4 more weeks" auto-close one hour later was not. I'm reopening it. |
|
... and I think @Ziad-Mid is still working on it, #2052 (comment) has not been addressed. |
|
@Ziad-Mid This pull request is already open |
Yes, I still do |
|
/template append |
|
@Ziad-Mid The pull request template has been appended to the pull request body |
|
So I think the problem identified in #2052 (comment) is still there. I've updated the test not only to add items but also remove them (making the list smaller, just in case) - see the latest version to reproduce,
Expecting to see no scrollbar, but:
|
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
still see the scrollbar.
|
In general I would say that if you have to rely on using Platform.runLater for some kind of layouting and size changes within a Control or Skin, the approach is usually not the right one. I would try to replace the runLater call with another implementation that fixes the issue as well somehow. |
|
Tested with latest test from Andy and it works. |
|
While fixing https://bugs.openjdk.org/browse/JDK-8338145, I found the cause to be the fact that the popup did not have the right size computed before the first show. That is why the fix calls |


Fixed popup size not changing to show more items or less when changing the number of items in
ComboBoxby adding apopupResizevariable which triggers a request layout when there is change in items list.Tested with the test app in bug and MonkeyTester.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/2052/head:pull/2052$ git checkout pull/2052Update a local copy of the PR:
$ git checkout pull/2052$ git pull https://git.openjdk.org/jfx.git pull/2052/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2052View PR using the GUI difftool:
$ git pr show -t 2052Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/2052.diff
Using Webrev
Link to Webrev Comment