Bug 394740, Inline MayDispatchMutationEvent, r+sr=peterv, a=jst

git-svn-id: svn://10.0.0.236/trunk@233918 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Olli.Pettay%helsinki.fi 2007-09-05 09:01:49 +00:00
parent 6b7807cb32
commit e989c06c07
3 changed files with 12 additions and 16 deletions

View File

@ -41,6 +41,7 @@
#include "nsStringGlue.h"
#include "nsIDocumentObserver.h" // for nsUpdateType
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsIURI.h"
#include "nsWeakPtr.h"
#include "nsIWeakReferenceUtils.h"
@ -95,8 +96,8 @@ class mozAutoSubtreeModified;
// IID for the nsIDocument interface
#define NS_IDOCUMENT_IID \
{ 0x6700e22b, 0x95b8, 0x44cf, \
{ 0x8f, 0x5a, 0x57, 0x2c, 0x14, 0x5b, 0xd1, 0xa1 } }
{ 0x9a26d0aa, 0x37d2, 0x4313, \
{ 0x9e, 0x53, 0x16, 0xd1, 0xa4, 0x67, 0xb3, 0x5b } }
// Flag for AddStyleSheet().
@ -853,7 +854,12 @@ public:
*
* @param aTarget is the target for the mutation event.
*/
virtual void MayDispatchMutationEvent(nsINode* aTarget) = 0;
void MayDispatchMutationEvent(nsINode* aTarget)
{
if (mSubtreeModifiedDepth > 0) {
mSubtreeModifiedTargets.AppendObject(aTarget);
}
}
/**
* Marks as not-going-to-be-collected for the given generation of
@ -962,6 +968,9 @@ protected:
PRUint32 mMarkedCCGeneration;
nsTObserverArray<nsIPresShell> mPresShells;
nsCOMArray<nsINode> mSubtreeModifiedTargets;
PRUint32 mSubtreeModifiedDepth;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocument, NS_IDOCUMENT_IID)

View File

@ -5756,14 +5756,6 @@ nsDocument::OnPageHide(PRBool aPersisted)
mVisible = PR_FALSE;
}
void
nsDocument::MayDispatchMutationEvent(nsINode* aTarget)
{
if (mSubtreeModifiedDepth > 0) {
mSubtreeModifiedTargets.AppendObject(aTarget);
}
}
void
nsDocument::WillDispatchMutationEvent(nsINode* aTarget)
{

View File

@ -73,7 +73,6 @@
#include "nsINodeInfo.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOM3DocumentEvent.h"
#include "nsCOMArray.h"
#include "nsHashtable.h"
#include "nsInterfaceHashtable.h"
#include "nsIBoxObject.h"
@ -507,7 +506,6 @@ public:
virtual void OnPageShow(PRBool aPersisted);
virtual void OnPageHide(PRBool aPersisted);
virtual void MayDispatchMutationEvent(nsINode* aTarget);
virtual void WillDispatchMutationEvent(nsINode* aTarget);
virtual void MutationEventDispatched(nsINode* aTarget);
@ -819,9 +817,6 @@ private:
// Member to store out last-selected stylesheet set.
nsString mLastStyleSheetSet;
nsCOMArray<nsINode> mSubtreeModifiedTargets;
PRUint32 mSubtreeModifiedDepth;
// Our update nesting level
PRUint32 mUpdateNestLevel;
};