Bug 610427 - Remove aNotify in nsHTMLInputElement::SetCheckedChangedInternal. r=bz a=bsmedberg
authorMounir Lamouri <mounir.lamouri@gmail.com>
Wed, 24 Nov 2010 00:53:39 +0100
changeset 58150 41e7b8cbd271f7ab01a72479c84c678077127f32
parent 58149 50dda7cdd3e88588ad9b33fc367c6da6ec7ce5dc
child 58151 27db143745a77ffbcaeb8acea9dd4f590d7f4fe7
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersbz, bsmedberg
bugs610427
milestone2.0b8pre
Bug 610427 - Remove aNotify in nsHTMLInputElement::SetCheckedChangedInternal. r=bz a=bsmedberg
content/html/content/src/nsHTMLInputElement.cpp
content/html/content/src/nsHTMLInputElement.h
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -1478,32 +1478,33 @@ nsHTMLInputElement::DoSetCheckedChanged(
   if (mType == NS_FORM_INPUT_RADIO) {
     if (GET_BOOLBIT(mBitField, BF_CHECKED_CHANGED) != aCheckedChanged) {
       nsCOMPtr<nsIRadioVisitor> visitor;
       NS_GetRadioSetCheckedChangedVisitor(aCheckedChanged,
                                           getter_AddRefs(visitor));
       VisitGroup(visitor, aNotify);
     }
   } else {
-    SetCheckedChangedInternal(aCheckedChanged, aNotify);
+    SetCheckedChangedInternal(aCheckedChanged);
   }
 }
 
 void
-nsHTMLInputElement::SetCheckedChangedInternal(PRBool aCheckedChanged,
-                                              PRBool aNotify)
+nsHTMLInputElement::SetCheckedChangedInternal(PRBool aCheckedChanged)
 {
   PRBool checkedChangedBefore = GetCheckedChanged();
 
   SET_BOOLBIT(mBitField, BF_CHECKED_CHANGED, aCheckedChanged);
 
-  if (aNotify && checkedChangedBefore != aCheckedChanged) {
+  // This method can't be called when we are not authorized to notify
+  // so we do not need a aNotify parameter.
+  if (checkedChangedBefore != aCheckedChanged) {
     nsIDocument* document = GetCurrentDoc();
     if (document) {
-      mozAutoDocUpdate upd(document, UPDATE_CONTENT_STATE, aNotify);
+      mozAutoDocUpdate upd(document, UPDATE_CONTENT_STATE, PR_TRUE);
       document->ContentStatesChanged(this, nsnull,
                                      NS_EVENT_STATE_MOZ_UI_INVALID);
     }
   }
 }
 
 NS_IMETHODIMP
 nsHTMLInputElement::SetChecked(PRBool aChecked)
@@ -3405,20 +3406,20 @@ nsHTMLInputElement::AllowDrop()
   return mType != NS_FORM_INPUT_FILE;
 }
 
 /*
  * Radio group stuff
  */
 
 void
-nsHTMLInputElement::AddedToRadioGroup(PRBool aNotify)
+nsHTMLInputElement::AddedToRadioGroup()
 {
   // Make sure not to notify if we're still being created by the parser
-  aNotify = aNotify && !GET_BOOLBIT(mBitField, BF_PARSER_CREATING);
+  PRBool notify = !GET_BOOLBIT(mBitField, BF_PARSER_CREATING);
 
   //
   //  If the input element is not in a form and
   //  not in a document, we just need to return.
   //
   if (!mForm && !(IsInDoc() && GetParent())) {
     return;
   }
@@ -3430,31 +3431,31 @@ nsHTMLInputElement::AddedToRadioGroup(PR
   if (GetChecked()) {
     //
     // If it is checked, call "RadioSetChecked" to perform the selection/
     // deselection ritual.  This has the side effect of repainting the
     // radio button, but as adding a checked radio button into the group
     // should not be that common an occurrence, I think we can live with
     // that.
     //
-    RadioSetChecked(aNotify);
+    RadioSetChecked(notify);
   }
 
   //
   // For integrity purposes, we have to ensure that "checkedChanged" is
   // the same for this new element as for all the others in the group
   //
   PRBool checkedChanged = GET_BOOLBIT(mBitField, BF_CHECKED_CHANGED);
   nsCOMPtr<nsIRadioVisitor> visitor;
   nsresult rv = NS_GetRadioGetCheckedChangedVisitor(&checkedChanged, this,
                                            getter_AddRefs(visitor));
   if (NS_FAILED(rv)) { return; }
   
-  VisitGroup(visitor, aNotify);
-  SetCheckedChangedInternal(checkedChanged, aNotify);
+  VisitGroup(visitor, notify);
+  SetCheckedChangedInternal(checkedChanged);
   
   //
   // Add the radio to the radio group container.
   //
   nsCOMPtr<nsIRadioGroupContainer> container = GetRadioGroupContainer();
   if (container) {
     nsAutoString name;
     if (GetNameIfExists(name)) {
@@ -4169,17 +4170,17 @@ public:
 
   virtual ~nsRadioSetCheckedChangedVisitor() { }
 
   NS_IMETHOD Visit(nsIFormControl* aRadio, PRBool* aStop)
   {
     nsRefPtr<nsHTMLInputElement> radio =
       static_cast<nsHTMLInputElement*>(aRadio);
     NS_ASSERTION(radio, "Visit() passed a null button!");
-    radio->SetCheckedChangedInternal(mCheckedChanged, PR_TRUE);
+    radio->SetCheckedChangedInternal(mCheckedChanged);
     return NS_OK;
   }
 
 protected:
   PRPackedBool mCheckedChanged;
 };
 
 //
--- a/content/html/content/src/nsHTMLInputElement.h
+++ b/content/html/content/src/nsHTMLInputElement.h
@@ -214,21 +214,21 @@ public:
   NS_IMETHOD_(void) InitializeKeyboardEventListeners();
   NS_IMETHOD_(void) OnValueChanged(PRBool aNotify);
 
   // nsIFileControlElement
   void GetDisplayFileName(nsAString& aFileName) const;
   const nsCOMArray<nsIDOMFile>& GetFiles();
   void SetFiles(const nsCOMArray<nsIDOMFile>& aFiles, bool aSetValueChanged);
 
-  void SetCheckedChangedInternal(PRBool aCheckedChanged, PRBool aNotify);
+  void SetCheckedChangedInternal(PRBool aCheckedChanged);
   PRBool GetCheckedChanged() const {
     return GET_BOOLBIT(mBitField, BF_CHECKED_CHANGED);
   }
-  void AddedToRadioGroup(PRBool aNotify = PR_TRUE);
+  void AddedToRadioGroup();
   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();
 
  /**