Bug 1854550 - pt 10. Allow LOG() with zero extra arguments r=glandium
[gecko.git] / dom / base / nsIDocumentObserver.h
blobff20f1834326c708c60c049120befdd958b27c09
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___
9 #include "nsISupports.h"
10 #include "nsIMutationObserver.h"
11 #include "mozilla/dom/RustTypes.h"
13 namespace mozilla {
15 namespace dom {
16 class Document;
17 class Element;
18 } // namespace dom
19 } // namespace mozilla
21 #define NS_IDOCUMENT_OBSERVER_IID \
22 { \
23 0x71041fa3, 0x6dd7, 0x4cde, { \
24 0xbb, 0x76, 0xae, 0xcc, 0x69, 0xe1, 0x75, 0x78 \
25 } \
28 // Document observer interface
29 class nsIDocumentObserver : public nsIMutationObserver {
30 public:
31 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_OBSERVER_IID)
33 /**
34 * Notify that a content model update is beginning. This call can be
35 * nested.
37 virtual void BeginUpdate(mozilla::dom::Document*) = 0;
39 /**
40 * Notify that a content model update is finished. This call can be
41 * nested.
43 virtual void EndUpdate(mozilla::dom::Document*) = 0;
45 /**
46 * Notify the observer that a document load is beginning.
48 virtual void BeginLoad(mozilla::dom::Document*) = 0;
50 /**
51 * Notify the observer that a document load has finished. Note that
52 * the associated reflow of the document will be done <b>before</b>
53 * EndLoad is invoked, not after.
55 virtual void EndLoad(mozilla::dom::Document*) = 0;
57 /**
58 * Notification that the state of an element has changed. (ie: gained or lost
59 * focus, became active or hovered over)
61 * This method is called automatically by elements when their state is changed
62 * (therefore there is normally no need to invoke this method directly).
64 * This notification is not sent when elements are added/removed from the
65 * document (the other notifications are used for that).
67 * @param Document The document being observed
68 * @param Element the piece of content that changed
69 * @param ElementState the element states that changed
71 virtual void ElementStateChanged(mozilla::dom::Document*,
72 mozilla::dom::Element*,
73 mozilla::dom::ElementState) = 0;
76 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
78 #define NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \
79 virtual void BeginUpdate(mozilla::dom::Document*) override;
81 #define NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE \
82 virtual void EndUpdate(mozilla::dom::Document*) override;
84 #define NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD \
85 virtual void BeginLoad(mozilla::dom::Document*) override;
87 #define NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD \
88 virtual void EndLoad(mozilla::dom::Document*) override;
90 #define NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED \
91 virtual void ElementStateChanged(mozilla::dom::Document*, \
92 mozilla::dom::Element*, \
93 mozilla::dom::ElementState) override;
95 #define NS_DECL_NSIDOCUMENTOBSERVER \
96 NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \
97 NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE \
98 NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD \
99 NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD \
100 NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED \
101 NS_DECL_NSIMUTATIONOBSERVER
103 #define NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(_class) \
104 void _class::BeginUpdate(mozilla::dom::Document*) {} \
105 void _class::EndUpdate(mozilla::dom::Document*) {} \
106 NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(_class)
108 #define NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(_class) \
109 void _class::BeginLoad(mozilla::dom::Document*) {} \
110 void _class::EndLoad(mozilla::dom::Document*) {}
112 #define NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(_class) \
113 void _class::ElementStateChanged(mozilla::dom::Document*, \
114 mozilla::dom::Element*, \
115 mozilla::dom::ElementState) {}
117 #define NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(_class) \
118 NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class)
120 #endif /* nsIDocumentObserver_h___ */