If a PopupPanel is closed while it is being opened, the animation is cancelled according to the new (closed) state instead of the old (opened) state.  As a result, the animation could be hidden twice in a row, once on cancel, and another when it is actually hidden.  In ie6, this causes a JS error.  The animation in the PopupPanel now has a boolean that keeps track of the old state.

Patch by: jlabanca, rajeev
Review by: rajeev



git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2072 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 c3f1eb9..97b1e4c 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
@@ -76,6 +76,11 @@
      * The {@link PopupPanel} being affected.
      */
     private PopupPanel curPanel = null;
+    
+    /**
+     * A boolean indicating whether we are showing or hiding the popup.
+     */
+    private boolean showing = false;
 
     @Override
     public void onCancel() {
@@ -84,7 +89,7 @@
 
     @Override
     public void onComplete() {
-      if (!curPanel.showing) {
+      if (!showing) {
         RootPanel.get().remove(curPanel);
         impl.onHide(curPanel.getElement());
       }
@@ -94,7 +99,7 @@
 
     @Override
     public void onInstantaneousRun() {
-      if (curPanel.showing) {
+      if (showing) {
         // Set the position attribute, and then attach to the DOM. Otherwise,
         // the PopupPanel will appear to 'jump' from its static/relative
         // position to its absolute position (issue #1231).
@@ -114,7 +119,7 @@
     @Override
     public void onStart() {
       // Attach to the page
-      if (curPanel.showing) {
+      if (showing) {
         // Set the position attribute, and then attach to the DOM. Otherwise,
         // the PopupPanel will appear to 'jump' from its static/relative
         // position to its absolute position (issue #1231).
@@ -133,7 +138,7 @@
 
     @Override
     public void onUpdate(double progress) {
-      if (!curPanel.showing) {
+      if (!showing) {
         progress = 1.0 - progress;
       }
 
@@ -174,6 +179,7 @@
       }
 
       // Open the new item
+      showing = panel.showing;
       curPanel = panel;
       if (animate) {
         run(200);