summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-01-21 11:27:18 +0000
committerVaadin Code Review <review@vaadin.com>2013-01-21 11:27:18 +0000
commit84b0df6f6b731d055a5451be07bb76f73accdef9 (patch)
tree020550638cf982313a9623b4617dc53eba8f1702
parent95e3d0535788e0c2240ca08f79e1d33a5671603f (diff)
parent63757589f526573f73dcd2cb426f342b744a8e8a (diff)
downloadvaadin-framework-84b0df6f6b731d055a5451be07bb76f73accdef9.tar.gz
vaadin-framework-84b0df6f6b731d055a5451be07bb76f73accdef9.zip
Merge "Fixed Window resize issues when content gets smaller in IE8 #10750"
-rw-r--r--client/src/com/vaadin/client/LayoutManager.java20
-rw-r--r--client/src/com/vaadin/client/LayoutManagerIE8.java10
-rw-r--r--client/src/com/vaadin/client/Util.java16
-rw-r--r--client/src/com/vaadin/client/ui/window/WindowConnector.java5
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);