Bug 1317138 - Summary: Add extra info in new-tab tooltip when containers are enabled r=jkt
authordennisschagt <dennisschagt@gmail.com>
Fri, 16 Aug 2019 08:47:19 +0000
changeset 488530 b00c70075119601d370255e5962eb62429d2cf95
parent 488529 8f72a3e136c8e9c27133e4d9b35a135005c984e4
child 488531 61a0b22d978af8c1c29a4ac84c023727d0621d66
push id92789
push userccoroiu@mozilla.com
push dateFri, 16 Aug 2019 13:29:01 +0000
treeherderautoland@b00c70075119 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjkt
bugs1317138
milestone70.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 1317138 - Summary: Add extra info in new-tab tooltip when containers are enabled r=jkt Differential Revision: https://phabricator.services.mozilla.com/D37611
browser/base/content/browser.xhtml
browser/base/content/tabbrowser-tabs.js
browser/locales/en-US/chrome/browser/browser.properties
--- a/browser/base/content/browser.xhtml
+++ b/browser/base/content/browser.xhtml
@@ -730,17 +730,21 @@
                   setfocus="false"
                   tooltip="tabbrowser-tab-tooltip"
                   stopwatchid="FX_TAB_CLICK_MS">
               <hbox class="tab-drop-indicator-box">
                 <image class="tab-drop-indicator" hidden="true"/>
               </hbox>
               <arrowscrollbox orient="horizontal" flex="1" style="min-width: 1px;" clicktoscroll="true" class="tabbrowser-arrowscrollbox" scrolledtostart="true" scrolledtoend="true">
                 <tab is="tabbrowser-tab" class="tabbrowser-tab" selected="true" visuallyselected="true" fadein="true"/>
-                <toolbarbutton class="tabs-newtab-button toolbarbutton-1" command="cmd_newNavigatorTab" onclick="checkForMiddleClick(this, event);"/>
+                <toolbarbutton id="tabs-newtab-button"
+                               class="tabs-newtab-button toolbarbutton-1"
+                               command="cmd_newNavigatorTab"
+                               onclick="checkForMiddleClick(this, event);"
+                               tooltip="dynamic-shortcut-tooltip"/>
                 <spacer class="closing-tabs-spacer" style="width: 0;"/>
               </arrowscrollbox>
               <html:span id="tabbrowser-tab-a11y-desc" hidden="true"/>
             </tabs>
 
             <toolbarbutton id="new-tab-button"
                            class="toolbarbutton-1 chromeclass-toolbar-additional"
                            label="&tabCmd.label;"
--- a/browser/base/content/tabbrowser-tabs.js
+++ b/browser/base/content/tabbrowser-tabs.js
@@ -62,21 +62,16 @@
       let strId = PrivateBrowsingUtils.isWindowPrivate(window)
         ? "emptyPrivateTabTitle"
         : "emptyTabTitle";
       this.emptyTabTitle = gTabBrowserBundle.GetStringFromName("tabs." + strId);
 
       var tab = this.allTabs[0];
       tab.label = this.emptyTabTitle;
 
-      this.newTabButton.setAttribute(
-        "tooltiptext",
-        GetDynamicShortcutTooltipText("tabs-newtab-button")
-      );
-
       window.addEventListener("resize", this);
 
       this.boundObserve = (...args) => this.observe(...args);
       Services.prefs.addObserver("privacy.userContext", this.boundObserve);
       this.observe(null, "nsPref:changed", "privacy.userContext.enabled");
 
       XPCOMUtils.defineLazyPreferenceGetter(
         this,
@@ -1058,17 +1053,17 @@
             }
 
             if (containersEnabled) {
               let popup = document.createElementNS(
                 "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
                 "menupopup"
               );
               if (parent.id) {
-                popup.id = "newtab-popup";
+                popup.id = parent.id + "-popup";
               } else {
                 popup.setAttribute("anonid", "newtab-popup");
               }
               popup.className = "new-tab-popup";
               popup.setAttribute("position", "after_end");
               popup.addEventListener("popupshowing", event => {
                 createUserContextMenu(event, {
                   useAccessKeys: false,
@@ -1083,16 +1078,25 @@
               // longPressBehavior == 2 means that the menu is shown after X
               // millisecs. Otherwise, with 1, the menu is open immediatelly.
               if (longPressBehavior == 2) {
                 gClickAndHoldListenersOnElement.add(parent);
               }
 
               parent.setAttribute("type", "menu");
             }
+
+            // Update tooltip text and evict from tooltip cache
+            if (containersEnabled) {
+              nodeToTooltipMap[parent.id] = "newTabContainer.tooltip";
+            } else {
+              nodeToTooltipMap[parent.id] = "newTabButton.tooltip";
+            }
+
+            gDynamicTooltipCache.delete(parent.id);
           }
 
           break;
       }
     }
 
     _getVisibleTabs() {
       // Cannot access gBrowser before it's initialized.
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -422,16 +422,17 @@ printButton.tooltip=Print this page… (%S)
 # LOCALIZATION NOTE (newWindowButton.tooltip):
 # %S is the keyboard shortcut for "New Window"
 newWindowButton.tooltip=Open a new window (%S)
 
 # New Tab button tooltip
 # LOCALIZATION NOTE (newTabButton.tooltip):
 # %S is the keyboard shortcut for "New Tab"
 newTabButton.tooltip=Open a new tab (%S)
+newTabContainer.tooltip=Open a new tab (%S)\nPress and hold to open a new container tab
 
 # Offline web applications
 offlineApps.available2=Will you allow %S to store data on your computer?
 offlineApps.allowStoring.label=Allow Storing Data
 offlineApps.allowStoring.accesskey=A
 offlineApps.dontAllow.label=Don’t Allow
 offlineApps.dontAllow.accesskey=n