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