1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsXMLPrettyPrinter_h__
7 #define nsXMLPrettyPrinter_h__
9 #include "nsStubDocumentObserver.h"
12 class nsXMLPrettyPrinter
: public nsStubDocumentObserver
{
18 // nsIMutationObserver
19 NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
20 NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
21 NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
22 NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
23 NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
26 * This will prettyprint the document if the document is loaded in a
29 * @param aDocument document to prettyprint
30 * @param [out] aDidPrettyPrint if true, and error not returned, actually
31 * went ahead with prettyprinting the document.
33 nsresult
PrettyPrint(mozilla::dom::Document
* aDocument
,
34 bool* aDidPrettyPrint
);
37 * Unhook the prettyprinter
42 virtual ~nsXMLPrettyPrinter();
45 * Signals for unhooking by setting mUnhookPending if the node changed is
46 * not in the shadow root tree nor in anonymous content.
48 * @param aContent content that has changed
50 void MaybeUnhook(nsIContent
* aContent
);
52 mozilla::dom::Document
*
53 mDocument
; // weak. Set as long as we're observing the document
57 nsresult
NS_NewXMLPrettyPrinter(nsXMLPrettyPrinter
** aPrinter
);
59 #endif // nsXMLPrettyPrinter_h__