bug 324738: Remove some unnecessary complexity from the parser and hardcode DTDs. r=sicking sr=jst

git-svn-id: svn://10.0.0.236/trunk@188251 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mrbkap%gmail.com
2006-01-26 19:07:41 +00:00
parent f35c210acb
commit 8b6ba84a47
18 changed files with 38 additions and 465 deletions

View File

@@ -92,7 +92,6 @@ Stopwatch vsTimer;
#endif
static NS_DEFINE_IID(kClassIID, NS_VIEWSOURCE_HTML_IID);
// Define this to dump the viewsource stuff to a file
//#define DUMP_TO_FILE
@@ -131,9 +130,6 @@ nsresult CViewSourceHTML::QueryInterface(const nsIID& aIID, void** aInstancePtr)
else if(aIID.Equals(NS_GET_IID(nsIDTD))) { //do IParser base class...
*aInstancePtr = (nsIDTD*)(this);
}
else if(aIID.Equals(kClassIID)) { //do this class...
*aInstancePtr = (CViewSourceHTML*)(this);
}
else {
*aInstancePtr=0;
return NS_NOINTERFACE;
@@ -158,7 +154,8 @@ nsresult NS_NewViewSourceHTML(nsIDTD** aInstancePtrResult)
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
NS_ADDREF(*aInstancePtrResult = it);
return NS_OK;
}
@@ -349,52 +346,6 @@ CViewSourceHTML::~CViewSourceHTML(){
mParser=0; //just to prove we destructed...
}
/**
*
* @update gess1/8/99
* @param
* @return
*/
const nsIID& CViewSourceHTML::GetMostDerivedIID(void) const{
return kClassIID;
}
/**
* Call this method if you want the DTD to construct a fresh
* instance of itself.
* @update gess7/23/98
* @param
* @return
*/
nsresult CViewSourceHTML::CreateNewInstance(nsIDTD** aInstancePtrResult){
return NS_NewViewSourceHTML(aInstancePtrResult);
}
/**
* This method is called to determine if the given DTD can parse
* a document in a given source-type.
* NOTE: Parsing always assumes that the end result will involve
* storing the result in the main content model.
* @update gess6/24/98
* @param
* @return TRUE if this DTD can satisfy the request; FALSE otherwise.
*/
NS_IMETHODIMP_(eAutoDetectResult)
CViewSourceHTML::CanParse(CParserContext& aParserContext)
{
if (eViewSource == aParserContext.mParserCommand) {
if (aParserContext.mDocType == ePlainText) {
return eValidDetect;
}
// We claim to parse XML... now _that_ is funny.
return ePrimaryDetect;
}
return eUnknownDetect;
}
/**
* The parser uses a code sandwich to wrap the parsing process. Before
* the process begins, WillBuildModel() is called. Afterwards the parser