embedding/components/find/src/nsFind.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 nsFind_h__
     7 #define nsFind_h__
     9 #include "nsIFind.h"
    11 #include "nsAutoPtr.h"
    12 #include "nsCOMPtr.h"
    13 #include "nsCycleCollectionParticipant.h"
    14 #include "nsIDOMNode.h"
    15 #include "nsIDOMRange.h"
    16 #include "nsIContentIterator.h"
    17 #include "nsIWordBreaker.h"
    19 class nsIAtom;
    20 class nsIContent;
    22 #define NS_FIND_CONTRACTID "@mozilla.org/embedcomp/rangefind;1"
    24 #define NS_FIND_CID \
    25  {0x471f4944, 0x1dd2, 0x11b2, {0x87, 0xac, 0x90, 0xbe, 0x0a, 0x51, 0xd6, 0x09}}
    27 class nsFindContentIterator;
    29 class nsFind : public nsIFind
    30 {
    31 public:
    32   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    33   NS_DECL_NSIFIND
    34   NS_DECL_CYCLE_COLLECTION_CLASS(nsFind)
    36   nsFind();
    37   virtual ~nsFind();
    39   static already_AddRefed<nsIDOMRange> CreateRange(nsINode* aNode);
    41 protected:
    42   // Parameters set from the interface:
    43   //nsCOMPtr<nsIDOMRange> mRange;   // search only in this range
    44   bool mFindBackward;
    45   bool mCaseSensitive;
    47   nsCOMPtr<nsIWordBreaker> mWordBreaker;
    49   int32_t mIterOffset;
    50   nsCOMPtr<nsIDOMNode> mIterNode;
    52   // Last block parent, so that we will notice crossing block boundaries:
    53   nsCOMPtr<nsIDOMNode> mLastBlockParent;
    54   nsresult GetBlockParent(nsIDOMNode* aNode, nsIDOMNode** aParent);
    56   // Utility routines:
    57   bool IsTextNode(nsIDOMNode* aNode);
    58   bool IsBlockNode(nsIContent* aNode);
    59   bool SkipNode(nsIContent* aNode);
    60   bool IsVisibleNode(nsIDOMNode *aNode);
    62   // Move in the right direction for our search:
    63   nsresult NextNode(nsIDOMRange* aSearchRange,
    64                     nsIDOMRange* aStartPoint, nsIDOMRange* aEndPoint,
    65                     bool aContinueOk);
    67   // Reset variables before returning -- don't hold any references.
    68   void ResetAll();
    70   // The iterator we use to move through the document:
    71   nsresult InitIterator(nsIDOMNode* aStartNode, int32_t aStartOffset,
    72                         nsIDOMNode* aEndNode, int32_t aEndOffset);
    73   nsRefPtr<nsFindContentIterator> mIterator;
    74 };
    76 #endif // nsFind_h__

mercurial