diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp index b40ab13cba4..6108701cb27 100644 --- a/mozilla/htmlparser/src/CNavDTD.cpp +++ b/mozilla/htmlparser/src/CNavDTD.cpp @@ -370,7 +370,7 @@ void CNavDTD::RecycleNode(nsCParserNode* aNode) { if(aNode) { CToken* theToken=0; - while(theToken=(CToken*)aNode->PopAttributeToken()){ + while(theToken=((CToken*)aNode->PopAttributeToken())){ gRecycler->RecycleToken(theToken); } @@ -402,7 +402,7 @@ CNavDTD::~CNavDTD(){ if(mTokenizer) delete (nsHTMLTokenizer*)mTokenizer; nsCParserNode* theNode=0; - while(theNode=(nsCParserNode*)mSharedNodes.Pop()){ + while(theNode=((nsCParserNode*)mSharedNodes.Pop())){ delete theNode; } NS_IF_RELEASE(mDTDDebug); @@ -815,6 +815,7 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){ * @param eHTMLTags tag to be searched for in stack * @return topmost index of tag on stack */ +#if 0 static PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsEntryStack& aTagStack) { int i=0; @@ -825,7 +826,7 @@ PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsEntryStack& aTagStack) { } return kNotFound; } - +#endif /** * Call this to find the index of a given child, or (if not found) diff --git a/mozilla/htmlparser/src/CRtfDTD.cpp b/mozilla/htmlparser/src/CRtfDTD.cpp index 316c997117f..70711243df7 100644 --- a/mozilla/htmlparser/src/CRtfDTD.cpp +++ b/mozilla/htmlparser/src/CRtfDTD.cpp @@ -111,6 +111,7 @@ static RTFEntry gRTFTable[] = { * @param * @return */ +#if 0 static const char* GetTagName(eRTFTags aTag) { PRInt32 cnt=sizeof(gRTFTable)/sizeof(RTFEntry); @@ -128,6 +129,7 @@ const char* GetTagName(eRTFTags aTag) { } return ""; } +#endif /** * This method gets called as part of our COM-like interfaces. diff --git a/mozilla/htmlparser/src/nsParserNode.cpp b/mozilla/htmlparser/src/nsParserNode.cpp index b1f859f5c9e..d823d5d1d52 100644 --- a/mozilla/htmlparser/src/nsParserNode.cpp +++ b/mozilla/htmlparser/src/nsParserNode.cpp @@ -55,7 +55,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber,nsITokenRecycler static void RecycleTokens(nsITokenRecycler* aRecycler,nsDeque& aDeque) { CToken* theToken=0; if(aRecycler) { - while(theToken=(CToken*)aDeque.Pop()){ + while(theToken=((CToken*)aDeque.Pop())){ aRecycler->RecycleToken(theToken); } } diff --git a/mozilla/htmlparser/src/nsViewSourceHTML.cpp b/mozilla/htmlparser/src/nsViewSourceHTML.cpp index 559ca2c87fd..6ecd072c9c4 100644 --- a/mozilla/htmlparser/src/nsViewSourceHTML.cpp +++ b/mozilla/htmlparser/src/nsViewSourceHTML.cpp @@ -194,6 +194,11 @@ static void SetFont(const char* aFace,const char* aSize,PRBool aEnable,nsIConten theNode.Init(theToken,0); aSink.CloseContainer(theNode); } + + while(theToken=((CToken*)theNode.PopAttributeToken())){ + //dump the attributes since they're on the stack... + } + if(theToken) gTokenRecycler->RecycleToken(theToken); } @@ -213,12 +218,17 @@ static void SetColor(const char* aColor,PRBool aEnable,nsIContentSink& aSink) { theNode.Init(theToken,0); aSink.CloseContainer(theNode); } + + while(theToken=((CToken*)theNode.PopAttributeToken())){ + //dump the attributes since they're on the stack... + } + if(theToken) gTokenRecycler->RecycleToken(theToken); } static void SetStyle(eHTMLTags theTag,PRBool aEnable,nsIContentSink& aSink) { - nsCParserNode theNode; + static nsCParserNode theNode; CToken* theToken=0; if(aEnable){ theToken=gTokenRecycler->CreateTokenOfType(eToken_start,theTag); @@ -230,6 +240,7 @@ static void SetStyle(eHTMLTags theTag,PRBool aEnable,nsIContentSink& aSink) { theNode.Init(theToken); aSink.CloseContainer(theNode); } + if(theToken) gTokenRecycler->RecycleToken(theToken); } @@ -340,9 +351,12 @@ NS_IMETHODIMP CViewSourceHTML::WillBuildModel(nsString& aFilename,PRBool aNotify //now let's automatically open the body... CStartToken theBodyToken(eHTMLTag_body); theNode.Init(&theBodyToken,0); + CAttributeToken theColor("bgcolor","white"); + theNode.AddAttribute(&theColor); + mSink->OpenBody(theNode); - //now let's automatically open the body... + //now let's automatically open the pre... if(mIsPlaintext) { CStartToken thePREToken(eHTMLTag_pre); theNode.Init(&thePREToken,0); @@ -897,7 +911,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { case eToken_instruction: { if(!mIsPlaintext){ - SetColor("orange",PR_TRUE,*mSink); + SetColor("#D74702",PR_TRUE,*mSink); SetStyle(eHTMLTag_i,PR_TRUE,*mSink); } @@ -964,6 +978,11 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { default: result=NS_OK; }//switch + + while(theContext.mTokenNode.PopAttributeToken()){ + //dump the attributes since they're on the stack... + } + return result; } diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index b40ab13cba4..6108701cb27 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -370,7 +370,7 @@ void CNavDTD::RecycleNode(nsCParserNode* aNode) { if(aNode) { CToken* theToken=0; - while(theToken=(CToken*)aNode->PopAttributeToken()){ + while(theToken=((CToken*)aNode->PopAttributeToken())){ gRecycler->RecycleToken(theToken); } @@ -402,7 +402,7 @@ CNavDTD::~CNavDTD(){ if(mTokenizer) delete (nsHTMLTokenizer*)mTokenizer; nsCParserNode* theNode=0; - while(theNode=(nsCParserNode*)mSharedNodes.Pop()){ + while(theNode=((nsCParserNode*)mSharedNodes.Pop())){ delete theNode; } NS_IF_RELEASE(mDTDDebug); @@ -815,6 +815,7 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){ * @param eHTMLTags tag to be searched for in stack * @return topmost index of tag on stack */ +#if 0 static PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsEntryStack& aTagStack) { int i=0; @@ -825,7 +826,7 @@ PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsEntryStack& aTagStack) { } return kNotFound; } - +#endif /** * Call this to find the index of a given child, or (if not found) diff --git a/mozilla/parser/htmlparser/src/CRtfDTD.cpp b/mozilla/parser/htmlparser/src/CRtfDTD.cpp index 316c997117f..70711243df7 100644 --- a/mozilla/parser/htmlparser/src/CRtfDTD.cpp +++ b/mozilla/parser/htmlparser/src/CRtfDTD.cpp @@ -111,6 +111,7 @@ static RTFEntry gRTFTable[] = { * @param * @return */ +#if 0 static const char* GetTagName(eRTFTags aTag) { PRInt32 cnt=sizeof(gRTFTable)/sizeof(RTFEntry); @@ -128,6 +129,7 @@ const char* GetTagName(eRTFTags aTag) { } return ""; } +#endif /** * This method gets called as part of our COM-like interfaces. diff --git a/mozilla/parser/htmlparser/src/nsParserNode.cpp b/mozilla/parser/htmlparser/src/nsParserNode.cpp index b1f859f5c9e..d823d5d1d52 100644 --- a/mozilla/parser/htmlparser/src/nsParserNode.cpp +++ b/mozilla/parser/htmlparser/src/nsParserNode.cpp @@ -55,7 +55,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber,nsITokenRecycler static void RecycleTokens(nsITokenRecycler* aRecycler,nsDeque& aDeque) { CToken* theToken=0; if(aRecycler) { - while(theToken=(CToken*)aDeque.Pop()){ + while(theToken=((CToken*)aDeque.Pop())){ aRecycler->RecycleToken(theToken); } } diff --git a/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp b/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp index 559ca2c87fd..6ecd072c9c4 100644 --- a/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp +++ b/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp @@ -194,6 +194,11 @@ static void SetFont(const char* aFace,const char* aSize,PRBool aEnable,nsIConten theNode.Init(theToken,0); aSink.CloseContainer(theNode); } + + while(theToken=((CToken*)theNode.PopAttributeToken())){ + //dump the attributes since they're on the stack... + } + if(theToken) gTokenRecycler->RecycleToken(theToken); } @@ -213,12 +218,17 @@ static void SetColor(const char* aColor,PRBool aEnable,nsIContentSink& aSink) { theNode.Init(theToken,0); aSink.CloseContainer(theNode); } + + while(theToken=((CToken*)theNode.PopAttributeToken())){ + //dump the attributes since they're on the stack... + } + if(theToken) gTokenRecycler->RecycleToken(theToken); } static void SetStyle(eHTMLTags theTag,PRBool aEnable,nsIContentSink& aSink) { - nsCParserNode theNode; + static nsCParserNode theNode; CToken* theToken=0; if(aEnable){ theToken=gTokenRecycler->CreateTokenOfType(eToken_start,theTag); @@ -230,6 +240,7 @@ static void SetStyle(eHTMLTags theTag,PRBool aEnable,nsIContentSink& aSink) { theNode.Init(theToken); aSink.CloseContainer(theNode); } + if(theToken) gTokenRecycler->RecycleToken(theToken); } @@ -340,9 +351,12 @@ NS_IMETHODIMP CViewSourceHTML::WillBuildModel(nsString& aFilename,PRBool aNotify //now let's automatically open the body... CStartToken theBodyToken(eHTMLTag_body); theNode.Init(&theBodyToken,0); + CAttributeToken theColor("bgcolor","white"); + theNode.AddAttribute(&theColor); + mSink->OpenBody(theNode); - //now let's automatically open the body... + //now let's automatically open the pre... if(mIsPlaintext) { CStartToken thePREToken(eHTMLTag_pre); theNode.Init(&thePREToken,0); @@ -897,7 +911,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { case eToken_instruction: { if(!mIsPlaintext){ - SetColor("orange",PR_TRUE,*mSink); + SetColor("#D74702",PR_TRUE,*mSink); SetStyle(eHTMLTag_i,PR_TRUE,*mSink); } @@ -964,6 +978,11 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { default: result=NS_OK; }//switch + + while(theContext.mTokenNode.PopAttributeToken()){ + //dump the attributes since they're on the stack... + } + return result; }