Bug 1304178 - Use a different node to scroll in old and new frontends;r=linclark
MozReview-Commit-ID: LNu0QNlVBBK
--- a/devtools/client/webconsole/jsterm.js
+++ b/devtools/client/webconsole/jsterm.js
@@ -1181,59 +1181,59 @@ JSTerm.prototype = {
case KeyCodes.DOM_VK_PAGE_UP:
if (this.autocompletePopup.isOpen) {
inputUpdated = this.complete(this.COMPLETE_PAGEUP);
if (inputUpdated) {
this._autocompletePopupNavigated = true;
}
} else {
- this.hud.outputWrapper.scrollTop =
+ this.hud.outputScroller.scrollTop =
Math.max(0,
- this.hud.outputWrapper.scrollTop -
- this.hud.outputWrapper.clientHeight
+ this.hud.outputScroller.scrollTop -
+ this.hud.outputScroller.clientHeight
);
}
event.preventDefault();
break;
case KeyCodes.DOM_VK_PAGE_DOWN:
if (this.autocompletePopup.isOpen) {
inputUpdated = this.complete(this.COMPLETE_PAGEDOWN);
if (inputUpdated) {
this._autocompletePopupNavigated = true;
}
} else {
- this.hud.outputWrapper.scrollTop =
- Math.min(this.hud.outputWrapper.scrollHeight,
- this.hud.outputWrapper.scrollTop +
- this.hud.outputWrapper.clientHeight
+ this.hud.outputScroller.scrollTop =
+ Math.min(this.hud.outputScroller.scrollHeight,
+ this.hud.outputScroller.scrollTop +
+ this.hud.outputScroller.clientHeight
);
}
event.preventDefault();
break;
case KeyCodes.DOM_VK_HOME:
if (this.autocompletePopup.isOpen) {
this.autocompletePopup.selectedIndex = 0;
event.preventDefault();
} else if (inputValue.length <= 0) {
- this.hud.outputWrapper.scrollTop = 0;
+ this.hud.outputScroller.scrollTop = 0;
event.preventDefault();
}
break;
case KeyCodes.DOM_VK_END:
if (this.autocompletePopup.isOpen) {
this.autocompletePopup.selectedIndex =
this.autocompletePopup.itemCount - 1;
event.preventDefault();
} else if (inputValue.length <= 0) {
- this.hud.outputWrapper.scrollTop =
- this.hud.outputWrapper.scrollHeight;
+ this.hud.outputScroller.scrollTop =
+ this.hud.outputScroller.scrollHeight;
event.preventDefault();
}
break;
case KeyCodes.DOM_VK_LEFT:
if (this.autocompletePopup.isOpen || this.lastCompletion.value) {
this.clearCompletion();
}
--- a/devtools/client/webconsole/new-console-output/components/console-output.js
+++ b/devtools/client/webconsole/new-console-output/components/console-output.js
@@ -26,17 +26,17 @@ const ConsoleOutput = createClass({
serviceContainer: PropTypes.shape({
attachRefToHud: PropTypes.func.isRequired,
}),
autoscroll: PropTypes.bool.isRequired,
},
componentDidMount() {
scrollToBottom(this.outputNode);
- this.props.serviceContainer.attachRefToHud("outputWrapper", this.outputNode);
+ this.props.serviceContainer.attachRefToHud("outputScroller", this.outputNode);
},
componentWillUpdate(nextProps, nextState) {
if (!this.outputNode) {
return;
}
const outputNode = this.outputNode;
--- a/devtools/client/webconsole/webconsole.js
+++ b/devtools/client/webconsole/webconsole.js
@@ -542,16 +542,20 @@ WebConsoleFrame.prototype = {
&& !this.owner.target.chrome
&& Services.prefs.getBoolPref(PREF_NEW_FRONTEND_ENABLED);
this.outputNode = this.document.getElementById("output-container");
this.outputWrapper = this.document.getElementById("output-wrapper");
this.completeNode = this.document.querySelector(".jsterm-complete-node");
this.inputNode = this.document.querySelector(".jsterm-input-node");
+ // In the old frontend, the area that scrolls is outputWrapper, but in the new
+ // frontend this will be reassigned.
+ this.outputScroller = this.outputWrapper;
+
// Update the character width and height needed for the popup offset
// calculations.
this._updateCharSize();
this.jsterm = new JSTerm(this);
this.jsterm.init();
let toolbox = gDevTools.getToolbox(this.owner.target);