Bug 177179

slightly optimize inDOMView::GetNodeTypeKey
r=timeless/jkeiser sr=bzbarsky a=roc+moz


git-svn-id: svn://10.0.0.236/trunk@197671 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
caillon%returnzero.com 2006-05-17 02:37:33 +00:00
parent 3a94a4d91e
commit f5488aba0a
2 changed files with 9 additions and 15 deletions

View File

@ -265,8 +265,7 @@ inDOMView::AddFilterByType(PRUint16 aType, PRBool aExclusive)
NS_IMETHODIMP
inDOMView::RemoveFilterByType(PRUint16 aType)
{
PRUint16 key = GetNodeTypeKey(aType);
mFilters -= key;
mFilters &= ~(GetNodeTypeKey(aType));
return NS_OK;
}
@ -1265,13 +1264,3 @@ inDOMView::AppendAttrsToArray(nsIDOMNamedNodeMap* aKids, nsISupportsArray* aArra
}
return NS_OK;
}
PRUint16
inDOMView::GetNodeTypeKey(PRUint16 aType)
{
PRUint16 key = 1;
for (PRUint32 i = 0; i < aType; ++i)
key = key * 2;
return key;
}

View File

@ -134,8 +134,8 @@ protected:
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeSelection> mSelection;
PRBool mShowAnonymous;
PRBool mShowSubDocuments;
PRPackedBool mShowAnonymous;
PRPackedBool mShowSubDocuments;
PRUint32 mFilters;
nsCOMPtr<nsIDOMNode> mRootNode;
@ -165,7 +165,12 @@ protected:
void RemoveLink(inDOMViewNode* aNode);
void ReplaceLink(inDOMViewNode* aNewNode, inDOMViewNode* aOldNode);
PRUint16 GetNodeTypeKey(PRUint16 aType);
inline PRUint16 GetNodeTypeKey(PRUint16 aType)
{
NS_ASSERTION(aType < 16, "You doofus");
return 1 << aType;
};
nsresult GetChildNodesFor(nsIDOMNode* aNode, nsISupportsArray **aResult);
nsresult AppendKidsToArray(nsIDOMNodeList* aKids, nsISupportsArray* aArray);
nsresult AppendAttrsToArray(nsIDOMNamedNodeMap* aKids, nsISupportsArray* aArray);