/src/mozilla-central/dom/base/nsIDocumentObserver.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 nsIDocumentObserver_h___ |
7 | | #define nsIDocumentObserver_h___ |
8 | | |
9 | | #include "mozilla/EventStates.h" |
10 | | #include "mozilla/StyleSheet.h" |
11 | | #include "nsISupports.h" |
12 | | #include "nsIMutationObserver.h" |
13 | | |
14 | | class nsIContent; |
15 | | class nsIDocument; |
16 | | |
17 | | #define NS_IDOCUMENT_OBSERVER_IID \ |
18 | | { 0x71041fa3, 0x6dd7, 0x4cde, \ |
19 | | { 0xbb, 0x76, 0xae, 0xcc, 0x69, 0xe1, 0x75, 0x78 } } |
20 | | |
21 | | // Document observer interface |
22 | | class nsIDocumentObserver : public nsIMutationObserver |
23 | | { |
24 | | public: |
25 | | NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_OBSERVER_IID) |
26 | | |
27 | | /** |
28 | | * Notify that a content model update is beginning. This call can be |
29 | | * nested. |
30 | | */ |
31 | | virtual void BeginUpdate(nsIDocument* aDocument) = 0; |
32 | | |
33 | | /** |
34 | | * Notify that a content model update is finished. This call can be |
35 | | * nested. |
36 | | */ |
37 | | virtual void EndUpdate(nsIDocument* aDocument) = 0; |
38 | | |
39 | | /** |
40 | | * Notify the observer that a document load is beginning. |
41 | | */ |
42 | | virtual void BeginLoad(nsIDocument* aDocument) = 0; |
43 | | |
44 | | /** |
45 | | * Notify the observer that a document load has finished. Note that |
46 | | * the associated reflow of the document will be done <b>before</b> |
47 | | * EndLoad is invoked, not after. |
48 | | */ |
49 | | virtual void EndLoad(nsIDocument* aDocument) = 0; |
50 | | |
51 | | /** |
52 | | * Notification that the state of a content node has changed. |
53 | | * (ie: gained or lost focus, became active or hovered over) |
54 | | * This method is called automatically by content objects |
55 | | * when their state is changed (therefore there is normally |
56 | | * no need to invoke this method directly). The notification |
57 | | * is passed to any IDocumentObservers. The notification is |
58 | | * passed on to all of the document observers. <p> |
59 | | * |
60 | | * This notification is not sent when a piece of content is |
61 | | * added/removed from the document or the content itself changed |
62 | | * (the other notifications are used for that). |
63 | | * |
64 | | * @param aDocument The document being observed |
65 | | * @param aContent the piece of content that changed |
66 | | */ |
67 | | virtual void ContentStateChanged(nsIDocument* aDocument, |
68 | | nsIContent* aContent, |
69 | | mozilla::EventStates aStateMask) = 0; |
70 | | |
71 | | /** |
72 | | * Notification that the state of the document has changed. |
73 | | * |
74 | | * @param aDocument The document being observed |
75 | | * @param aStateMask the state that changed |
76 | | */ |
77 | | virtual void DocumentStatesChanged(nsIDocument* aDocument, |
78 | | mozilla::EventStates aStateMask) = 0; |
79 | | }; |
80 | | |
81 | | NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID) |
82 | | |
83 | | #define NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \ |
84 | | virtual void BeginUpdate(nsIDocument* aDocument) override; |
85 | | |
86 | | #define NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE \ |
87 | | virtual void EndUpdate(nsIDocument* aDocument) override; |
88 | | |
89 | | #define NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD \ |
90 | | virtual void BeginLoad(nsIDocument* aDocument) override; |
91 | | |
92 | | #define NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD \ |
93 | | virtual void EndLoad(nsIDocument* aDocument) override; |
94 | | |
95 | | #define NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED \ |
96 | | virtual void ContentStateChanged(nsIDocument* aDocument, \ |
97 | | nsIContent* aContent, \ |
98 | | mozilla::EventStates aStateMask) override; |
99 | | |
100 | | #define NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED \ |
101 | | virtual void DocumentStatesChanged(nsIDocument* aDocument, \ |
102 | | mozilla::EventStates aStateMask) override; |
103 | | |
104 | | #define NS_DECL_NSIDOCUMENTOBSERVER \ |
105 | | NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \ |
106 | | NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE \ |
107 | | NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD \ |
108 | | NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD \ |
109 | | NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED \ |
110 | | NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED \ |
111 | | NS_DECL_NSIMUTATIONOBSERVER |
112 | | |
113 | | |
114 | | #define NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(_class) \ |
115 | | void \ |
116 | 0 | _class::BeginUpdate(nsIDocument* aDocument) \ |
117 | 0 | { \ |
118 | 0 | } \ Unexecuted instantiation: nsStubDocumentObserver::BeginUpdate(nsIDocument*) Unexecuted instantiation: mozilla::a11y::DocAccessible::BeginUpdate(nsIDocument*) |
119 | | void \ |
120 | 0 | _class::EndUpdate(nsIDocument* aDocument) \ |
121 | 0 | { \ |
122 | 0 | } \ Unexecuted instantiation: nsStubDocumentObserver::EndUpdate(nsIDocument*) Unexecuted instantiation: mozilla::a11y::DocAccessible::EndUpdate(nsIDocument*) |
123 | | NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(_class) |
124 | | |
125 | | #define NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(_class) \ |
126 | | void \ |
127 | 0 | _class::BeginLoad(nsIDocument* aDocument) \ |
128 | 0 | { \ |
129 | 0 | } \ Unexecuted instantiation: nsStubDocumentObserver::BeginLoad(nsIDocument*) Unexecuted instantiation: mozilla::a11y::DocAccessible::BeginLoad(nsIDocument*) |
130 | | void \ |
131 | 0 | _class::EndLoad(nsIDocument* aDocument) \ |
132 | 0 | { \ |
133 | 0 | } Unexecuted instantiation: nsStubDocumentObserver::EndLoad(nsIDocument*) Unexecuted instantiation: mozilla::a11y::DocAccessible::EndLoad(nsIDocument*) |
134 | | |
135 | | #define NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(_class) \ |
136 | | void \ |
137 | | _class::ContentStateChanged(nsIDocument* aDocument, \ |
138 | | nsIContent* aContent, \ |
139 | 0 | mozilla::EventStates aStateMask) \ |
140 | 0 | { \ |
141 | 0 | } \ |
142 | | \ |
143 | | void \ |
144 | | _class::DocumentStatesChanged(nsIDocument* aDocument, \ |
145 | 0 | mozilla::EventStates aStateMask) \ |
146 | 0 | { \ |
147 | 0 | } |
148 | | |
149 | | #define NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(_class) \ |
150 | | NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class) |
151 | | |
152 | | #endif /* nsIDocumentObserver_h___ */ |