2015-02-13 22:36:47 +03: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 15:12:37 +04: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 07:44:14 +03:00
|
|
|
#ifndef nsDocShellEditorData_h__
|
|
|
|
#define nsDocShellEditorData_h__
|
|
|
|
|
|
|
|
#ifndef nsCOMPtr_h___
|
|
|
|
# include "nsCOMPtr.h"
|
|
|
|
#endif
|
|
|
|
|
2017-08-04 15:42:13 +03:00
|
|
|
#include "mozilla/HTMLEditor.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
2008-04-24 01:36:17 +04:00
|
|
|
#include "nsIHTMLDocument.h"
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2013-09-04 00:17:26 +04:00
|
|
|
class nsIDocShell;
|
2019-04-03 04:56:31 +03:00
|
|
|
class nsEditingSession;
|
2002-01-30 07:44:14 +03:00
|
|
|
|
|
|
|
class nsDocShellEditorData {
|
|
|
|
public:
|
2015-02-13 22:36:37 +03:00
|
|
|
explicit nsDocShellEditorData(nsIDocShell* aOwningDocShell);
|
2008-04-24 01:36:17 +04:00
|
|
|
~nsDocShellEditorData();
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2015-02-13 22:36:37 +03:00
|
|
|
nsresult MakeEditable(bool aWaitForUriLoad);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetEditable();
|
2019-04-03 04:56:31 +03:00
|
|
|
nsEditingSession* GetEditingSession();
|
2017-08-04 15:42:13 +03:00
|
|
|
mozilla::HTMLEditor* GetHTMLEditor() const { return mHTMLEditor; }
|
|
|
|
nsresult SetHTMLEditor(mozilla::HTMLEditor* aHTMLEditor);
|
2008-04-24 01:36:17 +04:00
|
|
|
void TearDownEditor();
|
|
|
|
nsresult DetachFromWindow();
|
2015-02-13 22:36:37 +03:00
|
|
|
nsresult ReattachToWindow(nsIDocShell* aDocShell);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool WaitingForLoad() const { return mMakeEditable; }
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2008-04-24 01:36:17 +04:00
|
|
|
protected:
|
2018-09-08 19:38:01 +03:00
|
|
|
void EnsureEditingSession();
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2015-02-13 22:36:37 +03:00
|
|
|
// The doc shell that owns us. Weak ref, since it always outlives us.
|
2008-04-24 01:36:17 +04:00
|
|
|
nsIDocShell* mDocShell;
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2008-04-24 01:36:17 +04:00
|
|
|
// Only present for the content root docShell. Session is owned here.
|
2019-04-03 04:56:31 +03:00
|
|
|
RefPtr<nsEditingSession> mEditingSession;
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2017-08-04 15:42:13 +03:00
|
|
|
// If this frame is editable, store HTML editor here. It's owned here.
|
|
|
|
RefPtr<mozilla::HTMLEditor> mHTMLEditor;
|
|
|
|
|
|
|
|
// Backup for the corresponding nsIHTMLDocument's editing state while
|
|
|
|
// the editor is detached.
|
|
|
|
nsIHTMLDocument::EditingState mDetachedEditingState;
|
|
|
|
|
2008-04-24 01:36:17 +04:00
|
|
|
// Indicates whether to make an editor after a url load.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mMakeEditable;
|
2015-02-13 22:36:37 +03:00
|
|
|
|
2008-04-24 01:36:17 +04: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 10:19:26 +04:00
|
|
|
bool mIsDetached;
|
2008-04-24 01:36:17 +04:00
|
|
|
|
|
|
|
// Backup for mMakeEditable while the editor is detached.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mDetachedMakeEditable;
|
2002-01-30 07:44:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsDocShellEditorData_h__
|