зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1357646 part 1. Move the setting of mType from HTMLButtonElement::ParseAttribute to HTMLButtonElement::AfterSetAttr. r=mystor
ParseAttribute should generally not mutate the element.
This commit is contained in:
Родитель
28f7ae49bb
Коммит
d6ac03b76b
|
@ -173,16 +173,8 @@ HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
|
|||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::type) {
|
||||
// XXX ARG!! This is major evilness. ParseAttribute
|
||||
// shouldn't set members. Override SetAttr instead
|
||||
bool success = aResult.ParseEnumValue(aValue, kButtonTypeTable, false);
|
||||
if (success) {
|
||||
mType = aResult.GetEnumValue();
|
||||
} else {
|
||||
mType = kButtonDefaultType->value;
|
||||
}
|
||||
|
||||
return success;
|
||||
return aResult.ParseEnumValue(aValue, kButtonTypeTable, false,
|
||||
kButtonDefaultType);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::formmethod) {
|
||||
|
@ -440,7 +432,9 @@ HTMLButtonElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
{
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::type) {
|
||||
if (!aValue) {
|
||||
if (aValue) {
|
||||
mType = aValue->GetEnumValue();
|
||||
} else {
|
||||
mType = kButtonDefaultType->value;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче