mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 12:35:58 +00:00
fixed nsBeta2+ bugs: 42180, 42270; added env setting for view-errors, which is disabled by default. r=pollmann; a=pdt
This commit is contained in:
parent
bfa99a9a48
commit
8fea867053
@ -24,7 +24,7 @@
|
||||
//#define RICKG_DEBUG
|
||||
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsIDTDDebug.h"
|
||||
#include "COtherDTD.h"
|
||||
#include "nsHTMLTokens.h"
|
||||
@ -663,7 +663,7 @@ nsresult COtherDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This gets called after we've handled a given start tag.
|
||||
* It's a generic hook to let us to post processing.
|
||||
@ -842,7 +842,7 @@ nsresult COtherDTD::HandleStartToken(CToken* aToken) {
|
||||
theTagWasHandled=PR_TRUE;
|
||||
}
|
||||
break;
|
||||
}//switch
|
||||
}//switch
|
||||
|
||||
if(theTagWasHandled) {
|
||||
DidHandleStartTag(*theNode,theChildTag);
|
||||
|
@ -1320,7 +1320,8 @@ public:
|
||||
|
||||
CScriptElement() : CTextContainer(eHTMLTag_script) {
|
||||
mGroup.mBits.mHeadMisc=1;
|
||||
mGroup.mBits.mBlock=1;
|
||||
mGroup.mBits.mInlineEntity=1;
|
||||
mGroup.mBits.mSpecial=1;
|
||||
mProperties.mIsSinkContainer=PR_FALSE;
|
||||
}
|
||||
|
||||
@ -1362,27 +1363,14 @@ public:
|
||||
/**********************************************************
|
||||
This defines the preformatted element group, (PRE).
|
||||
**********************************************************/
|
||||
class CPreformattedElement: public CTextContainer {
|
||||
class CPreformattedElement: public CInlineElement {
|
||||
public:
|
||||
|
||||
static CGroupMembers& GetGroup(void) {
|
||||
static CGroupMembers theGroup={0};
|
||||
theGroup.mBits.mPreformatted=1;
|
||||
theGroup.mBits.mBlock=1;
|
||||
return theGroup;
|
||||
}
|
||||
|
||||
static CGroupMembers& GetContainedGroups(void) {
|
||||
static CGroupMembers theGroups={0};
|
||||
theGroups.mBits.mPreformatted=1;
|
||||
return theGroups;
|
||||
}
|
||||
|
||||
static void Initialize(CElement& anElement,eHTMLTags aTag){
|
||||
CElement::Initialize(anElement,aTag,GetGroup(),GetContainedGroups());
|
||||
CInlineElement::Initialize(anElement,aTag);
|
||||
}
|
||||
|
||||
CPreformattedElement(eHTMLTags aTag) : CTextContainer(aTag) {
|
||||
CPreformattedElement(eHTMLTags aTag) : CInlineElement(aTag) {
|
||||
mGroup=GetGroup();
|
||||
mContainsGroups=GetContainedGroups();
|
||||
mProperties.mIsContainer=1;
|
||||
@ -1392,69 +1380,16 @@ public:
|
||||
Pre handles the opening of it's own children
|
||||
**********************************************************/
|
||||
virtual nsresult HandleStartToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
nsresult result=NS_OK;
|
||||
|
||||
switch(aTag) {
|
||||
case eHTMLTag_newline:
|
||||
mText.Append(kNewLine);
|
||||
break;
|
||||
|
||||
case eHTMLTag_whitespace:
|
||||
case eHTMLTag_text:
|
||||
mText.Append(aNode->GetText());
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
nsCParserNode *theNode=(nsCParserNode*)aNode;
|
||||
theNode->mToken->GetSource(mText);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
nsresult result=CElement::HandleStartToken(aNode,aTag,aContext,aSink);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
Call this for each element as it get's closed
|
||||
**********************************************************/
|
||||
virtual nsresult NotifyClose(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
nsresult result=NS_OK;
|
||||
if(aNode) {
|
||||
|
||||
CTextToken theToken(mText);
|
||||
PRInt32 theLineNumber=0;
|
||||
nsCParserNode theNode(&theToken,theLineNumber);
|
||||
result=aSink->AddLeaf(theNode);
|
||||
}
|
||||
mText.Truncate(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
Pre handles the closing of it's own children
|
||||
**********************************************************/
|
||||
virtual nsresult HandleEndToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
nsresult result=NS_OK;
|
||||
|
||||
switch(aTag) {
|
||||
case eHTMLTag_newline:
|
||||
mText.Append(kNewLine);
|
||||
break;
|
||||
|
||||
case eHTMLTag_whitespace:
|
||||
case eHTMLTag_text:
|
||||
mText.Append(aNode->GetText());
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
nsCParserNode *theNode=(nsCParserNode*)aNode;
|
||||
theNode->mToken->GetSource(mText);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
nsresult result=CElement::HandleEndToken(aNode,aTag,aContext,aSink);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,6 @@
|
||||
*/
|
||||
|
||||
|
||||
//#define ENABLE_ERROR_OUTPUT //debug only for now...
|
||||
|
||||
|
||||
#ifdef RAPTOR_PERF_METRICS
|
||||
# define START_TIMER() \
|
||||
if(mParser) mParser->mParseTime.Start(PR_FALSE); \
|
||||
@ -202,7 +199,6 @@ public:
|
||||
nsCParserNode mTextNode;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*
|
||||
@ -233,6 +229,10 @@ CViewSourceHTML::CViewSourceHTML() : mTags(), mErrors() {
|
||||
mDocType=eHTML3Text;
|
||||
mValidator=0;
|
||||
|
||||
//set this to 1 if you want to see errors in your HTML markup.
|
||||
char* theEnvString = PR_GetEnv("MOZ_VALIDATE_HTML");
|
||||
mShowErrors=PRBool(theEnvString);
|
||||
|
||||
#ifdef rickgdebug
|
||||
gDumpFile = new fstream("c:/temp/viewsource.xml",ios::trunc);
|
||||
#endif
|
||||
@ -911,27 +911,26 @@ nsresult CViewSourceHTML::WriteTagWithError(nsString &theXMLTagName,CToken* aTok
|
||||
|
||||
void CViewSourceHTML::AddContainmentError(eHTMLTags aChildTag,eHTMLTags aParentTag,PRInt32 aLineNumber) {
|
||||
|
||||
#ifdef ENABLE_ERROR_OUTPUT
|
||||
if (mShowErrors) {
|
||||
mErrorCount++;
|
||||
|
||||
mErrorCount++;
|
||||
if(mErrorCount<=gErrorThreshold) {
|
||||
|
||||
if(mErrorCount<=gErrorThreshold) {
|
||||
char theChildMsg[100];
|
||||
if(eHTMLTag_text==aChildTag)
|
||||
strcpy(theChildMsg,"text");
|
||||
else sprintf(theChildMsg,"<%s>",nsHTMLTags::GetCStringValue(aChildTag));
|
||||
|
||||
char theChildMsg[100];
|
||||
if(eHTMLTag_text==aChildTag)
|
||||
strcpy(theChildMsg,"text");
|
||||
else sprintf(theChildMsg,"<%s>",nsHTMLTags::GetCStringValue(aChildTag));
|
||||
char theMsg[256];
|
||||
sprintf(theMsg,"\n -- Line (%i) error: %s is not a legal child of <%s>",
|
||||
aLineNumber,theChildMsg,nsHTMLTags::GetCStringValue(aParentTag));
|
||||
|
||||
char theMsg[256];
|
||||
sprintf(theMsg,"\n -- Line (%i) error: %s is not a legal child of <%s>",
|
||||
aLineNumber,theChildMsg,nsHTMLTags::GetCStringValue(aParentTag));
|
||||
|
||||
mErrors.AppendWithConversion(theMsg);
|
||||
mErrors.AppendWithConversion(theMsg);
|
||||
}
|
||||
else if(gErrorThreshold+1==mErrorCount){
|
||||
mErrors.AppendWithConversion("\n -- Too many errors -- terminating output.");
|
||||
}
|
||||
}
|
||||
else if(gErrorThreshold+1==mErrorCount){
|
||||
mErrors.AppendWithConversion("\n -- Too many errors -- terminating output.");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -961,25 +960,24 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
{
|
||||
mTagCount++;
|
||||
|
||||
#ifdef ENABLE_ERROR_OUTPUT
|
||||
PRBool theChildIsValid=PR_TRUE;
|
||||
if(mValidator) {
|
||||
theChildIsValid=mValidator->CanContain(theParent,theChild);
|
||||
if(theChildIsValid) {
|
||||
if(mValidator->IsContainer(theChild))
|
||||
mTags.Append(PRUnichar(theChild));
|
||||
if(mShowErrors) {
|
||||
PRBool theChildIsValid=PR_TRUE;
|
||||
if(mValidator) {
|
||||
theChildIsValid=mValidator->CanContain(theParent,theChild);
|
||||
if(theChildIsValid) {
|
||||
if(mValidator->IsContainer(theChild))
|
||||
mTags.Append(PRUnichar(theChild));
|
||||
}
|
||||
}
|
||||
|
||||
if(theChildIsValid)
|
||||
result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
else {
|
||||
AddContainmentError(theChild,theParent,mLineNumber);
|
||||
result=WriteTagWithError(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if(theChildIsValid)
|
||||
result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
else {
|
||||
AddContainmentError(theChild,theParent,mLineNumber);
|
||||
result=WriteTagWithError(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
}
|
||||
#else
|
||||
result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
#endif
|
||||
else result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
|
||||
if((ePlainText!=mDocType) && mParser && (NS_OK==result)) {
|
||||
CObserverService* theService=mParser->GetObserverService();
|
||||
@ -1029,16 +1027,15 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
|
||||
case eToken_text:
|
||||
|
||||
#ifdef ENABLE_ERROR_OUTPUT
|
||||
if((0==mValidator) || mValidator->CanContain(theParent,eHTMLTag_text))
|
||||
result=WriteTag(mText,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
else {
|
||||
AddContainmentError(eHTMLTag_text,theParent,mLineNumber);
|
||||
result=WriteTagWithError(mText,aToken,aToken->GetAttributeCount(),PR_FALSE);
|
||||
if(mShowErrors) {
|
||||
if((0==mValidator) || mValidator->CanContain(theParent,eHTMLTag_text))
|
||||
result=WriteTag(mText,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
else {
|
||||
AddContainmentError(eHTMLTag_text,theParent,mLineNumber);
|
||||
result=WriteTagWithError(mText,aToken,aToken->GetAttributeCount(),PR_FALSE);
|
||||
}
|
||||
}
|
||||
#else
|
||||
result=WriteTag(mText,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
#endif
|
||||
else result=WriteTag(mText,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
break;
|
||||
|
||||
case eToken_entity:
|
||||
|
@ -278,6 +278,7 @@ protected:
|
||||
nsIDTD *mValidator;
|
||||
nsString mTags;
|
||||
nsString mErrors;
|
||||
PRBool mShowErrors;
|
||||
};
|
||||
|
||||
extern NS_HTMLPARS nsresult NS_NewViewSourceHTML(nsIDTD** aInstancePtrResult);
|
||||
|
@ -24,7 +24,7 @@
|
||||
//#define RICKG_DEBUG
|
||||
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsIDTDDebug.h"
|
||||
#include "COtherDTD.h"
|
||||
#include "nsHTMLTokens.h"
|
||||
@ -663,7 +663,7 @@ nsresult COtherDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This gets called after we've handled a given start tag.
|
||||
* It's a generic hook to let us to post processing.
|
||||
@ -842,7 +842,7 @@ nsresult COtherDTD::HandleStartToken(CToken* aToken) {
|
||||
theTagWasHandled=PR_TRUE;
|
||||
}
|
||||
break;
|
||||
}//switch
|
||||
}//switch
|
||||
|
||||
if(theTagWasHandled) {
|
||||
DidHandleStartTag(*theNode,theChildTag);
|
||||
|
@ -1320,7 +1320,8 @@ public:
|
||||
|
||||
CScriptElement() : CTextContainer(eHTMLTag_script) {
|
||||
mGroup.mBits.mHeadMisc=1;
|
||||
mGroup.mBits.mBlock=1;
|
||||
mGroup.mBits.mInlineEntity=1;
|
||||
mGroup.mBits.mSpecial=1;
|
||||
mProperties.mIsSinkContainer=PR_FALSE;
|
||||
}
|
||||
|
||||
@ -1362,27 +1363,14 @@ public:
|
||||
/**********************************************************
|
||||
This defines the preformatted element group, (PRE).
|
||||
**********************************************************/
|
||||
class CPreformattedElement: public CTextContainer {
|
||||
class CPreformattedElement: public CInlineElement {
|
||||
public:
|
||||
|
||||
static CGroupMembers& GetGroup(void) {
|
||||
static CGroupMembers theGroup={0};
|
||||
theGroup.mBits.mPreformatted=1;
|
||||
theGroup.mBits.mBlock=1;
|
||||
return theGroup;
|
||||
}
|
||||
|
||||
static CGroupMembers& GetContainedGroups(void) {
|
||||
static CGroupMembers theGroups={0};
|
||||
theGroups.mBits.mPreformatted=1;
|
||||
return theGroups;
|
||||
}
|
||||
|
||||
static void Initialize(CElement& anElement,eHTMLTags aTag){
|
||||
CElement::Initialize(anElement,aTag,GetGroup(),GetContainedGroups());
|
||||
CInlineElement::Initialize(anElement,aTag);
|
||||
}
|
||||
|
||||
CPreformattedElement(eHTMLTags aTag) : CTextContainer(aTag) {
|
||||
CPreformattedElement(eHTMLTags aTag) : CInlineElement(aTag) {
|
||||
mGroup=GetGroup();
|
||||
mContainsGroups=GetContainedGroups();
|
||||
mProperties.mIsContainer=1;
|
||||
@ -1392,69 +1380,16 @@ public:
|
||||
Pre handles the opening of it's own children
|
||||
**********************************************************/
|
||||
virtual nsresult HandleStartToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
nsresult result=NS_OK;
|
||||
|
||||
switch(aTag) {
|
||||
case eHTMLTag_newline:
|
||||
mText.Append(kNewLine);
|
||||
break;
|
||||
|
||||
case eHTMLTag_whitespace:
|
||||
case eHTMLTag_text:
|
||||
mText.Append(aNode->GetText());
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
nsCParserNode *theNode=(nsCParserNode*)aNode;
|
||||
theNode->mToken->GetSource(mText);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
nsresult result=CElement::HandleStartToken(aNode,aTag,aContext,aSink);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
Call this for each element as it get's closed
|
||||
**********************************************************/
|
||||
virtual nsresult NotifyClose(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
nsresult result=NS_OK;
|
||||
if(aNode) {
|
||||
|
||||
CTextToken theToken(mText);
|
||||
PRInt32 theLineNumber=0;
|
||||
nsCParserNode theNode(&theToken,theLineNumber);
|
||||
result=aSink->AddLeaf(theNode);
|
||||
}
|
||||
mText.Truncate(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
Pre handles the closing of it's own children
|
||||
**********************************************************/
|
||||
virtual nsresult HandleEndToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
nsresult result=NS_OK;
|
||||
|
||||
switch(aTag) {
|
||||
case eHTMLTag_newline:
|
||||
mText.Append(kNewLine);
|
||||
break;
|
||||
|
||||
case eHTMLTag_whitespace:
|
||||
case eHTMLTag_text:
|
||||
mText.Append(aNode->GetText());
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
nsCParserNode *theNode=(nsCParserNode*)aNode;
|
||||
theNode->mToken->GetSource(mText);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
nsresult result=CElement::HandleEndToken(aNode,aTag,aContext,aSink);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,6 @@
|
||||
*/
|
||||
|
||||
|
||||
//#define ENABLE_ERROR_OUTPUT //debug only for now...
|
||||
|
||||
|
||||
#ifdef RAPTOR_PERF_METRICS
|
||||
# define START_TIMER() \
|
||||
if(mParser) mParser->mParseTime.Start(PR_FALSE); \
|
||||
@ -202,7 +199,6 @@ public:
|
||||
nsCParserNode mTextNode;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*
|
||||
@ -233,6 +229,10 @@ CViewSourceHTML::CViewSourceHTML() : mTags(), mErrors() {
|
||||
mDocType=eHTML3Text;
|
||||
mValidator=0;
|
||||
|
||||
//set this to 1 if you want to see errors in your HTML markup.
|
||||
char* theEnvString = PR_GetEnv("MOZ_VALIDATE_HTML");
|
||||
mShowErrors=PRBool(theEnvString);
|
||||
|
||||
#ifdef rickgdebug
|
||||
gDumpFile = new fstream("c:/temp/viewsource.xml",ios::trunc);
|
||||
#endif
|
||||
@ -911,27 +911,26 @@ nsresult CViewSourceHTML::WriteTagWithError(nsString &theXMLTagName,CToken* aTok
|
||||
|
||||
void CViewSourceHTML::AddContainmentError(eHTMLTags aChildTag,eHTMLTags aParentTag,PRInt32 aLineNumber) {
|
||||
|
||||
#ifdef ENABLE_ERROR_OUTPUT
|
||||
if (mShowErrors) {
|
||||
mErrorCount++;
|
||||
|
||||
mErrorCount++;
|
||||
if(mErrorCount<=gErrorThreshold) {
|
||||
|
||||
if(mErrorCount<=gErrorThreshold) {
|
||||
char theChildMsg[100];
|
||||
if(eHTMLTag_text==aChildTag)
|
||||
strcpy(theChildMsg,"text");
|
||||
else sprintf(theChildMsg,"<%s>",nsHTMLTags::GetCStringValue(aChildTag));
|
||||
|
||||
char theChildMsg[100];
|
||||
if(eHTMLTag_text==aChildTag)
|
||||
strcpy(theChildMsg,"text");
|
||||
else sprintf(theChildMsg,"<%s>",nsHTMLTags::GetCStringValue(aChildTag));
|
||||
char theMsg[256];
|
||||
sprintf(theMsg,"\n -- Line (%i) error: %s is not a legal child of <%s>",
|
||||
aLineNumber,theChildMsg,nsHTMLTags::GetCStringValue(aParentTag));
|
||||
|
||||
char theMsg[256];
|
||||
sprintf(theMsg,"\n -- Line (%i) error: %s is not a legal child of <%s>",
|
||||
aLineNumber,theChildMsg,nsHTMLTags::GetCStringValue(aParentTag));
|
||||
|
||||
mErrors.AppendWithConversion(theMsg);
|
||||
mErrors.AppendWithConversion(theMsg);
|
||||
}
|
||||
else if(gErrorThreshold+1==mErrorCount){
|
||||
mErrors.AppendWithConversion("\n -- Too many errors -- terminating output.");
|
||||
}
|
||||
}
|
||||
else if(gErrorThreshold+1==mErrorCount){
|
||||
mErrors.AppendWithConversion("\n -- Too many errors -- terminating output.");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -961,25 +960,24 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
{
|
||||
mTagCount++;
|
||||
|
||||
#ifdef ENABLE_ERROR_OUTPUT
|
||||
PRBool theChildIsValid=PR_TRUE;
|
||||
if(mValidator) {
|
||||
theChildIsValid=mValidator->CanContain(theParent,theChild);
|
||||
if(theChildIsValid) {
|
||||
if(mValidator->IsContainer(theChild))
|
||||
mTags.Append(PRUnichar(theChild));
|
||||
if(mShowErrors) {
|
||||
PRBool theChildIsValid=PR_TRUE;
|
||||
if(mValidator) {
|
||||
theChildIsValid=mValidator->CanContain(theParent,theChild);
|
||||
if(theChildIsValid) {
|
||||
if(mValidator->IsContainer(theChild))
|
||||
mTags.Append(PRUnichar(theChild));
|
||||
}
|
||||
}
|
||||
|
||||
if(theChildIsValid)
|
||||
result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
else {
|
||||
AddContainmentError(theChild,theParent,mLineNumber);
|
||||
result=WriteTagWithError(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if(theChildIsValid)
|
||||
result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
else {
|
||||
AddContainmentError(theChild,theParent,mLineNumber);
|
||||
result=WriteTagWithError(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
}
|
||||
#else
|
||||
result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
#endif
|
||||
else result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
|
||||
if((ePlainText!=mDocType) && mParser && (NS_OK==result)) {
|
||||
CObserverService* theService=mParser->GetObserverService();
|
||||
@ -1029,16 +1027,15 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
|
||||
case eToken_text:
|
||||
|
||||
#ifdef ENABLE_ERROR_OUTPUT
|
||||
if((0==mValidator) || mValidator->CanContain(theParent,eHTMLTag_text))
|
||||
result=WriteTag(mText,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
else {
|
||||
AddContainmentError(eHTMLTag_text,theParent,mLineNumber);
|
||||
result=WriteTagWithError(mText,aToken,aToken->GetAttributeCount(),PR_FALSE);
|
||||
if(mShowErrors) {
|
||||
if((0==mValidator) || mValidator->CanContain(theParent,eHTMLTag_text))
|
||||
result=WriteTag(mText,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
else {
|
||||
AddContainmentError(eHTMLTag_text,theParent,mLineNumber);
|
||||
result=WriteTagWithError(mText,aToken,aToken->GetAttributeCount(),PR_FALSE);
|
||||
}
|
||||
}
|
||||
#else
|
||||
result=WriteTag(mText,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
#endif
|
||||
else result=WriteTag(mText,aToken,aToken->GetAttributeCount(),PR_TRUE);
|
||||
break;
|
||||
|
||||
case eToken_entity:
|
||||
|
@ -278,6 +278,7 @@ protected:
|
||||
nsIDTD *mValidator;
|
||||
nsString mTags;
|
||||
nsString mErrors;
|
||||
PRBool mShowErrors;
|
||||
};
|
||||
|
||||
extern NS_HTMLPARS nsresult NS_NewViewSourceHTML(nsIDTD** aInstancePtrResult);
|
||||
|
Loading…
x
Reference in New Issue
Block a user