Bug 519948: showing the urlbar should not scroll to the top [r=mark.finkle]
authorVivien Nicolas <21@vingtetun.org>
Mon, 12 Oct 2009 14:23:29 -0400
changeset 65650 70638de55cd8518d97b2df8b740df786bd52dfd2
parent 65649 84572fa0050cd571e911ebe42dc8d37021fa3daa
child 65651 b582636eddc005cbb7c365f04c435cb039a9a5d4
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)
reviewersmark
bugs519948
Bug 519948: showing the urlbar should not scroll to the top [r=mark.finkle]
mobile/chrome/content/browser-ui.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -62,16 +62,21 @@ const TOOLBARSTATE_LOADED   = 2;
     "gURIFixup",
     "@mozilla.org/docshell/urifixup;1",
     [Ci.nsIURIFixup]
   ],
   [
     "gPrefService",
     "@mozilla.org/preferences-service;1",
     [Ci.nsIPrefBranch2]
+  ],
+  [
+    "gFocusManager",
+    "@mozilla.org/focus-manager;1",
+    [Ci.nsIFocusManager]
   ]
 ].forEach(function (service) {
   let [name, contract, ifaces] = service;
   window.__defineGetter__(name, function () {
     delete window[name];
     window[name] = Cc[contract].getService(ifaces.splice(0, 1)[0]);
     if (ifaces.length)
       ifaces.forEach(function (i) { return window[name].QueryInterface(i); });
@@ -215,17 +220,17 @@ var BrowserUI = {
       if (urlString == "about:blank")
         urlString = "";
       this._edit.value = urlString;
 
       // This is a workaround for bug 488420, needed to cycle focus for the
       // IME state to be set properly. Testing shows we only really need to
       // do this the first time.
       this._edit.blur();
-      this._edit.focus();
+      gFocusManager.setFocus(this._edit, Ci.nsIFocusManager.FLAG_NOSCROLL);
     }
     else if (!aEdit && Browser.selectedTab.isLoading() && icons.getAttribute("mode") != "loading") {
       icons.setAttribute("mode", "loading");
     }
     else if (!aEdit && icons.getAttribute("mode") != "view") {
       icons.setAttribute("mode", "view");
     }
   },