B2G/gecko/browser/devtools/shared/LayoutHelpers.jsm
/**
   * Prettifies the modifier keys for an element.
   *
   * @param Node aElemKey
   *        The key element to get the modifiers from.
   * @return string
   *         A prettified and properly separated modifier keys string.
   */
Prettifies the modifier keys for an element.
@param Node aElemKey
The key element to get the modifiers from.
@return string
A prettified and properly separated modifier keys string.
Prettifies the modifier keys for an element . @param Node aElemKey The key element to get the modifiers from . @return string A prettified and properly separated modifier keys string .
function LH_prettyKey(aElemKey)
  {
    let elemString = "";
    let elemMod = aElemKey.getAttribute("modifiers");
    if (elemMod.match("accel")) {
      if (Services.appinfo.OS == "Darwin") {
        elemString += "Cmd-";
      } else {
        elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
                      PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
      }
    }
    if (elemMod.match("access")) {
      if (Services.appinfo.OS == "Darwin") {
        elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
                      PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
      } else {
        elemString += PlatformKeys.GetStringFromName("VK_ALT") +
                      PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
      }
    }
    if (elemMod.match("shift")) {
      elemString += PlatformKeys.GetStringFromName("VK_SHIFT") +
                    PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
    }
    if (elemMod.match("alt")) {
      elemString += PlatformKeys.GetStringFromName("VK_ALT") +
                    PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
    }
    if (elemMod.match("ctrl")) {
      elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
                    PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
    }
    if (elemMod.match("meta")) {
      elemString += PlatformKeys.GetStringFromName("VK_META") +
                    PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
    }
    return elemString +
      (aElemKey.getAttribute("keycode").replace(/^.*VK_/, "") ||
       aElemKey.getAttribute("key")).toUpperCase();
  }
function LH_prettyKey ( aElemKey ) { let elemString = "" ; let elemMod = aElemKey . getAttribute ( "modifiers" ) ; if ( elemMod . match ( "accel" ) ) { if ( Services . appinfo . OS == "Darwin" ) { elemString += "Cmd-" ; } else { elemString += PlatformKeys . GetStringFromName ( "VK_CONTROL" ) + PlatformKeys . GetStringFromName ( "MODIFIER_SEPARATOR" ) ; } } if ( elemMod . match ( "access" ) ) { if ( Services . appinfo . OS == "Darwin" ) { elemString += PlatformKeys . GetStringFromName ( "VK_CONTROL" ) + PlatformKeys . GetStringFromName ( "MODIFIER_SEPARATOR" ) ; } else { elemString += PlatformKeys . GetStringFromName ( "VK_ALT" ) + PlatformKeys . GetStringFromName ( "MODIFIER_SEPARATOR" ) ; } } if ( elemMod . match ( "shift" ) ) { elemString += PlatformKeys . GetStringFromName ( "VK_SHIFT" ) + PlatformKeys . GetStringFromName ( "MODIFIER_SEPARATOR" ) ; } if ( elemMod . match ( "alt" ) ) { elemString += PlatformKeys . GetStringFromName ( "VK_ALT" ) + PlatformKeys . GetStringFromName ( "MODIFIER_SEPARATOR" ) ; } if ( elemMod . match ( "ctrl" ) ) { elemString += PlatformKeys . GetStringFromName ( "VK_CONTROL" ) + PlatformKeys . GetStringFromName ( "MODIFIER_SEPARATOR" ) ; } if ( elemMod . match ( "meta" ) ) { elemString += PlatformKeys . GetStringFromName ( "VK_META" ) + PlatformKeys . GetStringFromName ( "MODIFIER_SEPARATOR" ) ; } return elemString + ( aElemKey . getAttribute ( "keycode" ) . replace ( / ^.*VK_ / , "" ) || aElemKey . getAttribute ( "key" ) ) . toUpperCase ( ) ; }
Prettifies the modifier keys for an element.
Prettifies the modifier keys for an element .
// XXX bug 779642 Use "Cmd-" literal vs. cloverleaf meta-key until // Orion adds variable height lines. // elemString += PlatformKeys.GetStringFromName("VK_META") + //               PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");