зеркало из https://github.com/mozilla/pjs.git
moved skipped content token from the attribute list to it's own slot
This commit is contained in:
Родитель
001fef4967
Коммит
fa5ee1eb1c
|
@ -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(mAttributeCount<PRInt32(sizeof(mAttributes)-1), "Buffer overrun!");
|
||||
NS_PRECONDITION(0!=aToken, "Error: Token shouldn't be null!");
|
||||
if(aToken) {
|
||||
mAttributes[mAttributeCount++]=aToken;
|
||||
NS_ASSERTION(eToken_skippedcontent == aToken->GetTokenType(), "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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(mAttributeCount<PRInt32(sizeof(mAttributes)-1), "Buffer overrun!");
|
||||
NS_PRECONDITION(0!=aToken, "Error: Token shouldn't be null!");
|
||||
if(aToken) {
|
||||
mAttributes[mAttributeCount++]=aToken;
|
||||
NS_ASSERTION(eToken_skippedcontent == aToken->GetTokenType(), "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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче