diff --git a/browser/metro/base/content/ContentAreaObserver.js b/browser/metro/base/content/ContentAreaObserver.js index 5ff9b9d4a922..dd0d46ec1672 100644 --- a/browser/metro/base/content/ContentAreaObserver.js +++ b/browser/metro/base/content/ContentAreaObserver.js @@ -232,9 +232,11 @@ var ContentAreaObserver = { // Request info about the target form element to see if we // need to reposition the browser above the keyboard. - Browser.selectedBrowser.messageManager.sendAsyncMessage("Browser:RepositionInfoRequest", { - viewHeight: this.viewableHeight, - }); + if (SelectionHelperUI.layerMode === 2 /*kContentLayer*/) { + Browser.selectedBrowser.messageManager.sendAsyncMessage("Browser:RepositionInfoRequest", { + viewHeight: this.viewableHeight, + }); + } }, _onRepositionResponse: function _onRepositionResponse(aJsonMsg) { diff --git a/browser/metro/base/content/contenthandlers/SelectionHandler.js b/browser/metro/base/content/contenthandlers/SelectionHandler.js index 7a4a876430e9..48d70ba1baac 100644 --- a/browser/metro/base/content/contenthandlers/SelectionHandler.js +++ b/browser/metro/base/content/contenthandlers/SelectionHandler.js @@ -322,17 +322,6 @@ var SelectionHandler = { * whether the browser deck needs repositioning. */ _repositionInfoRequest: function _repositionInfoRequest(aJsonMsg) { - if (!this.isActive) { - Util.dumpLn("unexpected: repositionInfoRequest but selection isn't active."); - this.sendAsync("Content:RepositionInfoResponse", { reposition: false }); - return; - } - - if (!this.targetIsEditable) { - Util.dumpLn("unexpected: repositionInfoRequest but targetIsEditable is false."); - this.sendAsync("Content:RepositionInfoResponse", { reposition: false }); - } - let result = this._calcNewContentPosition(aJsonMsg.viewHeight); // no repositioning needed @@ -422,9 +411,10 @@ var SelectionHandler = { * distance content should be raised to center the target element. */ _calcNewContentPosition: function _calcNewContentPosition(aNewViewHeight) { - // We don't support this on non-editable elements - if (!this._targetIsEditable) { - return 0; + // We have no target element but the keyboard is up + // so lets not cover content + if (!this._cache || !this._cache.element) { + return Services.metro.keyboardHeight; } let position = Util.centerElementInView(aNewViewHeight, this._cache.element);