diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 07a8e032ea0..90bb40378bf 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -1393,6 +1393,7 @@ nsDocument::UpdateStyleSheets(nsISupportsArray* aOldSheets, nsISupportsArray* aN } } + // XXXldb Hopefully the observer doesn't care which sheet you use. for (PRInt32 indx = 0; indx < mObservers.Count(); indx++) { nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers.ElementAt(indx); observer->StyleSheetRemoved(this, sheet); @@ -3471,41 +3472,6 @@ nsDocument::RemoveReference(void *aKey, nsISupports **aOldReference) return NS_OK; } -NS_IMETHODIMP -nsDocument::GetDTD(nsIDTD** aDTD) const -{ - if (!aDTD) - return NS_ERROR_INVALID_ARG; - if (!mDTD) - { - nsCOMPtr doctype; - // Wish for mutable: - nsresult rv = NS_CONST_CAST(nsDocument* , this)->GetDoctype(getter_AddRefs(doctype)); - if (NS_FAILED(rv)) return rv; - if (!doctype) return NS_ERROR_FAILURE; - nsAutoString doctypename; - rv = doctype->GetName(doctypename); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr parser( do_CreateInstance(kCParserCID, &rv) ); - if (NS_FAILED(rv)) return rv; - if (!parser) return NS_ERROR_FAILURE; - - nsIDTD* dtd = 0; - rv = parser->CreateCompatibleDTD(&dtd, &doctypename, eViewNormal, - 0, eDTDMode_unknown); - if (NS_FAILED(rv)) return rv; - if (!dtd) return NS_ERROR_FAILURE; - - // Wish again for mutable: - NS_CONST_CAST(nsDocument* , this)->mDTD = dtd; - } - - NS_ADDREF(mDTD); - *aDTD = mDTD; - return NS_OK; -} - #ifdef IBMBIDI /** * Check if bidi enabled (set depending on the presence of RTL diff --git a/mozilla/content/base/src/nsDocument.h b/mozilla/content/base/src/nsDocument.h index 11fb6174a65..c0765afe3a2 100644 --- a/mozilla/content/base/src/nsDocument.h +++ b/mozilla/content/base/src/nsDocument.h @@ -558,8 +558,6 @@ public: virtual nsresult Init(); protected: - NS_IMETHOD GetDTD(nsIDTD** aDTD) const; - // subclass hooks for sheet ordering virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags); diff --git a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp index ab0e42fa805..ddb54f9a0c3 100644 --- a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -118,11 +118,6 @@ #include "nsIPref.h" const PRUnichar nbsp = 160; -// HACK - CID for NS_CTRANSITIONAL_DTD_CID so that we can get at transitional dtd -#define NS_CTRANSITIONAL_DTD_CID \ -{ 0x4611d482, 0x960a, 0x11d4, { 0x8e, 0xb0, 0xb6, 0x17, 0x66, 0x1b, 0x6f, 0x7c } } - - static NS_DEFINE_CID(kCRangeCID, NS_RANGE_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 7b3c12f72f6..eadde95ba25 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -129,11 +129,7 @@ #include "TextEditorTest.h" #include "nsEditorUtils.h" #include "nsIPref.h" - -// HACK - CID for NS_CTRANSITIONAL_DTD_CID so that we can get at transitional dtd -#define NS_CTRANSITIONAL_DTD_CID \ -{ 0x4611d482, 0x960a, 0x11d4, { 0x8e, 0xb0, 0xb6, 0x17, 0x66, 0x1b, 0x6f, 0x7c } } - +#include "nsParserCIID.h" static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID); static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID); diff --git a/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp b/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp index 317ed717c5a..abc27d10d23 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp @@ -112,11 +112,6 @@ #include "nsIPref.h" const PRUnichar nbsp = 160; -// HACK - CID for NS_CTRANSITIONAL_DTD_CID so that we can get at transitional dtd -#define NS_CTRANSITIONAL_DTD_CID \ -{ 0x4611d482, 0x960a, 0x11d4, { 0x8e, 0xb0, 0xb6, 0x17, 0x66, 0x1b, 0x6f, 0x7c } } - - static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID); static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID); static NS_DEFINE_IID(kSubtreeIteratorCID, NS_SUBTREEITERATOR_CID); diff --git a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp index b2a9f034e88..725ff47c332 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp @@ -112,11 +112,6 @@ const PRUnichar nbsp = 160; -// HACK - CID for NS_CTRANSITIONAL_DTD_CID so that we can get at transitional dtd -#define NS_CTRANSITIONAL_DTD_CID \ -{ 0x4611d482, 0x960a, 0x11d4, { 0x8e, 0xb0, 0xb6, 0x17, 0x66, 0x1b, 0x6f, 0x7c } } - - static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID); static NS_DEFINE_CID(kCRangeCID, NS_RANGE_CID); static NS_DEFINE_CID(kCDOMSelectionCID, NS_DOMSELECTION_CID); diff --git a/mozilla/htmlparser/public/nsIParser.h b/mozilla/htmlparser/public/nsIParser.h index 134f805c425..11463911505 100644 --- a/mozilla/htmlparser/public/nsIParser.h +++ b/mozilla/htmlparser/public/nsIParser.h @@ -259,24 +259,6 @@ class nsIParser : public nsISupports { */ virtual nsDTDMode GetParseMode(void)=0; - /** - * Call this method to determine a DTD for a DOCTYPE - * - * @update harishd 05/01/00 - * @param aDTD -- Carries the deduced ( from DOCTYPE ) DTD. - * @param aDocTypeStr -- A doctype for which a DTD is to be selected. - * @param aMimeType -- A mimetype for which a DTD is to be selected. - Note: aParseMode might be required. - * @param aCommand -- A command for which a DTD is to be selected. - * @param aParseMode -- Used with aMimeType to choose the correct DTD. - * @return NS_OK if succeeded else ERROR. - */ - NS_IMETHOD CreateCompatibleDTD(nsIDTD** aDTD, - nsString* aDocTypeStr, - eParserCommands aCommand, - const nsString* aMimeType=nsnull, - nsDTDMode aDTDMode=eDTDMode_unknown)=0; - /** * Call this method to cancel any pending parsing events. * Parsing events may be pending if all of the document's content diff --git a/mozilla/htmlparser/public/nsParserCIID.h b/mozilla/htmlparser/public/nsParserCIID.h index a546dfa8f54..a2201769973 100644 --- a/mozilla/htmlparser/public/nsParserCIID.h +++ b/mozilla/htmlparser/public/nsParserCIID.h @@ -61,14 +61,6 @@ #define NS_LOGGING_SINK_CID \ {0xa6cf9060, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} -// {a6cf910e-15b3-11d2-932e-00805f8add32} -#define NS_XIF_DTD_CID \ -{ 0xa6cf910e, 0x15b3, 0x11d2, { 0x93, 0x2e, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } - -// {CCF5BED0-1AF8-11d4-812B-0010A4E0C706} -#define NS_COTHER_DTD_CID \ -{ 0xccf5bed0, 0x1af8, 0x11d4, { 0x81, 0x2b, 0x0, 0x10, 0xa4, 0xe0, 0xc7, 0x6 } } - // {4611d482-960a-11d4-8eb0-b617661b6f7c} #define NS_CTRANSITIONAL_DTD_CID \ { 0x4611d482, 0x960a, 0x11d4, { 0x8e, 0xb0, 0xb6, 0x17, 0x66, 0x1b, 0x6f, 0x7c } } diff --git a/mozilla/htmlparser/src/CParserContext.cpp b/mozilla/htmlparser/src/CParserContext.cpp index 040cb06db77..5c098e53e81 100644 --- a/mozilla/htmlparser/src/CParserContext.cpp +++ b/mozilla/htmlparser/src/CParserContext.cpp @@ -78,7 +78,6 @@ CParserContext::CParserContext(nsScanner* aScanner, mCopyUnused=aCopyUnused; mParserCommand=aCommand; mRequest=0; - mValidator=0; } /** diff --git a/mozilla/htmlparser/src/CParserContext.h b/mozilla/htmlparser/src/CParserContext.h index 862bc6788fa..ff96f192977 100644 --- a/mozilla/htmlparser/src/CParserContext.h +++ b/mozilla/htmlparser/src/CParserContext.h @@ -82,7 +82,6 @@ public: nsCOMPtr mRequest; // provided by necko to differnciate different input streams // why is mRequest strongly referenced? see bug 102376. nsIDTD* mDTD; - nsIDTD* mValidator; nsIRequestObserver* mListener; char* mTransferBuffer; void* mKey; diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp index 686cd9c071a..45f977eedb0 100644 --- a/mozilla/htmlparser/src/nsParser.cpp +++ b/mozilla/htmlparser/src/nsParser.cpp @@ -80,7 +80,6 @@ static NS_DEFINE_IID(kIParserIID, NS_IPARSER_IID); static NS_DEFINE_IID(kExpatDriverCID, NS_EXPAT_DRIVER_CID); static NS_DEFINE_CID(kNavDTDCID, NS_CNAVDTD_CID); -static NS_DEFINE_CID(kCOtherDTDCID, NS_COTHER_DTD_CID); static NS_DEFINE_CID(kViewSourceDTDCID, NS_VIEWSOURCE_DTD_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); @@ -122,21 +121,13 @@ public: CSharedParserObjects() :mDTDDeque(0), mHasViewSourceDTD(PR_FALSE), - mHasXMLDTD(PR_FALSE), - mOtherDTD(nsnull) + mHasXMLDTD(PR_FALSE) { //Note: To cut down on startup time/overhead, we defer the construction of non-html DTD's. nsIDTD* theDTD; - const char* theStrictDTDEnabled=PR_GetEnv("ENABLE_STRICT"); //always false (except rickg's machine) - - if(theStrictDTDEnabled) { - NS_NewOtherHTMLDTD(&mOtherDTD); //do this as the default DTD for strict documents... - mDTDDeque.Push(mOtherDTD); - } - NS_NewNavHTMLDTD(&theDTD); //do this as a default HTML DTD... // please handle allocation failure @@ -169,7 +160,6 @@ public: nsDeque mDTDDeque; PRBool mHasViewSourceDTD; //this allows us to defer construction of this object. PRBool mHasXMLDTD; //also defer XML dtd construction - nsIDTD *mOtherDTD; //it's ok to leak this; the deque contains a copy too. }; @@ -1134,7 +1124,6 @@ PRBool FindSuitableDTD( CParserContext& aParserContext,nsString& aBuffer) { return PR_TRUE; CSharedParserObjects& gSharedObjects=GetSharedObjects(); - aParserContext.mValidator=gSharedObjects.mOtherDTD; aParserContext.mAutoDetectStatus=eUnknownDetect; PRInt32 theDTDIndex=0; @@ -1175,141 +1164,12 @@ PRBool FindSuitableDTD( CParserContext& aParserContext,nsString& aBuffer) { } if(theBestDTD) { - -//#define FORCE_HTML_THROUGH_STRICT_DTD -#if FORCE_HTML_THROUGH_STRICT_DTD - if(theBestDTD==gSharedObjects.mDTDDeque.ObjectAt(0)) - theBestDTD=(nsIDTD*)gSharedObjects.mDTDDeque.ObjectAt(1); -#endif - theBestDTD->CreateNewInstance(&aParserContext.mDTD); return PR_TRUE; } return PR_FALSE; } -/** - * Call this method to determine a DTD for a DOCTYPE - * - * @update harishd 05/01/00 - * @param aDTD -- Carries the deduced ( from DOCTYPE ) DTD. - * @param aDocTypeStr -- A doctype for which a DTD is to be selected. - * @param aMimeType -- A mimetype for which a DTD is to be selected. - * Note: aParseMode might be required. - * @param aCommand -- A command for which a DTD is to be selected. - * @param aParseMode -- Used with aMimeType to choose the correct DTD. - * @return NS_OK if succeeded else ERROR. - */ -NS_IMETHODIMP nsParser::CreateCompatibleDTD(nsIDTD** aDTD, - nsString* aDocTypeStr, - eParserCommands aCommand, - const nsString* aMimeType, - nsDTDMode aDTDMode) -{ - nsresult result=NS_OK; - const nsCID* theDTDClassID=0; - - /** - * If the command is eViewNormal then we choose the DTD from - * either the DOCTYPE or form the MIMETYPE. DOCTYPE is given - * precedence over MIMETYPE. The passsed in DTD mode takes - * precedence over the DTD mode figured out from the DOCTYPE string. - * Ex. Assume the following: - * aDocTypeStr= - * aCommand=eViewNormal - * aMimeType=text/html - * aDTDMode=eDTDMode_strict - * The above example would invoke DetermineParseMode(). This would figure out - * a DTD mode ( eDTDMode_quirks ) and the doctype (eHTML4Text). Based on this - * info. NavDTD would be chosen. However, since the passed in mode (aDTDMode) requests - * for a strict the COtherDTD ( strict mode ) would get chosen rather than NavDTD. - * That is, aDTDMode overrides theDTDMode ( configured by the DOCTYPE ).The mime type - * will be taken into consideration only if a DOCTYPE string is not available. - * - * Usage ( a sample ): - * - * nsCOMPtr theDTD; - * nsAutoString theMimeType; - * nsAutoString theDocType; - * - * theDocType.Assign(NS_LITERAL_STRING("")); - * theMimeType.Assign(NS_LITERAL_STRING("text/html")); - * - * result=CreateCompatibleDTD(getter_AddRefs(theDTD),&theDocType,eViewNormal,&theMimeType,eDTDMode_quirks); - * - */ - - if(aCommand==eViewNormal) { - if(aDocTypeStr) { - nsDTDMode theDTDMode=eDTDMode_unknown; - eParserDocType theDocType=ePlainText; - - if(!aMimeType) { - nsAutoString temp; - DetermineParseMode(*aDocTypeStr,theDTDMode,theDocType,temp); - } - else DetermineParseMode(*aDocTypeStr,theDTDMode,theDocType,*aMimeType); - - NS_ASSERTION(aDTDMode==eDTDMode_unknown || aDTDMode==theDTDMode,"aDTDMode overrides the mode selected from the DOCTYPE "); - - if(aDTDMode!=eDTDMode_unknown) theDTDMode=aDTDMode; // aDTDMode takes precedence over theDTDMode - - switch(theDocType) { - case eHTML_Strict: - NS_ASSERTION(theDTDMode==eDTDMode_strict, "wrong mode"); - theDTDClassID=&kCOtherDTDCID; - break; - case eHTML3_Quirks: - case eHTML_Quirks: - theDTDClassID=&kNavDTDCID; - break; - case eXML: - theDTDClassID=&kExpatDriverCID; - break; - default: - theDTDClassID=&kNavDTDCID; - break; - } - } - else if(aMimeType) { - - NS_ASSERTION(aDTDMode!=eDTDMode_unknown,"DTD selection might require a parsemode"); - - if(aMimeType->EqualsWithConversion(kHTMLTextContentType)) { - if(aDTDMode==eDTDMode_strict) { - theDTDClassID=&kCOtherDTDCID; - } - else { - theDTDClassID=&kNavDTDCID; - } - } - else if(aMimeType->EqualsWithConversion(kPlainTextContentType)) { - theDTDClassID=&kNavDTDCID; - } - else if(aMimeType->EqualsWithConversion(kXMLTextContentType) || - aMimeType->EqualsWithConversion(kXMLApplicationContentType) || - aMimeType->EqualsWithConversion(kXHTMLApplicationContentType) || - aMimeType->EqualsWithConversion(kXULTextContentType) || - aMimeType->EqualsWithConversion(kRDFTextContentType)) { - theDTDClassID=&kExpatDriverCID; - } - else { - theDTDClassID=&kNavDTDCID; - } - } - } - else { - if(aCommand==eViewSource) { - theDTDClassID=&kViewSourceDTDCID; - } - } - - result=(theDTDClassID)? nsComponentManager::CreateInstance(*theDTDClassID, nsnull, NS_GET_IID(nsIDTD),(void**)aDTD):NS_OK; - - return result; - -} - NS_IMETHODIMP nsParser::CancelParsingEvents() { if (mFlags & NS_PARSER_FLAG_PENDING_CONTINUE_EVENT) { diff --git a/mozilla/htmlparser/src/nsParser.h b/mozilla/htmlparser/src/nsParser.h index 3b012577cd8..77440c1ffb3 100644 --- a/mozilla/htmlparser/src/nsParser.h +++ b/mozilla/htmlparser/src/nsParser.h @@ -315,24 +315,6 @@ class nsParser : public nsIParser, */ NS_IMETHOD GetDTD(nsIDTD** aDTD); - /** - * Call this method to determine a DTD for a DOCTYPE - * - * @update harishd 05/01/00 - * @param aDTD -- Carries the deduced ( from DOCTYPE ) DTD. - * @param aDocTypeStr -- A doctype for which a DTD is to be selected. - * @param aMimeType -- A mimetype for which a DTD is to be selected. - Note: aParseMode might be required. - * @param aCommand -- A command for which a DTD is to be selected. - * @param aParseMode -- Used with aMimeType to choose the correct DTD. - * @return NS_OK if succeeded else ERROR. - */ - NS_IMETHOD CreateCompatibleDTD(nsIDTD** aDTD, - nsString* aDocTypeStr, - eParserCommands aCommand, - const nsString* aMimeType=nsnull, - nsDTDMode aDTDMode=eDTDMode_unknown); - /** * Detects the existence of a META tag with charset information in * the given buffer. diff --git a/mozilla/htmlparser/src/nsParserModule.cpp b/mozilla/htmlparser/src/nsParserModule.cpp index 83f7cecbb6d..e1376e9ed13 100644 --- a/mozilla/htmlparser/src/nsParserModule.cpp +++ b/mozilla/htmlparser/src/nsParserModule.cpp @@ -46,7 +46,6 @@ #include "nsParser.h" #include "CNavDTD.h" #include "COtherDTD.h" -#include "COtherDTD.h" #include "nsViewSourceHTML.h" #include "nsHTMLEntities.h" #include "nsHTMLTokenizer.h" @@ -68,7 +67,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver) NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser) NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD) -NS_GENERIC_FACTORY_CONSTRUCTOR(COtherDTD) NS_GENERIC_FACTORY_CONSTRUCTOR(CTransitionalDTD) NS_GENERIC_FACTORY_CONSTRUCTOR(CViewSourceHTML) NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService) @@ -82,13 +80,11 @@ static const nsModuleComponentInfo gComponents[] = { { "Parser", NS_PARSER_CID, NULL, nsParserConstructor }, { "Navigator HTML DTD", NS_CNAVDTD_CID, NULL, CNavDTDConstructor }, - { "OTHER DTD", NS_COTHER_DTD_CID, NULL, COtherDTDConstructor }, { "Transitional DTD", NS_CTRANSITIONAL_DTD_CID, NULL, CTransitionalDTDConstructor }, { "ViewSource DTD", NS_VIEWSOURCE_DTD_CID, NULL, CViewSourceHTMLConstructor }, { "ParserService", NS_PARSERSERVICE_CID, NULL, nsParserServiceConstructor } }; -#define NUM_COMPONENTS (sizeof(gComponents) / sizeof(gComponents[0])) static PRBool gInitialized = PR_FALSE; diff --git a/mozilla/htmlparser/src/nsViewSourceHTML.cpp b/mozilla/htmlparser/src/nsViewSourceHTML.cpp index 6fdb29d3e56..30f58f3fe28 100644 --- a/mozilla/htmlparser/src/nsViewSourceHTML.cpp +++ b/mozilla/htmlparser/src/nsViewSourceHTML.cpp @@ -358,14 +358,9 @@ CViewSourceHTML::CViewSourceHTML() : mFilename(), mTags(), mErrors() { mLineNumber=0; mTokenizer=0; mDocType=eHTML3_Quirks; // why? - mValidator=0; mHasOpenRoot=PR_FALSE; mHasOpenBody=PR_FALSE; - //set this to 1 if you want to see errors in your HTML markup. - char* theEnvString = PR_GetEnv("MOZ_VALIDATE_HTML"); - mShowErrors=PRBool(theEnvString != nsnull); - mTokenCount=0; #ifdef DUMP_TO_FILE @@ -477,7 +472,6 @@ nsresult CViewSourceHTML::WillBuildModel( const CParserContext& aParserContext, mTags.Truncate(); mErrors.Assign(NS_LITERAL_STRING(" HTML 4.0 Strict-DTD validation (enabled); [Should use Transitional?].\n")); - mValidator=aParserContext.mValidator; mDocType=aParserContext.mDocType; mMimeType=aParserContext.mMimeType; mDTDMode=aParserContext.mDTDMode; @@ -1024,67 +1018,6 @@ nsresult CViewSourceHTML::WriteTag(PRInt32 aTagType,const nsAReadableString & aT return result; } -/** - * This method gets called when a tag needs to be sent out but is known to be misplaced (error) - * - * @update gess 6June2000 -- - * @param - * @return result status - */ -nsresult CViewSourceHTML::WriteTagWithError(PRInt32 aTagType,const nsAReadableString& aStr,PRInt32 attrCount,PRBool aNewlineRequired) { - - STOP_TIMER(); - - CSharedVSContext& theContext=CSharedVSContext::GetSharedContext(); - nsresult result=NS_OK; - - if(ePlainText!=mDocType) { - //first write the error tag itself... - theContext.mErrorNode.Init(&theContext.mErrorToken,mLineNumber,0/*stack token*/); - result=mSink->OpenContainer(theContext.mErrorNode); //emit ... - } - - //now write the tag from the source file... - result=WriteTag(aTagType,aStr,attrCount,aNewlineRequired); - - if(ePlainText!=mDocType) { - //now close the error tag... - STOP_TIMER(); - theContext.mErrorNode.Init(&theContext.mErrorToken,0,0/*stack token*/); - mSink->CloseContainer(theContext.mErrorNode); - START_TIMER(); - } - - return result; -} - -void CViewSourceHTML::AddContainmentError(eHTMLTags aChildTag,eHTMLTags aParentTag,PRInt32 aLineNumber) { - - if (mShowErrors) { - mErrorCount++; - - if(mErrorCount<=gErrorThreshold) { - - char theChildMsg[100]; - if(eHTMLTag_text==aChildTag) - strcpy(theChildMsg,"text"); - else sprintf(theChildMsg,"<%s>", - NS_ConvertUCS2toUTF8(nsHTMLTags::GetStringValue(aChildTag)).get()); - - char theMsg[256]; - sprintf(theMsg,"\n -- Line (%i) error: %s is not a legal child of <%s>", - aLineNumber, theChildMsg, - NS_ConvertUCS2toUTF8(nsHTMLTags::GetStringValue(aParentTag)).get()); - - mErrors.AppendWithConversion(theMsg); - } - else if(gErrorThreshold+1==mErrorCount){ - mErrors.Append(NS_LITERAL_STRING("\n -- Too many errors -- terminating output.")); - } - } - -} - /** * * @update gess 3/25/98 @@ -1112,24 +1045,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { mTagCount++; const nsAReadableString& startValue = aToken->GetStringValue(); - 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,startValue,aToken->GetAttributeCount(),PR_TRUE); - else { - AddContainmentError(theChild,theParent,mLineNumber); - result=WriteTagWithError(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE); - } - } - else result=WriteTag(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE); + result=WriteTag(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE); if((ePlainText!=mDocType) && mParser && (NS_OK==result)) { result = mSink->NotifyTagObservers(&theContext.mTokenNode); @@ -1213,26 +1129,14 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { case eToken_text: { - if(mShowErrors) { - const nsAReadableString& str = aToken->GetStringValue(); - if((0==mValidator) || - mValidator->CanContain(theParent,eHTMLTag_text)) - result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE); - else { - AddContainmentError(eHTMLTag_text,theParent,mLineNumber); - result=WriteTagWithError(mText,str,aToken->GetAttributeCount(),PR_FALSE); - } - } - else { - const nsAReadableString& str = aToken->GetStringValue(); - result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE); - mTokenCount++; - if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && - mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !str.IsEmpty()) { - PRUnichar ch = str.Last(); - if (ch == kLF || ch == kCR) - StartNewPreBlock(); - } + const nsAReadableString& str = aToken->GetStringValue(); + result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE); + mTokenCount++; + if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && + mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !str.IsEmpty()) { + PRUnichar ch = str.Last(); + if (ch == kLF || ch == kCR) + StartNewPreBlock(); } } diff --git a/mozilla/htmlparser/src/nsViewSourceHTML.h b/mozilla/htmlparser/src/nsViewSourceHTML.h index 69cefccf0ac..35af6d8af9e 100644 --- a/mozilla/htmlparser/src/nsViewSourceHTML.h +++ b/mozilla/htmlparser/src/nsViewSourceHTML.h @@ -73,15 +73,6 @@ private: PRInt32 attrCount, PRBool aNewlineRequired); - nsresult WriteTagWithError(PRInt32 tagType, - const nsAReadableString& aToken, - PRInt32 attrCount, - PRBool aNewlineRequired); - - void AddContainmentError(eHTMLTags aChild, - eHTMLTags aParent, - PRInt32 aLineNumber); - nsresult WriteAttributes(PRInt32 attrCount); nsresult GenerateSummary(); void StartNewPreBlock(void); @@ -116,11 +107,9 @@ protected: PRInt32 mErrorCount; PRInt32 mTagCount; - nsIDTD *mValidator; nsString mFilename; nsString mTags; nsString mErrors; - PRPackedBool mShowErrors; PRPackedBool mHasOpenRoot; PRPackedBool mHasOpenBody; diff --git a/mozilla/parser/htmlparser/public/nsIParser.h b/mozilla/parser/htmlparser/public/nsIParser.h index 134f805c425..11463911505 100644 --- a/mozilla/parser/htmlparser/public/nsIParser.h +++ b/mozilla/parser/htmlparser/public/nsIParser.h @@ -259,24 +259,6 @@ class nsIParser : public nsISupports { */ virtual nsDTDMode GetParseMode(void)=0; - /** - * Call this method to determine a DTD for a DOCTYPE - * - * @update harishd 05/01/00 - * @param aDTD -- Carries the deduced ( from DOCTYPE ) DTD. - * @param aDocTypeStr -- A doctype for which a DTD is to be selected. - * @param aMimeType -- A mimetype for which a DTD is to be selected. - Note: aParseMode might be required. - * @param aCommand -- A command for which a DTD is to be selected. - * @param aParseMode -- Used with aMimeType to choose the correct DTD. - * @return NS_OK if succeeded else ERROR. - */ - NS_IMETHOD CreateCompatibleDTD(nsIDTD** aDTD, - nsString* aDocTypeStr, - eParserCommands aCommand, - const nsString* aMimeType=nsnull, - nsDTDMode aDTDMode=eDTDMode_unknown)=0; - /** * Call this method to cancel any pending parsing events. * Parsing events may be pending if all of the document's content diff --git a/mozilla/parser/htmlparser/public/nsParserCIID.h b/mozilla/parser/htmlparser/public/nsParserCIID.h index a546dfa8f54..a2201769973 100644 --- a/mozilla/parser/htmlparser/public/nsParserCIID.h +++ b/mozilla/parser/htmlparser/public/nsParserCIID.h @@ -61,14 +61,6 @@ #define NS_LOGGING_SINK_CID \ {0xa6cf9060, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} -// {a6cf910e-15b3-11d2-932e-00805f8add32} -#define NS_XIF_DTD_CID \ -{ 0xa6cf910e, 0x15b3, 0x11d2, { 0x93, 0x2e, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } - -// {CCF5BED0-1AF8-11d4-812B-0010A4E0C706} -#define NS_COTHER_DTD_CID \ -{ 0xccf5bed0, 0x1af8, 0x11d4, { 0x81, 0x2b, 0x0, 0x10, 0xa4, 0xe0, 0xc7, 0x6 } } - // {4611d482-960a-11d4-8eb0-b617661b6f7c} #define NS_CTRANSITIONAL_DTD_CID \ { 0x4611d482, 0x960a, 0x11d4, { 0x8e, 0xb0, 0xb6, 0x17, 0x66, 0x1b, 0x6f, 0x7c } } diff --git a/mozilla/parser/htmlparser/src/CParserContext.cpp b/mozilla/parser/htmlparser/src/CParserContext.cpp index 040cb06db77..5c098e53e81 100644 --- a/mozilla/parser/htmlparser/src/CParserContext.cpp +++ b/mozilla/parser/htmlparser/src/CParserContext.cpp @@ -78,7 +78,6 @@ CParserContext::CParserContext(nsScanner* aScanner, mCopyUnused=aCopyUnused; mParserCommand=aCommand; mRequest=0; - mValidator=0; } /** diff --git a/mozilla/parser/htmlparser/src/CParserContext.h b/mozilla/parser/htmlparser/src/CParserContext.h index 862bc6788fa..ff96f192977 100644 --- a/mozilla/parser/htmlparser/src/CParserContext.h +++ b/mozilla/parser/htmlparser/src/CParserContext.h @@ -82,7 +82,6 @@ public: nsCOMPtr mRequest; // provided by necko to differnciate different input streams // why is mRequest strongly referenced? see bug 102376. nsIDTD* mDTD; - nsIDTD* mValidator; nsIRequestObserver* mListener; char* mTransferBuffer; void* mKey; diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp index 686cd9c071a..45f977eedb0 100644 --- a/mozilla/parser/htmlparser/src/nsParser.cpp +++ b/mozilla/parser/htmlparser/src/nsParser.cpp @@ -80,7 +80,6 @@ static NS_DEFINE_IID(kIParserIID, NS_IPARSER_IID); static NS_DEFINE_IID(kExpatDriverCID, NS_EXPAT_DRIVER_CID); static NS_DEFINE_CID(kNavDTDCID, NS_CNAVDTD_CID); -static NS_DEFINE_CID(kCOtherDTDCID, NS_COTHER_DTD_CID); static NS_DEFINE_CID(kViewSourceDTDCID, NS_VIEWSOURCE_DTD_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); @@ -122,21 +121,13 @@ public: CSharedParserObjects() :mDTDDeque(0), mHasViewSourceDTD(PR_FALSE), - mHasXMLDTD(PR_FALSE), - mOtherDTD(nsnull) + mHasXMLDTD(PR_FALSE) { //Note: To cut down on startup time/overhead, we defer the construction of non-html DTD's. nsIDTD* theDTD; - const char* theStrictDTDEnabled=PR_GetEnv("ENABLE_STRICT"); //always false (except rickg's machine) - - if(theStrictDTDEnabled) { - NS_NewOtherHTMLDTD(&mOtherDTD); //do this as the default DTD for strict documents... - mDTDDeque.Push(mOtherDTD); - } - NS_NewNavHTMLDTD(&theDTD); //do this as a default HTML DTD... // please handle allocation failure @@ -169,7 +160,6 @@ public: nsDeque mDTDDeque; PRBool mHasViewSourceDTD; //this allows us to defer construction of this object. PRBool mHasXMLDTD; //also defer XML dtd construction - nsIDTD *mOtherDTD; //it's ok to leak this; the deque contains a copy too. }; @@ -1134,7 +1124,6 @@ PRBool FindSuitableDTD( CParserContext& aParserContext,nsString& aBuffer) { return PR_TRUE; CSharedParserObjects& gSharedObjects=GetSharedObjects(); - aParserContext.mValidator=gSharedObjects.mOtherDTD; aParserContext.mAutoDetectStatus=eUnknownDetect; PRInt32 theDTDIndex=0; @@ -1175,141 +1164,12 @@ PRBool FindSuitableDTD( CParserContext& aParserContext,nsString& aBuffer) { } if(theBestDTD) { - -//#define FORCE_HTML_THROUGH_STRICT_DTD -#if FORCE_HTML_THROUGH_STRICT_DTD - if(theBestDTD==gSharedObjects.mDTDDeque.ObjectAt(0)) - theBestDTD=(nsIDTD*)gSharedObjects.mDTDDeque.ObjectAt(1); -#endif - theBestDTD->CreateNewInstance(&aParserContext.mDTD); return PR_TRUE; } return PR_FALSE; } -/** - * Call this method to determine a DTD for a DOCTYPE - * - * @update harishd 05/01/00 - * @param aDTD -- Carries the deduced ( from DOCTYPE ) DTD. - * @param aDocTypeStr -- A doctype for which a DTD is to be selected. - * @param aMimeType -- A mimetype for which a DTD is to be selected. - * Note: aParseMode might be required. - * @param aCommand -- A command for which a DTD is to be selected. - * @param aParseMode -- Used with aMimeType to choose the correct DTD. - * @return NS_OK if succeeded else ERROR. - */ -NS_IMETHODIMP nsParser::CreateCompatibleDTD(nsIDTD** aDTD, - nsString* aDocTypeStr, - eParserCommands aCommand, - const nsString* aMimeType, - nsDTDMode aDTDMode) -{ - nsresult result=NS_OK; - const nsCID* theDTDClassID=0; - - /** - * If the command is eViewNormal then we choose the DTD from - * either the DOCTYPE or form the MIMETYPE. DOCTYPE is given - * precedence over MIMETYPE. The passsed in DTD mode takes - * precedence over the DTD mode figured out from the DOCTYPE string. - * Ex. Assume the following: - * aDocTypeStr= - * aCommand=eViewNormal - * aMimeType=text/html - * aDTDMode=eDTDMode_strict - * The above example would invoke DetermineParseMode(). This would figure out - * a DTD mode ( eDTDMode_quirks ) and the doctype (eHTML4Text). Based on this - * info. NavDTD would be chosen. However, since the passed in mode (aDTDMode) requests - * for a strict the COtherDTD ( strict mode ) would get chosen rather than NavDTD. - * That is, aDTDMode overrides theDTDMode ( configured by the DOCTYPE ).The mime type - * will be taken into consideration only if a DOCTYPE string is not available. - * - * Usage ( a sample ): - * - * nsCOMPtr theDTD; - * nsAutoString theMimeType; - * nsAutoString theDocType; - * - * theDocType.Assign(NS_LITERAL_STRING("")); - * theMimeType.Assign(NS_LITERAL_STRING("text/html")); - * - * result=CreateCompatibleDTD(getter_AddRefs(theDTD),&theDocType,eViewNormal,&theMimeType,eDTDMode_quirks); - * - */ - - if(aCommand==eViewNormal) { - if(aDocTypeStr) { - nsDTDMode theDTDMode=eDTDMode_unknown; - eParserDocType theDocType=ePlainText; - - if(!aMimeType) { - nsAutoString temp; - DetermineParseMode(*aDocTypeStr,theDTDMode,theDocType,temp); - } - else DetermineParseMode(*aDocTypeStr,theDTDMode,theDocType,*aMimeType); - - NS_ASSERTION(aDTDMode==eDTDMode_unknown || aDTDMode==theDTDMode,"aDTDMode overrides the mode selected from the DOCTYPE "); - - if(aDTDMode!=eDTDMode_unknown) theDTDMode=aDTDMode; // aDTDMode takes precedence over theDTDMode - - switch(theDocType) { - case eHTML_Strict: - NS_ASSERTION(theDTDMode==eDTDMode_strict, "wrong mode"); - theDTDClassID=&kCOtherDTDCID; - break; - case eHTML3_Quirks: - case eHTML_Quirks: - theDTDClassID=&kNavDTDCID; - break; - case eXML: - theDTDClassID=&kExpatDriverCID; - break; - default: - theDTDClassID=&kNavDTDCID; - break; - } - } - else if(aMimeType) { - - NS_ASSERTION(aDTDMode!=eDTDMode_unknown,"DTD selection might require a parsemode"); - - if(aMimeType->EqualsWithConversion(kHTMLTextContentType)) { - if(aDTDMode==eDTDMode_strict) { - theDTDClassID=&kCOtherDTDCID; - } - else { - theDTDClassID=&kNavDTDCID; - } - } - else if(aMimeType->EqualsWithConversion(kPlainTextContentType)) { - theDTDClassID=&kNavDTDCID; - } - else if(aMimeType->EqualsWithConversion(kXMLTextContentType) || - aMimeType->EqualsWithConversion(kXMLApplicationContentType) || - aMimeType->EqualsWithConversion(kXHTMLApplicationContentType) || - aMimeType->EqualsWithConversion(kXULTextContentType) || - aMimeType->EqualsWithConversion(kRDFTextContentType)) { - theDTDClassID=&kExpatDriverCID; - } - else { - theDTDClassID=&kNavDTDCID; - } - } - } - else { - if(aCommand==eViewSource) { - theDTDClassID=&kViewSourceDTDCID; - } - } - - result=(theDTDClassID)? nsComponentManager::CreateInstance(*theDTDClassID, nsnull, NS_GET_IID(nsIDTD),(void**)aDTD):NS_OK; - - return result; - -} - NS_IMETHODIMP nsParser::CancelParsingEvents() { if (mFlags & NS_PARSER_FLAG_PENDING_CONTINUE_EVENT) { diff --git a/mozilla/parser/htmlparser/src/nsParser.h b/mozilla/parser/htmlparser/src/nsParser.h index 3b012577cd8..77440c1ffb3 100644 --- a/mozilla/parser/htmlparser/src/nsParser.h +++ b/mozilla/parser/htmlparser/src/nsParser.h @@ -315,24 +315,6 @@ class nsParser : public nsIParser, */ NS_IMETHOD GetDTD(nsIDTD** aDTD); - /** - * Call this method to determine a DTD for a DOCTYPE - * - * @update harishd 05/01/00 - * @param aDTD -- Carries the deduced ( from DOCTYPE ) DTD. - * @param aDocTypeStr -- A doctype for which a DTD is to be selected. - * @param aMimeType -- A mimetype for which a DTD is to be selected. - Note: aParseMode might be required. - * @param aCommand -- A command for which a DTD is to be selected. - * @param aParseMode -- Used with aMimeType to choose the correct DTD. - * @return NS_OK if succeeded else ERROR. - */ - NS_IMETHOD CreateCompatibleDTD(nsIDTD** aDTD, - nsString* aDocTypeStr, - eParserCommands aCommand, - const nsString* aMimeType=nsnull, - nsDTDMode aDTDMode=eDTDMode_unknown); - /** * Detects the existence of a META tag with charset information in * the given buffer. diff --git a/mozilla/parser/htmlparser/src/nsParserModule.cpp b/mozilla/parser/htmlparser/src/nsParserModule.cpp index 83f7cecbb6d..e1376e9ed13 100644 --- a/mozilla/parser/htmlparser/src/nsParserModule.cpp +++ b/mozilla/parser/htmlparser/src/nsParserModule.cpp @@ -46,7 +46,6 @@ #include "nsParser.h" #include "CNavDTD.h" #include "COtherDTD.h" -#include "COtherDTD.h" #include "nsViewSourceHTML.h" #include "nsHTMLEntities.h" #include "nsHTMLTokenizer.h" @@ -68,7 +67,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver) NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser) NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD) -NS_GENERIC_FACTORY_CONSTRUCTOR(COtherDTD) NS_GENERIC_FACTORY_CONSTRUCTOR(CTransitionalDTD) NS_GENERIC_FACTORY_CONSTRUCTOR(CViewSourceHTML) NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService) @@ -82,13 +80,11 @@ static const nsModuleComponentInfo gComponents[] = { { "Parser", NS_PARSER_CID, NULL, nsParserConstructor }, { "Navigator HTML DTD", NS_CNAVDTD_CID, NULL, CNavDTDConstructor }, - { "OTHER DTD", NS_COTHER_DTD_CID, NULL, COtherDTDConstructor }, { "Transitional DTD", NS_CTRANSITIONAL_DTD_CID, NULL, CTransitionalDTDConstructor }, { "ViewSource DTD", NS_VIEWSOURCE_DTD_CID, NULL, CViewSourceHTMLConstructor }, { "ParserService", NS_PARSERSERVICE_CID, NULL, nsParserServiceConstructor } }; -#define NUM_COMPONENTS (sizeof(gComponents) / sizeof(gComponents[0])) static PRBool gInitialized = PR_FALSE; diff --git a/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp b/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp index 6fdb29d3e56..30f58f3fe28 100644 --- a/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp +++ b/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp @@ -358,14 +358,9 @@ CViewSourceHTML::CViewSourceHTML() : mFilename(), mTags(), mErrors() { mLineNumber=0; mTokenizer=0; mDocType=eHTML3_Quirks; // why? - mValidator=0; mHasOpenRoot=PR_FALSE; mHasOpenBody=PR_FALSE; - //set this to 1 if you want to see errors in your HTML markup. - char* theEnvString = PR_GetEnv("MOZ_VALIDATE_HTML"); - mShowErrors=PRBool(theEnvString != nsnull); - mTokenCount=0; #ifdef DUMP_TO_FILE @@ -477,7 +472,6 @@ nsresult CViewSourceHTML::WillBuildModel( const CParserContext& aParserContext, mTags.Truncate(); mErrors.Assign(NS_LITERAL_STRING(" HTML 4.0 Strict-DTD validation (enabled); [Should use Transitional?].\n")); - mValidator=aParserContext.mValidator; mDocType=aParserContext.mDocType; mMimeType=aParserContext.mMimeType; mDTDMode=aParserContext.mDTDMode; @@ -1024,67 +1018,6 @@ nsresult CViewSourceHTML::WriteTag(PRInt32 aTagType,const nsAReadableString & aT return result; } -/** - * This method gets called when a tag needs to be sent out but is known to be misplaced (error) - * - * @update gess 6June2000 -- - * @param - * @return result status - */ -nsresult CViewSourceHTML::WriteTagWithError(PRInt32 aTagType,const nsAReadableString& aStr,PRInt32 attrCount,PRBool aNewlineRequired) { - - STOP_TIMER(); - - CSharedVSContext& theContext=CSharedVSContext::GetSharedContext(); - nsresult result=NS_OK; - - if(ePlainText!=mDocType) { - //first write the error tag itself... - theContext.mErrorNode.Init(&theContext.mErrorToken,mLineNumber,0/*stack token*/); - result=mSink->OpenContainer(theContext.mErrorNode); //emit ... - } - - //now write the tag from the source file... - result=WriteTag(aTagType,aStr,attrCount,aNewlineRequired); - - if(ePlainText!=mDocType) { - //now close the error tag... - STOP_TIMER(); - theContext.mErrorNode.Init(&theContext.mErrorToken,0,0/*stack token*/); - mSink->CloseContainer(theContext.mErrorNode); - START_TIMER(); - } - - return result; -} - -void CViewSourceHTML::AddContainmentError(eHTMLTags aChildTag,eHTMLTags aParentTag,PRInt32 aLineNumber) { - - if (mShowErrors) { - mErrorCount++; - - if(mErrorCount<=gErrorThreshold) { - - char theChildMsg[100]; - if(eHTMLTag_text==aChildTag) - strcpy(theChildMsg,"text"); - else sprintf(theChildMsg,"<%s>", - NS_ConvertUCS2toUTF8(nsHTMLTags::GetStringValue(aChildTag)).get()); - - char theMsg[256]; - sprintf(theMsg,"\n -- Line (%i) error: %s is not a legal child of <%s>", - aLineNumber, theChildMsg, - NS_ConvertUCS2toUTF8(nsHTMLTags::GetStringValue(aParentTag)).get()); - - mErrors.AppendWithConversion(theMsg); - } - else if(gErrorThreshold+1==mErrorCount){ - mErrors.Append(NS_LITERAL_STRING("\n -- Too many errors -- terminating output.")); - } - } - -} - /** * * @update gess 3/25/98 @@ -1112,24 +1045,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { mTagCount++; const nsAReadableString& startValue = aToken->GetStringValue(); - 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,startValue,aToken->GetAttributeCount(),PR_TRUE); - else { - AddContainmentError(theChild,theParent,mLineNumber); - result=WriteTagWithError(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE); - } - } - else result=WriteTag(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE); + result=WriteTag(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE); if((ePlainText!=mDocType) && mParser && (NS_OK==result)) { result = mSink->NotifyTagObservers(&theContext.mTokenNode); @@ -1213,26 +1129,14 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { case eToken_text: { - if(mShowErrors) { - const nsAReadableString& str = aToken->GetStringValue(); - if((0==mValidator) || - mValidator->CanContain(theParent,eHTMLTag_text)) - result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE); - else { - AddContainmentError(eHTMLTag_text,theParent,mLineNumber); - result=WriteTagWithError(mText,str,aToken->GetAttributeCount(),PR_FALSE); - } - } - else { - const nsAReadableString& str = aToken->GetStringValue(); - result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE); - mTokenCount++; - if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && - mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !str.IsEmpty()) { - PRUnichar ch = str.Last(); - if (ch == kLF || ch == kCR) - StartNewPreBlock(); - } + const nsAReadableString& str = aToken->GetStringValue(); + result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE); + mTokenCount++; + if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && + mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !str.IsEmpty()) { + PRUnichar ch = str.Last(); + if (ch == kLF || ch == kCR) + StartNewPreBlock(); } } diff --git a/mozilla/parser/htmlparser/src/nsViewSourceHTML.h b/mozilla/parser/htmlparser/src/nsViewSourceHTML.h index 69cefccf0ac..35af6d8af9e 100644 --- a/mozilla/parser/htmlparser/src/nsViewSourceHTML.h +++ b/mozilla/parser/htmlparser/src/nsViewSourceHTML.h @@ -73,15 +73,6 @@ private: PRInt32 attrCount, PRBool aNewlineRequired); - nsresult WriteTagWithError(PRInt32 tagType, - const nsAReadableString& aToken, - PRInt32 attrCount, - PRBool aNewlineRequired); - - void AddContainmentError(eHTMLTags aChild, - eHTMLTags aParent, - PRInt32 aLineNumber); - nsresult WriteAttributes(PRInt32 attrCount); nsresult GenerateSummary(); void StartNewPreBlock(void); @@ -116,11 +107,9 @@ protected: PRInt32 mErrorCount; PRInt32 mTagCount; - nsIDTD *mValidator; nsString mFilename; nsString mTags; nsString mErrors; - PRPackedBool mShowErrors; PRPackedBool mHasOpenRoot; PRPackedBool mHasOpenBody;