Bug 589975 - NS_GetRadioUpdateValueMissingVisitor shouldn't have a aNotify parameter. r=sicking a=blocking-final
authorMounir Lamouri <mounir.lamouri@gmail.com>
Thu, 11 Nov 2010 13:34:27 +0100
changeset 57332 0d88025a123f4769ef8779221cd77434495beb27
parent 57331 7cf6faecbed3a54d95809996e5e329e7bbb2fff4
child 57333 ee16e4c4b133064f11f76660057d374ac6d9d438
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, blocking-final
bugs589975
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 589975 - NS_GetRadioUpdateValueMissingVisitor shouldn't have a aNotify parameter. r=sicking a=blocking-final
content/html/content/public/nsIRadioVisitor.h
content/html/content/src/nsHTMLFormElement.cpp
content/html/content/src/nsHTMLInputElement.cpp
content/html/content/src/nsHTMLInputElement.h
--- a/content/html/content/public/nsIRadioVisitor.h
+++ b/content/html/content/public/nsIRadioVisitor.h
@@ -97,11 +97,11 @@ NS_GetRadioGetCheckedChangedVisitor(PRBo
                                     nsIFormControl* aExcludeElement,
                                     nsIRadioVisitor** aVisitor);
 
 /**
  * This visitor will make sure all radio into the group updates their
  * value missing validity state.
  */
 nsIRadioVisitor*
-NS_GetRadioUpdateValueMissingVisitor(PRBool aNotify);
+NS_GetRadioUpdateValueMissingVisitor();
 
 #endif // nsIRadioVisitor_h___
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -1240,17 +1240,17 @@ nsHTMLFormElement::RemoveElement(nsGener
 {
   //
   // Remove it from the radio group if it's a radio button
   //
   nsresult rv = NS_OK;
   if (aChild->GetType() == NS_FORM_INPUT_RADIO) {
     nsRefPtr<nsHTMLInputElement> radio =
       static_cast<nsHTMLInputElement*>(aChild);
-    radio->WillRemoveFromRadioGroup(aNotify);
+    radio->WillRemoveFromRadioGroup();
   }
 
   // Determine whether to remove the child from the elements list
   // or the not in elements list.
   PRBool childInElements = ShouldBeInElements(aChild);
   nsTArray<nsGenericHTMLFormElement*>& controls = childInElements ?
       mControls->mElements :  mControls->mNotInElements;
   
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -773,17 +773,17 @@ nsHTMLInputElement::BeforeSetAttr(PRInt3
     // When name or type changes, radio should be removed from radio group.
     // (type changes are handled in the form itself currently)
     // If the parser is not done creating the radio, we also should not do it.
     //
     if ((aName == nsGkAtoms::name ||
          (aName == nsGkAtoms::type && !mForm)) &&
         mType == NS_FORM_INPUT_RADIO &&
         (mForm || !(GET_BOOLBIT(mBitField, BF_PARSER_CREATING)))) {
-      WillRemoveFromRadioGroup(aNotify);
+      WillRemoveFromRadioGroup();
     } else if (aNotify && aName == nsGkAtoms::src &&
                mType == NS_FORM_INPUT_IMAGE) {
       if (aValue) {
         LoadImage(*aValue, PR_TRUE, aNotify);
       } else {
         // Null value means the attr got unset; drop the image
         CancelImageRequests(aNotify);
       }
@@ -1680,17 +1680,17 @@ nsHTMLInputElement::SetCheckedInternal(P
 
   if (mType == NS_FORM_INPUT_CHECKBOX) {
     UpdateAllValidityStates(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(aNotify);
+      NS_GetRadioUpdateValueMissingVisitor();
     VisitGroup(visitor, aNotify);
   }
 }
 
 
 void
 nsHTMLInputElement::FireOnChange()
 {
@@ -2513,17 +2513,17 @@ void
 nsHTMLInputElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
 {
   // If we have a form and are unbound from it,
   // nsGenericHTMLFormElement::UnbindFromTree() will unset the form and
   // that takes care of form's WillRemove so we just have to take care
   // of the case where we're removing from the document and we don't
   // have a form
   if (!mForm && mType == NS_FORM_INPUT_RADIO) {
-    WillRemoveFromRadioGroup(PR_FALSE);
+    WillRemoveFromRadioGroup();
   }
 
   nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent);
 
   // GetCurrentDoc is returning nsnull so we can update the value
   // missing validity state to reflect we are no longer into a doc.
   UpdateValueMissingValidityState();
   // We might be no longer disabled because of parent chain changed.
@@ -3409,17 +3409,17 @@ nsHTMLInputElement::AddedToRadioGroup(PR
     nsAutoString name;
     if (GetNameIfExists(name)) {
       container->AddToRadioGroup(name, static_cast<nsIFormControl*>(this));
     }
   }
 }
 
 void
-nsHTMLInputElement::WillRemoveFromRadioGroup(PRBool aNotify)
+nsHTMLInputElement::WillRemoveFromRadioGroup()
 {
   //
   // If the input element is not in a form and
   // not in a document, we just need to return.
   //
   if (!mForm && !(IsInDoc() && GetParent())) {
     return;
   }
@@ -3442,17 +3442,17 @@ nsHTMLInputElement::WillRemoveFromRadioG
     nsCOMPtr<nsIRadioGroupContainer> container = GetRadioGroupContainer();
     if (container) {
       container->SetCurrentRadioButton(name, nsnull);
     }
 
     // Removing a checked radio from the group can change the validity state.
     // Let's ask other radio to update their value missing validity state.
     nsCOMPtr<nsIRadioVisitor> visitor =
-      NS_GetRadioUpdateValueMissingVisitor(aNotify);
+      NS_GetRadioUpdateValueMissingVisitor();
     VisitGroup(visitor, PR_FALSE);
   }
   
   //
   // Remove this radio from its group in the container
   //
   nsCOMPtr<nsIRadioGroupContainer> container = GetRadioGroupContainer();
   if (container) {
@@ -4156,19 +4156,18 @@ public:
 
 protected:
   PRBool* mCheckedChanged;
   nsIFormControl* mExcludeElement;
 };
 
 class nsRadioUpdateValueMissingVisitor : public nsRadioVisitor {
 public:
-  nsRadioUpdateValueMissingVisitor(PRBool aNotify)
+  nsRadioUpdateValueMissingVisitor()
     : nsRadioVisitor()
-    , mNotify(aNotify)
     { }
 
   virtual ~nsRadioUpdateValueMissingVisitor() { };
 
   NS_IMETHOD Visit(nsIFormControl* aRadio, PRBool* aStop)
   {
     /**
      * The simplest way to update the value missing validity state is to do a
@@ -4178,22 +4177,19 @@ public:
      * 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(mNotify);
+    textCtl->OnValueChanged(PR_TRUE);
     return NS_OK;
   }
-
-protected:
-  PRBool mNotify;
 };
 
 nsresult
 NS_GetRadioSetCheckedChangedVisitor(PRBool aCheckedChanged,
                                     nsIRadioVisitor** aVisitor)
 {
   //
   // These are static so that we don't have to keep creating new visitors for
@@ -4267,19 +4263,19 @@ NS_GetRadioGetCheckedChangedVisitor(PRBo
  *
  * TODO:
  * Do we really need factories for radio visitors? Or at least, we should move
  * that somewhere else because it feels like it's here only because the radio
  * visitor classes are defined after most of nsHTMLInputElement code.
  * See bug 586298
  */
 nsIRadioVisitor*
-NS_GetRadioUpdateValueMissingVisitor(PRBool aNotify)
+NS_GetRadioUpdateValueMissingVisitor()
 {
-  return new nsRadioUpdateValueMissingVisitor(aNotify);
+  return new nsRadioUpdateValueMissingVisitor();
 }
 
 NS_IMETHODIMP_(PRBool)
 nsHTMLInputElement::IsSingleLineTextControl() const
 {
   return IsSingleLineTextControl(PR_FALSE);
 }
 
--- a/content/html/content/src/nsHTMLInputElement.h
+++ b/content/html/content/src/nsHTMLInputElement.h
@@ -216,17 +216,17 @@ public:
   // nsIFileControlElement
   void GetDisplayFileName(nsAString& aFileName) const;
   const nsCOMArray<nsIDOMFile>& GetFiles();
   void SetFiles(const nsCOMArray<nsIDOMFile>& aFiles);
 
   void SetCheckedChangedInternal(PRBool aCheckedChanged);
   PRBool GetCheckedChanged();
   void AddedToRadioGroup(PRBool aNotify = PR_TRUE);
-  void WillRemoveFromRadioGroup(PRBool aNotify);
+  void WillRemoveFromRadioGroup();
   /**
    * Get the radio group container for this button (form or document)
    * @return the radio group container (or null if no form or document)
    */
   virtual already_AddRefed<nsIRadioGroupContainer> GetRadioGroupContainer();
 
  /**
    * Helper function returning the currently selected button in the radio group.