Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/html/nsIHTMLDocument.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
7
#ifndef nsIHTMLDocument_h
8
#define nsIHTMLDocument_h
9
10
#include "nsISupports.h"
11
#include "nsCompatibility.h"
12
13
class nsIContent;
14
class nsContentList;
15
16
#define NS_IHTMLDOCUMENT_IID \
17
{ 0xcf814492, 0x303c, 0x4718, \
18
  { 0x9a, 0x3e, 0x39, 0xbc, 0xd5, 0x2c, 0x10, 0xdb } }
19
20
/**
21
 * HTML document extensions to nsIDocument.
22
 */
23
class nsIHTMLDocument : public nsISupports
24
{
25
public:
26
  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTMLDOCUMENT_IID)
27
28
  /**
29
   * Set compatibility mode for this document
30
   */
31
  virtual void SetCompatibilityMode(nsCompatibility aMode) = 0;
32
33
  /**
34
   * Called when form->BindToTree() is called so that document knows
35
   * immediately when a form is added
36
   */
37
  virtual void AddedForm() = 0;
38
  /**
39
   * Called when form->SetDocument() is called so that document knows
40
   * immediately when a form is removed
41
   */
42
  virtual void RemovedForm() = 0;
43
  /**
44
   * Called to get a better count of forms than document.forms can provide
45
   * without calling FlushPendingNotifications (bug 138892).
46
   */
47
  // XXXbz is this still needed now that we can flush just content,
48
  // not the rest?
49
  virtual int32_t GetNumFormsSynchronous() = 0;
50
51
  virtual bool IsWriting() = 0;
52
53
  /**
54
   * Should be called when an element's editable changes as a result of
55
   * changing its contentEditable attribute/property.
56
   *
57
   * @param aElement the element for which the contentEditable
58
   *                 attribute/property was changed
59
   * @param aChange +1 if the contentEditable attribute/property was changed to
60
   *                true, -1 if it was changed to false
61
   */
62
  virtual nsresult ChangeContentEditableCount(nsIContent *aElement,
63
                                              int32_t aChange) = 0;
64
65
  enum EditingState {
66
    eTearingDown = -2,
67
    eSettingUp = -1,
68
    eOff = 0,
69
    eDesignMode,
70
    eContentEditable
71
  };
72
73
  /**
74
   * Returns whether the document is editable.
75
   */
76
  bool IsEditingOn()
77
0
  {
78
0
    return GetEditingState() == eDesignMode ||
79
0
           GetEditingState() == eContentEditable;
80
0
  }
81
82
  /**
83
   * Returns the editing state of the document (not editable, contentEditable or
84
   * designMode).
85
   */
86
  virtual EditingState GetEditingState() = 0;
87
88
  /**
89
   * Set the editing state of the document. Don't use this if you want
90
   * to enable/disable editing, call EditingStateChanged() or
91
   * SetDesignMode().
92
   */
93
  virtual nsresult SetEditingState(EditingState aState) = 0;
94
95
  /**
96
   * Disables getting and setting cookies
97
   */
98
  virtual void DisableCookieAccess() = 0;
99
100
  /**
101
   * Called when this nsIHTMLDocument's editor is destroyed.
102
   */
103
  virtual void TearingDownEditor() = 0;
104
105
  virtual void SetIsXHTML(bool aXHTML) = 0;
106
107
  virtual void SetDocWriteDisabled(bool aDisabled) = 0;
108
};
109
110
NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLDocument, NS_IHTMLDOCUMENT_IID)
111
112
#endif /* nsIHTMLDocument_h */