Bug 1515265: Move a place where add contextmenu listener to show the context menu in markup view. r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D17457

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daisuke Akatsuka 2019-01-24 07:04:22 +00:00
Родитель 51b9213cce
Коммит 2da37d4512
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -1402,7 +1402,8 @@ Inspector.prototype = {
if (this._markupFrame) { if (this._markupFrame) {
this._markupFrame.removeEventListener("load", this._onMarkupFrameLoad, true); this._markupFrame.removeEventListener("load", this._onMarkupFrameLoad, true);
this._markupFrame.removeEventListener("contextmenu", this._onContextMenu); this._markupFrame.contentWindow.removeEventListener("contextmenu",
this._onContextMenu);
} }
if (this._search) { if (this._search) {
@ -1899,7 +1900,6 @@ Inspector.prototype = {
this._markupFrame.setAttribute("flex", "1"); this._markupFrame.setAttribute("flex", "1");
// This is needed to enable tooltips inside the iframe document. // This is needed to enable tooltips inside the iframe document.
this._markupFrame.setAttribute("tooltip", "aHTMLTooltip"); this._markupFrame.setAttribute("tooltip", "aHTMLTooltip");
this._markupFrame.addEventListener("contextmenu", this._onContextMenu);
this._markupBox.style.visibility = "hidden"; this._markupBox.style.visibility = "hidden";
this._markupBox.appendChild(this._markupFrame); this._markupBox.appendChild(this._markupFrame);
@ -1913,6 +1913,7 @@ Inspector.prototype = {
_onMarkupFrameLoad: function() { _onMarkupFrameLoad: function() {
this._markupFrame.removeEventListener("load", this._onMarkupFrameLoad, true); this._markupFrame.removeEventListener("load", this._onMarkupFrameLoad, true);
this._markupFrame.contentWindow.addEventListener("contextmenu", this._onContextMenu);
this._markupFrame.contentWindow.focus(); this._markupFrame.contentWindow.focus();
this._markupBox.style.visibility = "visible"; this._markupBox.style.visibility = "visible";
this.markup = new MarkupView(this, this._markupFrame, this._toolbox.win); this.markup = new MarkupView(this, this._markupFrame, this._toolbox.win);