From d0f60a2c01506f256d1a0adb39c120f0b49f1791 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 21 Sep 2011 10:38:13 +0000 Subject: Refactored based on review (#6420) svn changeset:21204/svn branch:6.6 --- .../vaadin/terminal/gwt/client/ui/VMenuBar.java | 53 ++++++++++++---------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java index 694e16ec34..51b9abdb0b 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java @@ -718,6 +718,34 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, } } + top = adjustPopupHeight(top, shadowSpace); + + popup.setPopupPosition(left, top); + + // IE7 really tests one's patience sometimes + // Part of a fix to correct #3850 + if (BrowserInfo.get().isIE7()) { + popup.getElement().getStyle().setProperty("zoom", ""); + Scheduler.get().scheduleDeferred(new Command() { + public void execute() { + if (popup == null) { + // The child menu can be hidden before this command is + // run. + return; + } + + if (popup.getElement().getStyle().getProperty("width") == null + || popup.getElement().getStyle() + .getProperty("width") == "") { + popup.setWidth(popup.getOffsetWidth() + "px"); + } + popup.getElement().getStyle().setProperty("zoom", "1"); + } + }); + } + } + + private int adjustPopupHeight(int top, final int shadowSpace) { // Check that the popup will fit the screen int availableHeight = RootPanel.getBodyElement().getOffsetHeight() - top - shadowSpace; @@ -757,30 +785,7 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, popup.updateShadowSizeAndPosition(); } } - - popup.setPopupPosition(left, top); - - // IE7 really tests one's patience sometimes - // Part of a fix to correct #3850 - if (BrowserInfo.get().isIE7()) { - popup.getElement().getStyle().setProperty("zoom", ""); - Scheduler.get().scheduleDeferred(new Command() { - public void execute() { - if (popup == null) { - // The child menu can be hidden before this command is - // run. - return; - } - - if (popup.getElement().getStyle().getProperty("width") == null - || popup.getElement().getStyle() - .getProperty("width") == "") { - popup.setWidth(popup.getOffsetWidth() + "px"); - } - popup.getElement().getStyle().setProperty("zoom", "1"); - } - }); - } + return top; } /** -- cgit v1.2.3