Bug 615764 - Remove nsRadioUpdateValueMissingVisitor. r+a=sicking

--HG--
extra : rebase_source : 1655bae21cbaf865be38b63ebd0f8ac59b5002dd
This commit is contained in:
Mounir Lamouri 2010-12-16 11:53:40 -08:00
Родитель 3807d4f866
Коммит 91e3800e0c
2 изменённых файлов: 3 добавлений и 47 удалений

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

@ -98,13 +98,6 @@ NS_GetRadioGetCheckedChangedVisitor(PRBool* aCheckedChanged,
nsIFormControl* aExcludeElement,
nsIRadioVisitor** aVisitor);
/**
* This visitor will make sure all radio into the group updates their
* value missing validity state.
*/
nsIRadioVisitor*
NS_GetRadioUpdateValueMissingVisitor();
/**
* This visitor will return (via aRequired) if an element of the group has the
* required attribute set.

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

@ -1712,10 +1712,7 @@ nsHTMLInputElement::SetCheckedInternal(PRBool aChecked, PRBool aNotify)
}
if (mType == NS_FORM_INPUT_RADIO) {
// OnValueChanged is going to be called for all radios in the radio group.
nsCOMPtr<nsIRadioVisitor> visitor =
NS_GetRadioUpdateValueMissingVisitor();
VisitGroup(visitor, aNotify);
UpdateValueMissingValidityState();
}
}
@ -4255,34 +4252,6 @@ protected:
nsIFormControl* mExcludeElement;
};
class nsRadioUpdateValueMissingVisitor : public nsRadioVisitor {
public:
nsRadioUpdateValueMissingVisitor()
: nsRadioVisitor()
{ }
virtual ~nsRadioUpdateValueMissingVisitor() { };
NS_IMETHOD Visit(nsIFormControl* aRadio, PRBool* aStop)
{
/**
* The simplest way to update the value missing validity state is to do a
* global update of the validity state by simulationg a value change.
* OnValueChanged() is declared into nsITextControlElement. That may sound
* to be a weird way to update the validity states for radio controls but
* they are also implementing nsITextControlElement interface.
*
* When OnValueChanged() is called on a radio control, it will check if any
* radio in the group is checked. If none, the required radio will be
* suffering from being missing.
*/
nsCOMPtr<nsITextControlElement> textCtl(do_QueryInterface(aRadio));
NS_ASSERTION(textCtl, "Visit() passed a null or non-radio pointer");
textCtl->OnValueChanged(PR_TRUE);
return NS_OK;
}
};
class nsRadioGroupRequiredVisitor : public nsRadioVisitor {
public:
nsRadioGroupRequiredVisitor(nsIFormControl* aExcludeElement, bool* aRequired)
@ -4422,8 +4391,8 @@ NS_GetRadioGetCheckedChangedVisitor(PRBool* aCheckedChanged,
}
/*
* This method is a factory: it lets callers to create an instance of
* nsRadioUpdateValueMissing without the class declaration and definition.
* These methods are factores: they let callers to create an instance of
* a radio group visitor without the class declaration and definition.
*
* TODO:
* Do we really need factories for radio visitors? Or at least, we should move
@ -4431,12 +4400,6 @@ NS_GetRadioGetCheckedChangedVisitor(PRBool* aCheckedChanged,
* visitor classes are defined after most of nsHTMLInputElement code.
* See bug 586298
*/
nsIRadioVisitor*
NS_GetRadioUpdateValueMissingVisitor()
{
return new nsRadioUpdateValueMissingVisitor();
}
nsIRadioVisitor*
NS_GetRadioGroupRequiredVisitor(nsIFormControl* aExcludeElement,
bool* aRequired)