import java.util.Map;
import java.util.Set;
+import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Document;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.DeferredCommand;
}-*/;
+ /**
+ * IE7 sometimes "forgets" to render content. This function runs a hack to
+ * workaround the bug if needed. This happens easily in framset. See #3295.
+ */
+ public static void runIE7ZeroSizedBodyFix() {
+ if (BrowserInfo.get().isIE7()) {
+ int offsetWidth = RootPanel.getBodyElement().getOffsetWidth();
+ if (offsetWidth == 0) {
+ shakeBodyElement();
+ }
+ }
+ }
+
+ /**
+ * Does some very small adjustments to body element. We need this just to
+ * overcome some IE bugs.
+ */
+ public static void shakeBodyElement() {
+ final DivElement shaker = Document.get().createDivElement();
+ RootPanel.getBodyElement().insertBefore(shaker,
+ RootPanel.getBodyElement().getFirstChildElement());
+ shaker.getStyle().setPropertyPx("height", 0);
+ shaker.setInnerHTML(" ");
+ RootPanel.getBodyElement().removeChild(shaker);
+
+ }
+
}
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.vaadin.terminal.gwt.client.BrowserInfo;
+import com.vaadin.terminal.gwt.client.Util;
/**
* In Vaadin UI this Overlay should always be used for all elements that
updateShadowSizeAndPosition(1.0);
}
}
+ Util.runIE7ZeroSizedBodyFix();
+ }
+
+ @Override
+ public void hide(boolean autoClosed) {
+ super.hide(autoClosed);
+ Util.runIE7ZeroSizedBodyFix();
}
@Override
@Override
public int getWidth() {
- return getElement().getOffsetWidth() - getExcessWidth();
+ int w = getElement().getOffsetWidth() - getExcessWidth();
+ if (w < 10 && BrowserInfo.get().isIE7()) {
+ // Overcome an IE7 bug #3295
+ Util.shakeBodyElement();
+ w = getElement().getOffsetWidth() - getExcessWidth();
+ }
+ return w;
}
private int getExcessWidth() {