Bug 1414244 - Part 4 - Remove the "panel-clickcapturer" element. r=Gijs
MozReview-Commit-ID: 3aPVbnmr7QB
--- 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);