From 97c63bcd7744d426ea89fe9382dd7d05caed3ecd Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Wed, 8 Mar 2000 06:18:18 +0000 Subject: [PATCH] fixed PDT+ bugs 30929 and 29749; r=harishd, pollman; a=jar --- htmlparser/src/CNavDTD.cpp | 3 ++- htmlparser/src/nsDTDUtils.cpp | 4 ++-- htmlparser/src/nsHTMLTokens.cpp | 6 ++---- parser/htmlparser/src/CNavDTD.cpp | 3 ++- parser/htmlparser/src/nsDTDUtils.cpp | 4 ++-- parser/htmlparser/src/nsHTMLTokens.cpp | 6 ++---- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp index 5ca7ec6e9a68..04d7793e084f 100644 --- a/htmlparser/src/CNavDTD.cpp +++ b/htmlparser/src/CNavDTD.cpp @@ -3110,7 +3110,8 @@ nsresult CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTarget, PRBool aC } } else if(1==theNode->mUseCount) { - theNode->mUseCount--; //cause it to get popped from style stack. + //this fixes bug 30885 and 29626 + mBodyContext->PopStyle(theTag); } mBodyContext->PushStyles(theChildStyleStack); } diff --git a/htmlparser/src/nsDTDUtils.cpp b/htmlparser/src/nsDTDUtils.cpp index 579bcac569f4..5a9074460f4d 100644 --- a/htmlparser/src/nsDTDUtils.cpp +++ b/htmlparser/src/nsDTDUtils.cpp @@ -597,8 +597,8 @@ nsIParserNode* nsDTDContext::PopStyle(eHTMLTags aTag){ nsEntryStack *theStack=mStack.mEntries[theLevel].mStyles; if(theStack) { if(aTag==theStack->Last()) { - return theStack->Pop(); mResidualStyleCount--; + return theStack->Pop(); } else { // NS_ERROR("bad residual style entry"); } @@ -624,8 +624,8 @@ nsIParserNode* nsDTDContext::RemoveStyle(eHTMLTags aTag){ nsEntryStack *theStack=mStack.mEntries[theLevel].mStyles; if(theStack) { if(aTag==theStack->Last()) { - return theStack->Pop(); mResidualStyleCount--; + return theStack->Pop(); } else { // NS_ERROR("bad residual style entry"); } diff --git a/htmlparser/src/nsHTMLTokens.cpp b/htmlparser/src/nsHTMLTokens.cpp index 6088ae9b02b7..de3e4a67f121 100644 --- a/htmlparser/src/nsHTMLTokens.cpp +++ b/htmlparser/src/nsHTMLTokens.cpp @@ -1611,7 +1611,6 @@ static PRUint16 PA_HackTable[] = { */ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) { PRInt32 value=0; - PRInt32 theRadix[2]={16,10}; if(mTextValue.Length()>1) { PRUnichar theChar0=mTextValue.CharAt(0); @@ -1619,9 +1618,8 @@ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) { if(kHashsign==theChar0) { PRInt32 err=0; - PRUnichar theChar1=mTextValue.CharAt(1); - PRBool isDigit1=nsString::IsDigit(theChar1); - value=mTextValue.ToInteger(&err,theRadix[isDigit1]); + value=mTextValue.ToInteger(&err,kAutoDetect); + if(0==err) { #ifdef PA_REMAP_128_TO_160_ILLEGAL_NCR /* for some illegal, but popular usage */ diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp index 5ca7ec6e9a68..04d7793e084f 100644 --- a/parser/htmlparser/src/CNavDTD.cpp +++ b/parser/htmlparser/src/CNavDTD.cpp @@ -3110,7 +3110,8 @@ nsresult CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTarget, PRBool aC } } else if(1==theNode->mUseCount) { - theNode->mUseCount--; //cause it to get popped from style stack. + //this fixes bug 30885 and 29626 + mBodyContext->PopStyle(theTag); } mBodyContext->PushStyles(theChildStyleStack); } diff --git a/parser/htmlparser/src/nsDTDUtils.cpp b/parser/htmlparser/src/nsDTDUtils.cpp index 579bcac569f4..5a9074460f4d 100644 --- a/parser/htmlparser/src/nsDTDUtils.cpp +++ b/parser/htmlparser/src/nsDTDUtils.cpp @@ -597,8 +597,8 @@ nsIParserNode* nsDTDContext::PopStyle(eHTMLTags aTag){ nsEntryStack *theStack=mStack.mEntries[theLevel].mStyles; if(theStack) { if(aTag==theStack->Last()) { - return theStack->Pop(); mResidualStyleCount--; + return theStack->Pop(); } else { // NS_ERROR("bad residual style entry"); } @@ -624,8 +624,8 @@ nsIParserNode* nsDTDContext::RemoveStyle(eHTMLTags aTag){ nsEntryStack *theStack=mStack.mEntries[theLevel].mStyles; if(theStack) { if(aTag==theStack->Last()) { - return theStack->Pop(); mResidualStyleCount--; + return theStack->Pop(); } else { // NS_ERROR("bad residual style entry"); } diff --git a/parser/htmlparser/src/nsHTMLTokens.cpp b/parser/htmlparser/src/nsHTMLTokens.cpp index 6088ae9b02b7..de3e4a67f121 100644 --- a/parser/htmlparser/src/nsHTMLTokens.cpp +++ b/parser/htmlparser/src/nsHTMLTokens.cpp @@ -1611,7 +1611,6 @@ static PRUint16 PA_HackTable[] = { */ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) { PRInt32 value=0; - PRInt32 theRadix[2]={16,10}; if(mTextValue.Length()>1) { PRUnichar theChar0=mTextValue.CharAt(0); @@ -1619,9 +1618,8 @@ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) { if(kHashsign==theChar0) { PRInt32 err=0; - PRUnichar theChar1=mTextValue.CharAt(1); - PRBool isDigit1=nsString::IsDigit(theChar1); - value=mTextValue.ToInteger(&err,theRadix[isDigit1]); + value=mTextValue.ToInteger(&err,kAutoDetect); + if(0==err) { #ifdef PA_REMAP_128_TO_160_ILLEGAL_NCR /* for some illegal, but popular usage */