From 6ec6428291511774dd934463279834bd56f7b699 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Fri, 20 May 2011 12:18:19 +0200 Subject: [PATCH] Bug 654136 - Bixi site causing browser content interactivity issues in Fennec [r=mfinkle] --- mobile/chrome/content/browser.js | 6 ++++++ mobile/chrome/content/common-ui.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index ced7d1434ba4..9fef18cfcdb7 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -3019,6 +3019,8 @@ var ViewableAreaObserver = { return (this._height || window.innerHeight); }, + isKeyboardOpened: false, + observe: function va_observe(aSubject, aTopic, aData) { #if MOZ_PLATFORM_MAEMO == 6 let rect = Rect.fromRect(JSON.parse(aData)); @@ -3045,6 +3047,9 @@ var ViewableAreaObserver = { if (newHeight == oldHeight && newWidth == oldWidth) return; + // Guess if the window has been resize to handle a virtual keyboard + this.isKeyboardOpened = (newHeight < oldHeight && newWidth == oldWidth); + Browser.styles["viewable-height"].height = newHeight + "px"; Browser.styles["viewable-height"].maxHeight = newHeight + "px"; @@ -3076,3 +3081,4 @@ var ViewableAreaObserver = { }, 0); } }; + diff --git a/mobile/chrome/content/common-ui.js b/mobile/chrome/content/common-ui.js index 250106e2c652..b76144758cd4 100644 --- a/mobile/chrome/content/common-ui.js +++ b/mobile/chrome/content/common-ui.js @@ -829,6 +829,9 @@ var FormHelperUI = { break; case "FormAssist:Resize": + if (!ViewableAreaObserver.isKeyboardOpened) + return; + let element = json.current; this._zoom(Rect.fromRect(element.rect), Rect.fromRect(element.caretRect)); break; @@ -838,6 +841,9 @@ var FormHelperUI = { break; case "FormAssist:Update": + if (!ViewableAreaObserver.isKeyboardOpened) + return; + Browser.hideSidebars(); Browser.hideTitlebar(); this._zoom(null, Rect.fromRect(json.caretRect));