mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 456374 disabled attribute doesn't update native submenu r=josh sr=roc
This commit is contained in:
parent
160e4afb66
commit
7316c49063
@ -157,15 +157,13 @@ nsresult nsMenuX::Create(nsMenuObjectX* aParent, nsMenuBarX* aMenuBar, nsIConten
|
||||
if (mContent->GetChildCount() == 0)
|
||||
mVisible = PR_FALSE;
|
||||
|
||||
SetEnabled(!mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled,
|
||||
nsWidgetAtoms::_true, eCaseMatters));
|
||||
|
||||
NSString *newCocoaLabelString = nsMenuUtilsX::CreateTruncatedCocoaLabel(mLabel);
|
||||
mNativeMenuItem = [[NSMenuItem alloc] initWithTitle:newCocoaLabelString action:nil keyEquivalent:@""];
|
||||
[newCocoaLabelString release];
|
||||
[mNativeMenuItem setSubmenu:mNativeMenu];
|
||||
|
||||
[mNativeMenuItem setEnabled:(BOOL)mIsEnabled];
|
||||
SetEnabled(!mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled,
|
||||
nsWidgetAtoms::_true, eCaseMatters));
|
||||
|
||||
// We call MenuConstruct here because keyboard commands are dependent upon
|
||||
// native menu items being created. If we only call MenuConstruct when a menu
|
||||
@ -460,8 +458,8 @@ nsresult nsMenuX::SetEnabled(PRBool aIsEnabled)
|
||||
{
|
||||
if (aIsEnabled != mIsEnabled) {
|
||||
// we always want to rebuild when this changes
|
||||
SetRebuild(PR_TRUE);
|
||||
mIsEnabled = aIsEnabled;
|
||||
[mNativeMenuItem setEnabled:(BOOL)mIsEnabled];
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -765,13 +763,10 @@ void nsMenuX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aConte
|
||||
nsMenuObjectTypeX parentType = mParent->MenuObjectType();
|
||||
|
||||
if (aAttribute == nsWidgetAtoms::disabled) {
|
||||
SetRebuild(PR_TRUE);
|
||||
SetEnabled(!mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled,
|
||||
nsWidgetAtoms::_true, eCaseMatters));
|
||||
}
|
||||
else if (aAttribute == nsWidgetAtoms::label) {
|
||||
SetRebuild(PR_TRUE);
|
||||
|
||||
mContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::label, mLabel);
|
||||
|
||||
// invalidate my parent. If we're a submenu parent, we have to rebuild
|
||||
|
Loading…
Reference in New Issue
Block a user