Bug 618889 - Web Console doesn't animate away when you click the close button; f=mihai.sucan r=sdwilsh approval2.0=gavin.sharp
authorPatrick Walton <pwalton@mozilla.com>
Tue, 14 Dec 2010 10:52:37 -0800
changeset 59403 43b33e90152fc6b4710a4814b06773981b077460
parent 59402 6d62c9b35eb2293a8a245542f79fe8291e1bd626
child 59404 14acfa12a7e28bb5654c6433dbb83bc7888d4041
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewerssdwilsh
bugs618889
milestone2.0b9pre
Bug 618889 - Web Console doesn't animate away when you click the close button; f=mihai.sucan r=sdwilsh approval2.0=gavin.sharp
toolkit/components/console/hudservice/HUDService.jsm
--- a/toolkit/components/console/hudservice/HUDService.jsm
+++ b/toolkit/components/console/hudservice/HUDService.jsm
@@ -3361,19 +3361,26 @@ HeadsUpDisplay.prototype = {
    * Creates the close button on the toolbar.
    *
    * @param nsIDOMNode aParent
    *        The toolbar to attach the close button to.
    * @return void
    */
   makeCloseButton: function HUD_makeCloseButton(aToolbar)
   {
+    let hudId = this.hudId;
+
     function HUD_closeButton_onCommand() {
-      let tab = this.ownerDocument.defaultView.gBrowser.selectedTab;
-      HUDService.deactivateHUDForContext(tab);
+      let ownerDocument = this.ownerDocument;
+      let tab = ownerDocument.defaultView.gBrowser.selectedTab;
+      HUDService.animate(hudId, ANIMATE_OUT, function() {
+        if (ownerDocument.getElementById(hudId)) {
+          HUDService.deactivateHUDForContext(tab, true);
+        }
+      });
     }
 
     let closeButton = this.makeXULNode("toolbarbutton");
     closeButton.classList.add("webconsole-close-button");
     closeButton.addEventListener("command", HUD_closeButton_onCommand, false);
 
     aToolbar.appendChild(closeButton);
   },