diff --git a/browser/devtools/inspector/inspector-panel.js b/browser/devtools/inspector/inspector-panel.js index 01dec84af8ee..cc5ec6108b13 100644 --- a/browser/devtools/inspector/inspector-panel.js +++ b/browser/devtools/inspector/inspector-panel.js @@ -673,19 +673,27 @@ InspectorPanel.prototype = { deleteNode.setAttribute("disabled", "true"); } - // Disable / enable "Copy Unique Selector", "Copy inner HTML" & - // "Copy outer HTML" as appropriate + // Disable / enable "Copy Unique Selector", "Copy inner HTML", + // "Copy outer HTML" & "Scroll Into View" as appropriate let unique = this.panelDoc.getElementById("node-menu-copyuniqueselector"); let copyInnerHTML = this.panelDoc.getElementById("node-menu-copyinner"); let copyOuterHTML = this.panelDoc.getElementById("node-menu-copyouter"); + let scrollIntoView = this.panelDoc.getElementById("node-menu-scrollnodeintoview"); + + this._target.actorHasMethod("domnode", "scrollIntoView").then(value => { + scrollIntoView.hidden = !value; + }); + if (isSelectionElement) { unique.removeAttribute("disabled"); copyInnerHTML.removeAttribute("disabled"); copyOuterHTML.removeAttribute("disabled"); + scrollIntoView.removeAttribute("disabled"); } else { unique.setAttribute("disabled", "true"); copyInnerHTML.setAttribute("disabled", "true"); copyOuterHTML.setAttribute("disabled", "true"); + scrollIntoView.setAttribute("disabled", "true"); } if (!this.canGetUniqueSelector) { unique.hidden = true; @@ -999,6 +1007,18 @@ InspectorPanel.prototype = { }).then(null, console.error); }, + /** + * Scroll the node into view. + */ + scrollNodeIntoView: function InspectorPanel_scrollNodeIntoView() + { + if (!this.selection.isNode()) { + return; + } + + this.selection.nodeFront.scrollIntoView(); + }, + /** * Delete the selected node. */ diff --git a/browser/devtools/inspector/inspector.xul b/browser/devtools/inspector/inspector.xul index 92c4ab08cfe4..c88d599dc423 100644 --- a/browser/devtools/inspector/inspector.xul +++ b/browser/devtools/inspector/inspector.xul @@ -90,6 +90,11 @@ + + + + + + + + Test for Bug 901250 + + + + + + + +Mozilla Bug 901250 +Test Document +

+ +
+
+ +