2015-02-13 19:36:47 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 11:12:37 +00:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2002-01-30 04:44:14 +00:00
|
|
|
#ifndef nsDocShellEditorData_h__
|
|
|
|
#define nsDocShellEditorData_h__
|
|
|
|
|
|
|
|
#ifndef nsCOMPtr_h___
|
|
|
|
# include "nsCOMPtr.h"
|
|
|
|
#endif
|
|
|
|
|
2017-08-04 12:42:13 +00:00
|
|
|
#include "mozilla/HTMLEditor.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
2019-05-31 01:37:26 +00:00
|
|
|
#include "mozilla/dom/Document.h"
|
2002-01-30 04:44:14 +00:00
|
|
|
|
2013-09-03 20:17:26 +00:00
|
|
|
class nsIDocShell;
|
2019-04-03 01:56:31 +00:00
|
|
|
class nsEditingSession;
|
2002-01-30 04:44:14 +00:00
|
|
|
|
|
|
|
class nsDocShellEditorData {
|
|
|
|
public:
|
2015-02-13 19:36:37 +00:00
|
|
|
explicit nsDocShellEditorData(nsIDocShell* aOwningDocShell);
|
2008-04-23 21:36:17 +00:00
|
|
|
~nsDocShellEditorData();
|
2002-01-30 04:44:14 +00:00
|
|
|
|
2019-05-09 07:37:51 +00:00
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult MakeEditable(bool aWaitForUriLoad);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetEditable();
|
2019-04-03 01:56:31 +00:00
|
|
|
nsEditingSession* GetEditingSession();
|
2017-08-04 12:42:13 +00:00
|
|
|
mozilla::HTMLEditor* GetHTMLEditor() const { return mHTMLEditor; }
|
2019-05-09 07:37:51 +00:00
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
|
|
|
|
SetHTMLEditor(mozilla::HTMLEditor* aHTMLEditor);
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY void TearDownEditor();
|
2008-04-23 21:36:17 +00:00
|
|
|
nsresult DetachFromWindow();
|
2015-02-13 19:36:37 +00:00
|
|
|
nsresult ReattachToWindow(nsIDocShell* aDocShell);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool WaitingForLoad() const { return mMakeEditable; }
|
2002-01-30 04:44:14 +00:00
|
|
|
|
2008-04-23 21:36:17 +00:00
|
|
|
protected:
|
2018-09-08 16:38:01 +00:00
|
|
|
void EnsureEditingSession();
|
2002-01-30 04:44:14 +00:00
|
|
|
|
2015-02-13 19:36:37 +00:00
|
|
|
// The doc shell that owns us. Weak ref, since it always outlives us.
|
2008-04-23 21:36:17 +00:00
|
|
|
nsIDocShell* mDocShell;
|
2002-01-30 04:44:14 +00:00
|
|
|
|
2008-04-23 21:36:17 +00:00
|
|
|
// Only present for the content root docShell. Session is owned here.
|
2019-04-03 01:56:31 +00:00
|
|
|
RefPtr<nsEditingSession> mEditingSession;
|
2002-01-30 04:44:14 +00:00
|
|
|
|
2017-08-04 12:42:13 +00:00
|
|
|
// If this frame is editable, store HTML editor here. It's owned here.
|
|
|
|
RefPtr<mozilla::HTMLEditor> mHTMLEditor;
|
|
|
|
|
2019-06-04 17:27:43 +00:00
|
|
|
// Backup for the corresponding HTMLDocument's editing state while
|
2017-08-04 12:42:13 +00:00
|
|
|
// the editor is detached.
|
2019-05-31 01:37:26 +00:00
|
|
|
mozilla::dom::Document::EditingState mDetachedEditingState;
|
2017-08-04 12:42:13 +00:00
|
|
|
|
2008-04-23 21:36:17 +00:00
|
|
|
// Indicates whether to make an editor after a url load.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mMakeEditable;
|
2015-02-13 19:36:37 +00:00
|
|
|
|
2008-04-23 21:36:17 +00:00
|
|
|
// Denotes if the editor is detached from its window. The editor is detached
|
|
|
|
// while it's stored in the session history bfcache.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mIsDetached;
|
2008-04-23 21:36:17 +00:00
|
|
|
|
|
|
|
// Backup for mMakeEditable while the editor is detached.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mDetachedMakeEditable;
|
2002-01-30 04:44:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsDocShellEditorData_h__
|