Bug 1179698 - Part 1 - Put input focus on the URL bar when opening a new tab via keyboard. r=jchen
authorJan Henning <jh+bugzilla@buttercookie.de>
Thu, 29 Mar 2018 20:55:11 +0200
changeset 411549 7cd56bc0b98569426a0e485443654c520f5cbdd3
parent 411548 e7a004dce76eea63c9d5e08083960fb95a366ebc
child 411550 b2101216ff5e7230cc3cba8846308b5f5b08d023
push id101686
push useraciure@mozilla.com
push dateTue, 03 Apr 2018 21:59:31 +0000
treeherdermozilla-inbound@8d846598d35d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1179698
milestone61.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 1179698 - Part 1 - Put input focus on the URL bar when opening a new tab via keyboard. r=jchen MozReview-Commit-ID: 2iZkO8FDB3R
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -636,17 +636,18 @@ public class BrowserApp extends GeckoApp
                     tab.doReload(event.isShiftPressed());
                     return true;
 
                 case KeyEvent.KEYCODE_PERIOD:
                     tab.doStop();
                     return true;
 
                 case KeyEvent.KEYCODE_T:
-                    addTab();
+                    int flags = Tabs.LOADURL_START_EDITING;
+                    addTab(flags);
                     return true;
 
                 case KeyEvent.KEYCODE_W:
                     Tabs.getInstance().closeTab(tab);
                     return true;
 
                 case KeyEvent.KEYCODE_F:
                     mFindInPageBar.show(mBrowserToolbar.isPrivateMode());
@@ -2318,19 +2319,26 @@ public class BrowserApp extends GeckoApp
             return false;
         }
 
         final String packageName = info.activityInfo.packageName;
         return (TextUtils.equals(packageName, getPackageName()));
     }
 
     @Override
+    public void addTab(final int flags) {
+        if ((flags & Tabs.LOADURL_PRIVATE) == 0) {
+            MmaDelegate.track(NEW_TAB);
+        }
+        Tabs.getInstance().addTab(flags);
+    }
+
+    @Override
     public void addTab() {
-        MmaDelegate.track(NEW_TAB);
-        Tabs.getInstance().addTab();
+        addTab(Tabs.LOADURL_NONE);
     }
 
     @Override
     public void addPrivateTab() {
         Tabs.getInstance().addPrivateTab();
     }
 
     public void showTrackingProtectionPromptIfApplicable() {
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -629,16 +629,18 @@ public abstract class GeckoApp extends G
                 } catch (final InterruptedException e) { }
             }
             outState.putString(SAVED_STATE_PRIVATE_SESSION, mPrivateBrowsingSession);
         }
 
         outState.putBoolean(SAVED_STATE_IN_BACKGROUND, isApplicationInBackground());
     }
 
+    public void addTab(int flags) { }
+
     public void addTab() { }
 
     public void addPrivateTab() { }
 
     public void showNormalTabs() { }
 
     public void showPrivateTabs() { }