diff options
author | John Ahlroos <john@vaadin.com> | 2013-01-16 10:05:31 +0200 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2013-01-21 13:20:47 +0200 |
commit | 63757589f526573f73dcd2cb426f342b744a8e8a (patch) | |
tree | 69624316e2f2b8197ae000ad5dcf3294cb7b19fe /client/src | |
parent | e27fa2111f73828afcb513afb77b957d69bc8f58 (diff) | |
download | vaadin-framework-63757589f526573f73dcd2cb426f342b744a8e8a.tar.gz vaadin-framework-63757589f526573f73dcd2cb426f342b744a8e8a.zip |
Fixed Window resize issues when content gets smaller in IE8 #10750
Change-Id: I5ca165c12f9a376e1f22c1042dfb3c6138c2baef
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/com/vaadin/client/LayoutManager.java | 20 | ||||
-rw-r--r-- | client/src/com/vaadin/client/LayoutManagerIE8.java | 10 | ||||
-rw-r--r-- | client/src/com/vaadin/client/Util.java | 16 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/window/WindowConnector.java | 5 |
4 files changed, 41 insertions, 10 deletions
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java index 094afc5f01..d83811d8c5 100644 --- a/client/src/com/vaadin/client/LayoutManager.java +++ b/client/src/com/vaadin/client/LayoutManager.java @@ -28,7 +28,6 @@ import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.ui.RootPanel; import com.vaadin.client.MeasuredSize.MeasureResult; import com.vaadin.client.ui.ManagedLayout; import com.vaadin.client.ui.PostLayoutListener; @@ -250,6 +249,15 @@ public class LayoutManager { } } + /** + * Called once per iteration in the layout loop before size calculations so + * different browsers quirks can be handled. Mainly this is currently for + * the IE8 permutation. + */ + protected void performBrowserLayoutHacks() { + // Permutations implement this + } + private void doLayout() { VConsole.log("Starting layout phase"); @@ -280,15 +288,7 @@ public class LayoutManager { Duration passDuration = new Duration(); passes++; - /* - * Fixes IE8 issues where IE8 sometimes forgets to update the size - * of the containing element. To force a reflow by modifying the - * magical zoom property. - */ - if (BrowserInfo.get().isIE8()) { - int zoom = RootPanel.get().getElement().getPropertyInt("zoom"); - RootPanel.get().getElement().setPropertyInt("zoom", zoom); - } + performBrowserLayoutHacks(); int measuredConnectorCount = measureConnectors( currentDependencyTree, everythingNeedsMeasure); diff --git a/client/src/com/vaadin/client/LayoutManagerIE8.java b/client/src/com/vaadin/client/LayoutManagerIE8.java index 887f3dccbd..b352e14dc6 100644 --- a/client/src/com/vaadin/client/LayoutManagerIE8.java +++ b/client/src/com/vaadin/client/LayoutManagerIE8.java @@ -71,4 +71,14 @@ public class LayoutManagerIE8 extends LayoutManager { } } } + + @Override + protected void performBrowserLayoutHacks() { + /* + * Fixes IE8 issues where IE8 sometimes forgets to update the size of + * the containing element. To force a reflow by modifying the magical + * zoom property. + */ + Util.forceIE8Redraw(RootPanel.get().getElement()); + } } diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index a29398706d..2cd01b2dd8 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -882,6 +882,20 @@ public class Util { } /** + * Performs a hack to trigger a re-layout in the IE8. This is usually + * necessary in cases where IE8 "forgets" to update child elements when they + * resize. + * + * @param e + * The element to perform the hack on + */ + public static final void forceIE8Redraw(Element e) { + if (BrowserInfo.get().isIE8()) { + setStyleTemporarily(e, "zoom", "1"); + } + } + + /** * Detaches and re-attaches the element from its parent. The element is * reattached at the same position in the DOM as it was before. * @@ -1324,4 +1338,6 @@ public class Util { return a.getHref(); } } + + } diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java index a4001733c6..8cfc25a9dc 100644 --- a/client/src/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java @@ -30,6 +30,7 @@ import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.LayoutManager; import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; +import com.vaadin.client.Util; import com.vaadin.client.ui.AbstractSingleComponentContainerConnector; import com.vaadin.client.ui.ClickEventHandler; import com.vaadin.client.ui.PostLayoutListener; @@ -262,6 +263,10 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector if (hasContent) { Element layoutElement = content.getWidget().getElement(); Style childStyle = layoutElement.getStyle(); + + // IE8 needs some hackery to measure its content correctly + Util.forceIE8Redraw((com.google.gwt.user.client.Element) layoutElement); + if (content.isRelativeHeight() && !BrowserInfo.get().isIE9()) { childStyle.setPosition(Position.ABSOLUTE); |