diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index 3fbd5960e5e9..4baab1476b15 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -1231,19 +1231,17 @@ void nsDocAccessible::ContentAppended(nsIDocument *aDocument, { } -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 event = - new AccStateChangeEvent(aContent1, nsIAccessibleStates::STATE_INVALID, + new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_INVALID, PR_FALSE, PR_TRUE); FireDelayedAccessibleEvent(event); } diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 229ba922c2a0..89ac00bbff58 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -123,8 +123,8 @@ class Element; #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) @@ -757,11 +757,9 @@ public: 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 diff --git a/content/base/public/nsIDocumentObserver.h b/content/base/public/nsIDocumentObserver.h index 36b1ec2e257a..d34947e5458c 100644 --- a/content/base/public/nsIDocumentObserver.h +++ b/content/base/public/nsIDocumentObserver.h @@ -49,8 +49,8 @@ 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; @@ -103,20 +103,12 @@ public: * 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. @@ -247,11 +239,10 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID) #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, \ @@ -293,7 +284,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID) 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 \ @@ -327,9 +318,8 @@ _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) \ { \ } \ diff --git a/content/base/src/Link.cpp b/content/base/src/Link.cpp index 60bff84a1832..3fa567801eaa 100644 --- a/content/base/src/Link.cpp +++ b/content/base/src/Link.cpp @@ -102,7 +102,7 @@ Link::SetLinkState(nsLinkState aState) 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 @@ -493,7 +493,7 @@ Link::ResetLinkState(bool aNotify) 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); } } diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index f182b1f9dc2c..e416efa1ee1c 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -4266,11 +4266,10 @@ nsDocument::EndLoad() } void -nsDocument::ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2, - nsEventStates aStateMask) +nsDocument::ContentStateChanged(nsIContent* aContent, nsEventStates aStateMask) { - NS_DOCUMENT_NOTIFY_OBSERVERS(ContentStatesChanged, - (this, aContent1, aContent2, aStateMask)); + NS_DOCUMENT_NOTIFY_OBSERVERS(ContentStateChanged, + (this, aContent, aStateMask)); } void diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 0d7ad651275b..a80c5bf646bc 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -706,9 +706,8 @@ public: 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, diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 6f834ce814c7..ece698562201 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -4766,7 +4766,7 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID, 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); } @@ -5013,7 +5013,7 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, 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); diff --git a/content/base/src/nsImageLoadingContent.cpp b/content/base/src/nsImageLoadingContent.cpp index 423b6f851f1e..196e4069b550 100644 --- a/content/base/src/nsImageLoadingContent.cpp +++ b/content/base/src/nsImageLoadingContent.cpp @@ -829,7 +829,7 @@ nsImageLoadingContent::UpdateImageState(PRBool aNotify) nsEventStates changedBits = oldState ^ ImageState(); if (!changedBits.IsEmpty()) { mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(thisContent, nsnull, changedBits); + doc->ContentStateChanged(thisContent, changedBits); } } } diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index 5148ae1f794e..2695d9c715a4 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -1657,7 +1657,7 @@ nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType, { 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 diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 5b3034741d62..211677f710e9 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -4305,10 +4305,10 @@ NotifyAncestors(nsIDocument* aDocument, nsIContent* aStartNode, nsIContent* aStopBefore, nsEventStates aState) { while (aStartNode && aStartNode != aStopBefore) { - aDocument->ContentStatesChanged(aStartNode, nsnull, aState); + aDocument->ContentStateChanged(aStartNode, aState); nsCOMPtr labelTarget = GetLabelTarget(aStartNode); if (labelTarget) { - aDocument->ContentStatesChanged(labelTarget, nsnull, aState); + aDocument->ContentStateChanged(labelTarget, aState); } aStartNode = aStartNode->GetParent(); } @@ -4467,20 +4467,19 @@ nsEventStateManager::SetContentState(nsIContent *aContent, nsEventStates aState) 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); } } } @@ -4488,11 +4487,16 @@ nsEventStateManager::SetContentState(nsIContent *aContent, nsEventStates aState) 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); } diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index f84db8977920..ff7c367ae773 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -2624,7 +2624,7 @@ nsGenericHTMLFormElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, // 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); } } @@ -2682,7 +2682,7 @@ nsGenericHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, // 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); } } @@ -2998,7 +2998,7 @@ nsGenericHTMLFormElement::FieldSetDisabledChanged(nsEventStates aStates, PRBool nsIDocument* doc = GetCurrentDoc(); if (doc) { MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, aStates); + doc->ContentStateChanged(this, aStates); } } @@ -3496,9 +3496,9 @@ MakeContentDescendantsEditable(nsIContent *aContent, nsIDocument *aDocument) 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(); @@ -3530,7 +3530,7 @@ nsGenericHTMLElement::ChangeEditableState(PRInt32 aChange) 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); diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index 8c00b262f42d..3b1a06bd775e 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -632,7 +632,7 @@ nsHTMLButtonElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIDocument* doc = GetCurrentDoc(); if (doc) { MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, states); + doc->ContentStateChanged(this, states); } } } diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 390928ed80e5..135d8708223a 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -394,16 +394,16 @@ nsHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, 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); } } } @@ -547,7 +547,7 @@ CollectOrphans(nsINode* aRemovalRoot, nsTArray aArray } if (doc) { - doc->ContentStatesChanged(node, nsnull, states); + doc->ContentStateChanged(node, states); } #ifdef DEBUG removed = PR_TRUE; @@ -1234,7 +1234,7 @@ nsHTMLFormElement::AddElement(nsGenericHTMLFormElement* aChild, // 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) { @@ -1242,8 +1242,7 @@ nsHTMLFormElement::AddElement(nsGenericHTMLFormElement* aChild, if (document) { MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, PR_TRUE); nsCOMPtr oldElement(do_QueryInterface(oldDefaultSubmit)); - document->ContentStatesChanged(oldElement, nsnull, - NS_EVENT_STATE_DEFAULT); + document->ContentStateChanged(oldElement, NS_EVENT_STATE_DEFAULT); } } } @@ -1380,8 +1379,8 @@ nsHTMLFormElement::HandleDefaultSubmitRemoval() 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); } } } @@ -1754,7 +1753,7 @@ nsHTMLFormElement::CheckValidFormSubmission() 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. */ @@ -1771,9 +1770,9 @@ nsHTMLFormElement::CheckValidFormSubmission() ->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, is not in @@ -1781,9 +1780,9 @@ nsHTMLFormElement::CheckValidFormSubmission() // 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); } } } @@ -1838,7 +1837,7 @@ nsHTMLFormElement::UpdateValidity(PRBool aElementValidity) } /* - * 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. @@ -1850,8 +1849,8 @@ nsHTMLFormElement::UpdateValidity(PRBool aElementValidity) 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); } } @@ -1860,8 +1859,8 @@ nsHTMLFormElement::UpdateValidity(PRBool aElementValidity) 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); } } } diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index e7ea6f076e6b..8313099c4734 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -799,7 +799,7 @@ 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) { @@ -953,7 +953,7 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, if (doc && !states.IsEmpty()) { MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, states); + doc->ContentStateChanged(this, states); } } } @@ -1027,7 +1027,7 @@ nsHTMLInputElement::SetIndeterminateInternal(PRBool aValue, 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; @@ -1444,7 +1444,7 @@ nsHTMLInputElement::SetValueInternal(const nsAString& aValue, 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); } } @@ -1483,8 +1483,8 @@ nsHTMLInputElement::SetValueChanged(PRBool 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); } } @@ -1533,9 +1533,9 @@ nsHTMLInputElement::SetCheckedChangedInternal(PRBool 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); } } } @@ -1733,7 +1733,7 @@ nsHTMLInputElement::SetCheckedInternal(PRBool aChecked, PRBool 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); } } @@ -2147,7 +2147,7 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) nsIDocument* doc = GetCurrentDoc(); if (doc) { MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, states); + doc->ContentStateChanged(this, states); } } @@ -3784,10 +3784,10 @@ nsHTMLInputElement::SetCustomValidity(const nsAString& 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; @@ -4000,9 +4000,10 @@ nsHTMLInputElement::UpdateAllValidityStates(PRBool 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); } } } @@ -4322,11 +4323,11 @@ public: 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; @@ -4542,7 +4543,7 @@ nsHTMLInputElement::OnValueChanged(PRBool aNotify) 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); } } } diff --git a/content/html/content/src/nsHTMLOptionElement.cpp b/content/html/content/src/nsHTMLOptionElement.cpp index 8532461b5543..9a2fd031cdc1 100644 --- a/content/html/content/src/nsHTMLOptionElement.cpp +++ b/content/html/content/src/nsHTMLOptionElement.cpp @@ -157,7 +157,7 @@ nsHTMLOptionElement::SetSelectedInternal(PRBool aValue, PRBool 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); } } } diff --git a/content/html/content/src/nsHTMLOutputElement.cpp b/content/html/content/src/nsHTMLOutputElement.cpp index 0ad64060d037..3adc2382bf6d 100644 --- a/content/html/content/src/nsHTMLOutputElement.cpp +++ b/content/html/content/src/nsHTMLOutputElement.cpp @@ -160,10 +160,10 @@ nsHTMLOutputElement::SetCustomValidity(const nsAString& 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; diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index bb7437a8e238..b7e30850d57a 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -212,10 +212,10 @@ nsHTMLSelectElement::SetCustomValidity(const nsAString& 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; @@ -366,10 +366,10 @@ nsHTMLSelectElement::RemoveOptionsFromList(nsIContent* aOptions, 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); } } } @@ -899,10 +899,10 @@ nsHTMLSelectElement::OnOptionSelected(nsISelectControlFrame* aSelectFrame, 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); } } } @@ -1344,10 +1344,10 @@ nsHTMLSelectElement::SelectSomething(PRBool 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); } } @@ -1410,7 +1410,7 @@ nsHTMLSelectElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIDocument* doc = GetCurrentDoc(); if (doc) { MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, states); + doc->ContentStateChanged(this, states); } } @@ -1586,8 +1586,8 @@ nsHTMLSelectElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) 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); } } @@ -2328,8 +2328,8 @@ nsHTMLSelectElement::SetSelectionChanged(PRBool aValue, PRBool aNotify) 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); } } } diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index 261d9ead2273..548e4f2a1fe9 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -603,7 +603,7 @@ nsHTMLTextAreaElement::SetValueChanged(PRBool aValueChanged) nsIDocument* doc = GetCurrentDoc(); if (doc) { mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, states); + doc->ContentStateChanged(this, states); } } @@ -781,7 +781,7 @@ nsHTMLTextAreaElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) nsIDocument* doc = GetCurrentDoc(); if (doc) { MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, states); + doc->ContentStateChanged(this, states); } } @@ -1234,7 +1234,7 @@ nsHTMLTextAreaElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, if (doc && !states.IsEmpty()) { MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, states); + doc->ContentStateChanged(this, states); } } } @@ -1273,10 +1273,10 @@ nsHTMLTextAreaElement::SetCustomValidity(const nsAString& 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; @@ -1507,7 +1507,7 @@ nsHTMLTextAreaElement::OnValueChanged(PRBool aNotify) nsIDocument* doc = GetCurrentDoc(); if (doc) { MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, states); + doc->ContentStateChanged(this, states); } } } diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 5b81ef9b3357..c823ab77fcdd 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -3145,9 +3145,9 @@ NotifyEditableStateChange(nsINode *aNode, nsIDocument *aDocument, 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); } diff --git a/content/mathml/content/src/nsMathMLElement.cpp b/content/mathml/content/src/nsMathMLElement.cpp index 1faf653429c1..babccb17c8ed 100644 --- a/content/mathml/content/src/nsMathMLElement.cpp +++ b/content/mathml/content/src/nsMathMLElement.cpp @@ -468,6 +468,5 @@ nsMathMLElement::SetIncrementScriptLevel(PRBool aIncrementScriptLevel, 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); } diff --git a/content/xtf/src/nsXTFElementWrapper.cpp b/content/xtf/src/nsXTFElementWrapper.cpp index b9e93c5c9ed4..52c627924112 100644 --- a/content/xtf/src/nsXTFElementWrapper.cpp +++ b/content/xtf/src/nsXTFElementWrapper.cpp @@ -916,7 +916,7 @@ nsXTFElementWrapper::SetIntrinsicState(nsEventStates::InternalType aNewState) mIntrinsicState = newStates; mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, bits); + doc->ContentStateChanged(this, bits); return NS_OK; } diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 14a695086282..9d88fbfe03d6 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -1473,7 +1473,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool 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); diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index ce7d6920d4b5..02e5d6681b33 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -8092,25 +8092,17 @@ nsCSSFrameConstructor::RestyleElement(Element *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 (!aContent->IsElement()) { + return NS_OK; } - if (aContent2 && aContent2->IsElement()) { - DoContentStateChanged(aContent2->AsElement(), aStateMask); - } - return NS_OK; -} -void -nsCSSFrameConstructor::DoContentStateChanged(Element* aElement, - nsEventStates aStateMask) -{ + Element* aElement = aContent->AsElement(); + nsStyleSet *styleSet = mPresShell->StyleSet(); nsPresContext *presContext = mPresShell->GetPresContext(); NS_ASSERTION(styleSet, "couldn't get style set"); @@ -8164,6 +8156,7 @@ nsCSSFrameConstructor::DoContentStateChanged(Element* aElement, } PostRestyleEvent(aElement, rshint, hint); + return NS_OK; } void diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 1f9789762aee..d6f52a7dfbfb 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -235,9 +235,8 @@ public: 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); @@ -415,9 +414,6 @@ private: 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, diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 24f82f5f59c4..cff3af76ea4c 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -907,7 +907,7 @@ public: 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 @@ -4903,17 +4903,16 @@ PresShell::CharacterDataChanged(nsIDocument *aDocument, } void -PresShell::ContentStatesChanged(nsIDocument* aDocument, - nsIContent* aContent1, - nsIContent* aContent2, - nsEventStates aStateMask) +PresShell::ContentStateChanged(nsIDocument* aDocument, + nsIContent* aContent, + nsEventStates aStateMask) { - NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentStatesChanged"); + 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; } } diff --git a/layout/xul/base/src/tree/src/nsTreeContentView.cpp b/layout/xul/base/src/tree/src/nsTreeContentView.cpp index 53aa33cf780c..d7c8b8c43d85 100644 --- a/layout/xul/base/src/tree/src/nsTreeContentView.cpp +++ b/layout/xul/base/src/tree/src/nsTreeContentView.cpp @@ -820,19 +820,18 @@ nsTreeContentView::GetIndexOfItem(nsIDOMElement* aItem, PRInt32* _retval) } 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); } diff --git a/layout/xul/base/src/tree/src/nsTreeContentView.h b/layout/xul/base/src/tree/src/nsTreeContentView.h index 338afbe08ff0..3f21e6731e6b 100644 --- a/layout/xul/base/src/tree/src/nsTreeContentView.h +++ b/layout/xul/base/src/tree/src/nsTreeContentView.h @@ -72,7 +72,7 @@ class nsTreeContentView : public nsINativeTreeView, NS_DECL_NSITREECONTENTVIEW // nsIDocumentObserver - NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATESCHANGED + NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED diff --git a/parser/html/nsHtml5TreeOperation.cpp b/parser/html/nsHtml5TreeOperation.cpp index 867d9ad7ac78..6e7c08a86462 100644 --- a/parser/html/nsHtml5TreeOperation.cpp +++ b/parser/html/nsHtml5TreeOperation.cpp @@ -385,7 +385,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, 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,