1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsWebBrowserFindImpl_h__
8 #define nsWebBrowserFindImpl_h__
10 #include "nsIWebBrowserFind.h"
13 #include "nsIWeakReferenceUtils.h"
14 #include "nsPIDOMWindow.h"
28 } // namespace mozilla
30 //*****************************************************************************
31 // class nsWebBrowserFind
32 //*****************************************************************************
34 class nsWebBrowserFind
: public nsIWebBrowserFind
,
35 public nsIWebBrowserFindInFrames
{
43 NS_DECL_NSIWEBBROWSERFIND
45 // nsIWebBrowserFindInFrames
46 NS_DECL_NSIWEBBROWSERFINDINFRAMES
49 virtual ~nsWebBrowserFind();
51 bool CanFindNext() { return mSearchString
.Length() != 0; }
53 MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
54 SearchInFrame(nsPIDOMWindowOuter
* aWindow
, bool aWrapping
, bool* aDidFind
);
56 nsresult
OnStartSearchFrame(nsPIDOMWindowOuter
* aWindow
);
57 nsresult
OnEndSearchFrame(nsPIDOMWindowOuter
* aWindow
);
59 already_AddRefed
<mozilla::dom::Selection
> GetFrameSelection(
60 nsPIDOMWindowOuter
* aWindow
);
61 MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
62 ClearFrameSelection(nsPIDOMWindowOuter
* aWindow
);
64 MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
OnFind(nsPIDOMWindowOuter
* aFoundWindow
);
66 MOZ_CAN_RUN_SCRIPT_BOUNDARY
void SetSelectionAndScroll(
67 nsPIDOMWindowOuter
* aWindow
, nsRange
* aRange
);
69 nsresult
GetRootNode(mozilla::dom::Document
* aDomDoc
,
70 mozilla::dom::Element
** aNode
);
71 nsresult
GetSearchLimits(nsRange
* aRange
, nsRange
* aStartPt
, nsRange
* aEndPt
,
72 mozilla::dom::Document
* aDoc
,
73 mozilla::dom::Selection
* aSel
, bool aWrap
);
74 nsresult
SetRangeAroundDocument(nsRange
* aSearchRange
, nsRange
* aStartPoint
,
76 mozilla::dom::Document
* aDoc
);
79 nsString mSearchString
;
85 bool mMatchDiacritics
;
87 bool mSearchSubFrames
;
88 bool mSearchParentFrames
;
90 // These are all weak because who knows if windows can go away during our
92 nsWeakPtr mCurrentSearchFrame
;
93 nsWeakPtr mRootSearchFrame
;
94 nsWeakPtr mLastFocusedWindow
;