Fix for:

http://code.google.com/p/google-web-toolkit/issues/detail?id=4221

Review at: http://gwt-code-reviews.appspot.com/1573803
Patch by: stephenh

Review by: jlabanca@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10939 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/PopupPanel.java b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
index 19e7931..8460eb4 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
@@ -523,6 +523,14 @@
       show();
     }
 
+    // If left/top are set from a previous center() call, and our content
+    // has changed, we may get a bogus getOffsetWidth because our new content
+    // is wrapping (giving a lower offset width) then it would without the
+    // previous left. Setting left/top back to 0 avoids this.
+    Element elem = getElement();
+    elem.getStyle().setPropertyPx("left", 0);
+    elem.getStyle().setPropertyPx("top", 0);
+
     int left = (Window.getClientWidth() - getOffsetWidth()) >> 1;
     int top = (Window.getClientHeight() - getOffsetHeight()) >> 1;
     setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max(