On Thu, 4 Jun 2026 16:19:21 GMT, Ziad El Midaoui <[email protected]> wrote:

>> Fixed popup size not changing to show more items or less when changing the 
>> number of items in `ComboBox` by adding a `popupResize` variable which 
>> triggers a request layout when there is change in items list.
>> Tested with the test app in bug and MonkeyTester.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Ziad El Midaoui has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 10 additional 
> commits since the last revision:
> 
>  - Merge branch 'openjdk:master' into 8325564.popupSize
>  - Fixed Scrollbar issue with CSS
>  - Merge branch 'openjdk:master' into 8325564.popupSize
>  - Merge branch 'openjdk:master' into 8325564.popupSize
>  - Fix scrollbar issue
>  - Merge branch 'openjdk:master' into 8325564.popupSize
>  - Removed 'popupResize' flag
>  - Merge branch 'openjdk:master' into 8325564.popupSize
>  - Merge branch 'openjdk:master' into 8325564.popupSize
>  - Fixed ComboBox popup size not changing after update.

So while the fix works, I still think that it is not the right solution. 
Manually changing the size of the popup content should not be necessary imo 
when done right

modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java
 line 28:

> 26: package javafx.scene.control.skin;
> 27: 
> 28: import javafx.application.Platform;

Unused import

modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java
 line 475:

> (failed to retrieve contents of file, check the PR for context)
What if someone has bound the size of the popup content from the outside? Then 
this will fail

modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java
 line 476:

> 474:             final Region r = (Region) popupContent;
> 475:             r.setMinSize(Region.USE_COMPUTED_SIZE, 
> Region.USE_COMPUTED_SIZE);
> 476:             r.setPrefSize(Region.USE_COMPUTED_SIZE, 
> Region.USE_COMPUTED_SIZE);

Setting those sizes looks to be the wrong approach. I can see that without it, 
this PR does no longer work, but there should a more straightforward way of 
getting the right height in sizePopup() than to change the sizes like that. For 
example, why is the prefHeight not properly updating in this method without 
those calls?

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

Changes requested by crschnick (Author).

PR Review: https://git.openjdk.org/jfx/pull/2052#pullrequestreview-4671242826
PR Review Comment: https://git.openjdk.org/jfx/pull/2052#discussion_r3558755123
PR Review Comment: https://git.openjdk.org/jfx/pull/2052#discussion_r3558763979
PR Review Comment: https://git.openjdk.org/jfx/pull/2052#discussion_r3558901838

Reply via email to