Temporarily backing out the changes for bug 70048.

This commit is contained in:
jaggernaut%netscape.com 2001-06-30 16:26:23 +00:00
Родитель c55b76ec94
Коммит ce34ee4806
2 изменённых файлов: 8 добавлений и 77 удалений

Просмотреть файл

@ -80,13 +80,6 @@ nsMenuDismissalListener* nsMenuFrame::mDismissalListener = nsnull;
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
nsrefcnt nsMenuFrame::gRefCnt = 0;
nsString *nsMenuFrame::gShiftText = nsnull;
nsString *nsMenuFrame::gControlText = nsnull;
nsString *nsMenuFrame::gMetaText = nsnull;
nsString *nsMenuFrame::gAltText = nsnull;
nsString *nsMenuFrame::gModifierSeparator = nsnull;
//
// NS_NewMenuFrame
//
@ -186,63 +179,11 @@ nsMenuFrame::Init(nsIPresContext* aPresContext,
UpdateMenuType(aPresContext);
nsAutoString accelString;
//load the display strings for the keyboard accelerators, but only once
if (gRefCnt++ == 0) {
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv));
nsCOMPtr<nsIStringBundle> bundle;
if (NS_SUCCEEDED(rv) && bundleService) {
rv = bundleService->CreateBundle( "chrome://global/locale/platformKeys.properties",
getter_AddRefs(bundle));
}
NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/platformKeys.properties could not be loaded");
nsXPIDLString shiftModifier;
nsXPIDLString metaModifier;
nsXPIDLString altModifier;
nsXPIDLString controlModifier;
nsXPIDLString modifierSeparator;
if (NS_SUCCEEDED(rv) && bundle) {
//macs use symbols for each modifier key, so fetch each from the bundle, which also covers i18n
rv = bundle->GetStringFromName(NS_LITERAL_STRING("VK_SHIFT").get(), getter_Copies(shiftModifier));
rv = bundle->GetStringFromName(NS_LITERAL_STRING("VK_META").get(), getter_Copies(metaModifier));
rv = bundle->GetStringFromName(NS_LITERAL_STRING("VK_ALT").get(), getter_Copies(altModifier));
rv = bundle->GetStringFromName(NS_LITERAL_STRING("VK_CONTROL").get(), getter_Copies(controlModifier));
rv = bundle->GetStringFromName(NS_LITERAL_STRING("MODIFIER_SEPARATOR").get(), getter_Copies(modifierSeparator));
} else {
rv = NS_ERROR_NOT_AVAILABLE;
}
//if any of these don't exist, we get an empty string
gShiftText = new nsString(shiftModifier);
gMetaText = new nsString(metaModifier);
gAltText = new nsString(altModifier);
gControlText = new nsString(controlModifier);
gModifierSeparator = new nsString(modifierSeparator);
}
BuildAcceleratorText(accelString);
return rv;
}
nsMenuFrame::~nsMenuFrame()
{
// Clean up shared statics
if (--gRefCnt == 0) {
delete gShiftText;
gShiftText = nsnull;
delete gControlText;
gControlText = nsnull;
delete gMetaText;
gMetaText = nsnull;
delete gAltText;
gAltText = nsnull;
delete gModifierSeparator;
gModifierSeparator = nsnull;
}
}
// The following methods are all overridden to ensure that the menupopup frame
// is placed in the appropriate list.
NS_IMETHODIMP
@ -1389,32 +1330,32 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString)
while (token) {
if (PL_strcmp(token, "shift") == 0)
aAccelString += *gShiftText;
aAccelString += NS_LITERAL_STRING("Shift");
else if (PL_strcmp(token, "alt") == 0)
aAccelString += *gMetaText;
aAccelString += NS_LITERAL_STRING("Alt");
else if (PL_strcmp(token, "meta") == 0)
aAccelString += *gAltText;
aAccelString += NS_LITERAL_STRING("Meta");
else if (PL_strcmp(token, "control") == 0)
aAccelString += *gControlText;
aAccelString += NS_LITERAL_STRING("Ctrl");
else if (PL_strcmp(token, "accel") == 0) {
switch (accelKey)
{
case nsIDOMKeyEvent::DOM_VK_META:
aAccelString += *gMetaText;
aAccelString += NS_LITERAL_STRING("Meta");
break;
case nsIDOMKeyEvent::DOM_VK_ALT:
aAccelString += *gAltText;
aAccelString += NS_LITERAL_STRING("Alt");
break;
case nsIDOMKeyEvent::DOM_VK_CONTROL:
default:
aAccelString += *gControlText;
aAccelString += NS_LITERAL_STRING("Ctrl");
break;
}
}
aAccelString += *gModifierSeparator;
aAccelString += NS_LITERAL_STRING("+");
token = nsCRT::strtok(newStr, ", ", &newStr);
}

Просмотреть файл

@ -200,7 +200,6 @@ protected:
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aHint);
virtual ~nsMenuFrame();
protected:
nsresult SetDebug(nsBoxLayoutState& aState, nsIFrame* aList, PRBool aDebug);
@ -219,15 +218,6 @@ protected:
nsIPresContext* mPresContext; // Our pres context.
nsString mGroupName;
nsSize mLastPref;
//we load some display strings from platformKeys.properties only once
static nsrefcnt gRefCnt;
static nsString *gShiftText;
static nsString *gControlText;
static nsString *gMetaText;
static nsString *gAltText;
static nsString *gModifierSeparator;
public:
static nsMenuDismissalListener* mDismissalListener; // The listener that dismisses menus.
private: