diff -r a8abcf708255 javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PopupMenuSkin.fx --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PopupMenuSkin.fx Fri Apr 02 00:55:06 2010 -0700 +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PopupMenuSkin.fx Tue Apr 13 15:16:18 2010 +1200 @@ -274,10 +274,23 @@ override function impl_computePrefWidth(height) { var max = 0.0; - for (item in items) { - if (not item.visible) then continue; - max = Math.max(getNodePrefWidth(item), max); + var separatorWidth = 0.0; + for (item in items where item.visible) { + // We don't want to include the width of any Separator control in the + // width calculations for this menu, but we do record the width of + // the widest separator, so that we can handle the situation where + // the max variable remains 0.0. + if (item instanceof javafx.scene.control.Separator) { + separatorWidth = Math.max(getNodePrefWidth(item), separatorWidth); + } else { + max = Math.max(getNodePrefWidth(item), max); + } } + + if (max <= 0.0) { + max = separatorWidth; + } + return padding.left + max + padding.right; } @@ -327,8 +340,7 @@ function getContentHeight():Number { var h = 0.0; - for (item in items) { - if (not item.visible) then continue; + for (item in items where item.visible) { h += getNodePrefHeight(item, width); } return h;