private void updateWidthAndHeight(Element dropdownElement) {
/*
* The 'outline' is drawn to the left of and above where the absolute top
* and left are, so account for them in the top and right.
*/
CSSStyleDeclaration style = dropdownElement.getStyle();
/*
* This width will either be 0 if we're being positioned by the mouse or the width of our
* anchor.
*/
int widthOfAnchorOrZero = positioner.getMinimumWidth();
// set the minimum width
int dropdownViewMinWidth =
widthOfAnchorOrZero - (2 * res.defaultSimpleListCss().menuListBorderPx());
style.setProperty("min-width", dropdownViewMinWidth + "px");
// sets the maximum width
boolean useWidthOfAnchor = maxWidth == Builder.WIDTH_OF_ANCHOR && widthOfAnchorOrZero != 0;
if (maxWidth != 0 && useWidthOfAnchor) {
int curMaxWidth = useWidthOfAnchor ? widthOfAnchorOrZero : maxWidth;
style.setProperty("max-width", curMaxWidth + "px");
}
if (maxHeight != 0) {
style.setProperty("max-height", maxHeight + "px");
}
}