1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/inspector/inDOMView.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,95 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef __inDOMView_h__ 1.9 +#define __inDOMView_h__ 1.10 + 1.11 +#include "inIDOMView.h" 1.12 +#include "inIDOMUtils.h" 1.13 + 1.14 +#include "nsITreeView.h" 1.15 +#include "nsITreeSelection.h" 1.16 +#include "nsStubMutationObserver.h" 1.17 +#include "nsIDOMNode.h" 1.18 +#include "nsIDOMDocument.h" 1.19 +#include "nsTArray.h" 1.20 +#include "nsCOMArray.h" 1.21 +#include "nsCOMPtr.h" 1.22 + 1.23 +class inDOMViewNode; 1.24 +class nsIDOMMozNamedAttrMap; 1.25 + 1.26 +class inDOMView : public inIDOMView, 1.27 + public nsITreeView, 1.28 + public nsStubMutationObserver 1.29 +{ 1.30 +public: 1.31 + NS_DECL_ISUPPORTS 1.32 + NS_DECL_INIDOMVIEW 1.33 + NS_DECL_NSITREEVIEW 1.34 + 1.35 + inDOMView(); 1.36 + virtual ~inDOMView(); 1.37 + 1.38 + // nsIMutationObserver 1.39 + NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED 1.40 + NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED 1.41 + NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED 1.42 + NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED 1.43 + NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED 1.44 + 1.45 +protected: 1.46 + nsCOMPtr<nsITreeBoxObject> mTree; 1.47 + nsCOMPtr<nsITreeSelection> mSelection; 1.48 + nsCOMPtr<inIDOMUtils> mDOMUtils; 1.49 + 1.50 + bool mShowAnonymous; 1.51 + bool mShowSubDocuments; 1.52 + bool mShowWhitespaceNodes; 1.53 + bool mShowAccessibleNodes; 1.54 + uint32_t mWhatToShow; 1.55 + 1.56 + nsCOMPtr<nsIDOMNode> mRootNode; 1.57 + nsCOMPtr<nsIDOMDocument> mRootDocument; 1.58 + 1.59 + nsTArray<inDOMViewNode*> mNodes; 1.60 + 1.61 + inDOMViewNode* GetNodeAt(int32_t aIndex); 1.62 + int32_t GetRowCount(); 1.63 + int32_t NodeToRow(inDOMViewNode* aNode); 1.64 + bool RowOutOfBounds(int32_t aRow, int32_t aCount); 1.65 + inDOMViewNode* CreateNode(nsIDOMNode* aNode, inDOMViewNode* aParent); 1.66 + void AppendNode(inDOMViewNode* aNode); 1.67 + void InsertNode(inDOMViewNode* aNode, int32_t aIndex); 1.68 + void RemoveNode(int32_t aIndex); 1.69 + void ReplaceNode(inDOMViewNode* aNode, int32_t aIndex); 1.70 + void InsertNodes(nsTArray<inDOMViewNode*>& aNodes, int32_t aIndex); 1.71 + void RemoveNodes(int32_t aIndex, int32_t aCount); 1.72 + void RemoveAllNodes(); 1.73 + void ExpandNode(int32_t aRow); 1.74 + void CollapseNode(int32_t aRow); 1.75 + 1.76 + nsresult RowToNode(int32_t aRow, inDOMViewNode** aNode); 1.77 + nsresult NodeToRow(nsIDOMNode* aNode, int32_t* aRow); 1.78 + 1.79 + void InsertLinkAfter(inDOMViewNode* aNode, inDOMViewNode* aInsertAfter); 1.80 + void InsertLinkBefore(inDOMViewNode* aNode, inDOMViewNode* aInsertBefore); 1.81 + void RemoveLink(inDOMViewNode* aNode); 1.82 + void ReplaceLink(inDOMViewNode* aNewNode, inDOMViewNode* aOldNode); 1.83 + 1.84 + nsresult GetChildNodesFor(nsIDOMNode* aNode, nsCOMArray<nsIDOMNode>& aResult); 1.85 + nsresult AppendKidsToArray(nsIDOMNodeList* aKids, nsCOMArray<nsIDOMNode>& aArray); 1.86 + nsresult AppendAttrsToArray(nsIDOMMozNamedAttrMap* aKids, nsCOMArray<nsIDOMNode>& aArray); 1.87 + nsresult GetFirstDescendantOf(inDOMViewNode* aNode, int32_t aRow, int32_t* aResult); 1.88 + nsresult GetLastDescendantOf(inDOMViewNode* aNode, int32_t aRow, int32_t* aResult); 1.89 + nsresult GetRealPreviousSibling(nsIDOMNode* aNode, nsIDOMNode* aRealParent, nsIDOMNode** aSibling); 1.90 +}; 1.91 + 1.92 +// {FB5C1775-1BBD-4b9c-ABB0-AE7ACD29E87E} 1.93 +#define IN_DOMVIEW_CID \ 1.94 +{ 0xfb5c1775, 0x1bbd, 0x4b9c, { 0xab, 0xb0, 0xae, 0x7a, 0xcd, 0x29, 0xe8, 0x7e } } 1.95 + 1.96 +#endif // __inDOMView_h__ 1.97 + 1.98 +