diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-09-07 15:11:57 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-09-07 15:11:57 +0000 |
commit | 5ebc11a599389cca423783191ce5af8a3547fe44 (patch) | |
tree | ea09c55d69be51b83ad6ccf59f3e8f81894eb473 /src/com | |
parent | d6c748ba57e8675ab3787e92f9ee4cc13570274d (diff) | |
download | vaadin-framework-5ebc11a599389cca423783191ce5af8a3547fe44.tar.gz vaadin-framework-5ebc11a599389cca423783191ce5af8a3547fe44.zip |
fixes #3295
svn changeset:8688/svn branch:6.1
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/Util.java | 29 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VOverlay.java | 8 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VView.java | 8 |
3 files changed, 44 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java index fd1b6774ea..770214f45e 100644 --- a/src/com/vaadin/terminal/gwt/client/Util.java +++ b/src/com/vaadin/terminal/gwt/client/Util.java @@ -10,6 +10,8 @@ import java.util.Iterator; 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; @@ -713,4 +715,31 @@ public class Util { }-*/; + /** + * 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); + + } + } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java b/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java index d107f519ed..fb6831e31a 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java @@ -13,6 +13,7 @@ import com.google.gwt.user.client.Element; 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 @@ -130,6 +131,13 @@ public class VOverlay extends PopupPanel { updateShadowSizeAndPosition(1.0); } } + Util.runIE7ZeroSizedBodyFix(); + } + + @Override + public void hide(boolean autoClosed) { + super.hide(autoClosed); + Util.runIE7ZeroSizedBodyFix(); } @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/VView.java b/src/com/vaadin/terminal/gwt/client/ui/VView.java index 95e85aaa1f..e9a7588d93 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VView.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VView.java @@ -520,7 +520,13 @@ public class VView extends SimplePanel implements Container, ResizeHandler, @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() { |