Bug 906048 - Shift browser up to avoid covering content. r=jmathies

This commit is contained in:
Marina Samuel 2013-10-08 16:02:52 -04:00
Родитель 0b3dcdfb2a
Коммит bb55ea48d0
2 изменённых файлов: 9 добавлений и 17 удалений

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

@ -232,9 +232,11 @@ var ContentAreaObserver = {
// Request info about the target form element to see if we // Request info about the target form element to see if we
// need to reposition the browser above the keyboard. // need to reposition the browser above the keyboard.
Browser.selectedBrowser.messageManager.sendAsyncMessage("Browser:RepositionInfoRequest", { if (SelectionHelperUI.layerMode === 2 /*kContentLayer*/) {
viewHeight: this.viewableHeight, Browser.selectedBrowser.messageManager.sendAsyncMessage("Browser:RepositionInfoRequest", {
}); viewHeight: this.viewableHeight,
});
}
}, },
_onRepositionResponse: function _onRepositionResponse(aJsonMsg) { _onRepositionResponse: function _onRepositionResponse(aJsonMsg) {

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

@ -322,17 +322,6 @@ var SelectionHandler = {
* whether the browser deck needs repositioning. * whether the browser deck needs repositioning.
*/ */
_repositionInfoRequest: function _repositionInfoRequest(aJsonMsg) { _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); let result = this._calcNewContentPosition(aJsonMsg.viewHeight);
// no repositioning needed // no repositioning needed
@ -422,9 +411,10 @@ var SelectionHandler = {
* distance content should be raised to center the target element. * distance content should be raised to center the target element.
*/ */
_calcNewContentPosition: function _calcNewContentPosition(aNewViewHeight) { _calcNewContentPosition: function _calcNewContentPosition(aNewViewHeight) {
// We don't support this on non-editable elements // We have no target element but the keyboard is up
if (!this._targetIsEditable) { // so lets not cover content
return 0; if (!this._cache || !this._cache.element) {
return Services.metro.keyboardHeight;
} }
let position = Util.centerElementInView(aNewViewHeight, this._cache.element); let position = Util.centerElementInView(aNewViewHeight, this._cache.element);