Bug 1414244 - Part 4 - Remove the "panel-clickcapturer" element. r=Gijs
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Sat, 11 Nov 2017 22:48:32 +0000
changeset 437875 4b5eb229c2dda876883d751978badafd2e2fbddb
parent 437874 29ed6af31c628afb0d23edda60a65997bd1d2547
child 437876 b49d25e5c12490ed8b5fb74e25b8739e004b3e5c
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersGijs
bugs1414244
milestone59.0a1
Bug 1414244 - Part 4 - Remove the "panel-clickcapturer" element. r=Gijs MozReview-Commit-ID: 3aPVbnmr7QB
browser/components/customizableui/PanelMultiView.jsm
browser/components/customizableui/content/panelUI.xml
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -264,18 +264,16 @@ this.PanelMultiView = class {
       return;
 
     this._currentSubView = this._anchorElement = this._subViewObserver = null;
     this._mainViewHeight = 0;
     this.__transitioning = this._ignoreMutations = this._showingSubView = false;
 
     const {document, window} = this;
 
-    this._clickCapturer =
-      document.getAnonymousElementByAttribute(this.node, "anonid", "clickCapturer");
     this._viewContainer =
       document.getAnonymousElementByAttribute(this.node, "anonid", "viewContainer");
     this._mainViewContainer =
       document.getAnonymousElementByAttribute(this.node, "anonid", "mainViewContainer");
     this._viewStack =
       document.getAnonymousElementByAttribute(this.node, "anonid", "viewStack");
     this._offscreenViewStack =
       document.getAnonymousElementByAttribute(this.node, "anonid", "offscreenViewStack");
@@ -291,22 +289,18 @@ this.PanelMultiView = class {
     this._panel.addEventListener("popupshown", this);
     if (this.panelViews) {
       let cs = window.getComputedStyle(document.documentElement);
       // Set CSS-determined attributes now to prevent a layout flush when we do
       // it when transitioning between panels.
       this._dir = cs.direction;
       this.setMainView(this.panelViews.currentView);
       this.showMainView();
-    } else {
-      this._clickCapturer.addEventListener("click", this);
-
-      if (this._mainView) {
-        this.setMainView(this._mainView);
-      }
+    } else if (this._mainView) {
+      this.setMainView(this._mainView);
     }
 
     this._showingSubView = false;
 
     // Proxy these public properties and methods, as used elsewhere by various
     // parts of the browser, to this instance.
     ["_mainView", "ignoreMutations", "showingSubView",
      "_panelViews"].forEach(property => {
@@ -344,26 +338,24 @@ this.PanelMultiView = class {
       if (this._panelViewCache)
         this._panelViewCache.appendChild(mainView);
       mainView.removeAttribute("mainview");
     }
 
     if (this.panelViews) {
       this._moveOutKids(this._viewStack);
       this.panelViews.clear();
-    } else {
-      this._clickCapturer.removeEventListener("click", this);
     }
     this._panel.removeEventListener("mousemove", this);
     this._panel.removeEventListener("popupshowing", this);
     this._panel.removeEventListener("popuppositioned", this);
     this._panel.removeEventListener("popupshown", this);
     this._panel.removeEventListener("popuphidden", this);
     this.window.removeEventListener("keydown", this);
-    this.node = this._clickCapturer = this._viewContainer = this._mainViewContainer =
+    this.node = this._viewContainer = this._mainViewContainer =
       this._viewStack = this.__dwu = this._panelViewCache =
         this._transitionDetails = null;
   }
 
   /**
    * Remove any child subviews into the panelViewCache, to ensure
    * they remain usable even if this panelmultiview instance is removed
    * from the DOM.
@@ -986,21 +978,16 @@ this.PanelMultiView = class {
   }
 
   handleEvent(aEvent) {
     if (aEvent.type.startsWith("popup") && aEvent.target != this._panel) {
       // Shouldn't act on e.g. context menus being shown from within the panel.
       return;
     }
     switch (aEvent.type) {
-      case "click":
-        if (aEvent.originalTarget == this._clickCapturer) {
-          this.showMainView();
-        }
-        break;
       case "keydown":
         this._keyNavigation(aEvent);
         break;
       case "mousemove":
         this._resetKeyNavigation();
         break;
       case "popupshowing": {
         this.node.setAttribute("panelopen", "true");
--- a/browser/components/customizableui/content/panelUI.xml
+++ b/browser/components/customizableui/content/panelUI.xml
@@ -16,23 +16,16 @@
   <binding id="panelmultiview">
     <resources>
       <stylesheet src="chrome://browser/content/customizableui/panelUI.css"/>
     </resources>
     <content>
       <xul:vbox anonid="viewContainer" class="panel-viewcontainer" xbl:inherits="panelopen,transitioning">
         <xul:stack anonid="viewStack" xbl:inherits="transitioning" class="panel-viewstack">
           <xul:vbox anonid="mainViewContainer" class="panel-mainview"/>
-
-          <!-- Used to capture click events over the PanelUI-mainView if we're in
-               subview mode. That way, any click on the PanelUI-mainView causes us
-               to revert to the mainView mode, whereupon PanelUI-click-capture then
-               allows click events to go through it. -->
-          <xul:vbox anonid="clickCapturer" class="panel-clickcapturer"/>
-
           <children includes="panelview"/>
         </xul:stack>
       </xul:vbox>
     </content>
     <implementation>
       <constructor><![CDATA[
         const {PanelMultiView} = Components.utils.import("resource:///modules/PanelMultiView.jsm", {});
         this.instance = new PanelMultiView(this);