From f8aedd9a4c4e0c55725da0e2edaef2be0d204adc Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Tue, 22 Sep 1998 02:07:31 +0000 Subject: [PATCH] moved skipped content token from the attribute list to it's own slot git-svn-id: svn://10.0.0.236/trunk@10654 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/nsParserNode.cpp | 17 +++++------------ mozilla/htmlparser/src/nsParserNode.h | 1 + mozilla/parser/htmlparser/src/nsParserNode.cpp | 17 +++++------------ mozilla/parser/htmlparser/src/nsParserNode.h | 1 + 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/mozilla/htmlparser/src/nsParserNode.cpp b/mozilla/htmlparser/src/nsParserNode.cpp index 190d80ee89b..d4bbcc4069e 100644 --- a/mozilla/htmlparser/src/nsParserNode.cpp +++ b/mozilla/htmlparser/src/nsParserNode.cpp @@ -41,6 +41,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber): nsIParserNode( mLineNumber=aLineNumber; mToken=aToken; memset(mAttributes,0,sizeof(mAttributes)); + mSkippedContent=nsnull; } @@ -129,18 +130,15 @@ void nsCParserNode::AddAttribute(CToken* aToken) { /** * This method gets called when the parser encounters * skipped content after a start token. - * NOTE: To determine if we have skipped content, simply - * check mAttributes[mAttributeCount]. * * @update gess 3/26/98 * @param aToken -- really a skippedcontent token * @return nada */ void nsCParserNode::SetSkippedContent(CToken* aToken){ - NS_PRECONDITION(mAttributeCountGetTokenType(), "not a skipped content token"); + mSkippedContent = aToken; } } @@ -179,13 +177,8 @@ const nsString& nsCParserNode::GetText() const { * @return string ref of text from internal token */ const nsString& nsCParserNode::GetSkippedContent() const { - if (0 < mAttributeCount) { - if(mAttributes[mAttributeCount-1]) { - CSkippedContentToken* sc=(CSkippedContentToken*)(mAttributes[mAttributeCount-1]); - if(sc) { - return sc->GetKey(); - } - } + if (nsnull != mSkippedContent) { + return ((CSkippedContentToken*)mSkippedContent)->GetKey(); } return mEmptyString; } diff --git a/mozilla/htmlparser/src/nsParserNode.h b/mozilla/htmlparser/src/nsParserNode.h index 73ad33482dc..5da39d67a3e 100644 --- a/mozilla/htmlparser/src/nsParserNode.h +++ b/mozilla/htmlparser/src/nsParserNode.h @@ -168,6 +168,7 @@ class nsCParserNode : public nsIParserNode { PRInt32 mLineNumber; CToken* mToken; CToken* mAttributes[eMaxAttr]; // XXX Ack! This needs to be dynamic! + CToken* mSkippedContent; // nsAutoString mName; static const nsAutoString mEmptyString; diff --git a/mozilla/parser/htmlparser/src/nsParserNode.cpp b/mozilla/parser/htmlparser/src/nsParserNode.cpp index 190d80ee89b..d4bbcc4069e 100644 --- a/mozilla/parser/htmlparser/src/nsParserNode.cpp +++ b/mozilla/parser/htmlparser/src/nsParserNode.cpp @@ -41,6 +41,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber): nsIParserNode( mLineNumber=aLineNumber; mToken=aToken; memset(mAttributes,0,sizeof(mAttributes)); + mSkippedContent=nsnull; } @@ -129,18 +130,15 @@ void nsCParserNode::AddAttribute(CToken* aToken) { /** * This method gets called when the parser encounters * skipped content after a start token. - * NOTE: To determine if we have skipped content, simply - * check mAttributes[mAttributeCount]. * * @update gess 3/26/98 * @param aToken -- really a skippedcontent token * @return nada */ void nsCParserNode::SetSkippedContent(CToken* aToken){ - NS_PRECONDITION(mAttributeCountGetTokenType(), "not a skipped content token"); + mSkippedContent = aToken; } } @@ -179,13 +177,8 @@ const nsString& nsCParserNode::GetText() const { * @return string ref of text from internal token */ const nsString& nsCParserNode::GetSkippedContent() const { - if (0 < mAttributeCount) { - if(mAttributes[mAttributeCount-1]) { - CSkippedContentToken* sc=(CSkippedContentToken*)(mAttributes[mAttributeCount-1]); - if(sc) { - return sc->GetKey(); - } - } + if (nsnull != mSkippedContent) { + return ((CSkippedContentToken*)mSkippedContent)->GetKey(); } return mEmptyString; } diff --git a/mozilla/parser/htmlparser/src/nsParserNode.h b/mozilla/parser/htmlparser/src/nsParserNode.h index 73ad33482dc..5da39d67a3e 100644 --- a/mozilla/parser/htmlparser/src/nsParserNode.h +++ b/mozilla/parser/htmlparser/src/nsParserNode.h @@ -168,6 +168,7 @@ class nsCParserNode : public nsIParserNode { PRInt32 mLineNumber; CToken* mToken; CToken* mAttributes[eMaxAttr]; // XXX Ack! This needs to be dynamic! + CToken* mSkippedContent; // nsAutoString mName; static const nsAutoString mEmptyString;