Bug 654136 - Bixi site causing browser content interactivity issues in Fennec [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Fri, 20 May 2011 12:18:19 +0200
changeset 69743 c36e2218c101f62bc97d7d999ea50a0179778bc9
parent 69742 f2cac6e5a44488327c36344ca02b9b45a4939807
child 69744 d9080dd8b3f2bd8df620f5f12d9df7f23045bb4a
push id20094
push uservnicolas@mozilla.com
push dateFri, 20 May 2011 10:19:23 +0000
treeherdermozilla-central@e8d3246d2f2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs654136
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 654136 - Bixi site causing browser content interactivity issues in Fennec [r=mfinkle]
mobile/chrome/content/browser.js
mobile/chrome/content/common-ui.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -3014,16 +3014,18 @@ var ViewableAreaObserver = {
   get width() {
     return this._width || window.innerWidth;
   },
 
   get height() {
     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));
     let height = rect.bottom - rect.top;
     let width = rect.right - rect.left;
     if (height == window.innerHeight && width == window.innerWidth) {
       this._height = null;
       this._width = null;
@@ -3040,16 +3042,19 @@ var ViewableAreaObserver = {
     let oldHeight = parseInt(Browser.styles["viewable-height"].height);
     let oldWidth = parseInt(Browser.styles["viewable-width"].width);
 
     let newWidth = this.width;
     let newHeight = this.height;
     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";
 
     Browser.styles["viewable-width"].width = newWidth + "px";
     Browser.styles["viewable-width"].maxWidth = newWidth + "px";
 
     let startup = !oldHeight && !oldWidth;
     for (let i = Browser.tabs.length - 1; i >= 0; i--) {
@@ -3071,8 +3076,9 @@ var ViewableAreaObserver = {
     // setTimeout(callback, 0) to ensure the resize event handler dispatch is finished
     setTimeout(function() {
       let event = document.createEvent("Events");
       event.initEvent("SizeChanged", true, false);
       Elements.browsers.dispatchEvent(event);
     }, 0);
   }
 };
+
--- a/mobile/chrome/content/common-ui.js
+++ b/mobile/chrome/content/common-ui.js
@@ -824,25 +824,31 @@ var FormHelperUI = {
           this.hide();
         } else {
           SelectHelperUI.hide();
           ContentPopupHelper.popup = null;
         }
         break;
 
       case "FormAssist:Resize":
+        if (!ViewableAreaObserver.isKeyboardOpened)
+          return;
+
         let element = json.current;
         this._zoom(Rect.fromRect(element.rect), Rect.fromRect(element.caretRect));
         break;
 
       case "FormAssist:AutoComplete":
         this._updateSuggestionsFor(json.current);
         break;
 
        case "FormAssist:Update":
+        if (!ViewableAreaObserver.isKeyboardOpened)
+          return;
+
         Browser.hideSidebars();
         Browser.hideTitlebar();
         this._zoom(null, Rect.fromRect(json.caretRect));
         break;
 
       case "DOMWillOpenModalDialog":
         if (aMessage.target == Browser.selectedBrowser && this._container.isActive)
           this._container.style.display = "none";