Fix for issue 4532. Removes the CSS expressions from PopupImplIE6 that were interfering with layout on IE7. Review at http://gwt-code-reviews.appspot.com/238801 git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7745 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java b/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java index 9fa79d1..c84cb9c 100644 --- a/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java +++ b/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java
@@ -33,6 +33,8 @@ frame.parentElement.removeChild(frame); frame.__popup = null; popup.__frame = null; + popup.onresize = null; + popup.onmove = null; } }-*/; @@ -60,7 +62,7 @@ // Visibility of frame should match visiblity of popup element. style.visibility = popup.currentStyle.visibility; - + // Issue 2443: remove styles that affect the size of the iframe style.border = 0; style.padding = 0; @@ -74,14 +76,18 @@ style.zIndex = popup.currentStyle.zIndex; // updates position and dimensions as popup is moved & resized - style.setExpression('left', 'this.__popup.offsetLeft'); - style.setExpression('top', 'this.__popup.offsetTop'); - style.setExpression('width', 'this.__popup.offsetWidth'); - style.setExpression('height', 'this.__popup.offsetHeight'); + popup.onmove = function() { + frame.style.left = popup.offsetLeft; + frame.style.top = popup.offsetTop; + }; + popup.onresize = function() { + frame.style.width = popup.offsetWidth; + frame.style.height = popup.offsetHeight; + }; style.setExpression('zIndex', 'this.__popup.currentStyle.zIndex'); popup.parentElement.insertBefore(frame, popup); }-*/; - + @Override public native void setVisible(Element popup, boolean visible) /*-{ if (popup.__frame) {
diff --git a/user/test/com/google/gwt/user/client/ui/LayoutPanelTest.java b/user/test/com/google/gwt/user/client/ui/LayoutPanelTest.java index 19e9ef3..6ac4e96 100644 --- a/user/test/com/google/gwt/user/client/ui/LayoutPanelTest.java +++ b/user/test/com/google/gwt/user/client/ui/LayoutPanelTest.java
@@ -15,6 +15,7 @@ */ package com.google.gwt.user.client.ui; +import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.layout.client.Layout.AnimationCallback; import com.google.gwt.layout.client.Layout.Layer; @@ -55,4 +56,31 @@ } }); } + + /** + * Ensures that the popup implementation doesn't interfere with layout. This + * cropped up on IE7 as a result of CSS expressions used in PopupImplIE6, as + * described in issue 4532. + */ + public void testWeirdPopupInteraction() { + assertTrue(Document.get().isCSS1Compat()); + + final LayoutPanel lp = new LayoutPanel(); + lp.add(new HTML("foo")); + RootLayoutPanel.get().add(lp); + + PopupPanel popup = new PopupPanel(); + popup.center(); + + delayTestFinish(2000); + DeferredCommand.addCommand(new Command() { + public void execute() { + int offsetWidth = lp.getOffsetWidth(); + int offsetHeight = lp.getOffsetHeight(); + assertTrue(offsetWidth > 0); + assertTrue(offsetHeight > 0); + finishTest(); + } + }); + } }