Bug 996363 - order OS X cloverleaf symbol correctly in ShortcutUtils.jsm, r=Unfocused
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 16 Apr 2014 13:23:19 +0100
changeset 197398 14b25d18dbada515097030d6813540de6298157f
parent 197397 0ee15acfea79fa8d0dd1c5ddb9e6d04e56c99ac2
child 197399 854848b9722d69c8a7afea209e38ffbc339f73c2
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersUnfocused
bugs996363
milestone31.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 996363 - order OS X cloverleaf symbol correctly in ShortcutUtils.jsm, r=Unfocused
toolkit/modules/ShortcutUtils.jsm
--- a/toolkit/modules/ShortcutUtils.jsm
+++ b/toolkit/modules/ShortcutUtils.jsm
@@ -29,26 +29,26 @@ let ShortcutUtils = {
     * @param boolean aNoCloverLeaf
     *        Pass true to use a descriptive string instead of the cloverleaf symbol. (OS X only)
     * @return string
     *         A prettified and properly separated modifier keys string.
     */
   prettifyShortcut: function(aElemKey, aNoCloverLeaf) {
     let elemString = "";
     let elemMod = aElemKey.getAttribute("modifiers");
+    let haveCloverLeaf = false;
 
     if (elemMod.match("accel")) {
       if (Services.appinfo.OS == "Darwin") {
         // XXX bug 779642 Use "Cmd-" literal vs. cloverleaf meta-key until
         // Orion adds variable height lines.
         if (aNoCloverLeaf) {
           elemString += "Cmd-";
         } else {
-          elemString += PlatformKeys.GetStringFromName("VK_META") +
-            PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
+          haveCloverLeaf = true;
         }
       } else {
         elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
           PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
       }
     }
     if (elemMod.match("access")) {
       if (Services.appinfo.OS == "Darwin") {
@@ -75,16 +75,21 @@ let ShortcutUtils = {
       elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
         PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
     }
     if (elemMod.match("meta")) {
       elemString += PlatformKeys.GetStringFromName("VK_META") +
         PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
     }
 
+    if (haveCloverLeaf) {
+      elemString += PlatformKeys.GetStringFromName("VK_META") +
+        PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
+    }
+
     let key;
     let keyCode = aElemKey.getAttribute("keycode");
     if (keyCode) {
       try {
         // Some keys might not exist in the locale file, which will throw:
         key = Keys.GetStringFromName(keyCode.toUpperCase());
       } catch (ex) {
         Cu.reportError("Error finding " + keyCode + ": " + ex);