changeset 9094:d19f81227224

RT-46097: ComboBox dropdown width is computed incorrectly
author jgiles
date Tue, 09 Jun 2015 19:32:05 +1200
parents ccc3bab2e6e5
children 5e0626a55c47
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxPopupControl.java
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxPopupControl.java	Fri Jun 05 17:39:54 2015 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxPopupControl.java	Tue Jun 09 19:32:05 2015 +1200
@@ -208,15 +208,16 @@
             // snap to pixel
             final Region r = (Region) popupContent;
 
-            final double prefWidth = r.prefWidth(-1);
-            final double minWidth = r.minWidth(-1);
-            final double maxWidth = r.maxWidth(-1);
-            final double w = snapSize(Math.min(Math.max(prefWidth, minWidth), Math.max(minWidth, maxWidth)));
+            // 0 is used here for the width due to RT-46097
+            double prefHeight = snapSize(r.prefHeight(0));
+            double minHeight = snapSize(r.minHeight(0));
+            double maxHeight = snapSize(r.maxHeight(0));
+            double h = snapSize(Math.min(Math.max(prefHeight, minHeight), Math.max(minHeight, maxHeight)));
 
-            final double prefHeight = r.prefHeight(w);
-            final double minHeight = r.minHeight(w);
-            final double maxHeight = r.maxHeight(w);
-            final double h = snapSize(Math.min(Math.max(prefHeight, minHeight), Math.max(minHeight, maxHeight)));
+            double prefWidth = snapSize(r.prefWidth(h));
+            double minWidth = snapSize(r.minWidth(h));
+            double maxWidth = snapSize(r.maxWidth(h));
+            double w = snapSize(Math.min(Math.max(prefWidth, minWidth), Math.max(minWidth, maxWidth)));
 
             popupContent.resize(w, h);
         } else {