Bug 1807268 - Fix verifyOpenAllInNewTabsOptionTest UI test r=ohorvath
[gecko.git] / docshell / base / nsDocShellEditorData.h
blob27f840675bd10ed372d7ba43e00285b68acbac67
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__
9 #ifndef nsCOMPtr_h___
10 # include "nsCOMPtr.h"
11 #endif
13 #include "mozilla/RefPtr.h"
14 #include "mozilla/dom/Document.h"
16 class nsIDocShell;
17 class nsEditingSession;
19 namespace mozilla {
20 class HTMLEditor;
23 class nsDocShellEditorData {
24 public:
25 explicit nsDocShellEditorData(nsIDocShell* aOwningDocShell);
26 ~nsDocShellEditorData();
28 MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult MakeEditable(bool aWaitForUriLoad);
29 bool GetEditable();
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; }
39 protected:
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.
56 bool mMakeEditable;
58 // Denotes if the editor is detached from its window. The editor is detached
59 // while it's stored in the session history bfcache.
60 bool mIsDetached;
62 // Backup for mMakeEditable while the editor is detached.
63 bool mDetachedMakeEditable;
66 #endif // nsDocShellEditorData_h__