layout/inspector/inDOMView.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef __inDOMView_h__
     6 #define __inDOMView_h__
     8 #include "inIDOMView.h"
     9 #include "inIDOMUtils.h"
    11 #include "nsITreeView.h"
    12 #include "nsITreeSelection.h"
    13 #include "nsStubMutationObserver.h"
    14 #include "nsIDOMNode.h"
    15 #include "nsIDOMDocument.h"
    16 #include "nsTArray.h"
    17 #include "nsCOMArray.h"
    18 #include "nsCOMPtr.h"
    20 class inDOMViewNode;
    21 class nsIDOMMozNamedAttrMap;
    23 class inDOMView : public inIDOMView,
    24                   public nsITreeView,
    25                   public nsStubMutationObserver
    26 {
    27 public:
    28   NS_DECL_ISUPPORTS
    29   NS_DECL_INIDOMVIEW
    30   NS_DECL_NSITREEVIEW
    32   inDOMView();
    33   virtual ~inDOMView();
    35   // nsIMutationObserver
    36   NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
    37   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
    38   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
    39   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
    40   NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
    42 protected:
    43   nsCOMPtr<nsITreeBoxObject> mTree;
    44   nsCOMPtr<nsITreeSelection> mSelection;
    45   nsCOMPtr<inIDOMUtils> mDOMUtils;
    47   bool mShowAnonymous;
    48   bool mShowSubDocuments;
    49   bool mShowWhitespaceNodes;
    50   bool mShowAccessibleNodes;
    51   uint32_t mWhatToShow;
    53   nsCOMPtr<nsIDOMNode> mRootNode;
    54   nsCOMPtr<nsIDOMDocument> mRootDocument;
    56   nsTArray<inDOMViewNode*> mNodes;
    58   inDOMViewNode* GetNodeAt(int32_t aIndex);
    59   int32_t GetRowCount();
    60   int32_t NodeToRow(inDOMViewNode* aNode);
    61   bool RowOutOfBounds(int32_t aRow, int32_t aCount);
    62   inDOMViewNode* CreateNode(nsIDOMNode* aNode, inDOMViewNode* aParent);
    63   void AppendNode(inDOMViewNode* aNode);
    64   void InsertNode(inDOMViewNode* aNode, int32_t aIndex);
    65   void RemoveNode(int32_t aIndex);
    66   void ReplaceNode(inDOMViewNode* aNode, int32_t aIndex);
    67   void InsertNodes(nsTArray<inDOMViewNode*>& aNodes, int32_t aIndex);
    68   void RemoveNodes(int32_t aIndex, int32_t aCount);
    69   void RemoveAllNodes();
    70   void ExpandNode(int32_t aRow);
    71   void CollapseNode(int32_t aRow);
    73   nsresult RowToNode(int32_t aRow, inDOMViewNode** aNode);
    74   nsresult NodeToRow(nsIDOMNode* aNode, int32_t* aRow);
    76   void InsertLinkAfter(inDOMViewNode* aNode, inDOMViewNode* aInsertAfter);
    77   void InsertLinkBefore(inDOMViewNode* aNode, inDOMViewNode* aInsertBefore);
    78   void RemoveLink(inDOMViewNode* aNode);
    79   void ReplaceLink(inDOMViewNode* aNewNode, inDOMViewNode* aOldNode);
    81   nsresult GetChildNodesFor(nsIDOMNode* aNode, nsCOMArray<nsIDOMNode>& aResult);
    82   nsresult AppendKidsToArray(nsIDOMNodeList* aKids, nsCOMArray<nsIDOMNode>& aArray);
    83   nsresult AppendAttrsToArray(nsIDOMMozNamedAttrMap* aKids, nsCOMArray<nsIDOMNode>& aArray);
    84   nsresult GetFirstDescendantOf(inDOMViewNode* aNode, int32_t aRow, int32_t* aResult);
    85   nsresult GetLastDescendantOf(inDOMViewNode* aNode, int32_t aRow, int32_t* aResult);
    86   nsresult GetRealPreviousSibling(nsIDOMNode* aNode, nsIDOMNode* aRealParent, nsIDOMNode** aSibling);
    87 };
    89 // {FB5C1775-1BBD-4b9c-ABB0-AE7ACD29E87E}
    90 #define IN_DOMVIEW_CID \
    91 { 0xfb5c1775, 0x1bbd, 0x4b9c, { 0xab, 0xb0, 0xae, 0x7a, 0xcd, 0x29, 0xe8, 0x7e } }
    93 #endif // __inDOMView_h__

mercurial