Revision: 7745
Author: [email protected]
Date: Thu Mar 18 10:07:14 2010
Log: 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

http://code.google.com/p/google-web-toolkit/source/detail?r=7745

Modified:
 /trunk/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java
 /trunk/user/test/com/google/gwt/user/client/ui/LayoutPanelTest.java

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java Tue Dec 1 16:25:52 2009 +++ /trunk/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java Thu Mar 18 10:07:14 2010
@@ -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) {
=======================================
--- /trunk/user/test/com/google/gwt/user/client/ui/LayoutPanelTest.java Thu Feb 25 06:57:14 2010 +++ /trunk/user/test/com/google/gwt/user/client/ui/LayoutPanelTest.java Thu Mar 18 10:07:14 2010
@@ -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();
+      }
+    });
+  }
+}

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

To unsubscribe from this group, send email to 
google-web-toolkit-contributors+unsubscribegooglegroups.com or reply to this email with 
the words "REMOVE ME" as the subject.

Reply via email to