diff --git a/browser/components/places/content/places-menupopup.js b/browser/components/places/content/places-menupopup.js index 989c0b6cbb24..f07a26e2ee7a 100644 --- a/browser/components/places/content/places-menupopup.js +++ b/browser/components/places/content/places-menupopup.js @@ -31,7 +31,7 @@ "dragend", ]; for (let event_name of event_names) { - this.addEventListener(event_name, this); + this.addEventListener(event_name, ev => this[`on_${event_name}`](ev)); } } @@ -364,10 +364,6 @@ } on_DOMMenuItemActive(event) { - if (super.on_DOMMenuItemActive) { - super.on_DOMMenuItemActive(event); - } - let elt = event.target; if (elt.parentNode != this) { return; @@ -599,7 +595,7 @@ "popuphidden", ]; for (let event_name of event_names) { - this.addEventListener(event_name, this); + this.addEventListener(event_name, ev => this[`on_${event_name}`](ev)); } } diff --git a/toolkit/content/widgets/menupopup.js b/toolkit/content/widgets/menupopup.js index ee234e9d6025..1c0e7e1ee578 100644 --- a/toolkit/content/widgets/menupopup.js +++ b/toolkit/content/widgets/menupopup.js @@ -57,8 +57,6 @@ }); this.attachShadow({ mode: "open" }); - - this.addEventListener("DOMMenuItemActive", this); } connectedCallback() { @@ -260,28 +258,6 @@ this._scrollTimer = 0; } } - - on_DOMMenuItemActive(event) { - // Scroll buttons may overlap the active item. In that case, scroll - // further to stay clear of the buttons. - if (!this.scrollBox.hasAttribute("overflowing")) { - return; - } - let item = event.target; - if (item.parentNode != this) { - return; - } - let itemRect = item.getBoundingClientRect(); - let buttonRect = this.scrollBox._scrollButtonUp.getBoundingClientRect(); - if (buttonRect.bottom > itemRect.top) { - this.scrollBox.scrollByPixels(itemRect.top - buttonRect.bottom, true); - } else { - buttonRect = this.scrollBox._scrollButtonDown.getBoundingClientRect(); - if (buttonRect.top < itemRect.bottom) { - this.scrollBox.scrollByPixels(itemRect.bottom - buttonRect.top, true); - } - } - } } customElements.define("menupopup", MozMenuPopup);