Bug 1890793: Assert CallArgs::newTarget is not gray. r=spidermonkey-reviewers,sfink...
[gecko.git] / dom / xml / nsXMLPrettyPrinter.h
blob04835666ddc128c67ce456d802c18d1c854e080f
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"
10 #include "nsCOMPtr.h"
12 class nsXMLPrettyPrinter : public nsStubDocumentObserver {
13 public:
14 nsXMLPrettyPrinter();
16 NS_DECL_ISUPPORTS
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
25 /**
26 * This will prettyprint the document if the document is loaded in a
27 * displayed window.
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);
36 /**
37 * Unhook the prettyprinter
39 void Unhook();
41 private:
42 virtual ~nsXMLPrettyPrinter();
44 /**
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
54 bool mUnhookPending;
57 nsresult NS_NewXMLPrettyPrinter(nsXMLPrettyPrinter** aPrinter);
59 #endif // nsXMLPrettyPrinter_h__