Bug 1673931 - Avoid including nsINode/nsIContent in header files. r=mbrodesser

Differential Revision: https://phabricator.services.mozilla.com/D97738
This commit is contained in:
Simon Giesecke 2020-11-26 13:21:07 +00:00
Родитель e1afffcd87
Коммит fe7ed70053
3 изменённых файлов: 28 добавлений и 24 удалений

Просмотреть файл

@ -113,9 +113,32 @@ static bool NodeIsInTraversalRange(nsINode* aNode, bool aIsPreMode,
return ComparePostMode(aStart, aEnd, *aNode);
}
// Each concreate class of ContentIteratorBase may be owned by another class
// which may be owned by JS. Therefore, all of them should be in the cycle
// collection. However, we cannot make non-refcountable classes only with the
// macros. So, we need to make them cycle collectable without the macros.
void ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
ContentIteratorBase& aField, const char* aName,
uint32_t aFlags = 0) {
ImplCycleCollectionTraverse(aCallback, aField.mCurNode, aName, aFlags);
ImplCycleCollectionTraverse(aCallback, aField.mFirst, aName, aFlags);
ImplCycleCollectionTraverse(aCallback, aField.mLast, aName, aFlags);
ImplCycleCollectionTraverse(aCallback, aField.mClosestCommonInclusiveAncestor,
aName, aFlags);
}
void ImplCycleCollectionUnlink(ContentIteratorBase& aField) {
ImplCycleCollectionUnlink(aField.mCurNode);
ImplCycleCollectionUnlink(aField.mFirst);
ImplCycleCollectionUnlink(aField.mLast);
ImplCycleCollectionUnlink(aField.mClosestCommonInclusiveAncestor);
}
ContentIteratorBase::ContentIteratorBase(Order aOrder)
: mIsDone(false), mOrder(aOrder) {}
ContentIteratorBase::~ContentIteratorBase() = default;
/******************************************************
* Init routines
******************************************************/

Просмотреть файл

@ -10,10 +10,12 @@
#include "mozilla/RangeBoundary.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIContent.h"
#include "nsRange.h"
#include "nsTArray.h"
class nsIContent;
class nsINode;
namespace mozilla {
/**
@ -27,7 +29,7 @@ class ContentIteratorBase {
ContentIteratorBase() = delete;
ContentIteratorBase(const ContentIteratorBase&) = delete;
ContentIteratorBase& operator=(const ContentIteratorBase&) = delete;
virtual ~ContentIteratorBase() = default;
virtual ~ContentIteratorBase();
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(ContentIteratorBase)
@ -110,27 +112,6 @@ class ContentIteratorBase {
friend void ImplCycleCollectionUnlink(ContentIteratorBase&);
};
// Each concreate class of ContentIteratorBase may be owned by another class
// which may be owned by JS. Therefore, all of them should be in the cycle
// collection. However, we cannot make non-refcountable classes only with the
// macros. So, we need to make them cycle collectable without the macros.
inline void ImplCycleCollectionTraverse(
nsCycleCollectionTraversalCallback& aCallback, ContentIteratorBase& aField,
const char* aName, uint32_t aFlags = 0) {
ImplCycleCollectionTraverse(aCallback, aField.mCurNode, aName, aFlags);
ImplCycleCollectionTraverse(aCallback, aField.mFirst, aName, aFlags);
ImplCycleCollectionTraverse(aCallback, aField.mLast, aName, aFlags);
ImplCycleCollectionTraverse(aCallback, aField.mClosestCommonInclusiveAncestor,
aName, aFlags);
}
inline void ImplCycleCollectionUnlink(ContentIteratorBase& aField) {
ImplCycleCollectionUnlink(aField.mCurNode);
ImplCycleCollectionUnlink(aField.mFirst);
ImplCycleCollectionUnlink(aField.mLast);
ImplCycleCollectionUnlink(aField.mClosestCommonInclusiveAncestor);
}
/**
* A simple iterator class for traversing the content in "close tag" order.
*/

Просмотреть файл

@ -8,7 +8,7 @@
#define nsINodeList_h___
#include "nsWrapperCache.h"
#include "nsIContent.h"
#include "nsISupports.h"
// IID for the nsINodeList interface
#define NS_INODELIST_IID \