Implemented idea from shaver for speeding up SelectorMatches().

We wait until we know we are going to need the contentTag before
we create it.
r=shaver


git-svn-id: svn://10.0.0.236/trunk@59021 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jim_nance%yahoo.com
2000-01-28 04:37:13 +00:00
parent ec1db35b63
commit 370762744f
3 changed files with 30 additions and 9 deletions

View File

@@ -2294,7 +2294,8 @@ static PRBool SelectorMatches(nsIPresContext* aPresContext,
PRBool aTestState)
{
PRBool result = PR_FALSE;
nsIAtom* contentTag;
PRBool tagset = PR_FALSE;
nsIAtom* contentTag = NULL; // Make sure this is NULL for NS_IF_RELEASE
// Bail out early if we can
if(kNameSpaceID_Unknown != aSelector->mNameSpace) {
@@ -2305,9 +2306,11 @@ static PRBool SelectorMatches(nsIPresContext* aPresContext,
}
}
aContent->GetTag(contentTag);
if (((nsnull == aSelector->mTag) || (
aContent->GetTag(contentTag),
tagset=PR_TRUE,
aSelector->mTag == contentTag))) {
if (((nsnull == aSelector->mTag) || (aSelector->mTag == contentTag))) {
result = PR_TRUE;
// namespace/tag match
if (nsnull != aSelector->mAttrList) { // test for attribute match
@@ -2482,6 +2485,10 @@ static PRBool SelectorMatches(nsIPresContext* aPresContext,
}
else if (IsLinkPseudo(pseudoClass->mAtom)) {
// XXX xml link too
if(!tagset) {
tagset=PR_TRUE;
aContent->GetTag(contentTag);
}
if (nsHTMLAtoms::a == contentTag) {
if (aTestState) {
if (! linkHandler) {