1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsFilteredContentIterator_h__
7 #define nsFilteredContentIterator_h__
10 #include "nsCycleCollectionParticipant.h"
11 #include "nsIContentIterator.h"
12 #include "nsISupportsImpl.h"
19 class nsITextServicesFilter
;
21 class nsFilteredContentIterator MOZ_FINAL
: public nsIContentIterator
25 // nsISupports interface...
26 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
27 NS_DECL_CYCLE_COLLECTION_CLASS(nsFilteredContentIterator
)
29 explicit nsFilteredContentIterator(nsITextServicesFilter
* aFilter
);
31 /* nsIContentIterator */
32 virtual nsresult
Init(nsINode
* aRoot
);
33 virtual nsresult
Init(nsIDOMRange
* aRange
);
38 virtual nsINode
*GetCurrentNode();
39 virtual bool IsDone();
40 virtual nsresult
PositionAt(nsINode
* aCurNode
);
43 bool DidSkip() { return mDidSkip
; }
44 void ClearDidSkip() { mDidSkip
= false; }
47 nsFilteredContentIterator() { }
49 virtual ~nsFilteredContentIterator();
51 // enum to give us the direction
52 typedef enum {eDirNotSet
, eForward
, eBackward
} eDirectionType
;
53 nsresult
AdvanceNode(nsIDOMNode
* aNode
, nsIDOMNode
*& aNewNode
, eDirectionType aDir
);
54 void CheckAdvNode(nsIDOMNode
* aNode
, bool& aDidSkip
, eDirectionType aDir
);
55 nsresult
SwitchDirections(bool aChangeToForward
);
57 nsCOMPtr
<nsIContentIterator
> mCurrentIterator
;
58 nsCOMPtr
<nsIContentIterator
> mIterator
;
59 nsCOMPtr
<nsIContentIterator
> mPreIterator
;
61 nsCOMPtr
<nsIAtom
> mBlockQuoteAtom
;
62 nsCOMPtr
<nsIAtom
> mScriptAtom
;
63 nsCOMPtr
<nsIAtom
> mTextAreaAtom
;
64 nsCOMPtr
<nsIAtom
> mSelectAreaAtom
;
65 nsCOMPtr
<nsIAtom
> mMapAtom
;
67 nsCOMPtr
<nsITextServicesFilter
> mFilter
;
68 nsCOMPtr
<nsIDOMRange
> mRange
;
71 eDirectionType mDirection
;