diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-01-10 17:46:15 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-01-10 17:46:15 +0000 |
commit | 1152b2c99bfd41eccf9c56dc5cba226507569ce7 (patch) | |
tree | a4fd87c4253e3e4a6ed27d3a8f0da2f62e32a70a | |
parent | 231ff7eab3f5b8d5ef9ff067d9d241c1a538b87b (diff) | |
parent | 5901b75dcacbe16a6af8d38df621864fbf107bcd (diff) | |
download | vaadin-framework-1152b2c99bfd41eccf9c56dc5cba226507569ce7.tar.gz vaadin-framework-1152b2c99bfd41eccf9c56dc5cba226507569ce7.zip |
Merge "Fixed issue with IE8 forgetting to re-render a slots height when child changes size #10588"
-rw-r--r-- | client/src/com/vaadin/client/ui/orderedlayout/Slot.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java index b59c3664c7..8cec3f755a 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java @@ -18,14 +18,17 @@ package com.vaadin.client.ui.orderedlayout; import java.util.List; +import com.google.gwt.core.client.Scheduler; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.UIObject; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.LayoutManager; import com.vaadin.client.StyleConstants; +import com.vaadin.client.ui.layout.ElementResizeEvent; import com.vaadin.client.ui.layout.ElementResizeListener; import com.vaadin.shared.ui.AlignmentInfo; @@ -92,6 +95,25 @@ public final class Slot extends SimplePanel { private ElementResizeListener spacingResizeListener; + /* + * IE8 forgets to re-render the slot if the widget inside the slot changes + * size. To force IE to re-render we apply the well know zoom property to + * the widget which triggers a re-render of the slot element. + */ + private static final ElementResizeListener ie8ElementRefresherListener = new ElementResizeListener() { + + @Override + public void onElementResize(final ElementResizeEvent e) { + Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { + @Override + public void execute() { + int zoom = e.getElement().getPropertyInt("zoom"); + e.getElement().setPropertyInt("zoom", zoom); + } + }); + } + }; + // Caption is placed after component unless there is some part which // moves it above. private CaptionPosition captionPosition = CaptionPosition.RIGHT; @@ -160,6 +182,11 @@ public final class Slot extends SimplePanel { lm.addElementResizeListener(getSpacingElement(), spacingResizeListener); } + + if (BrowserInfo.get().isIE8()) { + lm.addElementResizeListener(getWidget().getElement(), + ie8ElementRefresherListener); + } } } @@ -181,6 +208,11 @@ public final class Slot extends SimplePanel { lm.removeElementResizeListener(getSpacingElement(), spacingResizeListener); } + + if (BrowserInfo.get().isIE8()) { + lm.removeElementResizeListener(getWidget().getElement(), + ie8ElementRefresherListener); + } } } |