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/. */
6 #ifndef nsDocShellEditorData_h__
7 #define nsDocShellEditorData_h__
10 # include "nsCOMPtr.h"
13 #include "mozilla/RefPtr.h"
14 #include "mozilla/dom/Document.h"
17 class nsEditingSession
;
23 class nsDocShellEditorData
{
25 explicit nsDocShellEditorData(nsIDocShell
* aOwningDocShell
);
26 ~nsDocShellEditorData();
28 MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
MakeEditable(bool aWaitForUriLoad
);
30 nsEditingSession
* GetEditingSession();
31 mozilla::HTMLEditor
* GetHTMLEditor() const { return mHTMLEditor
; }
32 MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
33 SetHTMLEditor(mozilla::HTMLEditor
* aHTMLEditor
);
34 MOZ_CAN_RUN_SCRIPT_BOUNDARY
void TearDownEditor();
35 nsresult
DetachFromWindow();
36 nsresult
ReattachToWindow(nsIDocShell
* aDocShell
);
37 bool WaitingForLoad() const { return mMakeEditable
; }
40 void EnsureEditingSession();
42 // The doc shell that owns us. Weak ref, since it always outlives us.
43 nsIDocShell
* mDocShell
;
45 // Only present for the content root docShell. Session is owned here.
46 RefPtr
<nsEditingSession
> mEditingSession
;
48 // If this frame is editable, store HTML editor here. It's owned here.
49 RefPtr
<mozilla::HTMLEditor
> mHTMLEditor
;
51 // Backup for the corresponding HTMLDocument's editing state while
52 // the editor is detached.
53 mozilla::dom::Document::EditingState mDetachedEditingState
;
55 // Indicates whether to make an editor after a url load.
58 // Denotes if the editor is detached from its window. The editor is detached
59 // while it's stored in the session history bfcache.
62 // Backup for mMakeEditable while the editor is detached.
63 bool mDetachedMakeEditable
;
66 #endif // nsDocShellEditorData_h__