Bug 313351. ContentStatesChanged should take only one argument. r=dbaron
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 28 Mar 2011 23:32:11 -0400
changeset 64120 a9f63be5e953f8822c4f599c24502861dac2fc34
parent 64119 be9814a5a456c9fec511adaee7720c781c263005
child 64121 728077e8679d91e7b04a3efc52668568dd9d8b87
push idunknown
push userunknown
push dateunknown
reviewersdbaron
bugs313351
milestone2.2a1pre
Bug 313351. ContentStatesChanged should take only one argument. r=dbaron
accessible/src/base/nsDocAccessible.cpp
content/base/public/nsIDocument.h
content/base/public/nsIDocumentObserver.h
content/base/src/Link.cpp
content/base/src/nsDocument.cpp
content/base/src/nsDocument.h
content/base/src/nsGenericElement.cpp
content/base/src/nsImageLoadingContent.cpp
content/base/src/nsObjectLoadingContent.cpp
content/events/src/nsEventStateManager.cpp
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsHTMLButtonElement.cpp
content/html/content/src/nsHTMLFormElement.cpp
content/html/content/src/nsHTMLInputElement.cpp
content/html/content/src/nsHTMLOptionElement.cpp
content/html/content/src/nsHTMLOutputElement.cpp
content/html/content/src/nsHTMLSelectElement.cpp
content/html/content/src/nsHTMLTextAreaElement.cpp
content/html/document/src/nsHTMLDocument.cpp
content/mathml/content/src/nsMathMLElement.cpp
content/xtf/src/nsXTFElementWrapper.cpp
content/xul/content/src/nsXULElement.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/base/nsPresShell.cpp
layout/xul/base/src/tree/src/nsTreeContentView.cpp
layout/xul/base/src/tree/src/nsTreeContentView.h
parser/html/nsHtml5TreeOperation.cpp
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -1226,29 +1226,27 @@ nsDocAccessible::ARIAAttributeChanged(ns
 
 void nsDocAccessible::ContentAppended(nsIDocument *aDocument,
                                       nsIContent* aContainer,
                                       nsIContent* aFirstNewContent,
                                       PRInt32 /* unused */)
 {
 }
 
-void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument,
-                                           nsIContent* aContent1,
-                                           nsIContent* aContent2,
-                                           nsEventStates aStateMask)
+void nsDocAccessible::ContentStateChanged(nsIDocument* aDocument,
+                                          nsIContent* aContent,
+                                          nsEventStates aStateMask)
 {
   if (aStateMask.HasState(NS_EVENT_STATE_CHECKED)) {
-    nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent1);
-    nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent2);
+    nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent);
   }
 
   if (aStateMask.HasState(NS_EVENT_STATE_INVALID)) {
     nsRefPtr<AccEvent> event =
-      new AccStateChangeEvent(aContent1, nsIAccessibleStates::STATE_INVALID,
+      new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_INVALID,
                               PR_FALSE, PR_TRUE);
     FireDelayedAccessibleEvent(event);
    }
 }
 
 void nsDocAccessible::DocumentStatesChanged(nsIDocument* aDocument,
                                             nsEventStates aStateMask)
 {
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -118,18 +118,18 @@ class Loader;
 namespace dom {
 class Link;
 class Element;
 } // namespace dom
 } // namespace mozilla
 
 
 #define NS_IDOCUMENT_IID      \
-{ 0xc38a7935, 0xc854, 0x4df7, \
-  { 0x8f, 0xd4, 0xa2, 0x6f, 0x0d, 0x27, 0x9f, 0x31 } }
+{ 0x2c6ad63f, 0xb7b9, 0x42f8, \
+ { 0xbd, 0xde, 0x76, 0x0a, 0x83, 0xe3, 0xb0, 0x49 } }
 
 // Flag for AddStyleSheet().
 #define NS_STYLESHEET_FROM_CATALOG                (1 << 0)
 
 // Document states
 
 // RTL locale: specific to the XUL localedir attribute
 #define NS_DOCUMENT_STATE_RTL_LOCALE              NS_DEFINE_EVENT_STATE_MACRO(0)
@@ -752,21 +752,19 @@ public:
   virtual void EndUpdate(nsUpdateType aUpdateType) = 0;
   virtual void BeginLoad() = 0;
   virtual void EndLoad() = 0;
 
   enum ReadyState { READYSTATE_UNINITIALIZED = 0, READYSTATE_LOADING = 1, READYSTATE_INTERACTIVE = 3, READYSTATE_COMPLETE = 4};
   virtual void SetReadyStateInternal(ReadyState rs) = 0;
   virtual ReadyState GetReadyStateEnum() = 0;
 
-  // notify that one or two content nodes changed state
-  // either may be nsnull, but not both
-  virtual void ContentStatesChanged(nsIContent* aContent1,
-                                    nsIContent* aContent2,
-                                    nsEventStates aStateMask) = 0;
+  // notify that a content node changed state
+  virtual void ContentStateChanged(nsIContent* aContent,
+                                   nsEventStates aStateMask) = 0;
 
   // Notify that a document state has changed.
   // This should only be called by callers whose state is also reflected in the
   // implementation of nsDocument::GetDocumentState.
   virtual void DocumentStatesChanged(nsEventStates aStateMask) = 0;
 
   // Observation hooks for style data to propagate notifications
   // to document observers
--- a/content/base/public/nsIDocumentObserver.h
+++ b/content/base/public/nsIDocumentObserver.h
@@ -44,18 +44,18 @@
 class nsIAtom;
 class nsIContent;
 class nsIStyleSheet;
 class nsIStyleRule;
 class nsString;
 class nsIDocument;
 
 #define NS_IDOCUMENT_OBSERVER_IID \
-{ 0x3d005225, 0x210f, 0x4b07, \
-  { 0xb1, 0xd9, 0x96, 0x02, 0x05, 0x74, 0xc4, 0x37 } }
+{ 0x900bc4bc, 0x8b6c, 0x4cba, \
+ { 0x82, 0xfa, 0x56, 0x8a, 0x80, 0xff, 0xfd, 0x3e } }
 
 typedef PRUint32 nsUpdateType;
 
 #define UPDATE_CONTENT_MODEL 0x00000001
 #define UPDATE_STYLE         0x00000002
 #define UPDATE_CONTENT_STATE 0x00000004
 #define UPDATE_ALL (UPDATE_CONTENT_MODEL | UPDATE_STYLE | UPDATE_CONTENT_STATE)
 
@@ -98,30 +98,22 @@ public:
    * no need to invoke this method directly).  The notification 
    * is passed to any IDocumentObservers. The notification is 
    * passed on to all of the document observers. <p>
    *
    * This notification is not sent when a piece of content is
    * added/removed from the document or the content itself changed 
    * (the other notifications are used for that).
    *
-   * The optional second content node is to allow optimization
-   * of the case where state moves from one node to another
-   * (as is likely for :focus and :hover)
-   *
-   * Either content node may be nsnull, but not both
-   *
    * @param aDocument The document being observed
-   * @param aContent1 the piece of content that changed
-   * @param aContent2 optional second piece of content that changed
+   * @param aContent the piece of content that changed
    */
-  virtual void ContentStatesChanged(nsIDocument* aDocument,
-                                    nsIContent* aContent1,
-                                    nsIContent* aContent2,
-                                    nsEventStates aStateMask) = 0;
+  virtual void ContentStateChanged(nsIDocument* aDocument,
+                                   nsIContent* aContent,
+                                   nsEventStates aStateMask) = 0;
 
   /**
    * Notification that the state of the document has changed.
    *
    * @param aDocument The document being observed
    * @param aStateMask the state that changed
    */
   virtual void DocumentStatesChanged(nsIDocument* aDocument,
@@ -242,21 +234,20 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumen
     virtual void EndUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType);
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD                                \
     virtual void BeginLoad(nsIDocument* aDocument);
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD                                  \
     virtual void EndLoad(nsIDocument* aDocument);
 
-#define NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATESCHANGED                     \
-    virtual void ContentStatesChanged(nsIDocument* aDocument,                \
-                                      nsIContent* aContent1,                 \
-                                      nsIContent* aContent2,                 \
-                                      nsEventStates aStateMask);
+#define NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED                      \
+    virtual void ContentStateChanged(nsIDocument* aDocument,                 \
+                                     nsIContent* aContent,                   \
+                                     nsEventStates aStateMask);
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED                    \
     virtual void DocumentStatesChanged(nsIDocument* aDocument,               \
                                        nsEventStates aStateMask);
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETADDED                          \
     virtual void StyleSheetAdded(nsIDocument* aDocument,                     \
                                  nsIStyleSheet* aStyleSheet,                 \
@@ -288,17 +279,17 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumen
                                   nsIStyleSheet* aStyleSheet,                \
                                   nsIStyleRule* aStyleRule);
 
 #define NS_DECL_NSIDOCUMENTOBSERVER                                          \
     NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE                                  \
     NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE                                    \
     NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD                                    \
     NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD                                      \
-    NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATESCHANGED                         \
+    NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED                          \
     NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED                        \
     NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETADDED                              \
     NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETREMOVED                            \
     NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETAPPLICABLESTATECHANGED             \
     NS_DECL_NSIDOCUMENTOBSERVER_STYLERULECHANGED                             \
     NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEADDED                               \
     NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEREMOVED                             \
     NS_DECL_NSIMUTATIONOBSERVER
@@ -322,19 +313,18 @@ void                                    
 }                                                                         \
 void                                                                      \
 _class::EndLoad(nsIDocument* aDocument)                                   \
 {                                                                         \
 }
 
 #define NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(_class)                    \
 void                                                                      \
-_class::ContentStatesChanged(nsIDocument* aDocument,                      \
-                             nsIContent* aContent1,                       \
-                             nsIContent* aContent2,                       \
+_class::ContentStateChanged(nsIDocument* aDocument,                       \
+                             nsIContent* aContent,                        \
                              nsEventStates aStateMask)                    \
 {                                                                         \
 }                                                                         \
                                                                           \
 void                                                                      \
 _class::DocumentStatesChanged(nsIDocument* aDocument,                     \
                               nsEventStates aStateMask)                   \
 {                                                                         \
--- a/content/base/src/Link.cpp
+++ b/content/base/src/Link.cpp
@@ -97,17 +97,17 @@ Link::SetLinkState(nsLinkState aState)
   nsIContent *content = Content();
   nsIDocument *doc = content->GetCurrentDoc();
   NS_ASSERTION(doc, "Registered but we have no document?!");
   nsEventStates newLinkState = LinkState();
   NS_ASSERTION(newLinkState == NS_EVENT_STATE_VISITED ||
                newLinkState == NS_EVENT_STATE_UNVISITED,
                "Unexpected state obtained from LinkState()!");
   mozAutoDocUpdate update(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-  doc->ContentStatesChanged(content, nsnull, oldLinkState ^ newLinkState);
+  doc->ContentStateChanged(content, oldLinkState ^ newLinkState);
 }
 
 nsEventStates
 Link::LinkState() const
 {
   // We are a constant method, but we are just lazily doing things and have to
   // track that state.  Cast away that constness!
   Link *self = const_cast<Link *>(this);
@@ -488,17 +488,17 @@ Link::ResetLinkState(bool aNotify)
   // If aNotify is true, notify both of the visited-related states.  We have
   // to do that, because we might be racing with a response from history and
   // hence need to make sure that we get restyled whether we were visited or
   // not before.  In particular, we need to make sure that our LinkState() is
   // called so that we'll start a new history query as needed.
   if (aNotify && doc) {
     nsEventStates changedState = NS_EVENT_STATE_VISITED ^ NS_EVENT_STATE_UNVISITED;
     MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, aNotify);
-    doc->ContentStatesChanged(content, nsnull, changedState);
+    doc->ContentStateChanged(content, changedState);
   }
 }
 
 void
 Link::UnregisterFromHistory()
 {
   // If we are not registered, we have nothing to do.
   if (!mRegistered) {
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -4261,21 +4261,20 @@ nsDocument::EndLoad()
       NS_NewRunnableMethod(this, &nsDocument::DispatchContentLoadedEvents);
     NS_DispatchToCurrentThread(ev);
   } else {
     DispatchContentLoadedEvents();
   }
 }
 
 void
-nsDocument::ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2,
-                                 nsEventStates aStateMask)
-{
-  NS_DOCUMENT_NOTIFY_OBSERVERS(ContentStatesChanged,
-                               (this, aContent1, aContent2, aStateMask));
+nsDocument::ContentStateChanged(nsIContent* aContent, nsEventStates aStateMask)
+{
+  NS_DOCUMENT_NOTIFY_OBSERVERS(ContentStateChanged,
+                               (this, aContent, aStateMask));
 }
 
 void
 nsDocument::DocumentStatesChanged(nsEventStates aStateMask)
 {
   // Invalidate our cached state.
   mGotDocumentState &= ~aStateMask;
   mDocumentState &= ~aStateMask;
--- a/content/base/src/nsDocument.h
+++ b/content/base/src/nsDocument.h
@@ -701,19 +701,18 @@ public:
   virtual void BeginUpdate(nsUpdateType aUpdateType);
   virtual void EndUpdate(nsUpdateType aUpdateType);
   virtual void BeginLoad();
   virtual void EndLoad();
 
   virtual void SetReadyStateInternal(ReadyState rs);
   virtual ReadyState GetReadyStateEnum();
 
-  virtual void ContentStatesChanged(nsIContent* aContent1,
-                                    nsIContent* aContent2,
-                                    nsEventStates aStateMask);
+  virtual void ContentStateChanged(nsIContent* aContent,
+                                   nsEventStates aStateMask);
   virtual void DocumentStatesChanged(nsEventStates aStateMask);
 
   virtual void StyleRuleChanged(nsIStyleSheet* aStyleSheet,
                                 nsIStyleRule* aOldStyleRule,
                                 nsIStyleRule* aNewStyleRule);
   virtual void StyleRuleAdded(nsIStyleSheet* aStyleSheet,
                               nsIStyleRule* aStyleRule);
   virtual void StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -4761,17 +4761,17 @@ nsGenericElement::SetAttrAndNotify(PRInt
       }
     }
   }
 
   if (aNotify) {
     stateMask ^= IntrinsicState();
     if (document && !stateMask.IsEmpty()) {
       MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, aNotify);
-      document->ContentStatesChanged(this, nsnull, stateMask);
+      document->ContentStateChanged(this, stateMask);
     }
     nsNodeUtils::AttributeChanged(this, aNamespaceID, aName, aModType);
   }
 
   if (aNamespaceID == kNameSpaceID_XMLEvents && 
       aName == nsGkAtoms::event && mNodeInfo->GetDocument()) {
     mNodeInfo->GetDocument()->AddXMLEventsContent(this);
   }
@@ -5008,17 +5008,17 @@ nsGenericElement::UnsetAttr(PRInt32 aNam
       }
     }
   }
 
   if (aNotify) {
     stateMask ^= IntrinsicState();
     if (document && !stateMask.IsEmpty()) {
       MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, aNotify);
-      document->ContentStatesChanged(this, nsnull, stateMask);
+      document->ContentStateChanged(this, stateMask);
     }
     nsNodeUtils::AttributeChanged(this, aNameSpaceID, aName,
                                   nsIDOMMutationEvent::REMOVAL);
   }
 
   rv = AfterSetAttr(aNameSpaceID, aName, nsnull, aNotify);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/content/base/src/nsImageLoadingContent.cpp
+++ b/content/base/src/nsImageLoadingContent.cpp
@@ -824,17 +824,17 @@ nsImageLoadingContent::UpdateImageState(
 
   if (aNotify) {
     nsIDocument* doc = thisContent->GetCurrentDoc();
     if (doc) {
       NS_ASSERTION(thisContent->IsInDoc(), "Something is confused");
       nsEventStates changedBits = oldState ^ ImageState();
       if (!changedBits.IsEmpty()) {
         mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-        doc->ContentStatesChanged(thisContent, nsnull, changedBits);
+        doc->ContentStateChanged(thisContent, changedBits);
       }
     }
   }
 }
 
 void
 nsImageLoadingContent::CancelImageRequests(PRBool aNotify)
 {
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -1652,17 +1652,17 @@ nsObjectLoadingContent::NotifyStateChang
 
   if (newState != aOldState) {
     // This will trigger frame construction
     NS_ASSERTION(thisContent->IsInDoc(), "Something is confused");
     nsEventStates changedBits = aOldState ^ newState;
 
     {
       mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(thisContent, nsnull, changedBits);
+      doc->ContentStateChanged(thisContent, changedBits);
     }
     if (aSync) {
       // Make sure that frames are actually constructed, and do it after
       // EndUpdate was called.
       doc->FlushPendingNotifications(Flush_Frames);
     }
   } else if (aOldType != mType) {
     // If our state changed, then we already recreated frames
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -4300,20 +4300,20 @@ static nsIContent* FindCommonAncestor(ns
   return nsnull;
 }
 
 static void
 NotifyAncestors(nsIDocument* aDocument, nsIContent* aStartNode,
                 nsIContent* aStopBefore, nsEventStates aState)
 {
   while (aStartNode && aStartNode != aStopBefore) {
-    aDocument->ContentStatesChanged(aStartNode, nsnull, aState);
+    aDocument->ContentStateChanged(aStartNode, aState);
     nsCOMPtr<nsIContent> labelTarget = GetLabelTarget(aStartNode);
     if (labelTarget) {
-      aDocument->ContentStatesChanged(labelTarget, nsnull, aState);
+      aDocument->ContentStateChanged(labelTarget, aState);
     }
     aStartNode = aStartNode->GetParent();
   }
 }
 
 PRBool
 nsEventStateManager::SetContentState(nsIContent *aContent, nsEventStates aState)
 {
@@ -4462,42 +4462,46 @@ nsEventStateManager::SetContentState(nsI
       doc1->BeginUpdate(UPDATE_CONTENT_STATE);
 
       NotifyAncestors(doc1, newActive, commonActiveAncestor, NS_EVENT_STATE_ACTIVE);
       NotifyAncestors(doc1, oldActive, commonActiveAncestor, NS_EVENT_STATE_ACTIVE);
       NotifyAncestors(doc1, newHover, commonHoverAncestor, NS_EVENT_STATE_HOVER);
       NotifyAncestors(doc1, oldHover, commonHoverAncestor, NS_EVENT_STATE_HOVER);
 
       if (notifyContent[0]) {
-        doc1->ContentStatesChanged(notifyContent[0], notifyContent[1],
-                                   simpleStates);
+        doc1->ContentStateChanged(notifyContent[0], simpleStates);
+        if (notifyContent[1]) {
+          doc1->ContentStateChanged(notifyContent[1], simpleStates);
+        }
         if (notifyContent[2]) {
           // more that two notifications are needed (should be rare)
-          // XXX a further optimization here would be to group the
-          // notification pairs together by parent/child, only needed if
-          // more than two content changed (ie: if [0] and [2] are
-          // parent/child, then notify (0,2) (1,3))
-          doc1->ContentStatesChanged(notifyContent[2], notifyContent[3],
-                                     simpleStates);
+          doc1->ContentStateChanged(notifyContent[2], simpleStates);
+          if (notifyContent[3]) {
+            doc1->ContentStateChanged(notifyContent[3], simpleStates);
+          }
           if (notifyContent[4]) {
             // more that four notifications are needed (should be rare)
-            doc1->ContentStatesChanged(notifyContent[4], nsnull,
-                                       simpleStates);
+            doc1->ContentStateChanged(notifyContent[4], simpleStates);
           }
         }
       }
       doc1->EndUpdate(UPDATE_CONTENT_STATE);
 
       if (doc2) {
         doc2->BeginUpdate(UPDATE_CONTENT_STATE);
-        doc2->ContentStatesChanged(notifyContent[1], notifyContent[2],
-                                   simpleStates);
+        doc2->ContentStateChanged(notifyContent[1], simpleStates);
+        if (notifyContent[2]) {
+          doc2->ContentStateChanged(notifyContent[2], simpleStates);
+        }
         if (notifyContent[3]) {
-          doc1->ContentStatesChanged(notifyContent[3], notifyContent[4],
-                                     simpleStates);
+          // XXXbz shouldn't this notify doc2????
+          doc1->ContentStateChanged(notifyContent[3], simpleStates);
+          if (notifyContent[4]) {
+            doc1->ContentStateChanged(notifyContent[4], simpleStates);
+          }
         }
         doc2->EndUpdate(UPDATE_CONTENT_STATE);
       }
     }
 
     from = &(notifyContent[0]);
     while (from < to) {  // release old refs now that we are through
       nsIContent* notify = *from++;
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -2619,17 +2619,17 @@ nsGenericHTMLFormElement::BeforeSetAttr(
       mForm->RemoveElement(this, false);
 
       // Removing the element from the form can make it not be the default
       // control anymore.  Go ahead and notify on that change, though we might
       // end up readding and becoming the default control again in
       // AfterSetAttr.
       if (doc && aNotify) {
         MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-        doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_DEFAULT);
+        doc->ContentStateChanged(this, NS_EVENT_STATE_DEFAULT);
       }
     }
 
     if (aName == nsGkAtoms::form) {
       // If @form isn't set or set to the empty string, there were no observer
       // so we don't have to remove it.
       if (nsContentUtils::HasNonEmptyAttr(this, kNameSpaceID_None,
                                           nsGkAtoms::form)) {
@@ -2677,17 +2677,17 @@ nsGenericHTMLFormElement::AfterSetAttr(P
       mForm->AddElement(this, false, aNotify);
 
       // Adding the element to the form can make it be the default control .
       // Go ahead and notify on that change.
       // Note: no need to notify on CanBeDisabled(), since type attr
       // changes can't affect that.
       if (doc && aNotify) {
         MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-        doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_DEFAULT);
+        doc->ContentStateChanged(this, NS_EVENT_STATE_DEFAULT);
       }
     }
 
     if (aName == nsGkAtoms::form) {
       // We need a new form id observer.
       nsIDocument* doc = GetCurrentDoc();
       if (doc) {
         Element* formIdElement = nsnull;
@@ -2993,17 +2993,17 @@ nsGenericHTMLFormElement::FieldSetDisabl
     return;
   }
 
   aStates |= NS_EVENT_STATE_DISABLED | NS_EVENT_STATE_ENABLED;
 
   nsIDocument* doc = GetCurrentDoc();
   if (doc) {
     MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-    doc->ContentStatesChanged(this, nsnull, aStates);
+    doc->ContentStateChanged(this, aStates);
   }
 }
 
 //----------------------------------------------------------------------
 
 nsGenericHTMLFrameElement::~nsGenericHTMLFrameElement()
 {
   if (mFrameLoader) {
@@ -3491,19 +3491,19 @@ nsGenericHTMLElement::IsEditableRoot() c
 static void
 MakeContentDescendantsEditable(nsIContent *aContent, nsIDocument *aDocument)
 {
   nsEventStates stateBefore = aContent->IntrinsicState();
 
   aContent->UpdateEditableState();
 
   if (aDocument && stateBefore != aContent->IntrinsicState()) {
-    aDocument->ContentStatesChanged(aContent, nsnull,
-                                    NS_EVENT_STATE_MOZ_READONLY |
-                                    NS_EVENT_STATE_MOZ_READWRITE);
+    aDocument->ContentStateChanged(aContent,
+                                   NS_EVENT_STATE_MOZ_READONLY |
+                                   NS_EVENT_STATE_MOZ_READWRITE);
   }
 
   PRUint32 i, n = aContent->GetChildCount();
   for (i = 0; i < n; ++i) {
     nsIContent *child = aContent->GetChildAt(i);
     if (!child->HasAttr(kNameSpaceID_None, nsGkAtoms::contenteditable)) {
       MakeContentDescendantsEditable(child, aDocument);
     }
@@ -3525,14 +3525,14 @@ nsGenericHTMLElement::ChangeEditableStat
       htmlDocument->ChangeContentEditableCount(this, aChange);
     }
   }
 
   if (document->HasFlag(NODE_IS_EDITABLE)) {
     document = nsnull;
   }
 
-  // MakeContentDescendantsEditable is going to call ContentStatesChanged for
+  // MakeContentDescendantsEditable is going to call ContentStateChanged for
   // this element and all descendants if editable state has changed.
   // We have to create a document update batch now so it's created once.
   MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, PR_TRUE);
   MakeContentDescendantsEditable(this, document);
 }
--- a/content/html/content/src/nsHTMLButtonElement.cpp
+++ b/content/html/content/src/nsHTMLButtonElement.cpp
@@ -627,17 +627,17 @@ nsHTMLButtonElement::AfterSetAttr(PRInt3
 
       states |= NS_EVENT_STATE_MOZ_SUBMITINVALID;
     }
 
     if (aNotify && !states.IsEmpty()) {
       nsIDocument* doc = GetCurrentDoc();
       if (doc) {
         MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-        doc->ContentStatesChanged(this, nsnull, states);
+        doc->ContentStateChanged(this, states);
       }
     }
   }
 
   return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName,
                                                 aValue, aNotify);
 }
 
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -389,26 +389,26 @@ nsHTMLFormElement::AfterSetAttr(PRInt32 
     // Update all form elements states because they might be [no longer]
     // affected by :-moz-ui-valid or :-moz-ui-invalid.
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
 
       for (PRUint32 i = 0, length = mControls->mElements.Length();
            i < length; ++i) {
-        doc->ContentStatesChanged(mControls->mElements[i], nsnull,
-                                  NS_EVENT_STATE_MOZ_UI_VALID |
-                                  NS_EVENT_STATE_MOZ_UI_INVALID);
+        doc->ContentStateChanged(mControls->mElements[i],
+                                 NS_EVENT_STATE_MOZ_UI_VALID |
+                                 NS_EVENT_STATE_MOZ_UI_INVALID);
       }
 
       for (PRUint32 i = 0, length = mControls->mNotInElements.Length();
            i < length; ++i) {
-        doc->ContentStatesChanged(mControls->mNotInElements[i], nsnull,
-                                  NS_EVENT_STATE_MOZ_UI_VALID |
-                                  NS_EVENT_STATE_MOZ_UI_INVALID);
+        doc->ContentStateChanged(mControls->mNotInElements[i],
+                                 NS_EVENT_STATE_MOZ_UI_VALID |
+                                 NS_EVENT_STATE_MOZ_UI_INVALID);
       }
     }
   }
 
   return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue, aNotify);
 }
 
 NS_IMPL_STRING_ATTR(nsHTMLFormElement, AcceptCharset, acceptcharset)
@@ -542,17 +542,17 @@ CollectOrphans(nsINode* aRemovalRoot, ns
 
         // In addition, submit controls shouldn't have
         // NS_EVENT_STATE_MOZ_SUBMITINVALID applying if they do not have a form.
         if (node->IsSubmitControl()) {
           states |= NS_EVENT_STATE_MOZ_SUBMITINVALID;
         }
 
         if (doc) {
-          doc->ContentStatesChanged(node, nsnull, states);
+          doc->ContentStateChanged(node, states);
         }
 #ifdef DEBUG
         removed = PR_TRUE;
 #endif
       }
     }
 
 #ifdef DEBUG
@@ -1229,26 +1229,25 @@ nsHTMLFormElement::AddElement(nsGenericH
     }
     NS_POSTCONDITION(mDefaultSubmitElement == mFirstSubmitInElements ||
                      mDefaultSubmitElement == mFirstSubmitNotInElements ||
                      !mDefaultSubmitElement,
                      "What happened here?");
 
     // Notify that the state of the previous default submit element has changed
     // if the element which is the default submit element has changed.  The new
-    // default submit element is responsible for its own ContentStatesChanged
+    // default submit element is responsible for its own ContentStateChanged
     // call.
     if (aNotify && oldDefaultSubmit &&
         oldDefaultSubmit != mDefaultSubmitElement) {
       nsIDocument* document = GetCurrentDoc();
       if (document) {
         MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, PR_TRUE);
         nsCOMPtr<nsIContent> oldElement(do_QueryInterface(oldDefaultSubmit));
-        document->ContentStatesChanged(oldElement, nsnull,
-                                       NS_EVENT_STATE_DEFAULT);
+        document->ContentStateChanged(oldElement, NS_EVENT_STATE_DEFAULT);
       }
     }
   }
 
   // If the element is subject to constraint validaton and is invalid, we need
   // to update our internal counter.
   if (aUpdateValidity) {
     nsCOMPtr<nsIConstraintValidation> cvElmt =
@@ -1375,18 +1374,18 @@ nsHTMLFormElement::HandleDefaultSubmitRe
                    mDefaultSubmitElement == mFirstSubmitNotInElements,
                    "What happened here?");
 
   // Notify about change if needed.
   if (mDefaultSubmitElement) {
     nsIDocument* document = GetCurrentDoc();
     if (document) {
       MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, PR_TRUE);
-      document->ContentStatesChanged(mDefaultSubmitElement, nsnull,
-                                     NS_EVENT_STATE_DEFAULT);
+      document->ContentStateChanged(mDefaultSubmitElement,
+                                    NS_EVENT_STATE_DEFAULT);
     }
   }
 }
 
 nsresult
 nsHTMLFormElement::RemoveElementFromTable(nsGenericHTMLFormElement* aElement,
                                           const nsAString& aName)
 {
@@ -1749,46 +1748,46 @@ nsHTMLFormElement::CheckValidFormSubmiss
       // We have to do that _before_ calling the observers so we are sure they
       // will not interfere (like focusing the element).
       if (!mEverTriedInvalidSubmit) {
         mEverTriedInvalidSubmit = true;
 
         nsIDocument* doc = GetCurrentDoc();
         if (doc) {
           /*
-           * We are going to call ContentStatesChanged assuming elements want to
+           * We are going to call ContentStateChanged assuming elements want to
            * be notified because we can't know.
            * Submissions shouldn't happen during parsing so it _should_ be safe.
            */
 
           MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
 
           for (PRUint32 i = 0, length = mControls->mElements.Length();
                i < length; ++i) {
             // Input elements can trigger a form submission and we want to
             // update the style in that case.
             if (mControls->mElements[i]->IsHTML(nsGkAtoms::input) &&
                 nsContentUtils::IsFocusedContent(mControls->mElements[i])) {
               static_cast<nsHTMLInputElement*>(mControls->mElements[i])
                 ->UpdateValidityUIBits(true);
             }
 
-            doc->ContentStatesChanged(mControls->mElements[i], nsnull,
-                                      NS_EVENT_STATE_MOZ_UI_VALID |
-                                      NS_EVENT_STATE_MOZ_UI_INVALID);
+            doc->ContentStateChanged(mControls->mElements[i],
+                                     NS_EVENT_STATE_MOZ_UI_VALID |
+                                     NS_EVENT_STATE_MOZ_UI_INVALID);
           }
 
           // Because of backward compatibility, <input type='image'> is not in
           // elements but can be invalid.
           // TODO: should probably be removed when bug 606491 will be fixed.
           for (PRUint32 i = 0, length = mControls->mNotInElements.Length();
                i < length; ++i) {
-            doc->ContentStatesChanged(mControls->mNotInElements[i], nsnull,
-                                      NS_EVENT_STATE_MOZ_UI_VALID |
-                                      NS_EVENT_STATE_MOZ_UI_INVALID);
+            doc->ContentStateChanged(mControls->mNotInElements[i],
+                                     NS_EVENT_STATE_MOZ_UI_VALID |
+                                     NS_EVENT_STATE_MOZ_UI_INVALID);
           }
         }
       }
 
       nsCOMPtr<nsISupports> inst;
       nsCOMPtr<nsIFormSubmitObserver> observer;
       PRBool more = PR_TRUE;
       while (NS_SUCCEEDED(theEnum->HasMoreElements(&more)) && more) {
@@ -1833,40 +1832,40 @@ nsHTMLFormElement::UpdateValidity(PRBool
   }
 
   nsIDocument* doc = GetCurrentDoc();
   if (!doc) {
     return;
   }
 
   /*
-   * We are going to call ContentStatesChanged assuming submit controls want to
+   * We are going to call ContentStateChanged assuming submit controls want to
    * be notified because we can't know.
    * UpdateValidity shouldn't be called so much during parsing so it _should_
    * be safe.
    */
 
   MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
 
   // Inform submit controls that the form validity has changed.
   for (PRUint32 i = 0, length = mControls->mElements.Length();
        i < length; ++i) {
     if (mControls->mElements[i]->IsSubmitControl()) {
-      doc->ContentStatesChanged(mControls->mElements[i], nsnull,
-                                NS_EVENT_STATE_MOZ_SUBMITINVALID);
+      doc->ContentStateChanged(mControls->mElements[i],
+                               NS_EVENT_STATE_MOZ_SUBMITINVALID);
     }
   }
 
   // Because of backward compatibility, <input type='image'> is not in elements
   // so we have to check for controls not in elements too.
   PRUint32 length = mControls->mNotInElements.Length();
   for (PRUint32 i = 0; i < length; ++i) {
     if (mControls->mNotInElements[i]->IsSubmitControl()) {
-      doc->ContentStatesChanged(mControls->mNotInElements[i], nsnull,
-                                NS_EVENT_STATE_MOZ_SUBMITINVALID);
+      doc->ContentStateChanged(mControls->mNotInElements[i],
+                               NS_EVENT_STATE_MOZ_SUBMITINVALID);
     }
   }
 }
 
 // nsIWebProgressListener
 NS_IMETHODIMP
 nsHTMLFormElement::OnStateChange(nsIWebProgress* aWebProgress,
                                  nsIRequest* aRequest,
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -794,17 +794,17 @@ nsHTMLInputElement::BeforeSetAttr(PRInt3
                                                  aValue, aNotify);
 }
 
 nsresult
 nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
                                  const nsAString* aValue,
                                  PRBool aNotify)
 {
-  // States changes that have to be passed to ContentStatesChanged().
+  // States changes that have to be passed to ContentStateChanged().
   nsEventStates states;
 
   if (aNameSpaceID == kNameSpaceID_None) {
     //
     // When name or type changes, radio should be added to 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.
     //
@@ -948,17 +948,17 @@ nsHTMLInputElement::AfterSetAttr(PRInt32
         UpdateEditableState();
       } else if (IsSingleLineTextControl(PR_FALSE) && aName == nsGkAtoms::readonly) {
         UpdateEditableState();
         states |= NS_EVENT_STATE_MOZ_READONLY | NS_EVENT_STATE_MOZ_READWRITE;
       }
 
       if (doc && !states.IsEmpty()) {
         MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-        doc->ContentStatesChanged(this, nsnull, states);
+        doc->ContentStateChanged(this, states);
       }
     }
   }
 
   return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName,
                                                 aValue, aNotify);
 }
 
@@ -1022,17 +1022,17 @@ nsHTMLInputElement::SetIndeterminateInte
     if (frame)
       frame->InvalidateFrameSubtree();
   }
 
   // Notify the document so it can update :indeterminate pseudoclass rules
   nsIDocument* document = GetCurrentDoc();
   if (document) {
     mozAutoDocUpdate upd(document, UPDATE_CONTENT_STATE, PR_TRUE);
-    document->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_INDETERMINATE);
+    document->ContentStateChanged(this, NS_EVENT_STATE_INDETERMINATE);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLInputElement::SetIndeterminate(PRBool aValue)
 {
@@ -1439,17 +1439,17 @@ nsHTMLInputElement::SetValueInternal(con
     }
     mInputData.mState->SetValue(value, aUserInput);
 
     if (PlaceholderApplies() &&
         HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
       nsIDocument* doc = GetCurrentDoc();
       if (doc) {
         mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-        doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_MOZ_PLACEHOLDER);
+        doc->ContentStateChanged(this, NS_EVENT_STATE_MOZ_PLACEHOLDER);
       }
     }
 
     return NS_OK;
   }
 
   // If the value of a hidden input was changed, we mark it changed so that we
   // will know we need to save / restore the value.  Yes, we are overloading
@@ -1478,18 +1478,18 @@ nsHTMLInputElement::SetValueChanged(PRBo
       FreeData();
     }
   }
 
   if (valueChangedBefore != aValueChanged) {
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_MOZ_UI_VALID |
-                                              NS_EVENT_STATE_MOZ_UI_INVALID);
+      doc->ContentStateChanged(this, NS_EVENT_STATE_MOZ_UI_VALID |
+                                     NS_EVENT_STATE_MOZ_UI_INVALID);
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 nsHTMLInputElement::GetChecked(PRBool* aChecked)
@@ -1528,19 +1528,19 @@ nsHTMLInputElement::SetCheckedChangedInt
   SET_BOOLBIT(mBitField, BF_CHECKED_CHANGED, 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, PR_TRUE);
-      document->ContentStatesChanged(this, nsnull,
-                                     NS_EVENT_STATE_MOZ_UI_VALID |
-                                     NS_EVENT_STATE_MOZ_UI_INVALID);
+      document->ContentStateChanged(this,
+                                    NS_EVENT_STATE_MOZ_UI_VALID |
+                                    NS_EVENT_STATE_MOZ_UI_INVALID);
     }
   }
 }
 
 NS_IMETHODIMP
 nsHTMLInputElement::SetChecked(PRBool aChecked)
 {
   return DoSetChecked(aChecked, PR_TRUE, PR_TRUE);
@@ -1728,17 +1728,17 @@ nsHTMLInputElement::SetCheckedInternal(P
   }
 
   // Notify the document that the CSS :checked pseudoclass for this element
   // has changed state.
   if (aNotify) {
     nsIDocument* document = GetCurrentDoc();
     if (document) {
       mozAutoDocUpdate upd(document, UPDATE_CONTENT_STATE, aNotify);
-      document->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_CHECKED);
+      document->ContentStateChanged(this, NS_EVENT_STATE_CHECKED);
     }
   }
 
   if (mType == NS_FORM_INPUT_CHECKBOX) {
     UpdateAllValidityStates(aNotify);
   }
 
   if (mType == NS_FORM_INPUT_RADIO) {
@@ -2142,17 +2142,17 @@ nsHTMLInputElement::PostHandleEvent(nsEv
         // TODO: checking if the value is empty could be a good idea but we do not
       // have a simple way to do that, see bug 585100
       states |= NS_EVENT_STATE_MOZ_PLACEHOLDER;
     }
 
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull, states);
+      doc->ContentStateChanged(this, states);
     }
   }
 
   // ignore the activate event fired by the "Browse..." button
   // (file input controls fire their own) (bug 500885)
   if (mType == NS_FORM_INPUT_FILE) {
     nsCOMPtr<nsIContent> maybeButton =
       do_QueryInterface(aVisitor.mEvent->originalTarget);
@@ -3779,20 +3779,20 @@ nsHTMLInputElement::DoesPatternApply() c
 NS_IMETHODIMP
 nsHTMLInputElement::SetCustomValidity(const nsAString& aError)
 {
   nsIConstraintValidation::SetCustomValidity(aError);
 
   nsIDocument* doc = GetCurrentDoc();
   if (doc) {
     MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-    doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_INVALID |
-                                            NS_EVENT_STATE_VALID |
-                                            NS_EVENT_STATE_MOZ_UI_INVALID |
-                                            NS_EVENT_STATE_MOZ_UI_VALID);
+    doc->ContentStateChanged(this, NS_EVENT_STATE_INVALID |
+                                   NS_EVENT_STATE_VALID |
+                                   NS_EVENT_STATE_MOZ_UI_INVALID |
+                                   NS_EVENT_STATE_MOZ_UI_VALID);
   }
 
   return NS_OK;
 }
 
 PRBool
 nsHTMLInputElement::IsTooLong()
 {
@@ -3995,19 +3995,20 @@ nsHTMLInputElement::UpdateAllValiditySta
   UpdateValueMissingValidityState();
   UpdateTypeMismatchValidityState();
   UpdatePatternMismatchValidityState();
 
   if (validBefore != IsValid() && aNotify) {
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull,
-                                NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID |
-                                NS_EVENT_STATE_MOZ_UI_VALID | NS_EVENT_STATE_MOZ_UI_INVALID);
+      doc->ContentStateChanged(this,
+                               NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID |
+                               NS_EVENT_STATE_MOZ_UI_VALID |
+                               NS_EVENT_STATE_MOZ_UI_INVALID);
     }
   }
 }
 
 void
 nsHTMLInputElement::UpdateBarredFromConstraintValidation()
 {
   SetBarredFromConstraintValidation(mType == NS_FORM_INPUT_HIDDEN ||
@@ -4317,21 +4318,21 @@ public:
     }
 
     nsHTMLInputElement* input = static_cast<nsHTMLInputElement*>(aRadio);
 
     input->SetValidityState(nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING,
                             mValidity);
 
     if (mNotify && mDocument) {
-      mDocument->ContentStatesChanged(input, nsnull,
-                                      NS_EVENT_STATE_VALID |
-                                      NS_EVENT_STATE_INVALID |
-                                      NS_EVENT_STATE_MOZ_UI_VALID |
-                                      NS_EVENT_STATE_MOZ_UI_INVALID);
+      mDocument->ContentStateChanged(input,
+                                     NS_EVENT_STATE_VALID |
+                                     NS_EVENT_STATE_INVALID |
+                                     NS_EVENT_STATE_MOZ_UI_VALID |
+                                     NS_EVENT_STATE_MOZ_UI_INVALID);
     }
 
     return NS_OK;
   }
 
 protected:
   nsIFormControl* mExcludeElement;
   nsIDocument* mDocument;
@@ -4537,17 +4538,17 @@ nsHTMLInputElement::OnValueChanged(PRBoo
   // :-moz-placeholder pseudo-class may change when the value changes.
   // However, we don't want to waste cycles if the state doesn't apply.
   if (aNotify && PlaceholderApplies()
       && HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)
       && !nsContentUtils::IsFocusedContent((nsIContent*)(this))) {
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_MOZ_PLACEHOLDER);
+      doc->ContentStateChanged(this, NS_EVENT_STATE_MOZ_PLACEHOLDER);
     }
   }
 }
 
 void
 nsHTMLInputElement::FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify)
 {
   UpdateValueMissingValidityState();
--- a/content/html/content/src/nsHTMLOptionElement.cpp
+++ b/content/html/content/src/nsHTMLOptionElement.cpp
@@ -152,17 +152,17 @@ nsHTMLOptionElement::SetSelectedInternal
   mIsSelected = aValue;
 
   // When mIsInSetDefaultSelected is true, the notification will be handled by
   // SetAttr/UnsetAttr.
   if (aNotify && !mIsInSetDefaultSelected) {
     nsIDocument* document = GetCurrentDoc();
     if (document) {
       mozAutoDocUpdate upd(document, UPDATE_CONTENT_STATE, aNotify);
-      document->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_CHECKED);
+      document->ContentStateChanged(this, NS_EVENT_STATE_CHECKED);
     }
   }
 }
 
 NS_IMETHODIMP
 nsHTMLOptionElement::SetValue(const nsAString& aValue)
 {
   SetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue, PR_TRUE);
--- a/content/html/content/src/nsHTMLOutputElement.cpp
+++ b/content/html/content/src/nsHTMLOutputElement.cpp
@@ -155,20 +155,20 @@ NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_S
 NS_IMETHODIMP
 nsHTMLOutputElement::SetCustomValidity(const nsAString& aError)
 {
   nsIConstraintValidation::SetCustomValidity(aError);
 
   nsIDocument* doc = GetCurrentDoc();
   if (doc) {
     MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-    doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_INVALID |
-                                            NS_EVENT_STATE_VALID |
-                                            NS_EVENT_STATE_MOZ_UI_INVALID |
-                                            NS_EVENT_STATE_MOZ_UI_VALID);
+    doc->ContentStateChanged(this, NS_EVENT_STATE_INVALID |
+                                   NS_EVENT_STATE_VALID |
+                                   NS_EVENT_STATE_MOZ_UI_INVALID |
+                                   NS_EVENT_STATE_MOZ_UI_VALID);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLOutputElement::Reset()
 {
--- a/content/html/content/src/nsHTMLSelectElement.cpp
+++ b/content/html/content/src/nsHTMLSelectElement.cpp
@@ -207,20 +207,20 @@ NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_S
 NS_IMETHODIMP
 nsHTMLSelectElement::SetCustomValidity(const nsAString& aError)
 {
   nsIConstraintValidation::SetCustomValidity(aError);
 
   nsIDocument* doc = GetCurrentDoc();
   if (doc) {
     MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-    doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_INVALID |
-                                            NS_EVENT_STATE_VALID |
-                                            NS_EVENT_STATE_MOZ_UI_INVALID |
-                                            NS_EVENT_STATE_MOZ_UI_VALID);
+    doc->ContentStateChanged(this, NS_EVENT_STATE_INVALID |
+                                   NS_EVENT_STATE_VALID |
+                                   NS_EVENT_STATE_MOZ_UI_INVALID |
+                                   NS_EVENT_STATE_MOZ_UI_VALID);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLSelectElement::GetForm(nsIDOMHTMLFormElement** aForm)
 {
@@ -361,20 +361,20 @@ nsHTMLSelectElement::RemoveOptionsFromLi
       // Update the validity state in case of we've just removed the last
       // option.
       UpdateValueMissingValidityState();
 
       if (aNotify) {
         nsIDocument* doc = GetCurrentDoc();
         if (doc) {
           MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-          doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_VALID |
-                                                  NS_EVENT_STATE_INVALID |
-                                                  NS_EVENT_STATE_MOZ_UI_INVALID |
-                                                  NS_EVENT_STATE_MOZ_UI_VALID);
+          doc->ContentStateChanged(this, NS_EVENT_STATE_VALID |
+                                         NS_EVENT_STATE_INVALID |
+                                         NS_EVENT_STATE_MOZ_UI_INVALID |
+                                         NS_EVENT_STATE_MOZ_UI_VALID);
         }
       }
     }
   }
 
   return NS_OK;
 }
 
@@ -894,20 +894,20 @@ nsHTMLSelectElement::OnOptionSelected(ns
     aSelectFrame->OnOptionSelected(aIndex, aSelected);
   }
 
   UpdateValueMissingValidityState();
   if (aNotify) {
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_VALID |
-                                              NS_EVENT_STATE_INVALID |
-                                              NS_EVENT_STATE_MOZ_UI_INVALID |
-                                              NS_EVENT_STATE_MOZ_UI_VALID);
+      doc->ContentStateChanged(this, NS_EVENT_STATE_VALID |
+                                     NS_EVENT_STATE_INVALID |
+                                     NS_EVENT_STATE_MOZ_UI_INVALID |
+                                     NS_EVENT_STATE_MOZ_UI_VALID);
     }
   }
 }
 
 void
 nsHTMLSelectElement::FindSelectedIndex(PRInt32 aStartIndex, PRBool aNotify)
 {
   mSelectedIndex = -1;
@@ -1339,20 +1339,20 @@ nsHTMLSelectElement::SelectSomething(PRB
       rv = SetSelectedIndexInternal(i, aNotify);
       NS_ENSURE_SUCCESS(rv, PR_FALSE);
 
       UpdateValueMissingValidityState();
       if (aNotify) {
         nsIDocument* doc = GetCurrentDoc();
         if (doc) {
           MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-          doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_VALID |
-                                                  NS_EVENT_STATE_INVALID |
-                                                  NS_EVENT_STATE_MOZ_UI_INVALID |
-                                                  NS_EVENT_STATE_MOZ_UI_VALID);
+          doc->ContentStateChanged(this, NS_EVENT_STATE_VALID |
+                                         NS_EVENT_STATE_INVALID |
+                                         NS_EVENT_STATE_MOZ_UI_INVALID |
+                                         NS_EVENT_STATE_MOZ_UI_VALID);
         }
       }
 
       return PR_TRUE;
     }
   }
 
   return PR_FALSE;
@@ -1405,17 +1405,17 @@ nsHTMLSelectElement::AfterSetAttr(PRInt3
                 NS_EVENT_STATE_MOZ_UI_VALID | NS_EVENT_STATE_MOZ_UI_INVALID;
     }
   }
 
   if (aNotify && !states.IsEmpty()) {
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull, states);
+      doc->ContentStateChanged(this, states);
     }
   }
 
   return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName,
                                                 aValue, aNotify);
 }
 
 nsresult
@@ -1581,18 +1581,18 @@ nsHTMLSelectElement::PostHandleEvent(nsE
     // NS_EVENT_STATE_MOZ_UI_VALID given that the states should not change.
   } else if (aVisitor.mEvent->message == NS_BLUR_CONTENT) {
     mCanShowInvalidUI = PR_TRUE;
     mCanShowValidUI = PR_TRUE;
 
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_MOZ_UI_VALID |
-                                              NS_EVENT_STATE_MOZ_UI_INVALID);
+      doc->ContentStateChanged(this, NS_EVENT_STATE_MOZ_UI_VALID |
+                                     NS_EVENT_STATE_MOZ_UI_INVALID);
     }
   }
 
   return nsGenericHTMLFormElement::PostHandleEvent(aVisitor);
 }
 
 nsEventStates
 nsHTMLSelectElement::IntrinsicState() const
@@ -2323,14 +2323,14 @@ nsHTMLSelectElement::SetSelectionChanged
 
   PRBool previousSelectionChangedValue = mSelectionHasChanged;
   mSelectionHasChanged = aValue;
 
   if (aNotify && mSelectionHasChanged != previousSelectionChangedValue) {
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_MOZ_UI_INVALID |
-                                              NS_EVENT_STATE_MOZ_UI_VALID);
+      doc->ContentStateChanged(this, NS_EVENT_STATE_MOZ_UI_INVALID |
+                                     NS_EVENT_STATE_MOZ_UI_VALID);
     }
   }
 }
 
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -598,17 +598,17 @@ nsHTMLTextAreaElement::SetValueChanged(P
 
     if (HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
       states |= NS_EVENT_STATE_MOZ_PLACEHOLDER;
     }
 
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull, states);
+      doc->ContentStateChanged(this, states);
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLTextAreaElement::GetDefaultValue(nsAString& aDefaultValue)
@@ -776,17 +776,17 @@ nsHTMLTextAreaElement::PostHandleEvent(n
       // TODO: checking if the value is empty could be a good idea but we do not
       // have a simple way to do that, see bug 585100
       states |= NS_EVENT_STATE_MOZ_PLACEHOLDER;
     }
 
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-      doc->ContentStatesChanged(this, nsnull, states);
+      doc->ContentStateChanged(this, states);
     }
   }
 
   // Reset the flag for other content besides this text field
   aVisitor.mEvent->flags |= (aVisitor.mItemFlags & NS_NO_CONTENT_DISPATCH)
     ? NS_EVENT_FLAG_NO_CONTENT_DISPATCH : NS_EVENT_FLAG_NONE;
 
   return NS_OK;
@@ -1229,17 +1229,17 @@ nsHTMLTextAreaElement::AfterSetAttr(PRIn
 
       if (aName == nsGkAtoms::readonly) {
         UpdateEditableState();
         states |= NS_EVENT_STATE_MOZ_READONLY | NS_EVENT_STATE_MOZ_READWRITE;
       }
 
       if (doc && !states.IsEmpty()) {
         MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-        doc->ContentStatesChanged(this, nsnull, states);
+        doc->ContentStateChanged(this, states);
       }
     }
   }
 
   return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName, aValue,
                                                 aNotify);
 }
 
@@ -1268,20 +1268,20 @@ nsHTMLTextAreaElement::IsMutable() const
 NS_IMETHODIMP
 nsHTMLTextAreaElement::SetCustomValidity(const nsAString& aError)
 {
   nsIConstraintValidation::SetCustomValidity(aError);
 
   nsIDocument* doc = GetCurrentDoc();
   if (doc) {
     MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-    doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_INVALID |
-                                            NS_EVENT_STATE_VALID |
-                                            NS_EVENT_STATE_MOZ_UI_INVALID |
-                                            NS_EVENT_STATE_MOZ_UI_VALID);
+    doc->ContentStateChanged(this, NS_EVENT_STATE_INVALID |
+                                   NS_EVENT_STATE_VALID |
+                                   NS_EVENT_STATE_MOZ_UI_INVALID |
+                                   NS_EVENT_STATE_MOZ_UI_VALID);
   }
 
   return NS_OK;
 }
 
 PRBool
 nsHTMLTextAreaElement::IsTooLong()
 {
@@ -1502,17 +1502,17 @@ nsHTMLTextAreaElement::OnValueChanged(PR
         && !nsContentUtils::IsFocusedContent((nsIContent*)(this))) {
       states |= NS_EVENT_STATE_MOZ_PLACEHOLDER;
     }
 
     if (!states.IsEmpty()) {
       nsIDocument* doc = GetCurrentDoc();
       if (doc) {
         MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-        doc->ContentStatesChanged(this, nsnull, states);
+        doc->ContentStateChanged(this, states);
       }
     }
   }
 }
 
 void
 nsHTMLTextAreaElement::FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify)
 {
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -3140,19 +3140,19 @@ nsHTMLDocument::GetDocumentAllResult(con
 static void
 NotifyEditableStateChange(nsINode *aNode, nsIDocument *aDocument,
                           PRBool aEditable)
 {
   PRUint32 i, n = aNode->GetChildCount();
   for (i = 0; i < n; ++i) {
     nsIContent *child = aNode->GetChildAt(i);
     if (child->HasFlag(NODE_IS_EDITABLE) != aEditable) {
-      aDocument->ContentStatesChanged(child, nsnull,
-                                      NS_EVENT_STATE_MOZ_READONLY |
-                                      NS_EVENT_STATE_MOZ_READWRITE);
+      aDocument->ContentStateChanged(child,
+                                     NS_EVENT_STATE_MOZ_READONLY |
+                                     NS_EVENT_STATE_MOZ_READWRITE);
     }
     NotifyEditableStateChange(child, aDocument, aEditable);
   }
 }
 
 void
 nsHTMLDocument::TearingDownEditor(nsIEditor *aEditor)
 {
--- a/content/mathml/content/src/nsMathMLElement.cpp
+++ b/content/mathml/content/src/nsMathMLElement.cpp
@@ -463,11 +463,10 @@ nsMathMLElement::SetIncrementScriptLevel
 
   NS_ASSERTION(aNotify, "We always notify!");
 
   nsIDocument* doc = GetCurrentDoc();
   if (!doc)
     return;
 
   mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-  doc->ContentStatesChanged(this, nsnull,
-                            NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL);
+  doc->ContentStateChanged(this, NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL);
 }
--- a/content/xtf/src/nsXTFElementWrapper.cpp
+++ b/content/xtf/src/nsXTFElementWrapper.cpp
@@ -911,17 +911,17 @@ nsXTFElementWrapper::SetIntrinsicState(n
     return NS_OK;
 
   NS_WARN_IF_FALSE(!newStates.HasAllStates(NS_EVENT_STATE_MOZ_READONLY |
                                            NS_EVENT_STATE_MOZ_READWRITE),
                    "Both READONLY and READWRITE are being set.  Yikes!!!");
 
   mIntrinsicState = newStates;
   mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
-  doc->ContentStatesChanged(this, nsnull, bits);
+  doc->ContentStateChanged(this, bits);
 
   return NS_OK;
 }
 
 nsIAtom *
 nsXTFElementWrapper::GetClassAttributeName() const
 {
   return mClassAttributeName;
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -1468,17 +1468,17 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpa
             binding->AttributeChanged(aName, aNameSpaceID, PR_TRUE, aNotify);
 
     }
 
     if (aNotify) {
         stateMask ^= IntrinsicState();
         if (doc && !stateMask.IsEmpty()) {
             MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, aNotify);
-            doc->ContentStatesChanged(this, nsnull, stateMask);
+            doc->ContentStateChanged(this, stateMask);
         }
         nsNodeUtils::AttributeChanged(this, aNameSpaceID, aName,
                                       nsIDOMMutationEvent::REMOVAL);
     }
 
     if (hasMutationListeners) {
         mozAutoRemovableBlockerRemover blockerRemover(GetOwnerDoc());
 
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -8087,35 +8087,27 @@ nsCSSFrameConstructor::RestyleElement(El
     ProcessRestyledFrames(changeList);
   } else {
     // no frames, reconstruct for content
     MaybeRecreateFramesForElement(aElement);
   }
 }
 
 nsresult
-nsCSSFrameConstructor::ContentStatesChanged(nsIContent* aContent1,
-                                            nsIContent* aContent2,
-                                            nsEventStates aStateMask)
+nsCSSFrameConstructor::ContentStateChanged(nsIContent* aContent,
+                                           nsEventStates aStateMask)
 {
   // XXXbz it would be good if this function only took Elements, but
   // we'd have to make ESM guarantee that usefully.
-  if (NS_LIKELY(aContent1 && aContent1->IsElement())) {
-    DoContentStateChanged(aContent1->AsElement(), aStateMask);
-  }
-  if (aContent2 && aContent2->IsElement()) {
-    DoContentStateChanged(aContent2->AsElement(), aStateMask);
-  }
-  return NS_OK;
-}
-
-void
-nsCSSFrameConstructor::DoContentStateChanged(Element* aElement,
-                                             nsEventStates aStateMask)
-{
+  if (!aContent->IsElement()) {
+    return NS_OK;
+  }
+
+  Element* aElement = aContent->AsElement();
+
   nsStyleSet *styleSet = mPresShell->StyleSet();
   nsPresContext *presContext = mPresShell->GetPresContext();
   NS_ASSERTION(styleSet, "couldn't get style set");
 
   nsChangeHint hint = NS_STYLE_HINT_NONE;
   // Any change to a content state that affects which frames we construct
   // must lead to a frame reconstruct here if we already have a frame.
   // Note that we never decide through non-CSS means to not create frames
@@ -8159,16 +8151,17 @@ nsCSSFrameConstructor::DoContentStateCha
   if (aStateMask.HasState(NS_EVENT_STATE_VISITED)) {
     // Exposing information to the page about whether the link is
     // visited or not isn't really something we can worry about here.
     // FIXME: We could probably do this a bit better.
     NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
   }
 
   PostRestyleEvent(aElement, rshint, hint);
+  return NS_OK;
 }
 
 void
 nsCSSFrameConstructor::AttributeWillChange(Element* aElement,
                                            PRInt32 aNameSpaceID,
                                            nsIAtom* aAttribute,
                                            PRInt32 aModType)
 {
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -230,19 +230,18 @@ public:
                           nsIContent* aChild,
                           nsIContent* aOldNextSibling,
                           RemoveFlags aFlags,
                           PRBool*     aDidReconstruct);
 
   nsresult CharacterDataChanged(nsIContent* aContent,
                                 CharacterDataChangeInfo* aInfo);
 
-  nsresult ContentStatesChanged(nsIContent*   aContent1,
-                                nsIContent*   aContent2,
-                                nsEventStates aStateMask);
+  nsresult ContentStateChanged(nsIContent*   aContent,
+                               nsEventStates aStateMask);
 
   // generate the child frames and process bindings
   nsresult GenerateChildFrames(nsIFrame* aFrame);
 
   // Should be called when a frame is going to be destroyed and
   // WillDestroyFrameTree hasn't been called yet.
   void NotifyDestroyingFrame(nsIFrame* aFrame);
 
@@ -410,19 +409,16 @@ private:
 
   nsresult ConstructPageFrame(nsIPresShell*  aPresShell, 
                               nsPresContext* aPresContext,
                               nsIFrame*      aParentFrame,
                               nsIFrame*      aPrevPageFrame,
                               nsIFrame*&     aPageFrame,
                               nsIFrame*&     aCanvasFrame);
 
-  void DoContentStateChanged(Element* aElement,
-                             nsEventStates aStateMask);
-
   /* aMinHint is the minimal change that should be made to the element */
   // XXXbz do we really need the aPrimaryFrame argument here?
   void RestyleElement(Element* aElement,
                       nsIFrame*       aPrimaryFrame,
                       nsChangeHint    aMinHint,
                       RestyleTracker& aRestyleTracker,
                       PRBool          aRestyleDescendants);
 
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -902,17 +902,17 @@ public:
   NS_IMETHOD SelectAll();
   NS_IMETHOD CheckVisibility(nsIDOMNode *node, PRInt16 startOffset, PRInt16 EndOffset, PRBool *_retval);
 
   // nsIDocumentObserver
   NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE
   NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE
   NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD
   NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD
-  NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATESCHANGED
+  NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED
   NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED
   NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETADDED
   NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETREMOVED
   NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETAPPLICABLESTATECHANGED
   NS_DECL_NSIDOCUMENTOBSERVER_STYLERULECHANGED
   NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEADDED
   NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEREMOVED
 
@@ -4898,27 +4898,26 @@ PresShell::CharacterDataChanged(nsIDocum
       mFrameConstructor->RestyleForInsertOrChange(element, aContent);
   }
 
   mFrameConstructor->CharacterDataChanged(aContent, aInfo);
   VERIFY_STYLE_TREE;
 }
 
 void
-PresShell::ContentStatesChanged(nsIDocument* aDocument,
-                                nsIContent* aContent1,
-                                nsIContent* aContent2,
-                                nsEventStates aStateMask)
-{
-  NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentStatesChanged");
+PresShell::ContentStateChanged(nsIDocument* aDocument,
+                               nsIContent* aContent,
+                               nsEventStates aStateMask)
+{
+  NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentStateChanged");
   NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
 
   if (mDidInitialReflow) {
     nsAutoCauseReflowNotifier crNotifier(this);
-    mFrameConstructor->ContentStatesChanged(aContent1, aContent2, aStateMask);
+    mFrameConstructor->ContentStateChanged(aContent, aStateMask);
     VERIFY_STYLE_TREE;
   }
 }
 
 void
 PresShell::DocumentStatesChanged(nsIDocument* aDocument,
                                  nsEventStates aStateMask)
 {
--- a/layout/xul/base/src/tree/src/nsTreeContentView.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeContentView.cpp
@@ -815,29 +815,28 @@ nsTreeContentView::GetIndexOfItem(nsIDOM
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(aItem);
   *_retval = FindContent(content);
 
   return NS_OK;
 }
 
 void
-nsTreeContentView::ContentStatesChanged(nsIDocument* aDocument,
-                                        nsIContent* aContent1,
-                                        nsIContent* aContent2,
-                                        nsEventStates aStateMask)
+nsTreeContentView::ContentStateChanged(nsIDocument* aDocument,
+                                       nsIContent* aContent,
+                                       nsEventStates aStateMask)
 {
-  if (!aContent1 || !mSelection ||
-      !aContent1->IsHTML() ||
+  if (!mSelection ||
+      !aContent->IsHTML() ||
       !aStateMask.HasState(NS_EVENT_STATE_CHECKED))
     return;
 
-  if (aContent1->Tag() == nsGkAtoms::option) {
+  if (aContent->Tag() == nsGkAtoms::option) {
     // update the selected state for this node
-    PRInt32 index = FindContent(aContent1);
+    PRInt32 index = FindContent(aContent);
     if (index >= 0)
       mSelection->ToggleSelect(index);
   }
 }
 
 void
 nsTreeContentView::AttributeChanged(nsIDocument*  aDocument,
                                     dom::Element* aElement,
--- a/layout/xul/base/src/tree/src/nsTreeContentView.h
+++ b/layout/xul/base/src/tree/src/nsTreeContentView.h
@@ -67,17 +67,17 @@ class nsTreeContentView : public nsINati
 
     NS_DECL_NSITREEVIEW
     // nsINativeTreeView: Untrusted code can use us
     NS_IMETHOD EnsureNative() { return NS_OK; }
 
     NS_DECL_NSITREECONTENTVIEW
 
     // nsIDocumentObserver
-    NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATESCHANGED
+    NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED
     NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
     NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
     NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
     NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
     NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
 
     static PRBool CanTrustTreeSelection(nsISupports* aValue);
 
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -380,17 +380,17 @@ nsHtml5TreeOperation::Perform(nsHtml5Tre
                 binding->AttributeChanged(localName, nsuri, PR_FALSE, PR_FALSE);
               }
             }
           }
           
           stateMask ^= node->IntrinsicState();
           if (!stateMask.IsEmpty() && document) {
             MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, PR_TRUE);
-            document->ContentStatesChanged(node, nsnull, stateMask);
+            document->ContentStateChanged(node, stateMask);
           }
           nsNodeUtils::AttributeChanged(node, 
                                         nsuri, 
                                         localName, 
                                         static_cast<PRUint8>(nsIDOMMutationEvent::ADDITION));
         }
       }