2015-05-03 22:32:37 +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: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* 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/. */
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsIDocumentObserver_h___
|
|
|
|
#define nsIDocumentObserver_h___
|
|
|
|
|
2014-04-03 08:18:36 +04:00
|
|
|
#include "mozilla/EventStates.h"
|
2016-09-26 15:03:25 +03:00
|
|
|
#include "mozilla/StyleSheet.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsISupports.h"
|
2006-07-02 11:23:10 +04:00
|
|
|
#include "nsIMutationObserver.h"
|
1999-01-09 03:11:10 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIContent;
|
1998-07-23 03:32:19 +04:00
|
|
|
class nsIDocument;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-06-03 19:40:56 +04:00
|
|
|
#define NS_IDOCUMENT_OBSERVER_IID \
|
2015-11-21 01:34:12 +03:00
|
|
|
{ 0x71041fa3, 0x6dd7, 0x4cde, \
|
|
|
|
{ 0xbb, 0x76, 0xae, 0xcc, 0x69, 0xe1, 0x75, 0x78 } }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
// Document observer interface
|
2006-07-02 11:23:10 +04:00
|
|
|
class nsIDocumentObserver : public nsIMutationObserver
|
2004-01-24 03:46:17 +03:00
|
|
|
{
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_OBSERVER_IID)
|
1999-06-30 00:28:56 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* Notify that a content model update is beginning. This call can be
|
|
|
|
* nested.
|
|
|
|
*/
|
2018-05-15 16:56:38 +03:00
|
|
|
virtual void BeginUpdate(nsIDocument* aDocument) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify that a content model update is finished. This call can be
|
|
|
|
* nested.
|
|
|
|
*/
|
2018-05-15 16:56:38 +03:00
|
|
|
virtual void EndUpdate(nsIDocument* aDocument) = 0;
|
1998-06-03 19:40:56 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify the observer that a document load is beginning.
|
|
|
|
*/
|
2018-05-15 16:56:38 +03:00
|
|
|
virtual void BeginLoad(nsIDocument* aDocument) = 0;
|
1998-06-03 19:40:56 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify the observer that a document load has finished. Note that
|
|
|
|
* the associated reflow of the document will be done <b>before</b>
|
|
|
|
* EndLoad is invoked, not after.
|
|
|
|
*/
|
2018-05-15 16:56:38 +03:00
|
|
|
virtual void EndLoad(nsIDocument* aDocument) = 0;
|
1998-06-03 19:40:56 +04:00
|
|
|
|
1999-02-27 10:15:09 +03:00
|
|
|
/**
|
2017-07-06 15:00:35 +03:00
|
|
|
* Notification that the state of a content node has changed.
|
1999-02-27 10:15:09 +03:00
|
|
|
* (ie: gained or lost focus, became active or hovered over)
|
2017-07-06 15:00:35 +03:00
|
|
|
* This method is called automatically by content objects
|
|
|
|
* when their state is changed (therefore there is normally
|
|
|
|
* no need to invoke this method directly). The notification
|
|
|
|
* is passed to any IDocumentObservers. The notification is
|
1999-02-27 10:15:09 +03:00
|
|
|
* passed on to all of the document observers. <p>
|
|
|
|
*
|
|
|
|
* This notification is not sent when a piece of content is
|
2017-07-06 15:00:35 +03:00
|
|
|
* added/removed from the document or the content itself changed
|
1999-02-27 10:15:09 +03:00
|
|
|
* (the other notifications are used for that).
|
|
|
|
*
|
|
|
|
* @param aDocument The document being observed
|
2011-03-29 07:32:11 +04:00
|
|
|
* @param aContent the piece of content that changed
|
1999-02-27 10:15:09 +03:00
|
|
|
*/
|
2011-03-29 07:32:11 +04:00
|
|
|
virtual void ContentStateChanged(nsIDocument* aDocument,
|
|
|
|
nsIContent* aContent,
|
2014-04-03 08:18:36 +04:00
|
|
|
mozilla::EventStates aStateMask) = 0;
|
1999-02-27 10:15:09 +03:00
|
|
|
|
2010-03-17 20:10:57 +03:00
|
|
|
/**
|
|
|
|
* Notification that the state of the document has changed.
|
|
|
|
*
|
|
|
|
* @param aDocument The document being observed
|
|
|
|
* @param aStateMask the state that changed
|
|
|
|
*/
|
|
|
|
virtual void DocumentStatesChanged(nsIDocument* aDocument,
|
2014-04-03 08:18:36 +04:00
|
|
|
mozilla::EventStates aStateMask) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
|
|
|
|
|
2010-10-20 11:41:05 +04:00
|
|
|
#define NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \
|
2018-05-15 16:56:38 +03:00
|
|
|
virtual void BeginUpdate(nsIDocument* aDocument) override;
|
2010-10-20 11:41:05 +04:00
|
|
|
|
|
|
|
#define NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE \
|
2018-05-15 16:56:38 +03:00
|
|
|
virtual void EndUpdate(nsIDocument* aDocument) override;
|
2010-10-20 11:41:05 +04:00
|
|
|
|
|
|
|
#define NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD \
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void BeginLoad(nsIDocument* aDocument) override;
|
2010-10-20 11:41:05 +04:00
|
|
|
|
|
|
|
#define NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD \
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void EndLoad(nsIDocument* aDocument) override;
|
2010-10-20 11:41:05 +04:00
|
|
|
|
2011-03-29 07:32:11 +04:00
|
|
|
#define NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED \
|
|
|
|
virtual void ContentStateChanged(nsIDocument* aDocument, \
|
|
|
|
nsIContent* aContent, \
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::EventStates aStateMask) override;
|
2010-10-20 11:41:05 +04:00
|
|
|
|
|
|
|
#define NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED \
|
2010-03-17 20:10:57 +03:00
|
|
|
virtual void DocumentStatesChanged(nsIDocument* aDocument, \
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::EventStates aStateMask) override;
|
2010-10-20 11:41:05 +04:00
|
|
|
|
|
|
|
#define NS_DECL_NSIDOCUMENTOBSERVER \
|
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \
|
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE \
|
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD \
|
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD \
|
2011-03-29 07:32:11 +04:00
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED \
|
2010-10-20 11:41:05 +04:00
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED \
|
2006-07-02 11:23:10 +04:00
|
|
|
NS_DECL_NSIMUTATIONOBSERVER
|
2002-10-22 09:28:36 +04:00
|
|
|
|
|
|
|
|
2002-11-25 11:33:30 +03:00
|
|
|
#define NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(_class) \
|
2004-01-24 03:46:17 +03:00
|
|
|
void \
|
2018-05-15 16:56:38 +03:00
|
|
|
_class::BeginUpdate(nsIDocument* aDocument) \
|
2002-11-25 11:33:30 +03:00
|
|
|
{ \
|
|
|
|
} \
|
2004-01-24 03:46:17 +03:00
|
|
|
void \
|
2018-05-15 16:56:38 +03:00
|
|
|
_class::EndUpdate(nsIDocument* aDocument) \
|
2002-11-25 11:33:30 +03:00
|
|
|
{ \
|
|
|
|
} \
|
2006-07-02 11:23:10 +04:00
|
|
|
NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(_class)
|
2002-11-25 11:33:30 +03:00
|
|
|
|
|
|
|
#define NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(_class) \
|
2004-01-24 03:46:17 +03:00
|
|
|
void \
|
2002-11-25 11:33:30 +03:00
|
|
|
_class::BeginLoad(nsIDocument* aDocument) \
|
|
|
|
{ \
|
|
|
|
} \
|
2004-01-24 03:46:17 +03:00
|
|
|
void \
|
2002-11-25 11:33:30 +03:00
|
|
|
_class::EndLoad(nsIDocument* aDocument) \
|
|
|
|
{ \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(_class) \
|
2004-01-24 03:46:17 +03:00
|
|
|
void \
|
2011-03-29 07:32:11 +04:00
|
|
|
_class::ContentStateChanged(nsIDocument* aDocument, \
|
2014-04-03 08:18:36 +04:00
|
|
|
nsIContent* aContent, \
|
|
|
|
mozilla::EventStates aStateMask) \
|
2010-03-17 20:10:57 +03:00
|
|
|
{ \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
void \
|
|
|
|
_class::DocumentStatesChanged(nsIDocument* aDocument, \
|
2014-04-03 08:18:36 +04:00
|
|
|
mozilla::EventStates aStateMask) \
|
2002-11-25 11:33:30 +03:00
|
|
|
{ \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(_class) \
|
2006-07-02 11:23:10 +04:00
|
|
|
NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class)
|
2002-11-25 11:33:30 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif /* nsIDocumentObserver_h___ */
|