Bug 1414244 - Part 4 - Remove the "panel-clickcapturer" element. r=Gijs draft
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Sat, 11 Nov 2017 22:48:32 +0000
changeset 702602 20be498d447bd00cbdd5f7e893b4ed959fc8f80a
parent 702601 c5cf51c8ccf557642d640c7fc60de6f906ee1c87
child 702603 a9e699f3f37de6d65e7a30b9c3d3e964cc7d74c2
push id90549
push userpaolo.mozmail@amadzone.org
push dateThu, 23 Nov 2017 12:01:13 +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,18 +289,16 @@ this.PanelMultiView = class {
     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);
       }
     }
 
     this._showingSubView = false;
 
     // Proxy these public properties and methods, as used elsewhere by various
@@ -343,25 +339,23 @@ 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("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.
@@ -946,21 +940,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);