Backed out changesets aed22a2d8353 and c61fe8e1f887 (bug 908006) for OSX reftest...
[gecko.git] / docshell / base / nsDocShellEditorData.h
blob14a19c63afc13119a21190d6968e146904570671
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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/. */
6 #ifndef nsDocShellEditorData_h__
7 #define nsDocShellEditorData_h__
9 #ifndef nsCOMPtr_h___
10 #include "nsCOMPtr.h"
11 #endif
13 #ifndef __gen_nsIDocShell_h__
14 #include "nsIDocShell.h"
15 #endif
17 #ifndef __gen_nsIEditingSession_h__
18 #include "nsIEditingSession.h"
19 #endif
22 #include "nsIHTMLDocument.h"
23 #include "nsIEditor.h"
25 class nsIDOMWindow;
27 class nsDocShellEditorData
29 public:
31 nsDocShellEditorData(nsIDocShell* inOwningDocShell);
32 ~nsDocShellEditorData();
34 nsresult MakeEditable(bool inWaitForUriLoad);
35 bool GetEditable();
36 nsresult CreateEditor();
37 nsresult GetEditingSession(nsIEditingSession **outEditingSession);
38 nsresult GetEditor(nsIEditor **outEditor);
39 nsresult SetEditor(nsIEditor *inEditor);
40 void TearDownEditor();
41 nsresult DetachFromWindow();
42 nsresult ReattachToWindow(nsIDocShell *aDocShell);
43 bool WaitingForLoad() const { return mMakeEditable; }
45 protected:
47 nsresult EnsureEditingSession();
49 // The doc shell that owns us. Weak ref, since it always outlives us.
50 nsIDocShell* mDocShell;
52 // Only present for the content root docShell. Session is owned here.
53 nsCOMPtr<nsIEditingSession> mEditingSession;
55 // Indicates whether to make an editor after a url load.
56 bool mMakeEditable;
58 // If this frame is editable, store editor here. Editor is owned here.
59 nsCOMPtr<nsIEditor> mEditor;
61 // Denotes if the editor is detached from its window. The editor is detached
62 // while it's stored in the session history bfcache.
63 bool mIsDetached;
65 // Backup for mMakeEditable while the editor is detached.
66 bool mDetachedMakeEditable;
68 // Backup for the corresponding nsIHTMLDocument's editing state while
69 // the editor is detached.
70 nsIHTMLDocument::EditingState mDetachedEditingState;
75 #endif // nsDocShellEditorData_h__