mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-21 02:35:21 +00:00
Bug 1034914 - Clean up CreateContentIterator and give nsFilteredContentIterator a private dtor. r=ehsan
This commit is contained in:
parent
0090b646d5
commit
0f2ea02bef
@ -18,10 +18,7 @@ class nsIDOMRange;
|
||||
class nsINode;
|
||||
class nsITextServicesFilter;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class nsFilteredContentIterator : public nsIContentIterator
|
||||
class nsFilteredContentIterator MOZ_FINAL : public nsIContentIterator
|
||||
{
|
||||
public:
|
||||
|
||||
@ -31,8 +28,6 @@ public:
|
||||
|
||||
nsFilteredContentIterator(nsITextServicesFilter* aFilter);
|
||||
|
||||
virtual ~nsFilteredContentIterator();
|
||||
|
||||
/* nsIContentIterator */
|
||||
virtual nsresult Init(nsINode* aRoot);
|
||||
virtual nsresult Init(nsIDOMRange* aRange);
|
||||
@ -51,6 +46,8 @@ public:
|
||||
protected:
|
||||
nsFilteredContentIterator() { }
|
||||
|
||||
virtual ~nsFilteredContentIterator();
|
||||
|
||||
// enum to give us the direction
|
||||
typedef enum {eDirNotSet, eForward, eBackward} eDirectionType;
|
||||
nsresult AdvanceNode(nsIDOMNode* aNode, nsIDOMNode*& aNewNode, eDirectionType aDir);
|
||||
@ -74,12 +71,4 @@ protected:
|
||||
eDirectionType mDirection;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
template<>
|
||||
struct HasDangerousPublicDestructor<nsFilteredContentIterator>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1979,37 +1979,21 @@ nsTextServicesDocument::DidJoinNodes(nsIDOMNode *aLeftNode,
|
||||
nsresult
|
||||
nsTextServicesDocument::CreateContentIterator(nsIDOMRange *aRange, nsIContentIterator **aIterator)
|
||||
{
|
||||
nsresult result;
|
||||
|
||||
NS_ENSURE_TRUE(aRange && aIterator, NS_ERROR_NULL_POINTER);
|
||||
|
||||
*aIterator = 0;
|
||||
*aIterator = nullptr;
|
||||
|
||||
// Create a nsFilteredContentIterator
|
||||
// This class wraps the ContentIterator in order to give itself a chance
|
||||
// This class wraps the ContentIterator in order to give itself a chance
|
||||
// to filter out certain content nodes
|
||||
nsFilteredContentIterator* filter = new nsFilteredContentIterator(mTxtSvcFilter);
|
||||
*aIterator = static_cast<nsIContentIterator *>(filter);
|
||||
if (*aIterator) {
|
||||
NS_IF_ADDREF(*aIterator);
|
||||
result = filter ? NS_OK : NS_ERROR_FAILURE;
|
||||
} else {
|
||||
delete filter;
|
||||
result = NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
nsRefPtr<nsFilteredContentIterator> filter = new nsFilteredContentIterator(mTxtSvcFilter);
|
||||
|
||||
NS_ENSURE_TRUE(*aIterator, NS_ERROR_NULL_POINTER);
|
||||
|
||||
result = (*aIterator)->Init(aRange);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
{
|
||||
NS_RELEASE((*aIterator));
|
||||
*aIterator = 0;
|
||||
nsresult result = filter->Init(aRange);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
filter.forget(aIterator);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user