зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1703419 - When an item is unchecked, remove the checked attribute rather than setting it to false, and don't touch the checked attribute during initialization. r=tnikkel
Depends on D111023 Differential Revision: https://phabricator.services.mozilla.com/D111024
This commit is contained in:
Родитель
67e2a23081
Коммит
81eaaaa047
|
@ -77,10 +77,12 @@ nsMenuItemX::nsMenuItemX(nsMenuX* aParent, const nsString& aLabel, EMenuItemType
|
|||
action:nil
|
||||
keyEquivalent:@""];
|
||||
|
||||
mNativeMenuItem.enabled = isEnabled;
|
||||
mIsChecked = mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
|
||||
mNativeMenuItem.enabled = isEnabled;
|
||||
mNativeMenuItem.state = mIsChecked ? NSOnState : NSOffState;
|
||||
|
||||
SetChecked(mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked,
|
||||
nsGkAtoms::_true, eCaseMatters));
|
||||
SetKeyEquiv();
|
||||
}
|
||||
|
||||
|
@ -123,8 +125,11 @@ nsresult nsMenuItemX::SetChecked(bool aIsChecked) {
|
|||
|
||||
// update the content model. This will also handle unchecking our siblings
|
||||
// if we are a radiomenu
|
||||
mContent->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::checked,
|
||||
mIsChecked ? u"true"_ns : u"false"_ns, true);
|
||||
if (mIsChecked) {
|
||||
mContent->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::checked, u"true"_ns, true);
|
||||
} else {
|
||||
mContent->AsElement()->UnsetAttr(kNameSpaceID_None, nsGkAtoms::checked, true);
|
||||
}
|
||||
|
||||
// update native menu item
|
||||
mNativeMenuItem.state = mIsChecked ? NSOnState : NSOffState;
|
||||
|
|
Загрузка…
Ссылка в новой задаче