Bug 976905 - Let dynamic-shortcut-tooltip use the anonymous tooltip label. r=gijs a=sledru
authorDão Gottwald <dao@mozilla.com>
Wed, 26 Feb 2014 20:29:57 +0100
changeset 183037 7d9d7b90548bebe112402dea904942381f78716d
parent 183036 4d90aa42194ef1215441112ee725f50d796b0158
child 183038 446339e15b974325c0f39b78043d1d1412acffb3
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs, sledru
bugs976905
milestone29.0a2
Bug 976905 - Let dynamic-shortcut-tooltip use the anonymous tooltip label. r=gijs a=sledru
browser/base/content/browser.js
browser/base/content/browser.xul
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4857,33 +4857,31 @@ const nodeToShortcutMap = {
 #ifdef XP_MACOSX
   "print-button": "printKb",
 #endif
   "new-window-button": "key_newNavigator",
   "fullscreen-button": "key_fullScreen",
   "tabview-button": "key_tabview",
 };
 const gDynamicTooltipCache = new Map();
-function UpdateDynamicShortcutTooltipText(popupTriggerNode) {
-  let label = document.getElementById("dynamic-shortcut-tooltip-label");
-  let nodeId = popupTriggerNode.id;
+function UpdateDynamicShortcutTooltipText(aTooltip) {
+  let nodeId = aTooltip.triggerNode.id;
   if (!gDynamicTooltipCache.has(nodeId) && nodeId in nodeToTooltipMap) {
     let strId = nodeToTooltipMap[nodeId];
     let args = [];
     if (nodeId in nodeToShortcutMap) {
       let shortcutId = nodeToShortcutMap[nodeId];
       let shortcut = document.getElementById(shortcutId);
       if (shortcut) {
         args.push(ShortcutUtils.prettifyShortcut(shortcut));
       }
     }
     gDynamicTooltipCache.set(nodeId, gNavigatorBundle.getFormattedString(strId, args));
   }
-  let desiredLabel = gDynamicTooltipCache.get(nodeId);
-  label.setAttribute("value", desiredLabel);
+  aTooltip.setAttribute("label", gDynamicTooltipCache.get(nodeId));
 }
 
 /**
  * Gets the selected text in the active browser. Leading and trailing
  * whitespace is removed, and consecutive whitespace is replaced by a single
  * space. A maximum of 150 characters will be returned, regardless of the value
  * of aCharLen.
  *
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -471,19 +471,17 @@
 
     <hbox id="bookmarked-notification-container" mousethrough="always">
       <vbox id="bookmarked-notification-anchor">
         <vbox id="bookmarked-notification"/>
       </vbox>
     </hbox>
 
     <tooltip id="dynamic-shortcut-tooltip"
-             onpopupshowing="UpdateDynamicShortcutTooltipText(this.triggerNode)">
-      <label id="dynamic-shortcut-tooltip-label"/>
-    </tooltip>
+             onpopupshowing="UpdateDynamicShortcutTooltipText(this);"/>
   </popupset>
 
 #ifdef CAN_DRAW_IN_TITLEBAR
 <vbox id="titlebar">
   <hbox id="titlebar-content">
     <spacer id="titlebar-spacer" flex="1"/>
     <hbox id="titlebar-buttonbox-container">
       <hbox id="titlebar-buttonbox">