Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 nsIDocument;
14 class nsXMLPrettyPrinter : public nsStubDocumentObserver
15 {
16 public:
17 nsXMLPrettyPrinter();
18 virtual ~nsXMLPrettyPrinter();
20 NS_DECL_ISUPPORTS
22 // nsIMutationObserver
23 NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
24 NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
25 NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
26 NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
27 NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
29 /**
30 * This will prettyprint the document if the document is loaded in a
31 * displayed window.
32 *
33 * @param aDocument document to prettyprint
34 * @param [out] aDidPrettyPrint if true, and error not returned, actually
35 * went ahead with prettyprinting the document.
36 */
37 nsresult PrettyPrint(nsIDocument* aDocument, bool* aDidPrettyPrint);
39 /**
40 * Unhook the prettyprinter
41 */
42 void Unhook();
43 private:
44 /**
45 * Signals for unhooking by setting mUnhookPending if the node changed is
46 * non-anonymous content.
47 *
48 * @param aContent content that has changed
49 */
50 void MaybeUnhook(nsIContent* aContent);
52 nsIDocument* mDocument; //weak. Set as long as we're observing the document
53 bool mUnhookPending;
54 };
56 nsresult NS_NewXMLPrettyPrinter(nsXMLPrettyPrinter** aPrinter);
58 #endif //nsXMLPrettyPrinter_h__