Bug 963143 - downloads animation no longer showing when button is in Australis' menu or overflow panel, r=mak
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 14 Mar 2014 17:01:34 +0100
changeset 190927 3ee3e227a0c09c514e5d2192f0e074501d2b84e1
parent 190926 a7e1aeb46c7952ddebbe1e7ad197910789f9e881
child 190928 be3ab4f3041063240158ae61015cea94e8b7e662
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs963143
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 963143 - downloads animation no longer showing when button is in Australis' menu or overflow panel, r=mak
browser/components/downloads/content/indicator.js
--- a/browser/components/downloads/content/indicator.js
+++ b/browser/components/downloads/content/indicator.js
@@ -293,16 +293,29 @@ const DownloadsIndicatorView = {
   //// Direct control functions
 
   /**
    * Set while we are waiting for a notification to fade out.
    */
   _notificationTimeout: null,
 
   /**
+   * Check if the panel containing aNode is open.
+   * @param aNode
+   *        the node whose panel we're interested in.
+   */
+  _isAncestorPanelOpen: function DIV_isAncestorPanelOpen(aNode)
+  {
+    while (aNode && aNode.localName != "panel") {
+      aNode = aNode.parentNode;
+    }
+    return aNode && aNode.state == "open";
+  },
+
+  /**
    * If the status indicator is visible in its assigned position, shows for a
    * brief time a visual notification of a relevant event, like a new download.
    *
    * @param aType
    *        Set to "start" for new downloads, "finish" for completed downloads.
    */
   showEventNotification: function DIV_showEventNotification(aType)
   {
@@ -318,18 +331,18 @@ const DownloadsIndicatorView = {
     if (DownloadsPanel.isPanelShowing) {
       return;
     }
 
     let anchor = DownloadsButton._placeholder;
     let widgetGroup = CustomizableUI.getWidget("downloads-button");
     let widgetInWindow = widgetGroup.forWindow(window);
     if (widgetInWindow.overflowed || widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL) {
-      if (anchor && isElementVisible(anchor.parentNode)) {
-        // If the panel is open, don't do anything:
+      if (anchor && this._isAncestorPanelOpen(anchor)) {
+        // If the containing panel is open, don't do anything:
         return;
       }
 
       // Otherwise, try to use the anchor of the panel:
       anchor = widgetInWindow.anchor;
     }
     if (!anchor || !isElementVisible(anchor.parentNode)) {
       // Our container isn't visible, so can't show the animation: