Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/docshell/base/nsDocShellEditorData.h
Line
Count
Source (jump to first uncovered line)
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__
8
9
#ifndef nsCOMPtr_h___
10
#include "nsCOMPtr.h"
11
#endif
12
13
#include "mozilla/HTMLEditor.h"
14
#include "mozilla/RefPtr.h"
15
#include "nsIHTMLDocument.h"
16
17
class nsIDocShell;
18
class nsIEditingSession;
19
20
class nsDocShellEditorData
21
{
22
public:
23
  explicit nsDocShellEditorData(nsIDocShell* aOwningDocShell);
24
  ~nsDocShellEditorData();
25
26
  nsresult MakeEditable(bool aWaitForUriLoad);
27
  bool GetEditable();
28
  nsresult CreateEditor();
29
  nsresult GetEditingSession(nsIEditingSession** aResult);
30
  mozilla::HTMLEditor* GetHTMLEditor() const
31
0
  {
32
0
    return mHTMLEditor;
33
0
  }
34
  nsresult SetHTMLEditor(mozilla::HTMLEditor* aHTMLEditor);
35
  void TearDownEditor();
36
  nsresult DetachFromWindow();
37
  nsresult ReattachToWindow(nsIDocShell* aDocShell);
38
0
  bool WaitingForLoad() const { return mMakeEditable; }
39
40
protected:
41
  void EnsureEditingSession();
42
43
  // The doc shell that owns us. Weak ref, since it always outlives us.
44
  nsIDocShell* mDocShell;
45
46
  // Only present for the content root docShell. Session is owned here.
47
  nsCOMPtr<nsIEditingSession> mEditingSession;
48
49
  // If this frame is editable, store HTML editor here. It's owned here.
50
  RefPtr<mozilla::HTMLEditor> mHTMLEditor;
51
52
  // Backup for the corresponding nsIHTMLDocument's  editing state while
53
  // the editor is detached.
54
  nsIHTMLDocument::EditingState mDetachedEditingState;
55
56
  // Indicates whether to make an editor after a url load.
57
  bool mMakeEditable;
58
59
  // Denotes if the editor is detached from its window. The editor is detached
60
  // while it's stored in the session history bfcache.
61
  bool mIsDetached;
62
63
  // Backup for mMakeEditable while the editor is detached.
64
  bool mDetachedMakeEditable;
65
};
66
67
#endif // nsDocShellEditorData_h__