tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsXMLPrettyPrinter.h (1754B)


      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/. */
      5 
      6 #ifndef nsXMLPrettyPrinter_h__
      7 #define nsXMLPrettyPrinter_h__
      8 
      9 #include "nsCOMPtr.h"
     10 #include "nsStubDocumentObserver.h"
     11 
     12 class nsXMLPrettyPrinter : public nsStubDocumentObserver {
     13 public:
     14  nsXMLPrettyPrinter();
     15 
     16  NS_DECL_ISUPPORTS
     17 
     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
     24 
     25  /**
     26   * This will prettyprint the document if the document is loaded in a
     27   * displayed window.
     28   *
     29   * @param aDocument  document to prettyprint
     30   * @param [out] aDidPrettyPrint if true, and error not returned, actually
     31   *              went ahead with prettyprinting the document.
     32   */
     33  nsresult PrettyPrint(mozilla::dom::Document* aDocument,
     34                       bool* aDidPrettyPrint);
     35 
     36  /**
     37   * Unhook the prettyprinter
     38   */
     39  void Unhook();
     40 
     41 private:
     42  virtual ~nsXMLPrettyPrinter();
     43 
     44  /**
     45   * Signals for unhooking by setting mUnhookPending if the node changed is
     46   * not in the shadow root tree nor in anonymous content.
     47   *
     48   * @param aContent  content that has changed
     49   */
     50  void MaybeUnhook(nsIContent* aContent);
     51 
     52  mozilla::dom::Document*
     53      mDocument;  // weak. Set as long as we're observing the document
     54  bool mUnhookPending;
     55 };
     56 
     57 nsresult NS_NewXMLPrettyPrinter(nsXMLPrettyPrinter** aPrinter);
     58 
     59 #endif  // nsXMLPrettyPrinter_h__