Bug 567044 - Tapping in urlbar doesn't work after pressing Android menu button [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Fri, 21 May 2010 13:05:46 -0400
changeset 66243 e26847b4011de3fd58e1a02a83abc21fe4b0ba60
parent 66242 48fe829edfe7aa25e55fae9933167bf46e57499c
child 66244 b6ed68f20286a0b2c9726757556be5e80c8a95bb
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs567044
Bug 567044 - Tapping in urlbar doesn't work after pressing Android menu button [r=mfinkle]
mobile/chrome/content/Util.js
mobile/chrome/content/browser-ui.js
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/Util.js
+++ b/mobile/chrome/content/Util.js
@@ -261,16 +261,17 @@ let Util = {
 let Elements = {};
 
 [
   ["browserBundle",      "bundle_browser"],
   ["contentShowing",     "bcast_contentShowing"],
   ["stack",              "stack"],
   ["panelUI",            "panel-container"],
   ["viewBuffer",         "view-buffer"],
+  ["toolbarContainer",   "toolbar-container"],
 ].forEach(function (elementGlobal) {
   let [name, id] = elementGlobal;
   Elements.__defineGetter__(name, function () {
     let element = document.getElementById(id);
     if (!element)
       return null;
     delete Elements[name];
     return Elements[name] = element;
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -213,16 +213,18 @@ var BrowserUI = {
     this._updateButtons(browser);
     this._updateIcon(browser.mIconURL);
     this.updateStar();
   },
 
   showToolbar : function showToolbar(aEdit) {
     this.hidePanel();
     this._editURI(aEdit);
+    if (aEdit)
+      this.showAutoComplete();
   },
 
   _toolbarLocked: 0,
 
   isToolbarLocked: function isToolbarLocked() {
     return this._toolbarLocked;
   },
 
@@ -562,16 +564,17 @@ var BrowserUI = {
   },
 
   showAutoComplete : function showAutoComplete() {
     if (this.isAutoCompleteOpen())
       return;
 
     BrowserSearch.updateSearchButtons();
 
+    this._hidePopup();
     this._edit.showHistoryPopup();
   },
 
   closeAutoComplete: function closeAutoComplete(aResetInput) {
     if (!this.isAutoCompleteOpen())
       return;
 
     if (aResetInput)
@@ -614,17 +617,16 @@ var BrowserUI = {
     aURI = aURI || "about:blank";
     let tab = Browser.addTab(aURI, true);
 
     this.hidePanel();
 
     if (aURI == "about:blank") {
       // Display awesomebar UI
       this.showToolbar(true);
-      this.showAutoComplete();
     }
     else {
       // Give the new page lots of room
       Browser.hideSidebars();
       this.closeAutoComplete(true);
     }
 
     return tab;
@@ -846,17 +848,16 @@ var BrowserUI = {
       case "cmd_stop":
         browser.stop();
         break;
       case "cmd_go":
         this.goToURI();
         break;
       case "cmd_openLocation":
         this.showToolbar(true);
-        this.showAutoComplete();
         break;
       case "cmd_star":
       {
         var bookmarkURI = browser.currentURI;
         var bookmarkTitle = browser.contentDocument.title || bookmarkURI.spec;
 
         let autoClose = false;
 
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -2336,17 +2336,17 @@ IdentityHandler.prototype = {
     this._identityPopup.top = BrowserUI.toolbarH;
     this._identityPopup.focus();
 
     this._identityBox.setAttribute("open", "true");
 
     // Update the popup strings
     this.setPopupMessages(this._identityBox.getAttribute("mode") || this.IDENTITY_MODE_UNKNOWN);
 
-    BrowserUI.pushPopup(this, [this._identityPopup, this._identityBox]);
+    BrowserUI.pushPopup(this, [this._identityPopup, this._identityBox, Elements.toolbarContainer]);
     BrowserUI.lockToolbar();
   },
 
   hide: function ih_hide() {
     this._identityPopup.hidden = true;
     this._identityBox.removeAttribute("open");
 
     BrowserUI.popPopup();
@@ -3510,18 +3510,17 @@ PluginObserver.prototype = {
       return this._emptyRect;
 
     let vs = bv._browserViewportState;
     let vr = bv.getVisibleRect();
     let crit = BrowserView.Util.visibleRectToCriticalRect(vr, vs);
     crit = Browser.browserViewToClientRect(crit);
 
     if (BrowserUI.isToolbarLocked()) {
-      let urlbar = document.getElementById("toolbar-container");
-      let urlbarRect = urlbar.getBoundingClientRect();
+      let urlbarRect = Elements.toolbarContainer.getBoundingClientRect();
       // Subtract urlbar area from critical rect area.  In general subtracting a rect from another
       // results in a region that can be described by a union of rects.  Luckily in this case,
       // we can cheat because the resulting area is still just one rect.
       crit.top = Math.max(Math.round(urlbarRect.height) + 1, crit.top);
       // XXX we add 1 to the height so that flash overlays don't leak into URL bar (otherwise
       // you may see a strip of junk if you pop up the identity panel over flash)
     }