Bug 1470861: Mark some methods const now that they don't mutate nsFind itself. r?mats
MozReview-Commit-ID: BBZlZ5FrP5K
--- a/toolkit/components/find/nsFind.cpp
+++ b/toolkit/components/find/nsFind.cpp
@@ -642,17 +642,17 @@ GetBlockParent(nsINode* aNode)
return nullptr;
}
nsresult
nsFind::InitIterator(State& aState,
nsINode* aStartNode,
int32_t aStartOffset,
nsINode* aEndNode,
- int32_t aEndOffset)
+ int32_t aEndOffset) const
{
if (!aState.mIterator) {
aState.mIterator = new nsFindContentIterator(mFindBackward);
}
NS_ENSURE_ARG_POINTER(aStartNode);
NS_ENSURE_ARG_POINTER(aEndNode);
@@ -742,17 +742,17 @@ nsFind::SetEntireWord(bool aEntireWord)
// union of a one-byte string or a two-byte string. Single and double strings
// are intermixed in the dom. We don't have string classes which can deal with
// intermixed strings, so all the handling is done explicitly here.
nsresult
nsFind::NextNode(State& aState,
nsRange* aSearchRange,
nsRange* aStartPoint,
- nsRange* aEndPoint)
+ nsRange* aEndPoint) const
{
nsresult rv;
nsCOMPtr<nsIContent> content;
if (!aState.mIterator) {
// If we are continuing, that means we have a match in progress. In that
// case, we want to continue from the end point (where we are now) to the
@@ -863,17 +863,17 @@ nsFind::NextNode(State& aState,
DumpNode(aState.mIterNode);
return NS_OK;
}
char16_t
nsFind::PeekNextChar(State& aState,
nsRange* aSearchRange,
nsRange* aStartPoint,
- nsRange* aEndPoint)
+ nsRange* aEndPoint) const
{
// We need to restore the necessary state before this function returns.
StateRestorer restorer(aState);
const nsTextFragment *frag;
int32_t fragLen;
// Loop through non-block nodes until we find one that's not empty.
--- a/toolkit/components/find/nsFind.h
+++ b/toolkit/components/find/nsFind.h
@@ -47,27 +47,27 @@ protected:
struct State;
class StateRestorer;
// Move in the right direction for our search:
nsresult NextNode(State&,
nsRange* aSearchRange,
nsRange* aStartPoint,
- nsRange* aEndPoint);
+ nsRange* aEndPoint) const;
// Get the first character from the next node (last if mFindBackward).
//
// This will mutate the state, but then restore it afterwards.
char16_t PeekNextChar(State&,
nsRange* aSearchRange,
nsRange* aStartPoint,
- nsRange* aEndPoint);
+ nsRange* aEndPoint) const;
// The iterator we use to move through the document:
nsresult InitIterator(State&,
nsINode* aStartNode,
int32_t aStartOffset,
nsINode* aEndNode,
- int32_t aEndOffset);
+ int32_t aEndOffset) const;
};
#endif // nsFind_h__