Bug 500710: double clicking in the url bar should select all, r=vingtetun
authorGavin Sharp <gavin@mozilla.com>
Tue, 21 Jul 2009 20:05:01 -0400
changeset 65333 02f6f7827758dc8774c755b35ec064c696b45340
parent 65332 cee41985ee1afe5e99ff2a29a0adc2e0f882e936
child 65334 f7b216bd85edab261b4af35d85be186d6d818c0f
child 65371 0abf414f07fb2cda5c43c653a65972f027489827
push idunknown
push userunknown
push dateunknown
reviewersvingtetun
bugs500710
Bug 500710: double clicking in the url bar should select all, r=vingtetun
mobile/app/mobile.js
mobile/chrome/content/browser-ui.js
--- a/mobile/app/mobile.js
+++ b/mobile/app/mobile.js
@@ -212,17 +212,17 @@ pref("browser.search.updateinterval", 6)
 pref("browser.search.suggest.enabled", true);
 
 // enable xul error pages
 pref("browser.xul.error_pages.enabled", true);
 
 // various and sundry awesomebar prefs (should remove/re-evaluate
 // these once bug 447900 is fixed)
 pref("browser.urlbar.clickSelectsAll", true);
-pref("browser.urlbar.doubleClickSelectsAll", false);
+pref("browser.urlbar.doubleClickSelectsAll", true);
 pref("browser.urlbar.autoFill", false);
 pref("browser.urlbar.matchOnlyTyped", false);
 pref("browser.urlbar.matchBehavior", 1);
 pref("browser.urlbar.filter.javascript", true);
 pref("browser.urlbar.maxRichResults", 12);
 pref("browser.urlbar.search.chunkSize", 1000);
 pref("browser.urlbar.search.timeout", 100);
 pref("browser.urlbar.restrict.history", "^");
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -318,17 +318,19 @@ var BrowserUI = {
   init : function() {
     this._edit = document.getElementById("urlbar-edit");
     this._edit.addEventListener("keypress", this, true);
     this._throbber = document.getElementById("urlbar-throbber");
     this._favicon = document.getElementById("urlbar-favicon");
     this._favicon.addEventListener("error", this, false);
     this._autocompleteNavbuttons = document.getElementById("autocomplete_navbuttons");
 
-    document.getElementById("urlbar-editarea").addEventListener("click", this, false);
+    let urlbarEditArea = document.getElementById("urlbar-editarea");
+    urlbarEditArea.addEventListener("click", this, false);
+    urlbarEditArea.addEventListener("mousedown", this, false);
 
     document.getElementById("tabs").addEventListener("TabSelect", this, true);
 
     let browsers = document.getElementById("browsers");
     browsers.addEventListener("DOMWindowClose", this, true);
     browsers.addEventListener("UIShowSelect", this, false, true);
 
     // XXX these really want to listen to only the the current browser
@@ -571,16 +573,24 @@ var BrowserUI = {
         this.doCommand("cmd_openLocation");
         break;
       case "keypress":
         if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
           this._edit.reset();
           this._editToolbar(false);
         }
         break;
+      case "mousedown":
+        if (aEvent.detail == 2 &&
+            aEvent.button == 0 &&
+            gPrefService.getBoolPref("browser.urlbar.doubleClickSelectsAll")) {
+          this._edit.editor.selectAll();
+          aEvent.preventDefault();
+        }
+        break;
       // Favicon events
       case "error":
         this._favicon.src = "chrome://browser/skin/images/default-favicon.png";
         break;
     }
   },
 
   supportsCommand : function(cmd) {