Revised sink API's and others to be more xpcom'ish

This commit is contained in:
kipp%netscape.com 1998-07-15 22:30:39 +00:00
Родитель 8432d360c2
Коммит 2fe4af0884
60 изменённых файлов: 2320 добавлений и 2812 удалений

Просмотреть файл

@ -34,7 +34,7 @@ class nsIDocument;
// - LAYER SRC
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTMLCONTENTSINK_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
static NS_DEFINE_IID(kIRobotSinkIID, NS_IROBOTSINK_IID);
class RobotSink : public nsIRobotSink {
@ -52,25 +52,28 @@ public:
NS_DECL_ISUPPORTS
// nsIHTMLContentSink
virtual PRInt32 SetTitle(const nsString& aValue);
virtual PRInt32 OpenHTML(const nsIParserNode& aNode);
virtual PRInt32 CloseHTML(const nsIParserNode& aNode);
virtual PRInt32 OpenHead(const nsIParserNode& aNode);
virtual PRInt32 CloseHead(const nsIParserNode& aNode);
virtual PRInt32 OpenBody(const nsIParserNode& aNode);
virtual PRInt32 CloseBody(const nsIParserNode& aNode);
virtual PRInt32 OpenForm(const nsIParserNode& aNode);
virtual PRInt32 CloseForm(const nsIParserNode& aNode);
virtual PRInt32 OpenFrameset(const nsIParserNode& aNode);
virtual PRInt32 CloseFrameset(const nsIParserNode& aNode);
virtual PRInt32 OpenContainer(const nsIParserNode& aNode);
virtual PRInt32 CloseContainer(const nsIParserNode& aNode);
virtual PRInt32 CloseTopmostContainer();
virtual PRInt32 AddLeaf(const nsIParserNode& aNode);
virtual void WillBuildModel(void) { }
virtual void DidBuildModel(PRInt32 aQualityLevel) { }
virtual void WillInterrupt(void) { }
virtual void WillResume(void) { }
NS_IMETHOD PushMark();
NS_IMETHOD SetTitle(const nsString& aValue);
NS_IMETHOD OpenHTML(const nsIParserNode& aNode);
NS_IMETHOD CloseHTML(const nsIParserNode& aNode);
NS_IMETHOD OpenHead(const nsIParserNode& aNode);
NS_IMETHOD CloseHead(const nsIParserNode& aNode);
NS_IMETHOD OpenBody(const nsIParserNode& aNode);
NS_IMETHOD CloseBody(const nsIParserNode& aNode);
NS_IMETHOD OpenForm(const nsIParserNode& aNode);
NS_IMETHOD CloseForm(const nsIParserNode& aNode);
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseTopmostContainer();
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD WillBuildModel(void) { return NS_OK; }
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel) { return NS_OK; }
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
NS_IMETHOD WillResume(void) { return NS_OK; }
// nsIRobotSink
NS_IMETHOD Init(nsIURL* aDocumentURL);
@ -131,62 +134,77 @@ NS_IMETHODIMP RobotSink::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return NS_NOINTERFACE;
}
PRInt32 RobotSink::SetTitle(const nsString& aValue)
NS_IMETHODIMP RobotSink::PushMark()
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenHTML(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::SetTitle(const nsString& aValue)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseHTML(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenHTML(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenHead(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseHTML(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseHead(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenHead(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenBody(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseHead(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseBody(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenBody(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenForm(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseBody(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseForm(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenForm(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenFrameset(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseForm(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseFrameset(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenMap(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenContainer(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseMap(const nsIParserNode& aNode)
{
return NS_OK;
}
NS_IMETHODIMP RobotSink::OpenFrameset(const nsIParserNode& aNode)
{
return NS_OK;
}
NS_IMETHODIMP RobotSink::CloseFrameset(const nsIParserNode& aNode)
{
return NS_OK;
}
NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
{
nsAutoString tmp(aNode.GetText());
tmp.ToUpperCase();
@ -219,22 +237,22 @@ PRInt32 RobotSink::OpenContainer(const nsIParserNode& aNode)
}
}
}
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseContainer(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseContainer(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseTopmostContainer()
NS_IMETHODIMP RobotSink::CloseTopmostContainer()
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::AddLeaf(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::AddLeaf(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
NS_IMETHODIMP RobotSink::Init(nsIURL* aDocumentURL)

Просмотреть файл

@ -36,7 +36,7 @@
#include "nsHTMLTokens.h"
#include "nsCRT.h"
#include "nsParser.h"
#include "nsHTMLContentSink.h"
#include "nsIHTMLContentSink.h"
#include "nsScanner.h"
#include "nsParserTypes.h"
#include "nsVoidArray.h"
@ -420,13 +420,14 @@ eAutoDetectResult CNavDTD::AutoDetectContentType(nsString& aBuffer,nsString& aTy
* @param
* @return
*/
PRInt32 CNavDTD::WillBuildModel(nsString& aFilename){
PRInt32 result=0;
nsresult CNavDTD::WillBuildModel(nsString& aFilename){
nsresult result=NS_OK;
mFilename=aFilename;
if(mSink)
mSink->WillBuildModel();
if(mSink) {
result = mSink->WillBuildModel();
}
return result;
}
@ -437,14 +438,14 @@ PRInt32 CNavDTD::WillBuildModel(nsString& aFilename){
* @param
* @return
*/
PRInt32 CNavDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
nsresult CNavDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result= NS_OK;
if((kNoError==anErrorCode) && (mContextStack.mCount>0)) {
CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE);
result = CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE);
}
if(mSink) {
mSink->DidBuildModel(1);
result = mSink->DidBuildModel(1);
}
return result;
@ -462,8 +463,8 @@ PRInt32 CNavDTD::DidBuildModel(PRInt32 anErrorCode){
* @param aParser
* @return
*/
PRInt32 CNavDTD::HandleToken(CToken* aToken){
PRInt32 result=0;
nsresult CNavDTD::HandleToken(CToken* aToken){
nsresult result=NS_OK;
if(aToken) {
CHTMLToken* theToken= (CHTMLToken*)(aToken);
@ -496,16 +497,16 @@ PRInt32 CNavDTD::HandleToken(CToken* aToken){
* @param aNode -- CParserNode representing this start token
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode) {
nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode) {
NS_PRECONDITION(0!=aToken,kNullToken);
eHTMLTags parentTag=GetTopNode();
PRInt32 result=kNoError;
nsresult result=NS_OK;
PRBool contains=CanContain(parentTag,aChildTag);
if(PR_FALSE==contains){
result=CreateContextStackFor(aChildTag);
if(kNoError!=result) {
if(NS_OK!=result) {
//if you're here, then the new topmost container can't contain aToken.
//You must determine what container hierarchy you need to hold aToken,
//and create that on the parsestack.
@ -546,7 +547,7 @@ PRInt32 CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIP
* @param aNode -- CParserNode representing this start token
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
nsresult CNavDTD::HandleStartToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
CStartToken* st= (CStartToken*)(aToken);
@ -556,9 +557,11 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
nsCParserNode attrNode((CHTMLToken*)aToken);
PRInt16 attrCount=aToken->GetAttributeCount();
PRInt32 theCount;
PRInt32 result=(0==attrCount) ? kNoError : mParser->CollectAttributes(attrNode,attrCount);
nsresult result=(0==attrCount)
? NS_OK
: mParser->CollectAttributes(attrNode,attrCount);
if(kNoError==result) {
if(NS_OK==result) {
//now check to see if this token should be omitted...
if(PR_FALSE==CanOmit(GetTopNode(),tokenTagType)) {
@ -571,7 +574,7 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
{
nsCParserNode theNode(st);
result=OpenHead(theNode); //open the head...
if(kNoError==result) {
if(NS_OK==result) {
result=mParser->CollectSkippedContent(attrNode,theCount);
mSink->SetTitle(attrNode.GetSkippedContent());
result=CloseHead(theNode); //close the head...
@ -595,9 +598,9 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
{
nsCParserNode theNode((CHTMLToken*)aToken);
result=OpenHead(theNode);
if(kNoError==result)
if(NS_OK==result)
result=AddLeaf(attrNode);
if(kNoError==result)
if(NS_OK==result)
result=CloseHead(theNode);
}
break;
@ -606,11 +609,11 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
{
nsCParserNode theNode((CHTMLToken*)aToken);
result=OpenHead(theNode);
if(kNoError==result) {
if(NS_OK==result) {
mParser->CollectSkippedContent(attrNode,theCount);
if(kNoError==result) {
if(NS_OK==result) {
result=AddLeaf(attrNode);
if(kNoError==result)
if(NS_OK==result)
result=CloseHead(theNode);
}
}
@ -625,9 +628,9 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
case eHTMLTag_base:
result=OpenHead(attrNode);
if(kNoError==result) {
if(NS_OK==result) {
result=AddLeaf(attrNode);
if(kNoError==result)
if(NS_OK==result)
result=CloseHead(attrNode);
}
break;
@ -661,10 +664,10 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleEndToken(CToken* aToken) {
nsresult CNavDTD::HandleEndToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
CEndToken* et = (CEndToken*)(aToken);
eHTMLTags tokenTagType=(eHTMLTags)et->GetTypeID();
@ -733,11 +736,11 @@ PRInt32 CNavDTD::HandleEndToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleEntityToken(CToken* aToken) {
nsresult CNavDTD::HandleEntityToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
CEntityToken* et = (CEntityToken*)(aToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
eHTMLTags tokenTagType=(eHTMLTags)et->GetTypeID();
if(PR_FALSE==CanOmit(GetTopNode(),tokenTagType)) {
@ -757,9 +760,9 @@ PRInt32 CNavDTD::HandleEntityToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleCommentToken(CToken* aToken) {
nsresult CNavDTD::HandleCommentToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
return kNoError;
return NS_OK;
}
/**
@ -772,10 +775,10 @@ PRInt32 CNavDTD::HandleCommentToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleSkippedContentToken(CToken* aToken) {
nsresult CNavDTD::HandleSkippedContentToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
if(HasOpenContainer(eHTMLTag_body)) {
nsCParserNode aNode((CHTMLToken*)aToken);
@ -794,12 +797,12 @@ PRInt32 CNavDTD::HandleSkippedContentToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleAttributeToken(CToken* aToken) {
nsresult CNavDTD::HandleAttributeToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
NS_ERROR("attribute encountered -- this shouldn't happen!");
CAttributeToken* at = (CAttributeToken*)(aToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
return result;
}
@ -811,9 +814,9 @@ PRInt32 CNavDTD::HandleAttributeToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleScriptToken(CToken* aToken) {
nsresult CNavDTD::HandleScriptToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
PRInt32 pos=GetTopmostIndexOf(eHTMLTag_body);
nsCParserNode theNode((CHTMLToken*)aToken);
@ -823,11 +826,11 @@ PRInt32 CNavDTD::HandleScriptToken(CToken* aToken) {
if (kNotFound == pos) {
// We're in the HEAD
result=OpenHead(theNode);
if(kNoError==result) {
if(NS_OK==result) {
mParser->CollectSkippedContent(attrNode,attrCount);
if(kNoError==result) {
if(NS_OK==result) {
result=AddLeaf(attrNode);
if(kNoError==result)
if(NS_OK==result)
result=CloseHead(theNode);
}
}
@ -835,7 +838,7 @@ PRInt32 CNavDTD::HandleScriptToken(CToken* aToken) {
else {
// We're in the BODY
mParser->CollectSkippedContent(attrNode,attrCount);
if(kNoError==result) {
if(NS_OK==result) {
result=AddLeaf(attrNode);
}
}
@ -851,11 +854,11 @@ PRInt32 CNavDTD::HandleScriptToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleStyleToken(CToken* aToken){
nsresult CNavDTD::HandleStyleToken(CToken* aToken){
NS_PRECONDITION(0!=aToken,kNullToken);
CStyleToken* st = (CStyleToken*)(aToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
return result;
}
@ -872,7 +875,6 @@ void CNavDTD::DeleteTokenHandlers(void) {
delete mTokenHandlers[i];
mTokenHandlers[i]=0;
}
return;
}
@ -1762,8 +1764,8 @@ PRInt32 CNavDTD::GetTopmostIndexOf(eHTMLTags aTag) const {
* @param tag of the container just opened
* @return 0 (for now)
*/
PRInt32 CNavDTD::OpenTransientStyles(eHTMLTags aTag){
PRInt32 result=0;
nsresult CNavDTD::OpenTransientStyles(eHTMLTags aTag){
nsresult result=NS_OK;
if(0==strchr(gWhitespaceTags,aTag)){
PRInt32 pos=0;
@ -1788,7 +1790,7 @@ PRInt32 CNavDTD::OpenTransientStyles(eHTMLTags aTag){
mContextStack.mBits[mContextStack.mCount-1]=PR_TRUE;
} //switch
}
if(kNoError!=result)
if(NS_OK!=result)
break;
}//for
}
@ -1808,8 +1810,8 @@ PRInt32 CNavDTD::OpenTransientStyles(eHTMLTags aTag){
* @param tag of the container just opened
* @return 0 (for now)
*/
PRInt32 CNavDTD::CloseTransientStyles(eHTMLTags aTag){
PRInt32 result=0;
nsresult CNavDTD::CloseTransientStyles(eHTMLTags aTag){
nsresult result=NS_OK;
if((mStyleStack.mCount>0) && (mContextStack.mBits[mContextStack.mCount-1])) {
if(0==strchr(gWhitespaceTags,aTag)){
@ -1829,12 +1831,11 @@ PRInt32 CNavDTD::CloseTransientStyles(eHTMLTags aTag){
*
* @update gess4/22/98
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenHTML(const nsIParserNode& aNode){
nsresult CNavDTD::OpenHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount >= 0, kInvalidTagStackPos);
PRInt32 result=mSink->OpenHTML(aNode);
nsresult result=mSink->OpenHTML(aNode);
mContextStack.Push((eHTMLTags)aNode.GetNodeType());
return result;
}
@ -1848,9 +1849,9 @@ PRInt32 CNavDTD::OpenHTML(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseHTML(const nsIParserNode& aNode){
nsresult CNavDTD::CloseHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=mSink->CloseHTML(aNode);
nsresult result=mSink->CloseHTML(aNode);
mContextStack.Pop();
return result;
}
@ -1864,9 +1865,9 @@ PRInt32 CNavDTD::CloseHTML(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenHead(const nsIParserNode& aNode){
nsresult CNavDTD::OpenHead(const nsIParserNode& aNode){
mContextStack.Push(eHTMLTag_head);
PRInt32 result=mSink->OpenHead(aNode);
nsresult result=mSink->OpenHead(aNode);
return result;
}
@ -1878,8 +1879,8 @@ PRInt32 CNavDTD::OpenHead(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseHead(const nsIParserNode& aNode){
PRInt32 result=mSink->CloseHead(aNode);
nsresult CNavDTD::CloseHead(const nsIParserNode& aNode){
nsresult result=mSink->CloseHead(aNode);
mContextStack.Pop();
return result;
}
@ -1892,10 +1893,10 @@ PRInt32 CNavDTD::CloseHead(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenBody(const nsIParserNode& aNode){
nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount >= 0, kInvalidTagStackPos);
PRInt32 result=kNoError;
nsresult result=NS_OK;
eHTMLTags topTag=GetTopNode();
if(eHTMLTag_html!=topTag) {
@ -1923,7 +1924,7 @@ PRInt32 CNavDTD::OpenBody(const nsIParserNode& aNode){
}
}
if(kNoError==result) {
if(NS_OK==result) {
result=mSink->OpenBody(aNode);
mContextStack.Push((eHTMLTags)aNode.GetNodeType());
}
@ -1938,9 +1939,9 @@ PRInt32 CNavDTD::OpenBody(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseBody(const nsIParserNode& aNode){
nsresult CNavDTD::CloseBody(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount >= 0, kInvalidTagStackPos);
PRInt32 result=mSink->CloseBody(aNode);
nsresult result=mSink->CloseBody(aNode);
mContextStack.Pop();
return result;
}
@ -1953,11 +1954,11 @@ PRInt32 CNavDTD::CloseBody(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenForm(const nsIParserNode& aNode){
nsresult CNavDTD::OpenForm(const nsIParserNode& aNode){
if(mHasOpenForm)
CloseForm(aNode);
PRInt32 result=mSink->OpenForm(aNode);
if(kNoError==result)
nsresult result=mSink->OpenForm(aNode);
if(NS_OK==result)
mHasOpenForm=PR_TRUE;
return result;
}
@ -1970,8 +1971,8 @@ PRInt32 CNavDTD::OpenForm(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseForm(const nsIParserNode& aNode){
PRInt32 result=kNoError;
nsresult CNavDTD::CloseForm(const nsIParserNode& aNode){
nsresult result=NS_OK;
if(mHasOpenForm) {
mHasOpenForm=PR_FALSE;
result=mSink->CloseForm(aNode);
@ -1987,15 +1988,11 @@ PRInt32 CNavDTD::CloseForm(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenMap(const nsIParserNode& aNode){
nsresult CNavDTD::OpenMap(const nsIParserNode& aNode){
if(mHasOpenMap)
CloseMap(aNode);
//NOTE: We need to change to method so that it opens a MAP,
// instead of a FORM. This was copy/paste coding at its best.
PRInt32 result=mSink->OpenForm(aNode);
if(kNoError==result)
nsresult result=mSink->OpenMap(aNode);
if(NS_OK==result)
mHasOpenMap=PR_TRUE;
return result;
}
@ -2008,15 +2005,11 @@ PRInt32 CNavDTD::OpenMap(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseMap(const nsIParserNode& aNode){
PRInt32 result=kNoError;
nsresult CNavDTD::CloseMap(const nsIParserNode& aNode){
nsresult result=NS_OK;
if(mHasOpenMap) {
mHasOpenMap=PR_FALSE;
//NOTE: We need to change to method so that it closes a MAP,
// instead of a FORM. This was copy/paste coding at its best.
result=mSink->CloseForm(aNode);
result=mSink->CloseMap(aNode);
}
return result;
}
@ -2029,9 +2022,9 @@ PRInt32 CNavDTD::CloseMap(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenFrameset(const nsIParserNode& aNode){
nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount >= 0, kInvalidTagStackPos);
PRInt32 result=mSink->OpenFrameset(aNode);
nsresult result=mSink->OpenFrameset(aNode);
mContextStack.Push((eHTMLTags)aNode.GetNodeType());
return result;
}
@ -2044,9 +2037,9 @@ PRInt32 CNavDTD::OpenFrameset(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseFrameset(const nsIParserNode& aNode){
nsresult CNavDTD::CloseFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=mSink->CloseFrameset(aNode);
nsresult result=mSink->CloseFrameset(aNode);
mContextStack.Pop();
return result;
}
@ -2060,10 +2053,11 @@ PRInt32 CNavDTD::CloseFrameset(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
nsresult
CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=kNoError;
nsresult result=NS_OK;
eHTMLTags nodeType=(eHTMLTags)aNode.GetNodeType();
// CloseTransientStyles(nodeType);
@ -2082,6 +2076,10 @@ PRInt32 CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleSta
case eHTMLTag_title:
break;
case eHTMLTag_map:
result=OpenMap(aNode);
break;
case eHTMLTag_form:
result=OpenForm(aNode); break;
@ -2091,7 +2089,7 @@ PRInt32 CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleSta
break;
}
if((kNoError==result) && (PR_TRUE==aUpdateStyleStack)){
if((NS_OK==result) && (PR_TRUE==aUpdateStyleStack)){
UpdateStyleStackForOpenTag(nodeType,nodeType);
}
@ -2106,9 +2104,11 @@ PRInt32 CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleSta
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool aUpdateStyles){
nsresult
CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,
PRBool aUpdateStyles){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=kNoError; //was false
nsresult result=NS_OK;
eHTMLTags nodeType=(eHTMLTags)aNode.GetNodeType();
//XXX Hack! We know this is wrong, but it works
@ -2129,6 +2129,10 @@ PRInt32 CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool
case eHTMLTag_body:
result=CloseBody(aNode); break;
case eHTMLTag_map:
result=CloseMap(aNode);
break;
case eHTMLTag_form:
result=CloseForm(aNode); break;
@ -2140,7 +2144,7 @@ PRInt32 CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool
}
mContextStack.mBits[mContextStack.mCount]=PR_FALSE;
if((kNoError==result) && (PR_TRUE==aUpdateStyles)){
if((NS_OK==result) && (PR_TRUE==aUpdateStyles)){
UpdateStyleStackForCloseTag(nodeType,aTag);
}
@ -2155,9 +2159,11 @@ PRInt32 CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles){
nsresult
CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,
PRBool aUpdateStyles){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=kNoError;
nsresult result=NS_OK;
CEndToken aToken(gEmpty);
nsCParserNode theNode(&aToken);
@ -2180,7 +2186,7 @@ PRInt32 CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdate
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
nsresult CNavDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 pos=GetTopmostIndexOf(aTag);
@ -2203,7 +2209,7 @@ PRInt32 CNavDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
}
}
PRInt32 result=kNoError;
nsresult result=NS_OK;
eHTMLTags theParentTag=GetDefaultParentTagFor(aTag);
pos=GetTopmostIndexOf(theParentTag);
if(kNotFound!=pos) {
@ -2221,7 +2227,7 @@ PRInt32 CNavDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseTopmostContainer(){
nsresult CNavDTD::CloseTopmostContainer(){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
CEndToken aToken(gEmpty);
@ -2239,8 +2245,8 @@ PRInt32 CNavDTD::CloseTopmostContainer(){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::AddLeaf(const nsIParserNode& aNode){
PRInt32 result=mSink->AddLeaf(aNode);
nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
nsresult result=mSink->AddLeaf(aNode);
return result;
}
@ -2255,10 +2261,10 @@ PRInt32 CNavDTD::AddLeaf(const nsIParserNode& aNode){
* create a new context vector
* @return true if we succeeded, otherwise false
*/
PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
nsresult CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
nsAutoString theVector;
PRInt32 result=kNoError;
nsresult result=NS_OK;
PRInt32 pos=0;
PRInt32 cnt=0;
eHTMLTags theTop=GetTopNode();
@ -2268,7 +2274,7 @@ PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
pos=0;
cnt=theVector.Length()-1;
if(mContextStack.Last()==(eHTMLTags)theVector[cnt])
result=kNoError;
result=NS_OK;
else result=kContextMismatch;
}
else {
@ -2285,7 +2291,7 @@ PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
//propagation worked, so pop unwanted containers, push new ones, then exit...
pos=0;
cnt=theVector.Length();
result=kNoError;
result=NS_OK;
while(pos<mContextStack.mCount) {
if(mContextStack.mTags[pos]==(eHTMLTags)theVector[cnt-1-pos]) {
pos++;
@ -2303,7 +2309,7 @@ PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
//now, build up the stack according to the tags
//you have that aren't in the stack...
if(kNoError==result){
if(NS_OK==result){
int i=0;
for(i=pos;i<cnt;i++) {
CStartToken* st=new CStartToken((eHTMLTags)theVector[cnt-1-i]);
@ -2325,8 +2331,8 @@ PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
* @param
* @return
*/
PRInt32 CNavDTD::ReduceContextStackFor(eHTMLTags aChildTag){
PRInt32 result=kNoError;
nsresult CNavDTD::ReduceContextStackFor(eHTMLTags aChildTag){
nsresult result=NS_OK;
eHTMLTags topTag=GetTopNode();
while( (topTag!=kNotFound) &&
@ -2347,8 +2353,9 @@ PRInt32 CNavDTD::ReduceContextStackFor(eHTMLTags aChildTag){
* @param aTag is the id of the html container being opened
* @return 0 if all is well.
*/
PRInt32 CNavDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag){
PRInt32 result=0;
nsresult
CNavDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag){
nsresult result=0;
switch (aTag) {
@ -2394,8 +2401,9 @@ PRInt32 CNavDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag
* @param
* @return 0 if all went well (which it always does)
*/
PRInt32 CNavDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTag){
PRInt32 result=0;
nsresult
CNavDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTag){
nsresult result=0;
if(mStyleStack.mCount>0) {
switch (aTag) {
@ -2452,18 +2460,19 @@ PRInt32 CNavDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTa
* @param aToken is the out arg holding our new token
* @return error code (may return kInterrupted).
*/
PRInt32 CNavDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult
CNavDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsAutoString empty("");
PRInt32 result=aScanner.GetChar(aChar);
nsresult result=aScanner.GetChar(aChar);
if(kNoError==result) {
if(NS_OK==result) {
switch(aChar) {
case kForwardSlash:
PRUnichar ch;
result=aScanner.Peek(ch);
if(kNoError==result) {
if(NS_OK==result) {
if(nsString::IsAlpha(ch))
aToken=new CEndToken(empty);
else aToken=new CCommentToken(empty); //Special case: </ ...> is treated as a comment
@ -2481,7 +2490,7 @@ PRInt32 CNavDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken)
}
} //switch
if((0!=aToken) && (kNoError==result)) {
if((0!=aToken) && (NS_OK==result)) {
result= aToken->Consume(aChar,aScanner); //tell new token to finish consuming text...
if(result) {
delete aToken;
@ -2501,13 +2510,14 @@ PRInt32 CNavDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken)
* @param aScanner: see nsScanner.h
* @return
*/
PRInt32 CNavDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken) {
nsresult
CNavDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken) {
PRBool done=PR_FALSE;
PRInt32 result=kNoError;
nsresult result=NS_OK;
nsAutoString as("");
PRInt16 theAttrCount=0;
while((!done) && (result==kNoError)) {
while((!done) && (result==NS_OK)) {
CAttributeToken* theToken= new CAttributeToken(as);
if(theToken){
result=theToken->Consume(aChar,aScanner); //tell new token to finish consuming text...
@ -2524,14 +2534,14 @@ PRInt32 CNavDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToke
aToken->SetEmpty(PR_TRUE);
delete theToken;
}
else if(kNoError==result){
else if(NS_OK==result){
theAttrCount++;
mTokenDeque.Push(theToken);
}//if
else delete theToken; //we can't keep it...
}//if
if(kNoError==result){
if(NS_OK==result){
result=aScanner.Peek(aChar);
if(aChar==kGreaterThan) { //you just ate the '>'
aScanner.GetChar(aChar); //skip the '>'
@ -2553,7 +2563,11 @@ PRInt32 CNavDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToke
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult
CNavDTD::ConsumeContentToEndTag(const nsString& aString,
PRUnichar aChar,
CScanner& aScanner,
CToken*& aToken){
//In the case that we just read the given tag, we should go and
//consume all the input until we find a matching end tag.
@ -2575,22 +2589,23 @@ PRInt32 CNavDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult
CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
PRInt32 theDequeSize=mTokenDeque.GetSize();
PRInt32 result=kNoError;
nsresult result=NS_OK;
aToken=new CStartToken(nsAutoString(""));
if(aToken) {
result= aToken->Consume(aChar,aScanner); //tell new token to finish consuming text...
if(kNoError==result) {
if(NS_OK==result) {
if(((CStartToken*)aToken)->IsAttributed()) {
result=ConsumeAttributes(aChar,aScanner,(CStartToken*)aToken);
}
//now that that's over with, we have one more problem to solve.
//In the case that we just read a <SCRIPT> or <STYLE> tags, we should go and
//consume all the content itself.
if(kNoError==result) {
if(NS_OK==result) {
nsString& str=aToken->GetText();
CToken* skippedToken=0;
if(str.EqualsIgnoreCase("SCRIPT") ||
@ -2600,7 +2615,7 @@ PRInt32 CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
result=ConsumeContentToEndTag(str,aChar,aScanner,skippedToken);
if((kNoError==result) && skippedToken){
if((NS_OK==result) && skippedToken){
//now we strip the ending sequence from our new SkippedContent token...
PRInt32 slen=str.Length()+3;
nsString& skippedText=skippedToken->GetText();
@ -2623,7 +2638,7 @@ PRInt32 CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
//tag but ran out of data (not in the stream, but in this *part* of the stream.
//For simplicity, we have to unwind our input. Therefore, we pop and discard
//any new tokens we've cued this round. Later we can get smarter about this.
if(kNoError!=result) {
if(NS_OK!=result) {
while(mTokenDeque.GetSize()>theDequeSize) {
delete mTokenDeque.PopBack();
}
@ -2645,11 +2660,12 @@ PRInt32 CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult
CNavDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
PRUnichar ch;
PRInt32 result=aScanner.GetChar(ch);
nsresult result=aScanner.GetChar(ch);
if(kNoError==result) {
if(NS_OK==result) {
if(nsString::IsAlpha(ch)) { //handle common enity references &xxx; or &#000.
aToken = new CEntityToken(nsAutoString(""));
result = aToken->Consume(ch,aScanner); //tell new token to finish consuming text...
@ -2677,9 +2693,12 @@ PRInt32 CNavDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToke
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult
CNavDTD::ConsumeWhitespace(PRUnichar aChar,
CScanner& aScanner,
CToken*& aToken) {
aToken = new CWhitespaceToken(nsAutoString(""));
PRInt32 result=kNoError;
nsresult result=NS_OK;
if(aToken) {
result=aToken->Consume(aChar,aScanner);
}
@ -2696,9 +2715,10 @@ PRInt32 CNavDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& a
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult
CNavDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
aToken = new CCommentToken(nsAutoString(""));
PRInt32 result=kNoError;
nsresult result=NS_OK;
if(aToken) {
result=aToken->Consume(aChar,aScanner);
}
@ -2715,9 +2735,11 @@ PRInt32 CNavDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aTok
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken){
PRInt32 result=kNoError;
nsresult
CNavDTD::ConsumeText(const nsString& aString,
CScanner& aScanner,
CToken*& aToken){
nsresult result=NS_OK;
if(aToken=new CTextToken(aString)) {
PRUnichar ch=0;
result=aToken->Consume(ch,aScanner);
@ -2734,9 +2756,12 @@ PRInt32 CNavDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken*&
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult
CNavDTD::ConsumeNewline(PRUnichar aChar,
CScanner& aScanner,
CToken*& aToken){
aToken=new CNewlineToken(nsAutoString(""));
PRInt32 result=kNoError;
nsresult result=NS_OK;
if(aToken) {
result=aToken->Consume(aChar,aScanner);
}
@ -2755,17 +2780,16 @@ PRInt32 CNavDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aTok
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeToken(CToken*& aToken){
nsresult CNavDTD::ConsumeToken(CToken*& aToken){
aToken=0;
if(mTokenDeque.GetSize()>0) {
aToken=(CToken*)mTokenDeque.Pop();
return kNoError;
return NS_OK;
}
PRInt32 result=kNoError;
nsresult result=NS_OK;
CScanner* theScanner=mParser->GetScanner();
if(kNoError==result){
if(NS_OK==result){
PRUnichar theChar;
result=theScanner->GetChar(theChar);
@ -2777,7 +2801,7 @@ PRInt32 CNavDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(theChar) {
case kLessThan:
@ -2801,7 +2825,7 @@ PRInt32 CNavDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
} //while
return result;
@ -2824,11 +2848,12 @@ CToken* CNavDTD::CreateTokenOfType(eHTMLTokenTypes aType) {
* @param
* @return
*/
void CNavDTD::WillResumeParse(void){
nsresult CNavDTD::WillResumeParse(void){
nsresult result = NS_OK;
if(mSink) {
mSink->WillResume();
result = mSink->WillResume();
}
return;
return result;
}
/**
@ -2837,11 +2862,12 @@ void CNavDTD::WillResumeParse(void){
* @param
* @return
*/
void CNavDTD::WillInterruptParse(void){
nsresult CNavDTD::WillInterruptParse(void){
nsresult result = NS_OK;
if(mSink) {
mSink->WillInterrupt();
result = mSink->WillInterrupt();
}
return;
return result;
}

Просмотреть файл

@ -93,13 +93,8 @@ public:
***************************************************************/
CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
class CNavDTD : public nsIDTD {
public:
NS_DECL_ISUPPORTS
/**
*
*
@ -118,6 +113,8 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
*/
virtual ~CNavDTD();
NS_DECL_ISUPPORTS
/**
* This method is called to determine if the given DTD can parse
* a document in a given source-type.
@ -151,7 +148,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename);
NS_IMETHOD WillBuildModel(nsString& aFilename);
/**
*
@ -159,7 +156,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -167,7 +164,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -186,7 +183,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -195,7 +192,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -203,7 +200,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* Select given content sink into parser for parser output
@ -331,15 +328,15 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param aToken is the start token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleStartToken(CToken* aToken);
PRInt32 HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode);
PRInt32 HandleEndToken(CToken* aToken);
PRInt32 HandleEntityToken(CToken* aToken);
PRInt32 HandleCommentToken(CToken* aToken);
PRInt32 HandleSkippedContentToken(CToken* aToken);
PRInt32 HandleAttributeToken(CToken* aToken);
PRInt32 HandleScriptToken(CToken* aToken);
PRInt32 HandleStyleToken(CToken* aToken);
nsresult HandleStartToken(CToken* aToken);
nsresult HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode);
nsresult HandleEndToken(CToken* aToken);
nsresult HandleEntityToken(CToken* aToken);
nsresult HandleCommentToken(CToken* aToken);
nsresult HandleSkippedContentToken(CToken* aToken);
nsresult HandleAttributeToken(CToken* aToken);
nsresult HandleScriptToken(CToken* aToken);
nsresult HandleStyleToken(CToken* aToken);
protected:
@ -367,13 +364,13 @@ protected:
* @param HTML (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenHTML(const nsIParserNode& aNode);
PRInt32 OpenHead(const nsIParserNode& aNode);
PRInt32 OpenBody(const nsIParserNode& aNode);
PRInt32 OpenForm(const nsIParserNode& aNode);
PRInt32 OpenMap(const nsIParserNode& aNode);
PRInt32 OpenFrameset(const nsIParserNode& aNode);
PRInt32 OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack);
nsresult OpenHTML(const nsIParserNode& aNode);
nsresult OpenHead(const nsIParserNode& aNode);
nsresult OpenBody(const nsIParserNode& aNode);
nsresult OpenForm(const nsIParserNode& aNode);
nsresult OpenMap(const nsIParserNode& aNode);
nsresult OpenFrameset(const nsIParserNode& aNode);
nsresult OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack);
/**
* The next set of methods close the given HTML element.
@ -382,13 +379,13 @@ protected:
* @param HTML (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 CloseHTML(const nsIParserNode& aNode);
PRInt32 CloseHead(const nsIParserNode& aNode);
PRInt32 CloseBody(const nsIParserNode& aNode);
PRInt32 CloseForm(const nsIParserNode& aNode);
PRInt32 CloseMap(const nsIParserNode& aNode);
PRInt32 CloseFrameset(const nsIParserNode& aNode);
PRInt32 CloseContainer(const nsIParserNode& aNode,eHTMLTags anActualTag,PRBool aUpdateStyles);
nsresult CloseHTML(const nsIParserNode& aNode);
nsresult CloseHead(const nsIParserNode& aNode);
nsresult CloseBody(const nsIParserNode& aNode);
nsresult CloseForm(const nsIParserNode& aNode);
nsresult CloseMap(const nsIParserNode& aNode);
nsresult CloseFrameset(const nsIParserNode& aNode);
nsresult CloseContainer(const nsIParserNode& aNode,eHTMLTags anActualTag,PRBool aUpdateStyles);
/**
* The special purpose methods automatically close
@ -396,9 +393,9 @@ protected:
* @update gess5/11/98
* @return TRUE if all went well.
*/
PRInt32 CloseTopmostContainer();
PRInt32 CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles);
PRInt32 CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles);
nsresult CloseTopmostContainer();
nsresult CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles);
nsresult CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles);
/**
* Causes leaf to be added to sink at current vector pos.
@ -406,7 +403,7 @@ protected:
* @param aNode is leaf node to be added.
* @return TRUE if all went well -- FALSE otherwise.
*/
PRInt32 AddLeaf(const nsIParserNode& aNode);
nsresult AddLeaf(const nsIParserNode& aNode);
/**
* Causes auto-closures of context vector stack in order to find a
@ -416,7 +413,7 @@ protected:
* @param child to be added (somewhere) to context vector stack.
* @return TRUE if succeeds, otherwise FALSE
*/
PRInt32 ReduceContextStackFor(eHTMLTags aChildTag);
nsresult ReduceContextStackFor(eHTMLTags aChildTag);
/**
* Attempt forward and/or backward propagation for the given
@ -425,12 +422,12 @@ protected:
* @param type of child to be propagated.
* @return TRUE if succeeds, otherwise FALSE
*/
PRInt32 CreateContextStackFor(eHTMLTags aChildTag);
nsresult CreateContextStackFor(eHTMLTags aChildTag);
PRInt32 OpenTransientStyles(eHTMLTags aTag);
PRInt32 CloseTransientStyles(eHTMLTags aTag);
PRInt32 UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags aActualTag);
PRInt32 UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags aActualTag);
nsresult OpenTransientStyles(eHTMLTags aTag);
nsresult CloseTransientStyles(eHTMLTags aTag);
nsresult UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags aActualTag);
nsresult UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags aActualTag);
PRBool CanContainStyles(eHTMLTags aTag) const;
/****************************************************
@ -456,14 +453,14 @@ protected:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken);
PRInt32 ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken);
nsresult ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken);
/**
* Causes content to be skipped up to sequence contained in aString.
@ -474,7 +471,7 @@ protected:
* @param aToken is the next token (or null)
* @return error code
*/
virtual PRInt32 ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
virtual nsresult ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
protected:

Просмотреть файл

@ -36,7 +36,7 @@
#include "nsHTMLTokens.h"
#include "nsCRT.h"
#include "nsParser.h"
#include "nsHTMLContentSink.h"
#include "nsIHTMLContentSink.h"
#include "nsScanner.h"
#include "nsParserTypes.h"
@ -178,7 +178,7 @@ eAutoDetectResult COtherDTD::AutoDetectContentType(nsString& aBuffer,nsString& a
* @param
* @return
*/
PRInt32 COtherDTD::WillBuildModel(nsString& aFilename) {
NS_IMETHODIMP COtherDTD::WillBuildModel(nsString& aFilename) {
return CNavDTD::WillBuildModel(aFilename);
}
@ -188,7 +188,7 @@ PRInt32 COtherDTD::WillBuildModel(nsString& aFilename) {
* @param
* @return
*/
PRInt32 COtherDTD::DidBuildModel(PRInt32 anErrorCode){
NS_IMETHODIMP COtherDTD::DidBuildModel(PRInt32 anErrorCode){
return CNavDTD::DidBuildModel(anErrorCode);
}
@ -203,7 +203,7 @@ PRInt32 COtherDTD::DidBuildModel(PRInt32 anErrorCode){
* @param aParser
* @return
*/
PRInt32 COtherDTD::HandleToken(CToken* aToken){
NS_IMETHODIMP COtherDTD::HandleToken(CToken* aToken){
return CNavDTD::HandleToken(aToken);
}
@ -223,7 +223,7 @@ PRInt32 COtherDTD::HandleToken(CToken* aToken){
* @param aNode -- CParserNode representing this start token
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode) {
nsresult COtherDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode) {
return CNavDTD::HandleDefaultStartToken(aToken,aChildTag,aNode);
}
@ -241,7 +241,7 @@ PRInt32 COtherDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,ns
* @param aNode -- CParserNode representing this start token
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleStartToken(CToken* aToken) {
nsresult COtherDTD::HandleStartToken(CToken* aToken) {
return CNavDTD::HandleStartToken(aToken);
}
@ -259,7 +259,7 @@ PRInt32 COtherDTD::HandleStartToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleEndToken(CToken* aToken) {
nsresult COtherDTD::HandleEndToken(CToken* aToken) {
return CNavDTD::HandleEndToken(aToken);
}
@ -271,7 +271,7 @@ PRInt32 COtherDTD::HandleEndToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleEntityToken(CToken* aToken) {
nsresult COtherDTD::HandleEntityToken(CToken* aToken) {
return CNavDTD::HandleEntityToken(aToken);
}
@ -285,7 +285,7 @@ PRInt32 COtherDTD::HandleEntityToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleCommentToken(CToken* aToken) {
nsresult COtherDTD::HandleCommentToken(CToken* aToken) {
return CNavDTD::HandleCommentToken(aToken);
}
@ -299,7 +299,7 @@ PRInt32 COtherDTD::HandleCommentToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleSkippedContentToken(CToken* aToken) {
nsresult COtherDTD::HandleSkippedContentToken(CToken* aToken) {
return CNavDTD::HandleSkippedContentToken(aToken);
}
@ -313,7 +313,7 @@ PRInt32 COtherDTD::HandleSkippedContentToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleAttributeToken(CToken* aToken) {
nsresult COtherDTD::HandleAttributeToken(CToken* aToken) {
return CNavDTD::HandleAttributeToken(aToken);
}
@ -325,7 +325,7 @@ PRInt32 COtherDTD::HandleAttributeToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleScriptToken(CToken* aToken) {
nsresult COtherDTD::HandleScriptToken(CToken* aToken) {
return CNavDTD::HandleScriptToken(aToken);
}
@ -337,7 +337,7 @@ PRInt32 COtherDTD::HandleScriptToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleStyleToken(CToken* aToken){
nsresult COtherDTD::HandleStyleToken(CToken* aToken){
return CNavDTD::HandleStyleToken(aToken);
}
@ -482,7 +482,7 @@ PRBool COtherDTD::BackwardPropagate(nsString& aVector,eHTMLTags aParentTag,eHTML
* @param tag of the container just opened
* @return 0 (for now)
*/
PRInt32 COtherDTD::OpenTransientStyles(eHTMLTags aTag){
nsresult COtherDTD::OpenTransientStyles(eHTMLTags aTag){
return CNavDTD::OpenTransientStyles(aTag);
}
@ -498,7 +498,7 @@ PRInt32 COtherDTD::OpenTransientStyles(eHTMLTags aTag){
* @param tag of the container just opened
* @return 0 (for now)
*/
PRInt32 COtherDTD::CloseTransientStyles(eHTMLTags aTag){
nsresult COtherDTD::CloseTransientStyles(eHTMLTags aTag){
return CNavDTD::CloseTransientStyles(aTag);
}
@ -511,7 +511,7 @@ PRInt32 COtherDTD::CloseTransientStyles(eHTMLTags aTag){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenHTML(const nsIParserNode& aNode){
nsresult COtherDTD::OpenHTML(const nsIParserNode& aNode){
return CNavDTD::OpenHTML(aNode);
}
@ -524,7 +524,7 @@ PRInt32 COtherDTD::OpenHTML(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseHTML(const nsIParserNode& aNode){
nsresult COtherDTD::CloseHTML(const nsIParserNode& aNode){
return CNavDTD::CloseHTML(aNode);
}
@ -537,7 +537,7 @@ PRInt32 COtherDTD::CloseHTML(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenHead(const nsIParserNode& aNode){
nsresult COtherDTD::OpenHead(const nsIParserNode& aNode){
return CNavDTD::OpenHead(aNode);
}
@ -549,7 +549,7 @@ PRInt32 COtherDTD::OpenHead(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseHead(const nsIParserNode& aNode){
nsresult COtherDTD::CloseHead(const nsIParserNode& aNode){
return CNavDTD::CloseHead(aNode);
}
@ -561,7 +561,7 @@ PRInt32 COtherDTD::CloseHead(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenBody(const nsIParserNode& aNode){
nsresult COtherDTD::OpenBody(const nsIParserNode& aNode){
return CNavDTD::OpenBody(aNode);
}
@ -573,7 +573,7 @@ PRInt32 COtherDTD::OpenBody(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseBody(const nsIParserNode& aNode){
nsresult COtherDTD::CloseBody(const nsIParserNode& aNode){
return CNavDTD::CloseBody(aNode);
}
@ -585,7 +585,7 @@ PRInt32 COtherDTD::CloseBody(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenForm(const nsIParserNode& aNode){
nsresult COtherDTD::OpenForm(const nsIParserNode& aNode){
return CNavDTD::OpenForm(aNode);
}
@ -597,7 +597,7 @@ PRInt32 COtherDTD::OpenForm(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseForm(const nsIParserNode& aNode){
nsresult COtherDTD::CloseForm(const nsIParserNode& aNode){
return CNavDTD::CloseForm(aNode);
}
@ -609,7 +609,7 @@ PRInt32 COtherDTD::CloseForm(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenMap(const nsIParserNode& aNode){
nsresult COtherDTD::OpenMap(const nsIParserNode& aNode){
return CNavDTD::OpenMap(aNode);
}
@ -621,7 +621,7 @@ PRInt32 COtherDTD::OpenMap(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseMap(const nsIParserNode& aNode){
nsresult COtherDTD::CloseMap(const nsIParserNode& aNode){
return CNavDTD::CloseMap(aNode);
}
@ -633,7 +633,7 @@ PRInt32 COtherDTD::CloseMap(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenFrameset(const nsIParserNode& aNode){
nsresult COtherDTD::OpenFrameset(const nsIParserNode& aNode){
return CNavDTD::OpenFrameset(aNode);
}
@ -645,7 +645,7 @@ PRInt32 COtherDTD::OpenFrameset(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseFrameset(const nsIParserNode& aNode){
nsresult COtherDTD::CloseFrameset(const nsIParserNode& aNode){
return CNavDTD::CloseFrameset(aNode);
}
@ -657,7 +657,7 @@ PRInt32 COtherDTD::CloseFrameset(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
nsresult COtherDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
return CNavDTD::OpenContainer(aNode,aUpdateStyleStack);
}
@ -669,7 +669,7 @@ PRInt32 COtherDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleS
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool aUpdateStyles){
nsresult COtherDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool aUpdateStyles){
return CNavDTD::CloseContainer(aNode,aTag,aUpdateStyles);
}
@ -681,7 +681,7 @@ PRInt32 COtherDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBo
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles){
nsresult COtherDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles){
return CNavDTD::CloseContainersTo(anIndex,aTag,aUpdateStyles);
}
@ -693,7 +693,7 @@ PRInt32 COtherDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpda
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
nsresult COtherDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
return CNavDTD::CloseContainersTo(aTag,aUpdateStyles);
}
@ -705,7 +705,7 @@ PRInt32 COtherDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseTopmostContainer(){
nsresult COtherDTD::CloseTopmostContainer(){
return CNavDTD::CloseTopmostContainer();
}
@ -717,7 +717,7 @@ PRInt32 COtherDTD::CloseTopmostContainer(){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::AddLeaf(const nsIParserNode& aNode){
nsresult COtherDTD::AddLeaf(const nsIParserNode& aNode){
return CNavDTD::AddLeaf(aNode);
}
@ -732,7 +732,7 @@ PRInt32 COtherDTD::AddLeaf(const nsIParserNode& aNode){
* create a new context vector
* @return true if we succeeded, otherwise false
*/
PRInt32 COtherDTD::CreateContextStackFor(eHTMLTags aChildTag){
nsresult COtherDTD::CreateContextStackFor(eHTMLTags aChildTag){
return CNavDTD::CreateContextStackFor(aChildTag);
}
@ -748,7 +748,7 @@ PRInt32 COtherDTD::CreateContextStackFor(eHTMLTags aChildTag){
* @param
* @return
*/
PRInt32 COtherDTD::ReduceContextStackFor(eHTMLTags aChildTag){
nsresult COtherDTD::ReduceContextStackFor(eHTMLTags aChildTag){
return CNavDTD::ReduceContextStackFor(aChildTag);
}
@ -761,7 +761,7 @@ PRInt32 COtherDTD::ReduceContextStackFor(eHTMLTags aChildTag){
* @param aTag is the id of the html container being opened
* @return 0 if all is well.
*/
PRInt32 COtherDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag){
nsresult COtherDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag){
return CNavDTD::UpdateStyleStackForOpenTag(aTag,anActualTag);
} //update...
@ -773,7 +773,7 @@ PRInt32 COtherDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualT
* @param
* @return 0 if all went well (which it always does)
*/
PRInt32 COtherDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTag){
nsresult COtherDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTag){
return CNavDTD::UpdateStyleStackForCloseTag(aTag,anActualTag);
} //update...
@ -794,7 +794,7 @@ PRInt32 COtherDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActual
* @param aToken is the out arg holding our new token
* @return error code (may return kInterrupted).
*/
PRInt32 COtherDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult COtherDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
return CNavDTD::ConsumeTag(aChar,aScanner,aToken);
}
@ -807,7 +807,7 @@ PRInt32 COtherDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken
* @param aScanner: see nsScanner.h
* @return
*/
PRInt32 COtherDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken) {
nsresult COtherDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken) {
return CNavDTD::ConsumeAttributes(aChar,aScanner,aToken);
}
@ -820,7 +820,7 @@ PRInt32 COtherDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartTo
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult COtherDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
return CNavDTD::ConsumeContentToEndTag(aString,aChar,aScanner,aToken);
}
@ -834,7 +834,7 @@ PRInt32 COtherDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aCha
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult COtherDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
return CNavDTD::ConsumeStartTag(aChar,aScanner,aToken);
}
@ -848,7 +848,7 @@ PRInt32 COtherDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& a
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult COtherDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
return CNavDTD::ConsumeEntity(aChar,aScanner,aToken);
}
@ -862,7 +862,7 @@ PRInt32 COtherDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult COtherDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
return CNavDTD::ConsumeWhitespace(aChar,aScanner,aToken);
}
@ -876,7 +876,7 @@ PRInt32 COtherDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*&
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult COtherDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
return CNavDTD::ConsumeComment(aChar,aScanner,aToken);
}
@ -890,7 +890,7 @@ PRInt32 COtherDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aT
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken){
nsresult COtherDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken){
return CNavDTD::ConsumeText(aString,aScanner,aToken);
}
@ -903,7 +903,7 @@ PRInt32 COtherDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult COtherDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
return CNavDTD::ConsumeNewline(aChar,aScanner,aToken);
}
@ -919,7 +919,7 @@ PRInt32 COtherDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aT
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeToken(CToken*& aToken){
nsresult COtherDTD::ConsumeToken(CToken*& aToken){
return CNavDTD::ConsumeToken(aToken);
}
@ -940,8 +940,8 @@ CToken* COtherDTD::CreateTokenOfType(eHTMLTokenTypes aType) {
* @param
* @return
*/
void COtherDTD::WillResumeParse(void){
CNavDTD::WillResumeParse();
nsresult COtherDTD::WillResumeParse(void){
return CNavDTD::WillResumeParse();
}
/**
@ -950,7 +950,7 @@ void COtherDTD::WillResumeParse(void){
* @param
* @return
*/
void COtherDTD::WillInterruptParse(void){
CNavDTD::WillInterruptParse();
nsresult COtherDTD::WillInterruptParse(void){
return CNavDTD::WillInterruptParse();
}

Просмотреть файл

@ -87,7 +87,7 @@ class COtherDTD : public CNavDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aString);
NS_IMETHOD WillBuildModel(nsString& aString);
/**
*
@ -95,7 +95,7 @@ class COtherDTD : public CNavDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -103,7 +103,7 @@ class COtherDTD : public CNavDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
* Cause the tokenizer to consume the next token, and
@ -113,7 +113,7 @@ class COtherDTD : public CNavDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -122,7 +122,7 @@ class COtherDTD : public CNavDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -130,7 +130,7 @@ class COtherDTD : public CNavDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* This method is called to determine whether or not a tag
@ -225,7 +225,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the start token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleStartToken(CToken* aToken);
nsresult HandleStartToken(CToken* aToken);
/**
* This method gets called when a start token has been consumed, and
@ -238,7 +238,7 @@ class COtherDTD : public CNavDTD {
* @param aNode is a node be updated with info from given token
* @return TRUE if the token was handled.
*/
PRInt32 HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode);
nsresult HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode);
/**
* This method gets called when an end token has been consumed and needs
@ -247,7 +247,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the end token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleEndToken(CToken* aToken);
nsresult HandleEndToken(CToken* aToken);
/**
* This method gets called when an entity token has been consumed and needs
@ -256,7 +256,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the entity token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleEntityToken(CToken* aToken);
nsresult HandleEntityToken(CToken* aToken);
/**
* This method gets called when a comment token has been consumed and needs
@ -265,7 +265,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the comment token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleCommentToken(CToken* aToken);
nsresult HandleCommentToken(CToken* aToken);
/**
* This method gets called when a skipped-content token has been consumed and needs
@ -274,7 +274,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the skipped-content token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleSkippedContentToken(CToken* aToken);
nsresult HandleSkippedContentToken(CToken* aToken);
/**
* This method gets called when an attribute token has been consumed and needs
@ -283,7 +283,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the attribute token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleAttributeToken(CToken* aToken);
nsresult HandleAttributeToken(CToken* aToken);
/**
* This method gets called when a script token has been consumed and needs
@ -292,7 +292,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the script token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleScriptToken(CToken* aToken);
nsresult HandleScriptToken(CToken* aToken);
/**
* This method gets called when a style token has been consumed and needs
@ -301,7 +301,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the style token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleStyleToken(CToken* aToken);
nsresult HandleStyleToken(CToken* aToken);
private:
@ -318,7 +318,7 @@ private:
* @param HTML (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenHTML(const nsIParserNode& aNode);
nsresult OpenHTML(const nsIParserNode& aNode);
/**
*
@ -326,7 +326,7 @@ private:
* @param
* @return
*/
PRInt32 CloseHTML(const nsIParserNode& aNode);
nsresult CloseHTML(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a head item in
@ -335,7 +335,7 @@ private:
* @param HEAD (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenHead(const nsIParserNode& aNode);
nsresult OpenHead(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink head to be closed
@ -343,7 +343,7 @@ private:
* @param aNode is the node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseHead(const nsIParserNode& aNode);
nsresult CloseHead(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a body item in
@ -352,7 +352,7 @@ private:
* @param BODY (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenBody(const nsIParserNode& aNode);
nsresult OpenBody(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink body to be closed
@ -360,7 +360,7 @@ private:
* @param aNode is the body node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseBody(const nsIParserNode& aNode);
nsresult CloseBody(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a form item in
@ -369,7 +369,7 @@ private:
* @param FORM (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenForm(const nsIParserNode& aNode);
nsresult OpenForm(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink form to be closed
@ -377,7 +377,7 @@ private:
* @param aNode is the form node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseForm(const nsIParserNode& aNode);
nsresult CloseForm(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a form item in
@ -386,7 +386,7 @@ private:
* @param FORM (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenMap(const nsIParserNode& aNode);
nsresult OpenMap(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink form to be closed
@ -394,7 +394,7 @@ private:
* @param aNode is the form node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseMap(const nsIParserNode& aNode);
nsresult CloseMap(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a frameset item in
@ -403,7 +403,7 @@ private:
* @param FRAMESET (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenFrameset(const nsIParserNode& aNode);
nsresult OpenFrameset(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink frameset to be closed
@ -411,7 +411,7 @@ private:
* @param aNode is the frameeset node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseFrameset(const nsIParserNode& aNode);
nsresult CloseFrameset(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a generic container in
@ -420,7 +420,7 @@ private:
* @param generic container (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack);
nsresult OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack);
/**
* This cover method causes a generic containre in the content-sink to be closed
@ -428,14 +428,14 @@ private:
* @param aNode is the node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseContainer(const nsIParserNode& aNode,eHTMLTags anActualTag,PRBool aUpdateStyles);
nsresult CloseContainer(const nsIParserNode& aNode,eHTMLTags anActualTag,PRBool aUpdateStyles);
/**
* This cover method causes the topmost container to be closed in sink
* @update gess5/11/98
* @return TRUE if all went well.
*/
PRInt32 CloseTopmostContainer();
nsresult CloseTopmostContainer();
/**
* Cause all containers down to topmost given tag to be closed
@ -443,7 +443,7 @@ private:
* @param aTag is the tag at which auto-closure should stop (inclusive)
* @return TRUE if all went well -- otherwise FALSE
*/
PRInt32 CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles);
nsresult CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles);
/**
* Cause all containers down to given position to be closed
@ -451,7 +451,7 @@ private:
* @param anIndex is the stack pos at which auto-closure should stop (inclusive)
* @return TRUE if all went well -- otherwise FALSE
*/
PRInt32 CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles);
nsresult CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles);
/**
* Causes leaf to be added to sink at current vector pos.
@ -459,7 +459,7 @@ private:
* @param aNode is leaf node to be added.
* @return TRUE if all went well -- FALSE otherwise.
*/
PRInt32 AddLeaf(const nsIParserNode& aNode);
nsresult AddLeaf(const nsIParserNode& aNode);
/**
* Causes auto-closures of context vector stack in order to find a
@ -469,7 +469,7 @@ private:
* @param child to be added (somewhere) to context vector stack.
* @return TRUE if succeeds, otherwise FALSE
*/
PRInt32 ReduceContextStackFor(eHTMLTags aChildTag);
nsresult ReduceContextStackFor(eHTMLTags aChildTag);
/**
* Attempt forward and/or backward propagation for the given
@ -478,12 +478,12 @@ private:
* @param type of child to be propagated.
* @return TRUE if succeeds, otherwise FALSE
*/
PRInt32 CreateContextStackFor(eHTMLTags aChildTag);
nsresult CreateContextStackFor(eHTMLTags aChildTag);
PRInt32 OpenTransientStyles(eHTMLTags aTag);
PRInt32 CloseTransientStyles(eHTMLTags aTag);
PRInt32 UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags aActualTag);
PRInt32 UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags aActualTag);
nsresult OpenTransientStyles(eHTMLTags aTag);
nsresult CloseTransientStyles(eHTMLTags aTag);
nsresult UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags aActualTag);
nsresult UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags aActualTag);
/****************************************************
@ -507,7 +507,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve next START tag from given scanner.
@ -516,7 +516,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve collection of HTML/XML attributes from given scanner
@ -525,7 +525,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken);
nsresult ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken);
/**
* Retrieve a sequence of text from given scanner.
@ -535,7 +535,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve an entity from given scanner
@ -545,7 +545,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve a whitespace sequence from the given scanner
@ -555,7 +555,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve a comment from the given scanner
@ -565,7 +565,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve newlines from given scanner
@ -575,7 +575,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Causes content to be skipped up to sequence contained in aString.
@ -586,7 +586,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
virtual PRInt32 ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
virtual nsresult ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
protected:

Просмотреть файл

@ -251,8 +251,8 @@ eAutoDetectResult CRtfDTD::AutoDetectContentType(nsString& aBuffer,nsString& aTy
* @param
* @return
*/
PRInt32 CRtfDTD::WillBuildModel(nsString& aFilename){
PRInt32 result=0;
NS_IMETHODIMP CRtfDTD::WillBuildModel(nsString& aFilename){
nsresult result=NS_OK;
return result;
}
@ -262,8 +262,8 @@ PRInt32 CRtfDTD::WillBuildModel(nsString& aFilename){
* @param
* @return
*/
PRInt32 CRtfDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
NS_IMETHODIMP CRtfDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result=NS_OK;
return result;
}
@ -371,12 +371,12 @@ PRInt32 CRtfDTD::ConsumeContent(PRUnichar aChar,CToken*& aToken){
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CRtfDTD::ConsumeToken(CToken*& aToken){
nsresult CRtfDTD::ConsumeToken(CToken*& aToken){
CScanner* theScanner=mParser->GetScanner();
PRUnichar aChar;
PRInt32 result=theScanner->GetChar(aChar);
nsresult result=theScanner->GetChar(aChar);
switch(result) {
case kEOF:
@ -386,7 +386,7 @@ PRInt32 CRtfDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(aChar) {
case kLeftBrace:
@ -409,7 +409,7 @@ PRInt32 CRtfDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
return result;
}
@ -420,8 +420,8 @@ PRInt32 CRtfDTD::ConsumeToken(CToken*& aToken){
* @param
* @return
*/
void CRtfDTD::WillResumeParse(void){
return;
nsresult CRtfDTD::WillResumeParse(void){
return NS_OK;
}
/**
@ -430,8 +430,8 @@ void CRtfDTD::WillResumeParse(void){
* @param
* @return
*/
void CRtfDTD::WillInterruptParse(void){
return;
nsresult CRtfDTD::WillInterruptParse(void){
return NS_OK;
}
/**
@ -496,8 +496,8 @@ PRInt32 CRtfDTD::HandleContent(CToken* aToken){
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
PRInt32 CRtfDTD::HandleToken(CToken* aToken) {
PRInt32 result=0;
nsresult CRtfDTD::HandleToken(CToken* aToken) {
nsresult result=NS_OK;
if(aToken) {
eRTFTokenTypes theType=eRTFTokenTypes(aToken->GetTokenType());

Просмотреть файл

@ -190,7 +190,7 @@ class CRtfDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename);
NS_IMETHOD WillBuildModel(nsString& aFilename);
/**
*
@ -198,7 +198,7 @@ class CRtfDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -230,7 +230,7 @@ class CRtfDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -279,7 +279,7 @@ class CRtfDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -288,7 +288,7 @@ class CRtfDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -296,7 +296,7 @@ class CRtfDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* Select given content sink into parser for parser output

Просмотреть файл

@ -22,7 +22,7 @@ LIBRARY_NAME = raptorhtmlpars
DEFINES = -D_IMPL_NS_HTMLPARS
CPPSRCS = \
nsHTMLContentSink.cpp \
nsHTMLNullSink.cpp \
nsParserNode.cpp \
nsDTDDebug.cpp \
nsScanner.cpp \

Просмотреть файл

@ -24,34 +24,32 @@ MODULE=raptor
REQUIRES=xpcom raptor netlib
CPPSRCS= \
CNavDTD.obj \
COtherDTD.obj \
CRTFDTD.obj \
nsWellFormedDTD.obj \
nsValidDTD.obj \
nsDTDDebug.obj \
nsHTMLContentSink.obj \
nsHTMLTags.obj \
nsHTMLTokens.obj \
nsParser.obj \
CParserContext.obj \
nsParserNode.obj \
nsScanner.obj \
nsToken.obj \
nsTokenHandler.obj \
nsHTMLContentSinkStream.obj \
nsXIFDTD.obj \
prstrm.obj \
CNavDTD.cpp \
COtherDTD.cpp \
CRtfDTD.cpp \
nsDTDDebug.cpp \
nsHTMLNullSink.cpp \
nsHTMLTags.cpp \
nsHTMLTokens.cpp \
nsParser.cpp \
CParserContext.cpp \
nsParserNode.cpp \
nsScanner.cpp \
nsToken.cpp \
nsTokenHandler.cpp \
nsHTMLContentSinkStream.cpp \
nsValid.cpp \
nsWellFormed.cpp \
nsXIFDTD.cpp \
prstrm.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\CNavDTD.obj \
.\$(OBJDIR)\CRTFDTD.obj \
.\$(OBJDIR)\COtherDTD.obj \
.\$(OBJDIR)\nsWellFormedDTD.obj \
.\$(OBJDIR)\nsValidDTD.obj \
.\$(OBJDIR)\CRtfDTD.obj \
.\$(OBJDIR)\nsDTDDebug.obj \
.\$(OBJDIR)\nsHTMLContentSink.obj \
.\$(OBJDIR)\nsHTMLNullSink.obj \
.\$(OBJDIR)\nsHTMLTags.obj \
.\$(OBJDIR)\nsHTMLTokens.obj \
.\$(OBJDIR)\nsParser.obj \
@ -60,7 +58,9 @@ CPP_OBJS= \
.\$(OBJDIR)\nsScanner.obj \
.\$(OBJDIR)\nsToken.obj \
.\$(OBJDIR)\nsTokenHandler.obj \
.\$(OBJDIR)\nsHTMLContentSinkStream.obj \
.\$(OBJDIR)\nsHTMLContentSinkStream.obj \
.\$(OBJDIR)\nsValidDTD.obj \
.\$(OBJDIR)\nsWellFormedDTD.obj \
.\$(OBJDIR)\nsXIFDTD.obj \
.\$(OBJDIR)\prstrm.obj \
$(NULL)
@ -69,7 +69,7 @@ EXPORTS= \
nshtmlpars.h \
nsIContentSink.h \
nsIHTMLContentSink.h \
nsHTMLContentSinkStream.h \
nsHTMLContentSinkStream.h \
nsHTMLTokens.h \
nsIParserNode.h \
nsIParser.h \
@ -77,12 +77,12 @@ EXPORTS= \
nsIDTDDebug.h \
nsIParserFilter.h \
CNavDTD.h \
nsWellFormedDTD.h \
nsValidDTD.h \
nsWellFormedDTD.h \
nsValidDTD.h \
CRTFDTD.h \
COtherDTD.h \
nsIDTD.h \
nsXIFDTD.h \
nsXIFDTD.h \
$(NULL)
EXTRA_EXPORTS= \

Просмотреть файл

@ -1,169 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/**
* MODULE NOTES:
* @update gess 4/1/98
*
* This file declares the concrete HTMLContentSink class.
* This class is used during the parsing process as the
* primary interface between the parser and the content
* model.
*
* After the tokenizer completes, the parser iterates over
* the known token list. As the parser identifies valid
* elements, it calls the contentsink interface to notify
* the content model that a new node or child node is being
* created and added to the content model.
*
* The HTMLContentSink interface assumes 4 underlying
* containers: HTML, HEAD, BODY and FRAMESET. Before
* accessing any these, the parser will call the appropriate
* OpenXXX method: OpenHTML,OpenHead,OpenBody,OpenFrameSet;
* likewise, the CloseXXX version will be called when the
* parser is done with a given section.
*
* IMPORTANT: The parser may Open each container more than
* once! This is due to the irregular nature of HTML files.
* For example, it is possible to encounter plain text at
* the start of an HTML document (that preceeds the HTML tag).
* Such text is treated as if it were part of the body.
* In such cases, the parser will Open the body, pass the text-
* node in and then Close the body. The body will likely be
* re-Opened later when the actual <BODY> tag has been seen.
*
* Containers within the body are Opened and Closed
* using the OpenContainer(...) and CloseContainer(...) calls.
* It is assumed that the document or contentSink is
* maintaining its state to manage where new content should
* be added to the underlying document.
*
* NOTE: OpenHTML() and OpenBody() may get called multiple times
* in the same document. That's fine, and it doesn't mean
* that we have multiple bodies or HTML's.
*
* NOTE: I haven't figured out how sub-documents (non-frames)
* are going to be handled. Stay tuned.
*/
#ifndef NS_HTMLCONTENTSINK
#define NS_HTMLCONTENTSINK
#include "nsIParserNode.h"
#include "nsIHTMLContentSink.h"
#include "nsIContentSink.h"
#include "nsString.h"
#define NS_HTMLCONTENTSINK_IID \
{0x803f8110, 0xc287, 0x11d1, \
{0x80, 0x22, 0x00, 0x60, 0x08, 0x14, 0x98, 0x89}}
class nsHTMLContentSink : public nsIHTMLContentSink {
public:
enum eSection {eNone=0,eHTML,eHead,eBody,eContainer};
nsHTMLContentSink();
~nsHTMLContentSink();
NS_DECL_ISUPPORTS
PRBool SetTitle(const nsString& aValue);
// Called when Opening or closing the main HTML container
PRInt32 OpenHTML(const nsIParserNode& aNode);
PRInt32 CloseHTML(const nsIParserNode& aNode);
// Called when Opening or closing the main HEAD container
PRInt32 OpenHead(const nsIParserNode& aNode);
PRInt32 CloseHead(const nsIParserNode& aNode);
// Called when Opening or closing the main BODY container
PRInt32 OpenBody(const nsIParserNode& aNode);
PRInt32 CloseBody(const nsIParserNode& aNode);
// Called when Opening or closing FORM containers
PRInt32 OpenForm(const nsIParserNode& aNode);
PRInt32 CloseForm(const nsIParserNode& aNode);
// Called when Opening or closing the main FRAMESET container
PRInt32 OpenFrameset(const nsIParserNode& aNode);
PRInt32 CloseFrameset(const nsIParserNode& aNode);
// Called when Opening or closing a general container
// This includes: OL,UL,DIR,SPAN,TABLE,H[1..6],etc.
// Until proven otherwise, I also plan to toss STYLE,
// FRAME, SCRIPT, etc. here too!
virtual PRInt32 OpenContainer(const nsIParserNode& aNode);
virtual PRInt32 CloseContainer(const nsIParserNode& aNode);
virtual PRInt32 CloseTopmostContainer();
virtual PRInt32 AddLeaf(const nsIParserNode& aNode);
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
*/
virtual void WillBuildModel(void);
/**
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
virtual void DidBuildModel(PRInt32 aQualityLevel);
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
*/
virtual void WillInterrupt(void);
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
virtual void WillResume(void);
PRInt32 NodeAt(PRInt32 aPos) {return mNodeStack[aPos];}
PRInt32 TopNode() {return mNodeStack[mNodeStackPos-1];}
PRInt32 GetStackPos() {return mNodeStackPos;}
protected:
PRInt32 mNodeStack[100];
PRInt32 mNodeStackPos;
nsString mTitle;
};
#endif

Просмотреть файл

@ -1,19 +1,20 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
/**
@ -33,10 +34,9 @@
#include "nsString.h"
#include "nsParserTypes.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIContentSinkIID,NS_IHTMLCONTENTSINK_IID);
static NS_DEFINE_IID(kClassIID, NS_HTMLCONTENTSINK_STREAM_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENT_SINK_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
static char* gHeaderComment = "<!-- This page was created by the NGLayout output system. -->";
static char* gDocTypeHeader = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">";
@ -53,21 +53,21 @@ static char gBuffer[500];
* @param aInstancePtr ptr to newly discovered interface
* @return NS_xxx result code
*/
nsresult nsHTMLContentSinkStream::QueryInterface(const nsIID& aIID, void** aInstancePtr)
nsresult
nsHTMLContentSinkStream::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if(aIID.Equals(kISupportsIID)) { //do IUnknown...
*aInstancePtr = (nsIContentSink*)(this);
if(aIID.Equals(kISupportsIID)) {
*aInstancePtr = (nsIContentSink*)(this);
}
else if(aIID.Equals(kIContentSinkIID)) { //do IParser base class...
*aInstancePtr = (nsIContentSink*)(this);
else if(aIID.Equals(kIContentSinkIID)) {
*aInstancePtr = (nsIContentSink*)(this);
}
else if(aIID.Equals(kIHTMLContentSinkIID)) {
*aInstancePtr = (nsIHTMLContentSink*)(this);
}
else if(aIID.Equals(kClassIID)) { //do this class...
*aInstancePtr = (nsHTMLContentSinkStream*)(this);
}
else {
*aInstancePtr=0;
return NS_NOINTERFACE;
@ -89,14 +89,14 @@ NS_IMPL_RELEASE(nsHTMLContentSinkStream)
* @param nsIParser** ptr to newly instantiated parser
* @return NS_xxx error result
*/
NS_HTMLPARS nsresult NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult) {
NS_HTMLPARS nsresult
NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult) {
nsHTMLContentSinkStream* it = new nsHTMLContentSinkStream();
if (it == 0) {
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
return it->QueryInterface(kIHTMLContentSinkIID, (void **)aInstancePtrResult);
}
/**
@ -248,6 +248,12 @@ void WritePair(eHTMLTags aTag,const nsString& theContent,int tab,ostream& aStrea
CloseTag(titleStr,0,aStream);
}
NS_IMETHODIMP
nsHTMLContentSinkStream::PushMark()
{
// XXX We need to defer our output when this occurs
return NS_OK;
}
/**
* This method gets called by the parser when it encounters
@ -257,12 +263,12 @@ void WritePair(eHTMLTags aTag,const nsString& theContent,int tab,ostream& aStrea
* @param nsString reference to new title value
* @return PR_TRUE if successful.
*/
PRBool nsHTMLContentSinkStream::SetTitle(const nsString& aValue){
PRBool result=PR_FALSE;
NS_IMETHODIMP
nsHTMLContentSinkStream::SetTitle(const nsString& aValue){
if(mOutput) {
WritePair(eHTMLTag_title,aValue,1+mTabLevel,*mOutput);
}
return result;
return NS_OK;
}
@ -273,14 +279,14 @@ PRBool nsHTMLContentSinkStream::SetTitle(const nsString& aValue){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenHTML(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenHTML(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_html)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -291,15 +297,15 @@ PRInt32 nsHTMLContentSinkStream::OpenHTML(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseHTML(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseHTML(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_html)
AddEndTag(aNode,*mOutput);
mOutput->flush();
}
return result;
return NS_OK;
}
@ -310,14 +316,14 @@ PRInt32 nsHTMLContentSinkStream::CloseHTML(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_head)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -328,14 +334,14 @@ PRInt32 nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseHead(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseHead(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_head)
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -346,14 +352,14 @@ PRInt32 nsHTMLContentSinkStream::CloseHead(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenBody(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenBody(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_body)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -364,14 +370,14 @@ PRInt32 nsHTMLContentSinkStream::OpenBody(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseBody(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseBody(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_body)
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -382,14 +388,14 @@ PRInt32 nsHTMLContentSinkStream::CloseBody(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenForm(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenForm(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_form)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -400,14 +406,49 @@ PRInt32 nsHTMLContentSinkStream::OpenForm(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseForm(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseForm(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_form)
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
/**
* This method is used to open a new FORM container.
*
* @update 07/12/98 gpk
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenMap(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_map)
AddStartTag(aNode,*mOutput);
}
return NS_OK;
}
/**
* This method is used to close the outer FORM container.
*
* @update 07/12/98 gpk
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseMap(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_map)
AddEndTag(aNode,*mOutput);
}
return NS_OK;
}
@ -418,14 +459,14 @@ PRInt32 nsHTMLContentSinkStream::CloseForm(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenFrameset(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenFrameset(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_frameset)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -436,14 +477,14 @@ PRInt32 nsHTMLContentSinkStream::OpenFrameset(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseFrameset(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseFrameset(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_frameset)
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -572,8 +613,8 @@ void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode, ostream& aSt
* @param
* @return
*/
PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream){
PRInt32 result=kNoError;
nsresult
nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream){
eHTMLTags type = (eHTMLTags)aNode.GetNodeType();
eHTMLTags tag = mHTMLTagStack[mHTMLStackPos-1];
@ -685,7 +726,7 @@ PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aS
}
}
return result;
return NS_OK;
}
@ -698,13 +739,13 @@ PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aS
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode){
if(mOutput) {
AddStartTag(aNode,*mOutput);
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
}
return result;
return NS_OK;
}
@ -715,12 +756,12 @@ PRInt32 nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseContainer(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseContainer(const nsIParserNode& aNode){
if(mOutput) {
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -732,10 +773,11 @@ PRInt32 nsHTMLContentSinkStream::CloseContainer(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode){
nsresult result = NS_OK;
if(mOutput) {
AddLeaf(aNode,*mOutput);
result = AddLeaf(aNode,*mOutput);
}
return result;
}
@ -747,12 +789,14 @@ PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode){
*
* @update 5/7/98 gess
*/
void nsHTMLContentSinkStream::WillBuildModel(void){
NS_IMETHODIMP
nsHTMLContentSinkStream::WillBuildModel(void){
mTabLevel=-1;
if(mOutput) {
(*mOutput) << gHeaderComment << endl;
(*mOutput) << gDocTypeHeader << endl;
}
return NS_OK;
}
@ -764,7 +808,9 @@ void nsHTMLContentSinkStream::WillBuildModel(void){
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
void nsHTMLContentSinkStream::DidBuildModel(PRInt32 aQualityLevel) {
NS_IMETHODIMP
nsHTMLContentSinkStream::DidBuildModel(PRInt32 aQualityLevel) {
return NS_OK;
}
@ -775,7 +821,9 @@ void nsHTMLContentSinkStream::DidBuildModel(PRInt32 aQualityLevel) {
*
* @update 5/7/98 gess
*/
void nsHTMLContentSinkStream::WillInterrupt(void) {
NS_IMETHODIMP
nsHTMLContentSinkStream::WillInterrupt(void) {
return NS_OK;
}
@ -785,7 +833,9 @@ void nsHTMLContentSinkStream::WillInterrupt(void) {
*
* @update 5/7/98 gess
*/
void nsHTMLContentSinkStream::WillResume(void) {
NS_IMETHODIMP
nsHTMLContentSinkStream::WillResume(void) {
return NS_OK;
}

Просмотреть файл

@ -53,8 +53,6 @@ class ostream;
class nsHTMLContentSinkStream : public nsIHTMLContentSink {
public:
NS_DECL_ISUPPORTS
/**
*
* @update gess7/7/98
@ -79,6 +77,33 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSink {
*/
virtual ~nsHTMLContentSinkStream();
// nsISupports
NS_DECL_ISUPPORTS
// nsIContentSink
NS_IMETHOD WillBuildModel(void);
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel);
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsIParserNode& aNode);
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
// nsIHTMLContentSink
NS_IMETHOD PushMark();
NS_IMETHOD SetTitle(const nsString& aValue);
NS_IMETHOD OpenHTML(const nsIParserNode& aNode);
NS_IMETHOD CloseHTML(const nsIParserNode& aNode);
NS_IMETHOD OpenHead(const nsIParserNode& aNode);
NS_IMETHOD CloseHead(const nsIParserNode& aNode);
NS_IMETHOD OpenBody(const nsIParserNode& aNode);
NS_IMETHOD CloseBody(const nsIParserNode& aNode);
NS_IMETHOD OpenForm(const nsIParserNode& aNode);
NS_IMETHOD CloseForm(const nsIParserNode& aNode);
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
/**
*
@ -88,183 +113,13 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSink {
*/
void SetOutputStream(ostream& aStream);
/**
* This method gets called by the parser when it encounters
* a title tag and wants to set the document title in the sink.
*
* @update 4/1/98 gess
* @param nsString reference to new title value
* @return PR_TRUE if successful.
*/
virtual PRBool SetTitle(const nsString& aValue);
/**
* This method is used to open the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenHTML(const nsIParserNode& aNode);
/**
* This method is used to close the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseHTML(const nsIParserNode& aNode);
/**
* This method is used to open the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenHead(const nsIParserNode& aNode);
/**
* This method is used to close the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseHead(const nsIParserNode& aNode);
/**
* This method is used to open the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenBody(const nsIParserNode& aNode);
/**
* This method is used to close the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseBody(const nsIParserNode& aNode);
/**
* This method is used to open a new FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenForm(const nsIParserNode& aNode);
/**
* This method is used to close the outer FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseForm(const nsIParserNode& aNode);
/**
* This method is used to open the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenFrameset(const nsIParserNode& aNode);
/**
* This method is used to close the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseFrameset(const nsIParserNode& aNode);
/**
* This method is used to a general container.
* This includes: OL,UL,DIR,SPAN,TABLE,H[1..6],etc.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenContainer(const nsIParserNode& aNode);
/**
* This method is used to close a generic container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseContainer(const nsIParserNode& aNode);
/**
* This method is used to add a leaf to the currently
* open container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 AddLeaf(const nsIParserNode& aNode);
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
*/
virtual void WillBuildModel(void);
/**
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
virtual void DidBuildModel(PRInt32 aQualityLevel);
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
*/
virtual void WillInterrupt(void);
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
virtual void WillResume(void);
/*
* PrettyPrinting Methods
*
*/
public:
void SetLowerCaseTags(PRBool aDoLowerCase) { mLowerCaseTags = aDoLowerCase; }
protected:
PRInt32 AddLeaf(const nsIParserNode& aNode, ostream& aStream);
nsresult AddLeaf(const nsIParserNode& aNode, ostream& aStream);
void WriteAttributes(const nsIParserNode& aNode,ostream& aStream);
void AddStartTag(const nsIParserNode& aNode, ostream& aStream);
void AddEndTag(const nsIParserNode& aNode, ostream& aStream);
@ -355,7 +210,8 @@ protected:
};
extern NS_HTMLPARS nsresult NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult);
extern NS_HTMLPARS nsresult
NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult);
#endif

Просмотреть файл

@ -1,22 +1,22 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsHTMLContentSink.h"
#include "nsIHTMLContentSink.h"
#include "nsHTMLTokens.h"
#include "nsParserTypes.h"
#include "prtypes.h"
@ -25,10 +25,49 @@
#define VERBOSE_DEBUG
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENTSINK_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTMLCONTENTSINK_IID);
static NS_DEFINE_IID(kClassIID, NS_HTMLCONTENTSINK_IID);
static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENT_SINK_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
class nsHTMLNullSink : public nsIHTMLContentSink {
public:
nsHTMLNullSink();
~nsHTMLNullSink();
enum eSection {eNone=0,eHTML,eHead,eBody,eContainer};
// nsISupports
NS_DECL_ISUPPORTS
// nsIContentSink
NS_IMETHOD WillBuildModel(void);
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel);
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsIParserNode& aNode);
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
// nsIHTMLContentSink
NS_IMETHOD PushMark();
NS_IMETHOD SetTitle(const nsString& aValue);
NS_IMETHOD OpenHTML(const nsIParserNode& aNode);
NS_IMETHOD CloseHTML(const nsIParserNode& aNode);
NS_IMETHOD OpenHead(const nsIParserNode& aNode);
NS_IMETHOD CloseHead(const nsIParserNode& aNode);
NS_IMETHOD OpenBody(const nsIParserNode& aNode);
NS_IMETHOD CloseBody(const nsIParserNode& aNode);
NS_IMETHOD OpenForm(const nsIParserNode& aNode);
NS_IMETHOD CloseForm(const nsIParserNode& aNode);
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
protected:
PRInt32 mNodeStack[100];
PRInt32 mNodeStackPos;
nsString mTitle;
};
/**
@ -39,15 +78,14 @@ static NS_DEFINE_IID(kClassIID, NS_HTMLCONTENTSINK_IID);
* @param
* @return
*/
nsresult NS_NewHTMLContentSink(nsIContentSink** aInstancePtrResult)
nsresult
NS_NewHTMLNullSink(nsIContentSink** aInstancePtrResult)
{
nsHTMLContentSink *it = new nsHTMLContentSink();
if (it == 0) {
nsHTMLNullSink *it = new nsHTMLNullSink();
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
return it->QueryInterface(kIContentSinkIID, (void **) aInstancePtrResult);
}
@ -58,7 +96,7 @@ nsresult NS_NewHTMLContentSink(nsIContentSink** aInstancePtrResult)
* @param
* @return
*/
nsHTMLContentSink::nsHTMLContentSink() : nsIHTMLContentSink(), mTitle("") {
nsHTMLNullSink::nsHTMLNullSink() : nsIHTMLContentSink(), mTitle("") {
mNodeStackPos=0;
memset(mNodeStack,0,sizeof(mNodeStack));
}
@ -72,7 +110,7 @@ nsHTMLContentSink::nsHTMLContentSink() : nsIHTMLContentSink(), mTitle("") {
* @param
* @return
*/
nsHTMLContentSink::~nsHTMLContentSink() {
nsHTMLNullSink::~nsHTMLNullSink() {
}
#ifdef VERBOSE_DEBUG
@ -94,8 +132,8 @@ static void DebugDump(const char* str1,const nsString& str2,PRInt32 tabs) {
* @param
* @return
*/
NS_IMPL_ADDREF(nsHTMLContentSink)
NS_IMPL_RELEASE(nsHTMLContentSink)
NS_IMPL_ADDREF(nsHTMLNullSink)
NS_IMPL_RELEASE(nsHTMLNullSink)
@ -109,24 +147,21 @@ NS_IMPL_RELEASE(nsHTMLContentSink)
* @param
* @return
*/
nsresult nsHTMLContentSink::QueryInterface(const nsIID& aIID, void** aInstancePtr)
nsresult
nsHTMLNullSink::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if(aIID.Equals(kISupportsIID)) { //do IUnknown...
*aInstancePtr = (nsIContentSink*)(this);
if(aIID.Equals(kISupportsIID)) {
*aInstancePtr = (nsIContentSink*)(this);
}
else if(aIID.Equals(kIContentSinkIID)) { //do nsIContentSink base class...
*aInstancePtr = (nsIContentSink*)(this);
else if(aIID.Equals(kIContentSinkIID)) {
*aInstancePtr = (nsIContentSink*)(this);
}
else if(aIID.Equals(kIHTMLContentSinkIID)) { //do nsIHTMLContentSink base class...
*aInstancePtr = (nsIHTMLContentSink*)(this);
else if(aIID.Equals(kIHTMLContentSinkIID)) {
*aInstancePtr = (nsIHTMLContentSink*)(this);
}
else if(aIID.Equals(kClassIID)) { //do this class...
*aInstancePtr = (nsHTMLContentSink*)(this);
}
else {
*aInstancePtr=0;
return NS_NOINTERFACE;
@ -135,6 +170,12 @@ nsresult nsHTMLContentSink::QueryInterface(const nsIID& aIID, void** aInstancePt
return NS_OK;
}
NS_IMETHODIMP
nsHTMLNullSink::PushMark()
{
// XXX We need to defer our output when this occurs
return NS_OK;
}
/**
* This method gets called by the parser when a <HTML>
@ -144,16 +185,14 @@ nsresult nsHTMLContentSink::QueryInterface(const nsIID& aIID, void** aInstancePt
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenHTML(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenHTML(const nsIParserNode& aNode){
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -163,18 +202,18 @@ PRInt32 nsHTMLContentSink::OpenHTML(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseHTML(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -187,15 +226,15 @@ PRInt32 nsHTMLContentSink::CloseHTML(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenHead(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenHead(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -206,17 +245,17 @@ PRInt32 nsHTMLContentSink::OpenHead(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseHead(const nsIParserNode& aNode) {
NS_IMETHODIMP
nsHTMLNullSink::CloseHead(const nsIParserNode& aNode) {
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
@ -227,10 +266,10 @@ PRInt32 nsHTMLContentSink::CloseHead(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::SetTitle(const nsString& aValue){
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::SetTitle(const nsString& aValue){
mTitle=aValue;
return result;
return NS_OK;
}
/**
@ -241,15 +280,15 @@ PRInt32 nsHTMLContentSink::SetTitle(const nsString& aValue){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenBody(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenBody(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
#endif
return result;
return NS_OK;
}
/**
@ -260,16 +299,16 @@ PRInt32 nsHTMLContentSink::OpenBody(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseBody(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseBody(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
@ -280,15 +319,15 @@ PRInt32 nsHTMLContentSink::CloseBody(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenForm(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenForm(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -299,17 +338,57 @@ PRInt32 nsHTMLContentSink::OpenForm(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseForm(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseForm(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
* This method gets called by the parser when a <FORM>
* tag has been consumed.
*
* @updated gess 3/25/98
* @param
* @return
*/
NS_IMETHODIMP
nsHTMLNullSink::OpenMap(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return NS_OK;
}
/**
* This method gets called by the parser when a </FORM>
* tag has been consumed.
*
* @updated gess 3/25/98
* @param
* @return
*/
NS_IMETHODIMP
nsHTMLNullSink::CloseMap(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return NS_OK;
}
/**
@ -320,15 +399,15 @@ PRInt32 nsHTMLContentSink::CloseForm(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenFrameset(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenFrameset(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
#endif
return result;
return NS_OK;
}
/**
@ -339,17 +418,17 @@ PRInt32 nsHTMLContentSink::OpenFrameset(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseFrameset(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
@ -361,15 +440,15 @@ PRInt32 nsHTMLContentSink::CloseFrameset(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenContainer(const nsIParserNode& aNode){
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenContainer(const nsIParserNode& aNode){
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -380,32 +459,17 @@ PRInt32 nsHTMLContentSink::OpenContainer(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseContainer(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseContainer(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
}
/**
* This causes the topmost container to be closed,
* regardless of its type.
*
* @updated gess 3/25/98
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseTopmostContainer(){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[mNodeStackPos--]=eHTMLTag_unknown;
return result;
return NS_OK;
}
/**
@ -417,14 +481,14 @@ PRInt32 nsHTMLContentSink::CloseTopmostContainer(){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::AddLeaf(const nsIParserNode& aNode){
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::AddLeaf(const nsIParserNode& aNode){
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
@ -433,7 +497,9 @@ PRInt32 nsHTMLContentSink::AddLeaf(const nsIParserNode& aNode){
*
* @update 5/7/98 gess
*/
void nsHTMLContentSink::WillBuildModel(void){
NS_IMETHODIMP
nsHTMLNullSink::WillBuildModel(void){
return NS_OK;
}
/**
@ -442,7 +508,9 @@ void nsHTMLContentSink::WillBuildModel(void){
*
* @update 5/7/98 gess
*/
void nsHTMLContentSink::DidBuildModel(PRInt32 aQualityLevel){
NS_IMETHODIMP
nsHTMLNullSink::DidBuildModel(PRInt32 aQualityLevel){
return NS_OK;
}
/**
@ -452,7 +520,9 @@ void nsHTMLContentSink::DidBuildModel(PRInt32 aQualityLevel){
*
* @update 5/7/98 gess
*/
void nsHTMLContentSink::WillInterrupt(void) {
NS_IMETHODIMP
nsHTMLNullSink::WillInterrupt(void) {
return NS_OK;
}
/**
@ -461,7 +531,9 @@ void nsHTMLContentSink::WillInterrupt(void) {
*
* @update 5/7/98 gess
*/
void nsHTMLContentSink::WillResume(void) {
NS_IMETHODIMP
nsHTMLNullSink::WillResume(void) {
return NS_OK;
}

Просмотреть файл

@ -240,7 +240,7 @@ PRBool CStartToken::IsEmpty(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CStartToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CStartToken::Consume(PRUnichar aChar, CScanner& aScanner) {
//if you're here, we've already Consumed the < char, and are
//ready to Consume the rest of the open tag identifier.
@ -248,16 +248,16 @@ PRInt32 CStartToken::Consume(PRUnichar aChar, CScanner& aScanner) {
//NOTE: We don't Consume the tag attributes here, nor do we eat the ">"
mTextValue=aChar;
PRInt32 result=aScanner.ReadWhile(mTextValue,gIdentChars,PR_FALSE);
nsresult result=aScanner.ReadWhile(mTextValue,gIdentChars,PR_FALSE);
//Good. Now, let's skip whitespace after the identifier,
//and see if the next char is ">". If so, we have a complete
//tag without attributes.
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.SkipWhitespace();
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.GetChar(aChar);
if(kNoError==result) {
if(NS_OK==result) {
if(kGreaterThan!=aChar) { //look for '>'
//push that char back, since we apparently have attributes...
aScanner.PutBack(aChar);
@ -305,7 +305,7 @@ CEndToken::CEndToken(const nsString& aName) : CHTMLToken(aName) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CEndToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CEndToken::Consume(PRUnichar aChar, CScanner& aScanner) {
//if you're here, we've already Consumed the <! chars, and are
//ready to Consume the rest of the open tag identifier.
@ -314,8 +314,8 @@ PRInt32 CEndToken::Consume(PRUnichar aChar, CScanner& aScanner) {
mTextValue="";
static nsAutoString terminals(">");
PRInt32 result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
if(kNoError==result)
nsresult result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
if(NS_OK==result)
result=aScanner.GetChar(aChar); //eat the closing '>;
return result;
};
@ -426,9 +426,9 @@ PRInt32 CTextToken::GetTokenType(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CTextToken::Consume(PRUnichar, CScanner& aScanner) {
nsresult CTextToken::Consume(PRUnichar, CScanner& aScanner) {
static nsAutoString terminals("&<\r\n");
PRInt32 result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
nsresult result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
return result;
};
@ -453,10 +453,10 @@ CCommentToken::CCommentToken(const nsString& aName) : CHTMLToken(aName) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CCommentToken::Consume(PRUnichar, CScanner& aScanner) {
nsresult CCommentToken::Consume(PRUnichar, CScanner& aScanner) {
PRUnichar ch,ch2;
PRInt32 result=kNoError;
nsresult result=NS_OK;
static nsAutoString terminals(">");
@ -464,12 +464,12 @@ PRInt32 CCommentToken::Consume(PRUnichar, CScanner& aScanner) {
mTextValue="<!";
if(kMinus==ch) {
result=aScanner.GetChar(ch2);
if(kNoError==result) {
if(NS_OK==result) {
if(kMinus==ch2) {
//in this case, we're reading a long-form comment <-- xxx -->
mTextValue+="--";
PRInt32 findpos=-1;
while((findpos==kNotFound) && (kNoError==result)) {
while((findpos==kNotFound) && (NS_OK==result)) {
result=aScanner.ReadUntil(mTextValue,terminals,PR_TRUE);
findpos=mTextValue.RFind("-->");
}
@ -557,14 +557,14 @@ nsString& CNewlineToken::GetText(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CNewlineToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CNewlineToken::Consume(PRUnichar aChar, CScanner& aScanner) {
mTextValue=aChar;
//we already read the \r or \n, let's see what's next!
PRUnichar nextChar;
PRInt32 result=aScanner.Peek(nextChar);
nsresult result=aScanner.Peek(nextChar);
if(kNoError==result) {
if(NS_OK==result) {
switch(aChar) {
case kNewLine:
if(kCR==nextChar) {
@ -704,21 +704,21 @@ PRInt32 ConsumeAttributeValueText(PRUnichar,nsString& aString,CScanner& aScanner
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CAttributeToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CAttributeToken::Consume(PRUnichar aChar, CScanner& aScanner) {
aScanner.SkipWhitespace(); //skip leading whitespace
PRInt32 result=aScanner.Peek(aChar);
if(kNoError==result) {
nsresult result=aScanner.Peek(aChar);
if(NS_OK==result) {
if(kQuote==aChar) { //if you're here, handle quoted key...
result=aScanner.GetChar(aChar); //skip the quote sign...
if(kNoError==result) {
if(NS_OK==result) {
mTextKey=aChar;
result=ConsumeQuotedString(aChar,mTextKey,aScanner);
}
}
else if(kHashsign==aChar) {
result=aScanner.GetChar(aChar); //skip the hash sign...
if(kNoError==result) {
if(NS_OK==result) {
mTextKey=aChar;
result=aScanner.ReadWhile(mTextKey,gDigits,PR_TRUE);
}
@ -731,15 +731,15 @@ PRInt32 CAttributeToken::Consume(PRUnichar aChar, CScanner& aScanner) {
}
//now it's time to Consume the (optional) value...
if(!(result=aScanner.SkipWhitespace())) {
if(!(result=aScanner.Peek(aChar))) {
if(NS_OK == (result=aScanner.SkipWhitespace())) {
if(NS_OK == (result=aScanner.Peek(aChar))) {
if(kEqual==aChar){
result=aScanner.GetChar(aChar); //skip the equal sign...
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.SkipWhitespace(); //now skip any intervening whitespace
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.GetChar(aChar); //and grab the next char.
if(kNoError==result) {
if(NS_OK==result) {
if((kQuote==aChar) || (kApostrophe==aChar)) {
mTextValue=aChar;
result=ConsumeQuotedString(aChar,mTextValue,aScanner);
@ -749,14 +749,14 @@ PRInt32 CAttributeToken::Consume(PRUnichar aChar, CScanner& aScanner) {
result=ConsumeAttributeValueText(aChar,mTextValue,aScanner);
}
}//if
if(kNoError==result)
if(NS_OK==result)
result=aScanner.SkipWhitespace();
}//if
}//if
}//if
}//if
}
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.Peek(aChar);
mLastAttribute= PRBool((kGreaterThan==aChar) || (kEOF==result));
}
@ -826,12 +826,12 @@ PRInt32 CWhitespaceToken::GetTokenType(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CWhitespaceToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CWhitespaceToken::Consume(PRUnichar aChar, CScanner& aScanner) {
mTextValue=aChar;
PRInt32 result=aScanner.ReadWhile(mTextValue,gWhitespace,PR_FALSE);
if(kNoError==result) {
nsresult result=aScanner.ReadWhile(mTextValue,gWhitespace,PR_FALSE);
if(NS_OK==result) {
mTextValue.StripChars("\r");
}
return result;
@ -861,10 +861,10 @@ CEntityToken::CEntityToken(const nsString& aName) : CHTMLToken(aName) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CEntityToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CEntityToken::Consume(PRUnichar aChar, CScanner& aScanner) {
if(aChar)
mTextValue=aChar;
PRInt32 result=ConsumeEntity(aChar,mTextValue,aScanner);
nsresult result=ConsumeEntity(aChar,mTextValue,aScanner);
return result;
}
@ -1198,13 +1198,13 @@ PRInt32 CSkippedContentToken::GetTokenType(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CSkippedContentToken::Consume(PRUnichar,CScanner& aScanner) {
nsresult CSkippedContentToken::Consume(PRUnichar,CScanner& aScanner) {
PRBool done=PR_FALSE;
PRInt32 result=kNoError;
nsresult result=NS_OK;
nsString temp;
// while((!done) && (!aScanner.Eof())) {
while((!done) && (kNoError==result)) {
while((!done) && (NS_OK==result)) {
static nsAutoString terminals(">");
result=aScanner.ReadUntil(temp,terminals,PR_TRUE);
done=PRBool(kNotFound!=temp.RFind(mTextValue,PR_TRUE));

Просмотреть файл

@ -80,7 +80,7 @@ class CStartToken: public CHTMLToken {
public:
CStartToken(eHTMLTags aTag);
CStartToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual PRInt32 GetTypeID(void);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
@ -106,7 +106,7 @@ class CStartToken: public CHTMLToken {
class CEndToken: public CHTMLToken {
public:
CEndToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual PRInt32 GetTypeID(void);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
@ -125,7 +125,7 @@ class CEndToken: public CHTMLToken {
class CCommentToken: public CHTMLToken {
public:
CCommentToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
char mLeadingChar;
@ -145,7 +145,7 @@ class CEntityToken : public CHTMLToken {
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
PRInt32 TranslateToUnicodeStr(nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
static PRInt32 ConsumeEntity(PRUnichar aChar,nsString& aString,CScanner& aScanner);
static PRInt32 TranslateToUnicodeStr(PRInt32 aValue,nsString& aString);
static PRInt32 FindEntityIndex(nsString& aString);
@ -169,7 +169,7 @@ class CEntityToken : public CHTMLToken {
class CWhitespaceToken: public CHTMLToken {
public:
CWhitespaceToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
};
@ -184,7 +184,7 @@ class CWhitespaceToken: public CHTMLToken {
class CTextToken: public CHTMLToken {
public:
CTextToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
};
@ -202,7 +202,7 @@ class CAttributeToken: public CHTMLToken {
public:
CAttributeToken(const nsString& aString);
CAttributeToken(const nsString& aKey, const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual nsString& GetKey(void) {return mTextKey;}
@ -224,7 +224,7 @@ class CAttributeToken: public CHTMLToken {
class CNewlineToken: public CHTMLToken {
public:
CNewlineToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual nsString& GetText(void);
@ -276,7 +276,7 @@ class CStyleToken: public CHTMLToken {
class CSkippedContentToken: public CAttributeToken {
public:
CSkippedContentToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
protected:

Просмотреть файл

@ -1,20 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsIContentSink_h___
#define nsIContentSink_h___
/**
* MODULE NOTES:
@ -24,95 +27,76 @@
* This pure virtual interface is used as the "glue" that
* connects the parsing process to the content model
* construction process.
*
*/
#ifndef ICONTENTSINK
#define ICONTENTSINK
#include "nsIParserNode.h"
#include "nsISupports.h"
#define NS_ICONTENTSINK_IID \
{0x4c2f7e34, 0xc286, 0x11d1, \
{0x80, 0x22, 0x00, 0x60, 0x08, 0x14, 0x98, 0x89}}
#define NS_ICONTENT_SINK_IID \
{ 0xa6cf9052, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
class nsIContentSink : public nsISupports {
public:
/**
* This method is used to open a generic container in the sink.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenContainer(const nsIParserNode& aNode) = 0;
/**
* This method gets called by the parser when a close
* container tag has been consumed and needs to be closed.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseContainer(const nsIParserNode& aNode) = 0;
/**
* This gets called by the parser when you want to add
* a leaf node to the current container in the content
* model.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 AddLeaf(const nsIParserNode& aNode) = 0;
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
public:
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
*/
virtual void WillBuildModel(void)=0;
/**
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
virtual void DidBuildModel(PRInt32 aQualityLevel)=0;
NS_IMETHOD WillBuildModel(void)=0;
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel)=0;
virtual void WillInterrupt(void)=0;
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
*/
NS_IMETHOD WillInterrupt(void)=0;
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
virtual void WillResume(void)=0;
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
NS_IMETHOD WillResume(void)=0;
/**
* This method is used to open a generic container in the sink.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenContainer(const nsIParserNode& aNode) = 0;
/**
* This method gets called by the parser when a close
* container tag has been consumed and needs to be closed.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseContainer(const nsIParserNode& aNode) = 0;
/**
* This gets called by the parser when you want to add
* a leaf node to the current container in the content
* model.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD AddLeaf(const nsIParserNode& aNode) = 0;
};
extern nsresult NS_NewHTMLContentSink(nsIContentSink** aInstancePtrResult);
#endif
#endif /* nsIContentSink_h___ */

Просмотреть файл

@ -15,6 +15,8 @@
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIDTD_h___
#define nsIDTD_h___
/**
* MODULE NOTES:
@ -22,18 +24,12 @@
*
*
*/
#ifndef NS_IDTD__
#define NS_IDTD__
#include "nshtmlpars.h"
#include "nsISupports.h"
#include "prtypes.h"
#define NS_IDTD_IID \
{0x75634940, 0xcfdc, 0x11d1, \
{0xaa, 0xda, 0x00, 0x80, 0x5f, 0x8a, 0x3e, 0x14}}
#define NS_IDTD_IID \
{ 0xa6cf9053, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
class nsIParser;
class CToken;
@ -44,20 +40,7 @@ class nsString;
enum eAutoDetectResult {eUnknownDetect, eValidDetect, eInvalidDetect};
// XXX: Disable warning message about nsISupports not being exported. I *believe* this
// to be a harmless warning message on windows, a better fix would be to export
// the nsISupports interface.
#if defined(XP_PC)
#pragma warning( disable : 4275 )
#endif
CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
#if defined(XP_PC)
#pragma warning( default : 4275 )
#endif
class nsIDTD : public nsISupports {
public:
/**
@ -112,7 +95,7 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename)=0;
NS_IMETHOD WillBuildModel(nsString& aFilename)=0;
/**
*
@ -120,27 +103,22 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode)=0;
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode)=0;
/**
*
* @update gess 3/25/98
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken)=0;
NS_IMETHOD HandleToken(CToken* aToken)=0;
/**
* Cause the tokenizer to consume the next token, and
* return an error result.
*
* @update gess 3/25/98
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken)=0;
NS_IMETHOD ConsumeToken(CToken*& aToken)=0;
/**
*
@ -148,7 +126,7 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
* @param
* @return
*/
virtual void WillResumeParse(void)=0;
NS_IMETHOD WillResumeParse(void)=0;
/**
*
@ -156,7 +134,7 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
* @param
* @return
*/
virtual void WillInterruptParse(void)=0;
NS_IMETHOD WillInterruptParse(void)=0;
/**
* This method is called to determine whether or not a tag
@ -169,7 +147,6 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
*/
virtual PRBool CanContain(PRInt32 aParent,PRInt32 aChild)=0;
/**
*
* @update jevering6/23/98
@ -179,8 +156,4 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
virtual void SetDTDDebug(nsIDTDDebug * aDTDDebug) = 0;
};
#endif
#endif /* nsIDTD_h___ */

Просмотреть файл

@ -1,20 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsIHTMLContentSink_h___
#define nsIHTMLContentSink_h___
/**
* MODULE NOTES:
@ -34,8 +37,8 @@
* The HTMLContentSink interface assumes 4 underlying
* containers: HTML, HEAD, BODY and FRAMESET. Before
* accessing any these, the parser will call the appropriate
* OpenXXX method: OpenHTML,OpenHead,OpenBody,OpenFrameSet;
* likewise, the CloseXXX version will be called when the
* OpennsIHTMLContentSink method: OpenHTML,OpenHead,OpenBody,OpenFrameSet;
* likewise, the ClosensIHTMLContentSink version will be called when the
* parser is done with a given section.
*
* IMPORTANT: The parser may Open each container more than
@ -60,190 +63,126 @@
* NOTE: I haven't figured out how sub-documents (non-frames)
* are going to be handled. Stay tuned.
*/
#ifndef NS_IHTMLCONTENTSINK
#define NS_IHTMLCONTENTSINK
#include "nsIParserNode.h"
#include "nsIContentSink.h"
#define NS_IHTMLCONTENTSINK_IID \
{0xd690e200, 0xc286, 0x11d1, \
{0x80, 0x22, 0x00, 0x60, 0x08, 0x14, 0x98, 0x89}}
#define NS_IHTML_CONTENT_SINK_IID \
{ 0xa6cf9051, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
class nsIHTMLContentSink : public nsIContentSink {
public:
public:
/**
* This method is called to inform the content sink to push a
* new mark.
*/
NS_IMETHOD PushMark(void) = 0;
/**
* This method gets called by the parser when it encounters
* a title tag and wants to set the document title in the sink.
*
* @update 4/1/98 gess
* @param nsString reference to new title value
* @return PR_TRUE if successful.
*/
virtual PRBool SetTitle(const nsString& aValue)=0;
/**
* This method gets called by the parser when it encounters
* a title tag and wants to set the document title in the sink.
*
* @update 4/1/98 gess
* @param nsString reference to new title value
*/
NS_IMETHOD SetTitle(const nsString& aValue)=0;
/**
* This method is used to open the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenHTML(const nsIParserNode& aNode)=0;
/**
* This method is used to open the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenHTML(const nsIParserNode& aNode)=0;
/**
* This method is used to close the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseHTML(const nsIParserNode& aNode)=0;
/**
* This method is used to close the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseHTML(const nsIParserNode& aNode)=0;
/**
* This method is used to open the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenHead(const nsIParserNode& aNode)=0;
/**
* This method is used to open the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenHead(const nsIParserNode& aNode)=0;
/**
* This method is used to close the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseHead(const nsIParserNode& aNode)=0;
/**
* This method is used to close the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseHead(const nsIParserNode& aNode)=0;
/**
* This method is used to open the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenBody(const nsIParserNode& aNode)=0;
/**
* This method is used to open the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenBody(const nsIParserNode& aNode)=0;
/**
* This method is used to close the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseBody(const nsIParserNode& aNode)=0;
/**
* This method is used to close the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseBody(const nsIParserNode& aNode)=0;
/**
* This method is used to open a new FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenForm(const nsIParserNode& aNode)=0;
/**
* This method is used to open a new FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenForm(const nsIParserNode& aNode)=0;
/**
* This method is used to close the outer FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseForm(const nsIParserNode& aNode)=0;
/**
* This method is used to close the outer FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseForm(const nsIParserNode& aNode)=0;
/**
* This method is used to open a new MAP container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenMap(const nsIParserNode& aNode)=0;
/**
* This method is used to close the MAP container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseMap(const nsIParserNode& aNode)=0;
/**
* This method is used to open the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenFrameset(const nsIParserNode& aNode)=0;
/**
* This method is used to close the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseFrameset(const nsIParserNode& aNode)=0;
/**
* This method is used to a general container.
* This includes: OL,UL,DIR,SPAN,TABLE,H[1..6],etc.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenContainer(const nsIParserNode& aNode)=0;
/**
* This method is used to close a generic container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseContainer(const nsIParserNode& aNode)=0;
/**
* This method is used to add a leaf to the currently
* open container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 AddLeaf(const nsIParserNode& aNode)=0;
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
*/
virtual void WillBuildModel(void)=0;
/**
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
virtual void DidBuildModel(PRInt32 aQualityLevel)=0;
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
*/
virtual void WillInterrupt(void)=0;
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
virtual void WillResume(void)=0;
/**
* This method is used to open the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode)=0;
/**
* This method is used to close the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode)=0;
};
extern nsresult NS_NewHTMLNullSink(nsIContentSink** aInstancePtrResult);
#endif
#endif /* nsIHTMLContentSink_h___ */

Просмотреть файл

@ -30,7 +30,7 @@
#include "nsIDTDDebug.h"
#include "nshtmlpars.h"
#define rickgdebug 1
#undef rickgdebug
#ifdef rickgdebug
#include "CRtfDTD.h"
#include "nsWellFormedDTD.h"

Просмотреть файл

@ -32,6 +32,7 @@
* ===========================================================*/
#include "prtypes.h"
#include "nsError.h"
enum eParseMode {
@ -50,7 +51,7 @@ const PRInt32 kBadFilename = -4;
const PRInt32 kBadURL = -3;
const PRInt32 kInterrupted = -2;
const PRInt32 kNotFound = -1;
const PRInt32 kNoError = 0;
const PRInt32 kNoError = NS_OK;
const PRUint32 kNewLine = '\n';
const PRUint32 kCR = '\r';

Просмотреть файл

@ -192,8 +192,8 @@ PRBool CScanner::Append(const char* aBuffer, PRInt32 aLen){
* @update gess4/3/98
* @return error code
*/
PRInt32 CScanner::FillBuffer(void) {
PRInt32 anError=0;
nsresult CScanner::FillBuffer(void) {
nsresult anError=NS_OK;
_PreCompressBuffer(mBuffer,mOffset,mMarkPos);
@ -233,15 +233,18 @@ PRInt32 CScanner::FillBuffer(void) {
* @param
* @return 0=!eof 1=eof kInterrupted=interrupted
*/
PRInt32 CScanner::Eof() {
PRInt32 theError=0;
nsresult CScanner::Eof() {
nsresult theError=NS_OK;
if(mOffset>=mBuffer.Length()) {
theError=FillBuffer();
}
if(0==theError)
return (0==mBuffer.Length());
if(NS_OK==theError) {
if (0==mBuffer.Length()) {
return kEOF;
}
}
return theError;
}
@ -253,11 +256,10 @@ PRInt32 CScanner::Eof() {
* @param
* @return error code reflecting read status
*/
PRInt32 CScanner::GetChar(PRUnichar& aChar) {
PRInt32 result=Eof();
if(!result) {
nsresult CScanner::GetChar(PRUnichar& aChar) {
nsresult result=Eof();
if(NS_OK == result) {
aChar=mBuffer[mOffset++];
result=kNoError;
}
return result;
}
@ -271,11 +273,10 @@ PRInt32 CScanner::GetChar(PRUnichar& aChar) {
* @param
* @return
*/
PRInt32 CScanner::Peek(PRUnichar& aChar) {
PRInt32 result=Eof();
if(!result) {
nsresult CScanner::Peek(PRUnichar& aChar) {
nsresult result=Eof();
if(NS_OK == result) {
aChar=mBuffer[mOffset];
result=kNoError;
}
return result;
}
@ -288,11 +289,11 @@ PRInt32 CScanner::Peek(PRUnichar& aChar) {
* @param
* @return error code
*/
PRInt32 CScanner::PutBack(PRUnichar aChar) {
nsresult CScanner::PutBack(PRUnichar aChar) {
if(mOffset>0)
mOffset--;
else mBuffer.Insert(aChar,0);
return kNoError;
return NS_OK;
}
@ -303,7 +304,7 @@ PRInt32 CScanner::PutBack(PRUnichar aChar) {
* @param
* @return error status
*/
PRInt32 CScanner::SkipWhitespace(void) {
nsresult CScanner::SkipWhitespace(void) {
static nsAutoString chars(" \n\r\t");
return SkipOver(chars);
}
@ -315,13 +316,13 @@ PRInt32 CScanner::SkipWhitespace(void) {
* @param
* @return error code
*/
PRInt32 CScanner::SkipOver(PRUnichar aSkipChar){
nsresult CScanner::SkipOver(PRUnichar aSkipChar){
PRUnichar ch=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
while(kNoError==result) {
while(NS_OK==result) {
result=GetChar(ch);
if(!result) {
if(NS_OK == result) {
if(ch!=aSkipChar) {
PutBack(ch);
break;
@ -339,13 +340,13 @@ PRInt32 CScanner::SkipOver(PRUnichar aSkipChar){
* @param
* @return error code
*/
PRInt32 CScanner::SkipOver(nsString& aSkipSet){
nsresult CScanner::SkipOver(nsString& aSkipSet){
PRUnichar ch=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
while(kNoError==result) {
while(NS_OK==result) {
result=GetChar(ch);
if(!result) {
if(NS_OK == result) {
PRInt32 pos=aSkipSet.Find(ch);
if(kNotFound==pos) {
PutBack(ch);
@ -364,9 +365,9 @@ PRInt32 CScanner::SkipOver(nsString& aSkipSet){
* @param
* @return error code
*/
PRInt32 CScanner::SkipPast(nsString& aValidSet){
nsresult CScanner::SkipPast(nsString& aValidSet){
NS_NOTYETIMPLEMENTED("Error: SkipPast not yet implemented.");
return kNoError;
return NS_OK;
}
/**
@ -377,14 +378,16 @@ PRInt32 CScanner::SkipPast(nsString& aValidSet){
* @param
* @return error code
*/
PRInt32 CScanner::ReadWhile(nsString& aString,nsString& aValidSet,PRBool addTerminal){
nsresult CScanner::ReadWhile(nsString& aString,
nsString& aValidSet,
PRBool addTerminal){
PRUnichar theChar=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
PRInt32 wrPos=0;
while(kNoError==result) {
while(NS_OK==result) {
result=GetChar(theChar);
if(kNoError==result) {
if(NS_OK==result) {
PRInt32 pos=aValidSet.Find(theChar);
if(kNotFound==pos) {
if(addTerminal)
@ -407,13 +410,15 @@ PRInt32 CScanner::ReadWhile(nsString& aString,nsString& aValidSet,PRBool addTerm
* @param
* @return error code
*/
PRInt32 CScanner::ReadUntil(nsString& aString,nsString& aTerminalSet,PRBool addTerminal){
nsresult CScanner::ReadUntil(nsString& aString,
nsString& aTerminalSet,
PRBool addTerminal){
PRUnichar ch=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
while(!result) {
while(NS_OK == result) {
result=GetChar(ch);
if(kNoError==result) {
if(NS_OK==result) {
PRInt32 pos=aTerminalSet.Find(ch);
if(kNotFound!=pos) {
if(addTerminal)
@ -435,11 +440,13 @@ PRInt32 CScanner::ReadUntil(nsString& aString,nsString& aTerminalSet,PRBool addT
* @param
* @return error code
*/
PRInt32 CScanner::ReadUntil(nsString& aString,PRUnichar aTerminalChar,PRBool addTerminal){
nsresult CScanner::ReadUntil(nsString& aString,
PRUnichar aTerminalChar,
PRBool addTerminal){
PRUnichar ch=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
while(kNoError==result) {
while(NS_OK==result) {
result=GetChar(ch);
if(ch==aTerminalChar) {
if(addTerminal)

Просмотреть файл

@ -70,7 +70,7 @@ class CScanner {
* @param ch is the char to accept new value
* @return error code reflecting read status
*/
PRInt32 GetChar(PRUnichar& ch);
nsresult GetChar(PRUnichar& ch);
/**
* peek ahead to consume next char from scanner's internal
@ -80,7 +80,7 @@ class CScanner {
* @param ch is the char to accept new value
* @return error code reflecting read status
*/
PRInt32 Peek(PRUnichar& ch);
nsresult Peek(PRUnichar& ch);
/**
* Push the given char back onto the scanner
@ -89,7 +89,7 @@ class CScanner {
* @param character to be pushed
* @return error code
*/
PRInt32 PutBack(PRUnichar ch);
nsresult PutBack(PRUnichar ch);
/**
* Skip over chars as long as they're in aSkipSet
@ -98,7 +98,7 @@ class CScanner {
* @param set of chars to be skipped
* @return error code
*/
PRInt32 SkipOver(nsString& SkipChars);
nsresult SkipOver(nsString& SkipChars);
/**
* Skip over chars as long as they equal given char
@ -107,7 +107,7 @@ class CScanner {
* @param char to be skipped
* @return error code
*/
PRInt32 SkipOver(PRUnichar aSkipChar);
nsresult SkipOver(PRUnichar aSkipChar);
/**
* Skip over chars as long as they're in aSequence
@ -116,7 +116,7 @@ class CScanner {
* @param contains sequence to be skipped
* @return error code
*/
PRInt32 SkipPast(nsString& aSequence);
nsresult SkipPast(nsString& aSequence);
/**
* Skip whitespace on scanner input stream
@ -124,7 +124,7 @@ class CScanner {
* @update gess 3/25/98
* @return error status
*/
PRInt32 SkipWhitespace(void);
nsresult SkipWhitespace(void);
/**
* Determine if the scanner has reached EOF.
@ -134,7 +134,7 @@ class CScanner {
* @update gess 3/25/98
* @return PR_TRUE upon eof condition
*/
PRInt32 Eof(void);
nsresult Eof(void);
/**
* Consume characters until you find the terminal char
@ -145,7 +145,7 @@ class CScanner {
* @param addTerminal tells us whether to append terminal to aString
* @return error code
*/
PRInt32 ReadUntil(nsString& aString,PRUnichar aTerminal,PRBool addTerminal);
nsresult ReadUntil(nsString& aString,PRUnichar aTerminal,PRBool addTerminal);
/**
* Consume characters until you find one contained in given
@ -157,7 +157,7 @@ class CScanner {
* @param addTerminal tells us whether to append terminal to aString
* @return error code
*/
PRInt32 ReadUntil(nsString& aString,nsString& aTermSet,PRBool addTerminal);
nsresult ReadUntil(nsString& aString,nsString& aTermSet,PRBool addTerminal);
/**
* Consume characters while they're members of anInputSet
@ -168,7 +168,7 @@ class CScanner {
* @param addTerminal tells us whether to append terminal to aString
* @return error code
*/
PRInt32 ReadWhile(nsString& aString,nsString& anInputSet,PRBool addTerminal);
nsresult ReadWhile(nsString& aString,nsString& anInputSet,PRBool addTerminal);
/**
* Records current offset position in input stream. This allows us
@ -240,10 +240,8 @@ class CScanner {
* be filled with data.
*
* @update gess4/3/98
* @param anError is the resulting error code (hopefully 0)
* @return number of new bytes read
*/
PRInt32 FillBuffer(void);
nsresult FillBuffer(void);
fstream* mFileStream;

Просмотреть файл

@ -59,8 +59,8 @@ CToken::~CToken() {
* @param aScanner -- object to retrieve data from
* @return int error code
*/
PRInt32 CToken::Consume(PRUnichar aChar,CScanner& aScanner) {
PRInt32 result=kNoError;
nsresult CToken::Consume(PRUnichar aChar,CScanner& aScanner) {
nsresult result=NS_OK;
return result;
}

Просмотреть файл

@ -130,7 +130,7 @@ class CToken {
* @param aScanner -- input source where token should get data
* @return error code (0 means ok)
*/
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
/**
* Causes token to dump itself in debug form to given output stream

Просмотреть файл

@ -190,8 +190,8 @@ eAutoDetectResult CValidDTD::AutoDetectContentType(nsString& aBuffer,nsString& a
* @param
* @return
*/
PRInt32 CValidDTD::WillBuildModel(nsString& aFilename){
PRInt32 result=0;
NS_IMETHODIMP CValidDTD::WillBuildModel(nsString& aFilename){
nsresult result=NS_OK;
return result;
}
@ -201,8 +201,8 @@ PRInt32 CValidDTD::WillBuildModel(nsString& aFilename){
* @param
* @return
*/
PRInt32 CValidDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
NS_IMETHODIMP CValidDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result=NS_OK;
return result;
}
@ -249,12 +249,12 @@ nsIContentSink* CValidDTD::SetContentSink(nsIContentSink* aSink) {
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CValidDTD::ConsumeToken(CToken*& aToken){
NS_IMETHODIMP CValidDTD::ConsumeToken(CToken*& aToken){
CScanner* theScanner=mParser->GetScanner();
PRUnichar aChar;
PRInt32 result=theScanner->GetChar(aChar);
nsresult result=theScanner->GetChar(aChar);
switch(result) {
case kEOF:
@ -264,7 +264,7 @@ PRInt32 CValidDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(aChar) {
case kLessThan:
@ -273,7 +273,7 @@ PRInt32 CValidDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
return result;
}
@ -284,8 +284,8 @@ PRInt32 CValidDTD::ConsumeToken(CToken*& aToken){
* @param
* @return
*/
void CValidDTD::WillResumeParse(void){
return;
NS_IMETHODIMP CValidDTD::WillResumeParse(void){
return NS_OK;
}
/**
@ -294,8 +294,8 @@ void CValidDTD::WillResumeParse(void){
* @param
* @return
*/
void CValidDTD::WillInterruptParse(void){
return;
NS_IMETHODIMP CValidDTD::WillInterruptParse(void){
return NS_OK;
}
/**
@ -327,8 +327,8 @@ PRBool CValidDTD::CanContain(PRInt32 aParent,PRInt32 aChild){
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
PRInt32 CValidDTD::HandleToken(CToken* aToken) {
PRInt32 result=0;
NS_IMETHODIMP CValidDTD::HandleToken(CToken* aToken) {
nsresult result=NS_OK;
return result;
}

Просмотреть файл

@ -108,7 +108,7 @@ class CValidDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename);
NS_IMETHOD WillBuildModel(nsString& aFilename);
/**
*
@ -116,7 +116,7 @@ class CValidDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -124,7 +124,7 @@ class CValidDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -143,7 +143,7 @@ class CValidDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -152,7 +152,7 @@ class CValidDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -160,7 +160,7 @@ class CValidDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* Select given content sink into parser for parser output

Просмотреть файл

@ -177,8 +177,8 @@ eAutoDetectResult CWellFormedDTD::AutoDetectContentType(nsString& aBuffer,nsStri
* @param
* @return
*/
PRInt32 CWellFormedDTD::WillBuildModel(nsString& aFilename){
PRInt32 result=0;
NS_IMETHODIMP CWellFormedDTD::WillBuildModel(nsString& aFilename){
nsresult result=NS_OK;
return result;
}
@ -188,8 +188,8 @@ PRInt32 CWellFormedDTD::WillBuildModel(nsString& aFilename){
* @param
* @return
*/
PRInt32 CWellFormedDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
NS_IMETHODIMP CWellFormedDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result=NS_OK;
return result;
}
@ -236,12 +236,12 @@ nsIContentSink* CWellFormedDTD::SetContentSink(nsIContentSink* aSink) {
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CWellFormedDTD::ConsumeToken(CToken*& aToken){
NS_IMETHODIMP CWellFormedDTD::ConsumeToken(CToken*& aToken){
CScanner* theScanner=mParser->GetScanner();
PRUnichar aChar;
PRInt32 result=theScanner->GetChar(aChar);
nsresult result=theScanner->GetChar(aChar);
switch(result) {
case kEOF:
@ -251,7 +251,7 @@ PRInt32 CWellFormedDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(aChar) {
case kLessThan:
@ -260,7 +260,7 @@ PRInt32 CWellFormedDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
return result;
}
@ -271,8 +271,8 @@ PRInt32 CWellFormedDTD::ConsumeToken(CToken*& aToken){
* @param
* @return
*/
void CWellFormedDTD::WillResumeParse(void){
return;
NS_IMETHODIMP CWellFormedDTD::WillResumeParse(void){
return NS_OK;
}
/**
@ -281,8 +281,8 @@ void CWellFormedDTD::WillResumeParse(void){
* @param
* @return
*/
void CWellFormedDTD::WillInterruptParse(void){
return;
NS_IMETHODIMP CWellFormedDTD::WillInterruptParse(void){
return NS_OK;
}
/**
@ -314,8 +314,8 @@ PRBool CWellFormedDTD::CanContain(PRInt32 aParent,PRInt32 aChild){
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
PRInt32 CWellFormedDTD::HandleToken(CToken* aToken) {
PRInt32 result=0;
NS_IMETHODIMP CWellFormedDTD::HandleToken(CToken* aToken) {
nsresult result=NS_OK;
return result;
}

Просмотреть файл

@ -97,7 +97,7 @@ class CWellFormedDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename);
NS_IMETHOD WillBuildModel(nsString& aFilename);
/**
*
@ -105,7 +105,7 @@ class CWellFormedDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -113,7 +113,7 @@ class CWellFormedDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -132,7 +132,7 @@ class CWellFormedDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -141,7 +141,7 @@ class CWellFormedDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -149,7 +149,7 @@ class CWellFormedDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* Select given content sink into parser for parser output

Просмотреть файл

@ -397,8 +397,8 @@ eAutoDetectResult nsXIFDTD::AutoDetectContentType(nsString& aBuffer,nsString& aT
* @param
* @return
*/
PRInt32 nsXIFDTD::WillBuildModel(nsString& aFileName){
PRInt32 result=0;
nsresult nsXIFDTD::WillBuildModel(nsString& aFileName){
nsresult result=NS_OK;
if(mSink)
{
@ -422,12 +422,12 @@ PRInt32 nsXIFDTD::WillBuildModel(nsString& aFileName){
* @param
* @return
*/
PRInt32 nsXIFDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
nsresult nsXIFDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result=NS_OK;
if(mSink)
{
mSink->DidBuildModel(anErrorCode);
result = mSink->DidBuildModel(anErrorCode);
if (mOut != nsnull)
{
@ -452,8 +452,8 @@ PRInt32 nsXIFDTD::DidBuildModel(PRInt32 anErrorCode){
* @param aParser
* @return
*/
PRInt32 nsXIFDTD::HandleToken(CToken* aToken){
PRInt32 result=0;
nsresult nsXIFDTD::HandleToken(CToken* aToken){
nsresult result=NS_OK;
if(aToken) {
CHTMLToken* theToken= (CHTMLToken*)(aToken);
@ -1621,7 +1621,7 @@ PRInt32 nsXIFDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 nsXIFDTD::ConsumeToken(CToken*& aToken){
nsresult nsXIFDTD::ConsumeToken(CToken*& aToken){
aToken=0;
if(mTokenDeque.GetSize()>0) {
@ -1629,9 +1629,9 @@ PRInt32 nsXIFDTD::ConsumeToken(CToken*& aToken){
return kNoError;
}
PRInt32 result=kNoError;
nsresult result=NS_OK;
CScanner* theScanner=mParser->GetScanner();
if(kNoError==result){
if(NS_OK==result){
PRUnichar aChar;
result=theScanner->GetChar(aChar);
@ -1643,7 +1643,7 @@ PRInt32 nsXIFDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(aChar) {
case kLessThan:
@ -1668,7 +1668,7 @@ PRInt32 nsXIFDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
} //while
return result;
@ -1691,11 +1691,12 @@ CToken* nsXIFDTD::CreateTokenOfType(eHTMLTokenTypes aType) {
* @param
* @return
*/
void nsXIFDTD::WillResumeParse(void){
nsresult nsXIFDTD::WillResumeParse(void){
nsresult result = NS_OK;
if(mSink) {
mSink->WillResume();
result = mSink->WillResume();
}
return;
return result;
}
/**
@ -1704,11 +1705,12 @@ void nsXIFDTD::WillResumeParse(void){
* @param
* @return
*/
void nsXIFDTD::WillInterruptParse(void){
nsresult nsXIFDTD::WillInterruptParse(void){
nsresult result = NS_OK;
if(mSink) {
mSink->WillInterrupt();
result = mSink->WillInterrupt();
}
return;
return result;
}

Просмотреть файл

@ -154,7 +154,7 @@ class nsXIFDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFileName);
NS_IMETHOD WillBuildModel(nsString& aFileName);
/**
*
@ -162,7 +162,7 @@ class nsXIFDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 aQualityLevel);
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel);
/**
*
@ -170,7 +170,7 @@ class nsXIFDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -189,7 +189,7 @@ class nsXIFDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -198,7 +198,7 @@ class nsXIFDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -206,7 +206,7 @@ class nsXIFDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
*

Просмотреть файл

@ -34,7 +34,7 @@ class nsIDocument;
// - LAYER SRC
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTMLCONTENTSINK_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
static NS_DEFINE_IID(kIRobotSinkIID, NS_IROBOTSINK_IID);
class RobotSink : public nsIRobotSink {
@ -52,25 +52,28 @@ public:
NS_DECL_ISUPPORTS
// nsIHTMLContentSink
virtual PRInt32 SetTitle(const nsString& aValue);
virtual PRInt32 OpenHTML(const nsIParserNode& aNode);
virtual PRInt32 CloseHTML(const nsIParserNode& aNode);
virtual PRInt32 OpenHead(const nsIParserNode& aNode);
virtual PRInt32 CloseHead(const nsIParserNode& aNode);
virtual PRInt32 OpenBody(const nsIParserNode& aNode);
virtual PRInt32 CloseBody(const nsIParserNode& aNode);
virtual PRInt32 OpenForm(const nsIParserNode& aNode);
virtual PRInt32 CloseForm(const nsIParserNode& aNode);
virtual PRInt32 OpenFrameset(const nsIParserNode& aNode);
virtual PRInt32 CloseFrameset(const nsIParserNode& aNode);
virtual PRInt32 OpenContainer(const nsIParserNode& aNode);
virtual PRInt32 CloseContainer(const nsIParserNode& aNode);
virtual PRInt32 CloseTopmostContainer();
virtual PRInt32 AddLeaf(const nsIParserNode& aNode);
virtual void WillBuildModel(void) { }
virtual void DidBuildModel(PRInt32 aQualityLevel) { }
virtual void WillInterrupt(void) { }
virtual void WillResume(void) { }
NS_IMETHOD PushMark();
NS_IMETHOD SetTitle(const nsString& aValue);
NS_IMETHOD OpenHTML(const nsIParserNode& aNode);
NS_IMETHOD CloseHTML(const nsIParserNode& aNode);
NS_IMETHOD OpenHead(const nsIParserNode& aNode);
NS_IMETHOD CloseHead(const nsIParserNode& aNode);
NS_IMETHOD OpenBody(const nsIParserNode& aNode);
NS_IMETHOD CloseBody(const nsIParserNode& aNode);
NS_IMETHOD OpenForm(const nsIParserNode& aNode);
NS_IMETHOD CloseForm(const nsIParserNode& aNode);
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseTopmostContainer();
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD WillBuildModel(void) { return NS_OK; }
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel) { return NS_OK; }
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
NS_IMETHOD WillResume(void) { return NS_OK; }
// nsIRobotSink
NS_IMETHOD Init(nsIURL* aDocumentURL);
@ -131,62 +134,77 @@ NS_IMETHODIMP RobotSink::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return NS_NOINTERFACE;
}
PRInt32 RobotSink::SetTitle(const nsString& aValue)
NS_IMETHODIMP RobotSink::PushMark()
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenHTML(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::SetTitle(const nsString& aValue)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseHTML(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenHTML(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenHead(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseHTML(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseHead(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenHead(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenBody(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseHead(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseBody(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenBody(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenForm(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseBody(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseForm(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenForm(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenFrameset(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseForm(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseFrameset(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::OpenMap(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::OpenContainer(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseMap(const nsIParserNode& aNode)
{
return NS_OK;
}
NS_IMETHODIMP RobotSink::OpenFrameset(const nsIParserNode& aNode)
{
return NS_OK;
}
NS_IMETHODIMP RobotSink::CloseFrameset(const nsIParserNode& aNode)
{
return NS_OK;
}
NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
{
nsAutoString tmp(aNode.GetText());
tmp.ToUpperCase();
@ -219,22 +237,22 @@ PRInt32 RobotSink::OpenContainer(const nsIParserNode& aNode)
}
}
}
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseContainer(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::CloseContainer(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::CloseTopmostContainer()
NS_IMETHODIMP RobotSink::CloseTopmostContainer()
{
return kNoError;
return NS_OK;
}
PRInt32 RobotSink::AddLeaf(const nsIParserNode& aNode)
NS_IMETHODIMP RobotSink::AddLeaf(const nsIParserNode& aNode)
{
return kNoError;
return NS_OK;
}
NS_IMETHODIMP RobotSink::Init(nsIURL* aDocumentURL)

Просмотреть файл

@ -36,7 +36,7 @@
#include "nsHTMLTokens.h"
#include "nsCRT.h"
#include "nsParser.h"
#include "nsHTMLContentSink.h"
#include "nsIHTMLContentSink.h"
#include "nsScanner.h"
#include "nsParserTypes.h"
#include "nsVoidArray.h"
@ -420,13 +420,14 @@ eAutoDetectResult CNavDTD::AutoDetectContentType(nsString& aBuffer,nsString& aTy
* @param
* @return
*/
PRInt32 CNavDTD::WillBuildModel(nsString& aFilename){
PRInt32 result=0;
nsresult CNavDTD::WillBuildModel(nsString& aFilename){
nsresult result=NS_OK;
mFilename=aFilename;
if(mSink)
mSink->WillBuildModel();
if(mSink) {
result = mSink->WillBuildModel();
}
return result;
}
@ -437,14 +438,14 @@ PRInt32 CNavDTD::WillBuildModel(nsString& aFilename){
* @param
* @return
*/
PRInt32 CNavDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
nsresult CNavDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result= NS_OK;
if((kNoError==anErrorCode) && (mContextStack.mCount>0)) {
CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE);
result = CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE);
}
if(mSink) {
mSink->DidBuildModel(1);
result = mSink->DidBuildModel(1);
}
return result;
@ -462,8 +463,8 @@ PRInt32 CNavDTD::DidBuildModel(PRInt32 anErrorCode){
* @param aParser
* @return
*/
PRInt32 CNavDTD::HandleToken(CToken* aToken){
PRInt32 result=0;
nsresult CNavDTD::HandleToken(CToken* aToken){
nsresult result=NS_OK;
if(aToken) {
CHTMLToken* theToken= (CHTMLToken*)(aToken);
@ -496,16 +497,16 @@ PRInt32 CNavDTD::HandleToken(CToken* aToken){
* @param aNode -- CParserNode representing this start token
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode) {
nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode) {
NS_PRECONDITION(0!=aToken,kNullToken);
eHTMLTags parentTag=GetTopNode();
PRInt32 result=kNoError;
nsresult result=NS_OK;
PRBool contains=CanContain(parentTag,aChildTag);
if(PR_FALSE==contains){
result=CreateContextStackFor(aChildTag);
if(kNoError!=result) {
if(NS_OK!=result) {
//if you're here, then the new topmost container can't contain aToken.
//You must determine what container hierarchy you need to hold aToken,
//and create that on the parsestack.
@ -546,7 +547,7 @@ PRInt32 CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIP
* @param aNode -- CParserNode representing this start token
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
nsresult CNavDTD::HandleStartToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
CStartToken* st= (CStartToken*)(aToken);
@ -556,9 +557,11 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
nsCParserNode attrNode((CHTMLToken*)aToken);
PRInt16 attrCount=aToken->GetAttributeCount();
PRInt32 theCount;
PRInt32 result=(0==attrCount) ? kNoError : mParser->CollectAttributes(attrNode,attrCount);
nsresult result=(0==attrCount)
? NS_OK
: mParser->CollectAttributes(attrNode,attrCount);
if(kNoError==result) {
if(NS_OK==result) {
//now check to see if this token should be omitted...
if(PR_FALSE==CanOmit(GetTopNode(),tokenTagType)) {
@ -571,7 +574,7 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
{
nsCParserNode theNode(st);
result=OpenHead(theNode); //open the head...
if(kNoError==result) {
if(NS_OK==result) {
result=mParser->CollectSkippedContent(attrNode,theCount);
mSink->SetTitle(attrNode.GetSkippedContent());
result=CloseHead(theNode); //close the head...
@ -595,9 +598,9 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
{
nsCParserNode theNode((CHTMLToken*)aToken);
result=OpenHead(theNode);
if(kNoError==result)
if(NS_OK==result)
result=AddLeaf(attrNode);
if(kNoError==result)
if(NS_OK==result)
result=CloseHead(theNode);
}
break;
@ -606,11 +609,11 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
{
nsCParserNode theNode((CHTMLToken*)aToken);
result=OpenHead(theNode);
if(kNoError==result) {
if(NS_OK==result) {
mParser->CollectSkippedContent(attrNode,theCount);
if(kNoError==result) {
if(NS_OK==result) {
result=AddLeaf(attrNode);
if(kNoError==result)
if(NS_OK==result)
result=CloseHead(theNode);
}
}
@ -625,9 +628,9 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
case eHTMLTag_base:
result=OpenHead(attrNode);
if(kNoError==result) {
if(NS_OK==result) {
result=AddLeaf(attrNode);
if(kNoError==result)
if(NS_OK==result)
result=CloseHead(attrNode);
}
break;
@ -661,10 +664,10 @@ PRInt32 CNavDTD::HandleStartToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleEndToken(CToken* aToken) {
nsresult CNavDTD::HandleEndToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
CEndToken* et = (CEndToken*)(aToken);
eHTMLTags tokenTagType=(eHTMLTags)et->GetTypeID();
@ -733,11 +736,11 @@ PRInt32 CNavDTD::HandleEndToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleEntityToken(CToken* aToken) {
nsresult CNavDTD::HandleEntityToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
CEntityToken* et = (CEntityToken*)(aToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
eHTMLTags tokenTagType=(eHTMLTags)et->GetTypeID();
if(PR_FALSE==CanOmit(GetTopNode(),tokenTagType)) {
@ -757,9 +760,9 @@ PRInt32 CNavDTD::HandleEntityToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleCommentToken(CToken* aToken) {
nsresult CNavDTD::HandleCommentToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
return kNoError;
return NS_OK;
}
/**
@ -772,10 +775,10 @@ PRInt32 CNavDTD::HandleCommentToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleSkippedContentToken(CToken* aToken) {
nsresult CNavDTD::HandleSkippedContentToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
if(HasOpenContainer(eHTMLTag_body)) {
nsCParserNode aNode((CHTMLToken*)aToken);
@ -794,12 +797,12 @@ PRInt32 CNavDTD::HandleSkippedContentToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleAttributeToken(CToken* aToken) {
nsresult CNavDTD::HandleAttributeToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
NS_ERROR("attribute encountered -- this shouldn't happen!");
CAttributeToken* at = (CAttributeToken*)(aToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
return result;
}
@ -811,9 +814,9 @@ PRInt32 CNavDTD::HandleAttributeToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleScriptToken(CToken* aToken) {
nsresult CNavDTD::HandleScriptToken(CToken* aToken) {
NS_PRECONDITION(0!=aToken,kNullToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
PRInt32 pos=GetTopmostIndexOf(eHTMLTag_body);
nsCParserNode theNode((CHTMLToken*)aToken);
@ -823,11 +826,11 @@ PRInt32 CNavDTD::HandleScriptToken(CToken* aToken) {
if (kNotFound == pos) {
// We're in the HEAD
result=OpenHead(theNode);
if(kNoError==result) {
if(NS_OK==result) {
mParser->CollectSkippedContent(attrNode,attrCount);
if(kNoError==result) {
if(NS_OK==result) {
result=AddLeaf(attrNode);
if(kNoError==result)
if(NS_OK==result)
result=CloseHead(theNode);
}
}
@ -835,7 +838,7 @@ PRInt32 CNavDTD::HandleScriptToken(CToken* aToken) {
else {
// We're in the BODY
mParser->CollectSkippedContent(attrNode,attrCount);
if(kNoError==result) {
if(NS_OK==result) {
result=AddLeaf(attrNode);
}
}
@ -851,11 +854,11 @@ PRInt32 CNavDTD::HandleScriptToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 CNavDTD::HandleStyleToken(CToken* aToken){
nsresult CNavDTD::HandleStyleToken(CToken* aToken){
NS_PRECONDITION(0!=aToken,kNullToken);
CStyleToken* st = (CStyleToken*)(aToken);
PRInt32 result=kNoError;
nsresult result=NS_OK;
return result;
}
@ -872,7 +875,6 @@ void CNavDTD::DeleteTokenHandlers(void) {
delete mTokenHandlers[i];
mTokenHandlers[i]=0;
}
return;
}
@ -1762,8 +1764,8 @@ PRInt32 CNavDTD::GetTopmostIndexOf(eHTMLTags aTag) const {
* @param tag of the container just opened
* @return 0 (for now)
*/
PRInt32 CNavDTD::OpenTransientStyles(eHTMLTags aTag){
PRInt32 result=0;
nsresult CNavDTD::OpenTransientStyles(eHTMLTags aTag){
nsresult result=NS_OK;
if(0==strchr(gWhitespaceTags,aTag)){
PRInt32 pos=0;
@ -1788,7 +1790,7 @@ PRInt32 CNavDTD::OpenTransientStyles(eHTMLTags aTag){
mContextStack.mBits[mContextStack.mCount-1]=PR_TRUE;
} //switch
}
if(kNoError!=result)
if(NS_OK!=result)
break;
}//for
}
@ -1808,8 +1810,8 @@ PRInt32 CNavDTD::OpenTransientStyles(eHTMLTags aTag){
* @param tag of the container just opened
* @return 0 (for now)
*/
PRInt32 CNavDTD::CloseTransientStyles(eHTMLTags aTag){
PRInt32 result=0;
nsresult CNavDTD::CloseTransientStyles(eHTMLTags aTag){
nsresult result=NS_OK;
if((mStyleStack.mCount>0) && (mContextStack.mBits[mContextStack.mCount-1])) {
if(0==strchr(gWhitespaceTags,aTag)){
@ -1829,12 +1831,11 @@ PRInt32 CNavDTD::CloseTransientStyles(eHTMLTags aTag){
*
* @update gess4/22/98
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenHTML(const nsIParserNode& aNode){
nsresult CNavDTD::OpenHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount >= 0, kInvalidTagStackPos);
PRInt32 result=mSink->OpenHTML(aNode);
nsresult result=mSink->OpenHTML(aNode);
mContextStack.Push((eHTMLTags)aNode.GetNodeType());
return result;
}
@ -1848,9 +1849,9 @@ PRInt32 CNavDTD::OpenHTML(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseHTML(const nsIParserNode& aNode){
nsresult CNavDTD::CloseHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=mSink->CloseHTML(aNode);
nsresult result=mSink->CloseHTML(aNode);
mContextStack.Pop();
return result;
}
@ -1864,9 +1865,9 @@ PRInt32 CNavDTD::CloseHTML(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenHead(const nsIParserNode& aNode){
nsresult CNavDTD::OpenHead(const nsIParserNode& aNode){
mContextStack.Push(eHTMLTag_head);
PRInt32 result=mSink->OpenHead(aNode);
nsresult result=mSink->OpenHead(aNode);
return result;
}
@ -1878,8 +1879,8 @@ PRInt32 CNavDTD::OpenHead(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseHead(const nsIParserNode& aNode){
PRInt32 result=mSink->CloseHead(aNode);
nsresult CNavDTD::CloseHead(const nsIParserNode& aNode){
nsresult result=mSink->CloseHead(aNode);
mContextStack.Pop();
return result;
}
@ -1892,10 +1893,10 @@ PRInt32 CNavDTD::CloseHead(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenBody(const nsIParserNode& aNode){
nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount >= 0, kInvalidTagStackPos);
PRInt32 result=kNoError;
nsresult result=NS_OK;
eHTMLTags topTag=GetTopNode();
if(eHTMLTag_html!=topTag) {
@ -1923,7 +1924,7 @@ PRInt32 CNavDTD::OpenBody(const nsIParserNode& aNode){
}
}
if(kNoError==result) {
if(NS_OK==result) {
result=mSink->OpenBody(aNode);
mContextStack.Push((eHTMLTags)aNode.GetNodeType());
}
@ -1938,9 +1939,9 @@ PRInt32 CNavDTD::OpenBody(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseBody(const nsIParserNode& aNode){
nsresult CNavDTD::CloseBody(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount >= 0, kInvalidTagStackPos);
PRInt32 result=mSink->CloseBody(aNode);
nsresult result=mSink->CloseBody(aNode);
mContextStack.Pop();
return result;
}
@ -1953,11 +1954,11 @@ PRInt32 CNavDTD::CloseBody(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenForm(const nsIParserNode& aNode){
nsresult CNavDTD::OpenForm(const nsIParserNode& aNode){
if(mHasOpenForm)
CloseForm(aNode);
PRInt32 result=mSink->OpenForm(aNode);
if(kNoError==result)
nsresult result=mSink->OpenForm(aNode);
if(NS_OK==result)
mHasOpenForm=PR_TRUE;
return result;
}
@ -1970,8 +1971,8 @@ PRInt32 CNavDTD::OpenForm(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseForm(const nsIParserNode& aNode){
PRInt32 result=kNoError;
nsresult CNavDTD::CloseForm(const nsIParserNode& aNode){
nsresult result=NS_OK;
if(mHasOpenForm) {
mHasOpenForm=PR_FALSE;
result=mSink->CloseForm(aNode);
@ -1987,15 +1988,11 @@ PRInt32 CNavDTD::CloseForm(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenMap(const nsIParserNode& aNode){
nsresult CNavDTD::OpenMap(const nsIParserNode& aNode){
if(mHasOpenMap)
CloseMap(aNode);
//NOTE: We need to change to method so that it opens a MAP,
// instead of a FORM. This was copy/paste coding at its best.
PRInt32 result=mSink->OpenForm(aNode);
if(kNoError==result)
nsresult result=mSink->OpenMap(aNode);
if(NS_OK==result)
mHasOpenMap=PR_TRUE;
return result;
}
@ -2008,15 +2005,11 @@ PRInt32 CNavDTD::OpenMap(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseMap(const nsIParserNode& aNode){
PRInt32 result=kNoError;
nsresult CNavDTD::CloseMap(const nsIParserNode& aNode){
nsresult result=NS_OK;
if(mHasOpenMap) {
mHasOpenMap=PR_FALSE;
//NOTE: We need to change to method so that it closes a MAP,
// instead of a FORM. This was copy/paste coding at its best.
result=mSink->CloseForm(aNode);
result=mSink->CloseMap(aNode);
}
return result;
}
@ -2029,9 +2022,9 @@ PRInt32 CNavDTD::CloseMap(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenFrameset(const nsIParserNode& aNode){
nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount >= 0, kInvalidTagStackPos);
PRInt32 result=mSink->OpenFrameset(aNode);
nsresult result=mSink->OpenFrameset(aNode);
mContextStack.Push((eHTMLTags)aNode.GetNodeType());
return result;
}
@ -2044,9 +2037,9 @@ PRInt32 CNavDTD::OpenFrameset(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseFrameset(const nsIParserNode& aNode){
nsresult CNavDTD::CloseFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=mSink->CloseFrameset(aNode);
nsresult result=mSink->CloseFrameset(aNode);
mContextStack.Pop();
return result;
}
@ -2060,10 +2053,11 @@ PRInt32 CNavDTD::CloseFrameset(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
nsresult
CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=kNoError;
nsresult result=NS_OK;
eHTMLTags nodeType=(eHTMLTags)aNode.GetNodeType();
// CloseTransientStyles(nodeType);
@ -2082,6 +2076,10 @@ PRInt32 CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleSta
case eHTMLTag_title:
break;
case eHTMLTag_map:
result=OpenMap(aNode);
break;
case eHTMLTag_form:
result=OpenForm(aNode); break;
@ -2091,7 +2089,7 @@ PRInt32 CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleSta
break;
}
if((kNoError==result) && (PR_TRUE==aUpdateStyleStack)){
if((NS_OK==result) && (PR_TRUE==aUpdateStyleStack)){
UpdateStyleStackForOpenTag(nodeType,nodeType);
}
@ -2106,9 +2104,11 @@ PRInt32 CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleSta
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool aUpdateStyles){
nsresult
CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,
PRBool aUpdateStyles){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=kNoError; //was false
nsresult result=NS_OK;
eHTMLTags nodeType=(eHTMLTags)aNode.GetNodeType();
//XXX Hack! We know this is wrong, but it works
@ -2129,6 +2129,10 @@ PRInt32 CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool
case eHTMLTag_body:
result=CloseBody(aNode); break;
case eHTMLTag_map:
result=CloseMap(aNode);
break;
case eHTMLTag_form:
result=CloseForm(aNode); break;
@ -2140,7 +2144,7 @@ PRInt32 CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool
}
mContextStack.mBits[mContextStack.mCount]=PR_FALSE;
if((kNoError==result) && (PR_TRUE==aUpdateStyles)){
if((NS_OK==result) && (PR_TRUE==aUpdateStyles)){
UpdateStyleStackForCloseTag(nodeType,aTag);
}
@ -2155,9 +2159,11 @@ PRInt32 CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles){
nsresult
CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,
PRBool aUpdateStyles){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 result=kNoError;
nsresult result=NS_OK;
CEndToken aToken(gEmpty);
nsCParserNode theNode(&aToken);
@ -2180,7 +2186,7 @@ PRInt32 CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdate
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
nsresult CNavDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
PRInt32 pos=GetTopmostIndexOf(aTag);
@ -2203,7 +2209,7 @@ PRInt32 CNavDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
}
}
PRInt32 result=kNoError;
nsresult result=NS_OK;
eHTMLTags theParentTag=GetDefaultParentTagFor(aTag);
pos=GetTopmostIndexOf(theParentTag);
if(kNotFound!=pos) {
@ -2221,7 +2227,7 @@ PRInt32 CNavDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::CloseTopmostContainer(){
nsresult CNavDTD::CloseTopmostContainer(){
NS_PRECONDITION(mContextStack.mCount > 0, kInvalidTagStackPos);
CEndToken aToken(gEmpty);
@ -2239,8 +2245,8 @@ PRInt32 CNavDTD::CloseTopmostContainer(){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 CNavDTD::AddLeaf(const nsIParserNode& aNode){
PRInt32 result=mSink->AddLeaf(aNode);
nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
nsresult result=mSink->AddLeaf(aNode);
return result;
}
@ -2255,10 +2261,10 @@ PRInt32 CNavDTD::AddLeaf(const nsIParserNode& aNode){
* create a new context vector
* @return true if we succeeded, otherwise false
*/
PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
nsresult CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
nsAutoString theVector;
PRInt32 result=kNoError;
nsresult result=NS_OK;
PRInt32 pos=0;
PRInt32 cnt=0;
eHTMLTags theTop=GetTopNode();
@ -2268,7 +2274,7 @@ PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
pos=0;
cnt=theVector.Length()-1;
if(mContextStack.Last()==(eHTMLTags)theVector[cnt])
result=kNoError;
result=NS_OK;
else result=kContextMismatch;
}
else {
@ -2285,7 +2291,7 @@ PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
//propagation worked, so pop unwanted containers, push new ones, then exit...
pos=0;
cnt=theVector.Length();
result=kNoError;
result=NS_OK;
while(pos<mContextStack.mCount) {
if(mContextStack.mTags[pos]==(eHTMLTags)theVector[cnt-1-pos]) {
pos++;
@ -2303,7 +2309,7 @@ PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
//now, build up the stack according to the tags
//you have that aren't in the stack...
if(kNoError==result){
if(NS_OK==result){
int i=0;
for(i=pos;i<cnt;i++) {
CStartToken* st=new CStartToken((eHTMLTags)theVector[cnt-1-i]);
@ -2325,8 +2331,8 @@ PRInt32 CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
* @param
* @return
*/
PRInt32 CNavDTD::ReduceContextStackFor(eHTMLTags aChildTag){
PRInt32 result=kNoError;
nsresult CNavDTD::ReduceContextStackFor(eHTMLTags aChildTag){
nsresult result=NS_OK;
eHTMLTags topTag=GetTopNode();
while( (topTag!=kNotFound) &&
@ -2347,8 +2353,9 @@ PRInt32 CNavDTD::ReduceContextStackFor(eHTMLTags aChildTag){
* @param aTag is the id of the html container being opened
* @return 0 if all is well.
*/
PRInt32 CNavDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag){
PRInt32 result=0;
nsresult
CNavDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag){
nsresult result=0;
switch (aTag) {
@ -2394,8 +2401,9 @@ PRInt32 CNavDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag
* @param
* @return 0 if all went well (which it always does)
*/
PRInt32 CNavDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTag){
PRInt32 result=0;
nsresult
CNavDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTag){
nsresult result=0;
if(mStyleStack.mCount>0) {
switch (aTag) {
@ -2452,18 +2460,19 @@ PRInt32 CNavDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTa
* @param aToken is the out arg holding our new token
* @return error code (may return kInterrupted).
*/
PRInt32 CNavDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult
CNavDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsAutoString empty("");
PRInt32 result=aScanner.GetChar(aChar);
nsresult result=aScanner.GetChar(aChar);
if(kNoError==result) {
if(NS_OK==result) {
switch(aChar) {
case kForwardSlash:
PRUnichar ch;
result=aScanner.Peek(ch);
if(kNoError==result) {
if(NS_OK==result) {
if(nsString::IsAlpha(ch))
aToken=new CEndToken(empty);
else aToken=new CCommentToken(empty); //Special case: </ ...> is treated as a comment
@ -2481,7 +2490,7 @@ PRInt32 CNavDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken)
}
} //switch
if((0!=aToken) && (kNoError==result)) {
if((0!=aToken) && (NS_OK==result)) {
result= aToken->Consume(aChar,aScanner); //tell new token to finish consuming text...
if(result) {
delete aToken;
@ -2501,13 +2510,14 @@ PRInt32 CNavDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken)
* @param aScanner: see nsScanner.h
* @return
*/
PRInt32 CNavDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken) {
nsresult
CNavDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken) {
PRBool done=PR_FALSE;
PRInt32 result=kNoError;
nsresult result=NS_OK;
nsAutoString as("");
PRInt16 theAttrCount=0;
while((!done) && (result==kNoError)) {
while((!done) && (result==NS_OK)) {
CAttributeToken* theToken= new CAttributeToken(as);
if(theToken){
result=theToken->Consume(aChar,aScanner); //tell new token to finish consuming text...
@ -2524,14 +2534,14 @@ PRInt32 CNavDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToke
aToken->SetEmpty(PR_TRUE);
delete theToken;
}
else if(kNoError==result){
else if(NS_OK==result){
theAttrCount++;
mTokenDeque.Push(theToken);
}//if
else delete theToken; //we can't keep it...
}//if
if(kNoError==result){
if(NS_OK==result){
result=aScanner.Peek(aChar);
if(aChar==kGreaterThan) { //you just ate the '>'
aScanner.GetChar(aChar); //skip the '>'
@ -2553,7 +2563,11 @@ PRInt32 CNavDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToke
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult
CNavDTD::ConsumeContentToEndTag(const nsString& aString,
PRUnichar aChar,
CScanner& aScanner,
CToken*& aToken){
//In the case that we just read the given tag, we should go and
//consume all the input until we find a matching end tag.
@ -2575,22 +2589,23 @@ PRInt32 CNavDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult
CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
PRInt32 theDequeSize=mTokenDeque.GetSize();
PRInt32 result=kNoError;
nsresult result=NS_OK;
aToken=new CStartToken(nsAutoString(""));
if(aToken) {
result= aToken->Consume(aChar,aScanner); //tell new token to finish consuming text...
if(kNoError==result) {
if(NS_OK==result) {
if(((CStartToken*)aToken)->IsAttributed()) {
result=ConsumeAttributes(aChar,aScanner,(CStartToken*)aToken);
}
//now that that's over with, we have one more problem to solve.
//In the case that we just read a <SCRIPT> or <STYLE> tags, we should go and
//consume all the content itself.
if(kNoError==result) {
if(NS_OK==result) {
nsString& str=aToken->GetText();
CToken* skippedToken=0;
if(str.EqualsIgnoreCase("SCRIPT") ||
@ -2600,7 +2615,7 @@ PRInt32 CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
result=ConsumeContentToEndTag(str,aChar,aScanner,skippedToken);
if((kNoError==result) && skippedToken){
if((NS_OK==result) && skippedToken){
//now we strip the ending sequence from our new SkippedContent token...
PRInt32 slen=str.Length()+3;
nsString& skippedText=skippedToken->GetText();
@ -2623,7 +2638,7 @@ PRInt32 CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
//tag but ran out of data (not in the stream, but in this *part* of the stream.
//For simplicity, we have to unwind our input. Therefore, we pop and discard
//any new tokens we've cued this round. Later we can get smarter about this.
if(kNoError!=result) {
if(NS_OK!=result) {
while(mTokenDeque.GetSize()>theDequeSize) {
delete mTokenDeque.PopBack();
}
@ -2645,11 +2660,12 @@ PRInt32 CNavDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult
CNavDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
PRUnichar ch;
PRInt32 result=aScanner.GetChar(ch);
nsresult result=aScanner.GetChar(ch);
if(kNoError==result) {
if(NS_OK==result) {
if(nsString::IsAlpha(ch)) { //handle common enity references &xxx; or &#000.
aToken = new CEntityToken(nsAutoString(""));
result = aToken->Consume(ch,aScanner); //tell new token to finish consuming text...
@ -2677,9 +2693,12 @@ PRInt32 CNavDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToke
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult
CNavDTD::ConsumeWhitespace(PRUnichar aChar,
CScanner& aScanner,
CToken*& aToken) {
aToken = new CWhitespaceToken(nsAutoString(""));
PRInt32 result=kNoError;
nsresult result=NS_OK;
if(aToken) {
result=aToken->Consume(aChar,aScanner);
}
@ -2696,9 +2715,10 @@ PRInt32 CNavDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& a
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult
CNavDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
aToken = new CCommentToken(nsAutoString(""));
PRInt32 result=kNoError;
nsresult result=NS_OK;
if(aToken) {
result=aToken->Consume(aChar,aScanner);
}
@ -2715,9 +2735,11 @@ PRInt32 CNavDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aTok
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken){
PRInt32 result=kNoError;
nsresult
CNavDTD::ConsumeText(const nsString& aString,
CScanner& aScanner,
CToken*& aToken){
nsresult result=NS_OK;
if(aToken=new CTextToken(aString)) {
PRUnichar ch=0;
result=aToken->Consume(ch,aScanner);
@ -2734,9 +2756,12 @@ PRInt32 CNavDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken*&
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult
CNavDTD::ConsumeNewline(PRUnichar aChar,
CScanner& aScanner,
CToken*& aToken){
aToken=new CNewlineToken(nsAutoString(""));
PRInt32 result=kNoError;
nsresult result=NS_OK;
if(aToken) {
result=aToken->Consume(aChar,aScanner);
}
@ -2755,17 +2780,16 @@ PRInt32 CNavDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aTok
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CNavDTD::ConsumeToken(CToken*& aToken){
nsresult CNavDTD::ConsumeToken(CToken*& aToken){
aToken=0;
if(mTokenDeque.GetSize()>0) {
aToken=(CToken*)mTokenDeque.Pop();
return kNoError;
return NS_OK;
}
PRInt32 result=kNoError;
nsresult result=NS_OK;
CScanner* theScanner=mParser->GetScanner();
if(kNoError==result){
if(NS_OK==result){
PRUnichar theChar;
result=theScanner->GetChar(theChar);
@ -2777,7 +2801,7 @@ PRInt32 CNavDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(theChar) {
case kLessThan:
@ -2801,7 +2825,7 @@ PRInt32 CNavDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
} //while
return result;
@ -2824,11 +2848,12 @@ CToken* CNavDTD::CreateTokenOfType(eHTMLTokenTypes aType) {
* @param
* @return
*/
void CNavDTD::WillResumeParse(void){
nsresult CNavDTD::WillResumeParse(void){
nsresult result = NS_OK;
if(mSink) {
mSink->WillResume();
result = mSink->WillResume();
}
return;
return result;
}
/**
@ -2837,11 +2862,12 @@ void CNavDTD::WillResumeParse(void){
* @param
* @return
*/
void CNavDTD::WillInterruptParse(void){
nsresult CNavDTD::WillInterruptParse(void){
nsresult result = NS_OK;
if(mSink) {
mSink->WillInterrupt();
result = mSink->WillInterrupt();
}
return;
return result;
}

Просмотреть файл

@ -93,13 +93,8 @@ public:
***************************************************************/
CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
class CNavDTD : public nsIDTD {
public:
NS_DECL_ISUPPORTS
/**
*
*
@ -118,6 +113,8 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
*/
virtual ~CNavDTD();
NS_DECL_ISUPPORTS
/**
* This method is called to determine if the given DTD can parse
* a document in a given source-type.
@ -151,7 +148,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename);
NS_IMETHOD WillBuildModel(nsString& aFilename);
/**
*
@ -159,7 +156,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -167,7 +164,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -186,7 +183,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -195,7 +192,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -203,7 +200,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* Select given content sink into parser for parser output
@ -331,15 +328,15 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
* @param aToken is the start token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleStartToken(CToken* aToken);
PRInt32 HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode);
PRInt32 HandleEndToken(CToken* aToken);
PRInt32 HandleEntityToken(CToken* aToken);
PRInt32 HandleCommentToken(CToken* aToken);
PRInt32 HandleSkippedContentToken(CToken* aToken);
PRInt32 HandleAttributeToken(CToken* aToken);
PRInt32 HandleScriptToken(CToken* aToken);
PRInt32 HandleStyleToken(CToken* aToken);
nsresult HandleStartToken(CToken* aToken);
nsresult HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode);
nsresult HandleEndToken(CToken* aToken);
nsresult HandleEntityToken(CToken* aToken);
nsresult HandleCommentToken(CToken* aToken);
nsresult HandleSkippedContentToken(CToken* aToken);
nsresult HandleAttributeToken(CToken* aToken);
nsresult HandleScriptToken(CToken* aToken);
nsresult HandleStyleToken(CToken* aToken);
protected:
@ -367,13 +364,13 @@ protected:
* @param HTML (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenHTML(const nsIParserNode& aNode);
PRInt32 OpenHead(const nsIParserNode& aNode);
PRInt32 OpenBody(const nsIParserNode& aNode);
PRInt32 OpenForm(const nsIParserNode& aNode);
PRInt32 OpenMap(const nsIParserNode& aNode);
PRInt32 OpenFrameset(const nsIParserNode& aNode);
PRInt32 OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack);
nsresult OpenHTML(const nsIParserNode& aNode);
nsresult OpenHead(const nsIParserNode& aNode);
nsresult OpenBody(const nsIParserNode& aNode);
nsresult OpenForm(const nsIParserNode& aNode);
nsresult OpenMap(const nsIParserNode& aNode);
nsresult OpenFrameset(const nsIParserNode& aNode);
nsresult OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack);
/**
* The next set of methods close the given HTML element.
@ -382,13 +379,13 @@ protected:
* @param HTML (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 CloseHTML(const nsIParserNode& aNode);
PRInt32 CloseHead(const nsIParserNode& aNode);
PRInt32 CloseBody(const nsIParserNode& aNode);
PRInt32 CloseForm(const nsIParserNode& aNode);
PRInt32 CloseMap(const nsIParserNode& aNode);
PRInt32 CloseFrameset(const nsIParserNode& aNode);
PRInt32 CloseContainer(const nsIParserNode& aNode,eHTMLTags anActualTag,PRBool aUpdateStyles);
nsresult CloseHTML(const nsIParserNode& aNode);
nsresult CloseHead(const nsIParserNode& aNode);
nsresult CloseBody(const nsIParserNode& aNode);
nsresult CloseForm(const nsIParserNode& aNode);
nsresult CloseMap(const nsIParserNode& aNode);
nsresult CloseFrameset(const nsIParserNode& aNode);
nsresult CloseContainer(const nsIParserNode& aNode,eHTMLTags anActualTag,PRBool aUpdateStyles);
/**
* The special purpose methods automatically close
@ -396,9 +393,9 @@ protected:
* @update gess5/11/98
* @return TRUE if all went well.
*/
PRInt32 CloseTopmostContainer();
PRInt32 CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles);
PRInt32 CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles);
nsresult CloseTopmostContainer();
nsresult CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles);
nsresult CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles);
/**
* Causes leaf to be added to sink at current vector pos.
@ -406,7 +403,7 @@ protected:
* @param aNode is leaf node to be added.
* @return TRUE if all went well -- FALSE otherwise.
*/
PRInt32 AddLeaf(const nsIParserNode& aNode);
nsresult AddLeaf(const nsIParserNode& aNode);
/**
* Causes auto-closures of context vector stack in order to find a
@ -416,7 +413,7 @@ protected:
* @param child to be added (somewhere) to context vector stack.
* @return TRUE if succeeds, otherwise FALSE
*/
PRInt32 ReduceContextStackFor(eHTMLTags aChildTag);
nsresult ReduceContextStackFor(eHTMLTags aChildTag);
/**
* Attempt forward and/or backward propagation for the given
@ -425,12 +422,12 @@ protected:
* @param type of child to be propagated.
* @return TRUE if succeeds, otherwise FALSE
*/
PRInt32 CreateContextStackFor(eHTMLTags aChildTag);
nsresult CreateContextStackFor(eHTMLTags aChildTag);
PRInt32 OpenTransientStyles(eHTMLTags aTag);
PRInt32 CloseTransientStyles(eHTMLTags aTag);
PRInt32 UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags aActualTag);
PRInt32 UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags aActualTag);
nsresult OpenTransientStyles(eHTMLTags aTag);
nsresult CloseTransientStyles(eHTMLTags aTag);
nsresult UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags aActualTag);
nsresult UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags aActualTag);
PRBool CanContainStyles(eHTMLTags aTag) const;
/****************************************************
@ -456,14 +453,14 @@ protected:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken);
PRInt32 ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
PRInt32 ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken);
nsresult ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken);
/**
* Causes content to be skipped up to sequence contained in aString.
@ -474,7 +471,7 @@ protected:
* @param aToken is the next token (or null)
* @return error code
*/
virtual PRInt32 ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
virtual nsresult ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
protected:

Просмотреть файл

@ -36,7 +36,7 @@
#include "nsHTMLTokens.h"
#include "nsCRT.h"
#include "nsParser.h"
#include "nsHTMLContentSink.h"
#include "nsIHTMLContentSink.h"
#include "nsScanner.h"
#include "nsParserTypes.h"
@ -178,7 +178,7 @@ eAutoDetectResult COtherDTD::AutoDetectContentType(nsString& aBuffer,nsString& a
* @param
* @return
*/
PRInt32 COtherDTD::WillBuildModel(nsString& aFilename) {
NS_IMETHODIMP COtherDTD::WillBuildModel(nsString& aFilename) {
return CNavDTD::WillBuildModel(aFilename);
}
@ -188,7 +188,7 @@ PRInt32 COtherDTD::WillBuildModel(nsString& aFilename) {
* @param
* @return
*/
PRInt32 COtherDTD::DidBuildModel(PRInt32 anErrorCode){
NS_IMETHODIMP COtherDTD::DidBuildModel(PRInt32 anErrorCode){
return CNavDTD::DidBuildModel(anErrorCode);
}
@ -203,7 +203,7 @@ PRInt32 COtherDTD::DidBuildModel(PRInt32 anErrorCode){
* @param aParser
* @return
*/
PRInt32 COtherDTD::HandleToken(CToken* aToken){
NS_IMETHODIMP COtherDTD::HandleToken(CToken* aToken){
return CNavDTD::HandleToken(aToken);
}
@ -223,7 +223,7 @@ PRInt32 COtherDTD::HandleToken(CToken* aToken){
* @param aNode -- CParserNode representing this start token
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode) {
nsresult COtherDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode) {
return CNavDTD::HandleDefaultStartToken(aToken,aChildTag,aNode);
}
@ -241,7 +241,7 @@ PRInt32 COtherDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,ns
* @param aNode -- CParserNode representing this start token
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleStartToken(CToken* aToken) {
nsresult COtherDTD::HandleStartToken(CToken* aToken) {
return CNavDTD::HandleStartToken(aToken);
}
@ -259,7 +259,7 @@ PRInt32 COtherDTD::HandleStartToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleEndToken(CToken* aToken) {
nsresult COtherDTD::HandleEndToken(CToken* aToken) {
return CNavDTD::HandleEndToken(aToken);
}
@ -271,7 +271,7 @@ PRInt32 COtherDTD::HandleEndToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleEntityToken(CToken* aToken) {
nsresult COtherDTD::HandleEntityToken(CToken* aToken) {
return CNavDTD::HandleEntityToken(aToken);
}
@ -285,7 +285,7 @@ PRInt32 COtherDTD::HandleEntityToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleCommentToken(CToken* aToken) {
nsresult COtherDTD::HandleCommentToken(CToken* aToken) {
return CNavDTD::HandleCommentToken(aToken);
}
@ -299,7 +299,7 @@ PRInt32 COtherDTD::HandleCommentToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleSkippedContentToken(CToken* aToken) {
nsresult COtherDTD::HandleSkippedContentToken(CToken* aToken) {
return CNavDTD::HandleSkippedContentToken(aToken);
}
@ -313,7 +313,7 @@ PRInt32 COtherDTD::HandleSkippedContentToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleAttributeToken(CToken* aToken) {
nsresult COtherDTD::HandleAttributeToken(CToken* aToken) {
return CNavDTD::HandleAttributeToken(aToken);
}
@ -325,7 +325,7 @@ PRInt32 COtherDTD::HandleAttributeToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleScriptToken(CToken* aToken) {
nsresult COtherDTD::HandleScriptToken(CToken* aToken) {
return CNavDTD::HandleScriptToken(aToken);
}
@ -337,7 +337,7 @@ PRInt32 COtherDTD::HandleScriptToken(CToken* aToken) {
* @param aToken -- next (start) token to be handled
* @return PR_TRUE if all went well; PR_FALSE if error occured
*/
PRInt32 COtherDTD::HandleStyleToken(CToken* aToken){
nsresult COtherDTD::HandleStyleToken(CToken* aToken){
return CNavDTD::HandleStyleToken(aToken);
}
@ -482,7 +482,7 @@ PRBool COtherDTD::BackwardPropagate(nsString& aVector,eHTMLTags aParentTag,eHTML
* @param tag of the container just opened
* @return 0 (for now)
*/
PRInt32 COtherDTD::OpenTransientStyles(eHTMLTags aTag){
nsresult COtherDTD::OpenTransientStyles(eHTMLTags aTag){
return CNavDTD::OpenTransientStyles(aTag);
}
@ -498,7 +498,7 @@ PRInt32 COtherDTD::OpenTransientStyles(eHTMLTags aTag){
* @param tag of the container just opened
* @return 0 (for now)
*/
PRInt32 COtherDTD::CloseTransientStyles(eHTMLTags aTag){
nsresult COtherDTD::CloseTransientStyles(eHTMLTags aTag){
return CNavDTD::CloseTransientStyles(aTag);
}
@ -511,7 +511,7 @@ PRInt32 COtherDTD::CloseTransientStyles(eHTMLTags aTag){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenHTML(const nsIParserNode& aNode){
nsresult COtherDTD::OpenHTML(const nsIParserNode& aNode){
return CNavDTD::OpenHTML(aNode);
}
@ -524,7 +524,7 @@ PRInt32 COtherDTD::OpenHTML(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseHTML(const nsIParserNode& aNode){
nsresult COtherDTD::CloseHTML(const nsIParserNode& aNode){
return CNavDTD::CloseHTML(aNode);
}
@ -537,7 +537,7 @@ PRInt32 COtherDTD::CloseHTML(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenHead(const nsIParserNode& aNode){
nsresult COtherDTD::OpenHead(const nsIParserNode& aNode){
return CNavDTD::OpenHead(aNode);
}
@ -549,7 +549,7 @@ PRInt32 COtherDTD::OpenHead(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseHead(const nsIParserNode& aNode){
nsresult COtherDTD::CloseHead(const nsIParserNode& aNode){
return CNavDTD::CloseHead(aNode);
}
@ -561,7 +561,7 @@ PRInt32 COtherDTD::CloseHead(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenBody(const nsIParserNode& aNode){
nsresult COtherDTD::OpenBody(const nsIParserNode& aNode){
return CNavDTD::OpenBody(aNode);
}
@ -573,7 +573,7 @@ PRInt32 COtherDTD::OpenBody(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseBody(const nsIParserNode& aNode){
nsresult COtherDTD::CloseBody(const nsIParserNode& aNode){
return CNavDTD::CloseBody(aNode);
}
@ -585,7 +585,7 @@ PRInt32 COtherDTD::CloseBody(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenForm(const nsIParserNode& aNode){
nsresult COtherDTD::OpenForm(const nsIParserNode& aNode){
return CNavDTD::OpenForm(aNode);
}
@ -597,7 +597,7 @@ PRInt32 COtherDTD::OpenForm(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseForm(const nsIParserNode& aNode){
nsresult COtherDTD::CloseForm(const nsIParserNode& aNode){
return CNavDTD::CloseForm(aNode);
}
@ -609,7 +609,7 @@ PRInt32 COtherDTD::CloseForm(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenMap(const nsIParserNode& aNode){
nsresult COtherDTD::OpenMap(const nsIParserNode& aNode){
return CNavDTD::OpenMap(aNode);
}
@ -621,7 +621,7 @@ PRInt32 COtherDTD::OpenMap(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseMap(const nsIParserNode& aNode){
nsresult COtherDTD::CloseMap(const nsIParserNode& aNode){
return CNavDTD::CloseMap(aNode);
}
@ -633,7 +633,7 @@ PRInt32 COtherDTD::CloseMap(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenFrameset(const nsIParserNode& aNode){
nsresult COtherDTD::OpenFrameset(const nsIParserNode& aNode){
return CNavDTD::OpenFrameset(aNode);
}
@ -645,7 +645,7 @@ PRInt32 COtherDTD::OpenFrameset(const nsIParserNode& aNode){
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseFrameset(const nsIParserNode& aNode){
nsresult COtherDTD::CloseFrameset(const nsIParserNode& aNode){
return CNavDTD::CloseFrameset(aNode);
}
@ -657,7 +657,7 @@ PRInt32 COtherDTD::CloseFrameset(const nsIParserNode& aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
nsresult COtherDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
return CNavDTD::OpenContainer(aNode,aUpdateStyleStack);
}
@ -669,7 +669,7 @@ PRInt32 COtherDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleS
* @param aNode -- next node to be removed from our model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool aUpdateStyles){
nsresult COtherDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBool aUpdateStyles){
return CNavDTD::CloseContainer(aNode,aTag,aUpdateStyles);
}
@ -681,7 +681,7 @@ PRInt32 COtherDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,PRBo
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles){
nsresult COtherDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles){
return CNavDTD::CloseContainersTo(anIndex,aTag,aUpdateStyles);
}
@ -693,7 +693,7 @@ PRInt32 COtherDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpda
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
nsresult COtherDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
return CNavDTD::CloseContainersTo(aTag,aUpdateStyles);
}
@ -705,7 +705,7 @@ PRInt32 COtherDTD::CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles){
* @param
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::CloseTopmostContainer(){
nsresult COtherDTD::CloseTopmostContainer(){
return CNavDTD::CloseTopmostContainer();
}
@ -717,7 +717,7 @@ PRInt32 COtherDTD::CloseTopmostContainer(){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
PRInt32 COtherDTD::AddLeaf(const nsIParserNode& aNode){
nsresult COtherDTD::AddLeaf(const nsIParserNode& aNode){
return CNavDTD::AddLeaf(aNode);
}
@ -732,7 +732,7 @@ PRInt32 COtherDTD::AddLeaf(const nsIParserNode& aNode){
* create a new context vector
* @return true if we succeeded, otherwise false
*/
PRInt32 COtherDTD::CreateContextStackFor(eHTMLTags aChildTag){
nsresult COtherDTD::CreateContextStackFor(eHTMLTags aChildTag){
return CNavDTD::CreateContextStackFor(aChildTag);
}
@ -748,7 +748,7 @@ PRInt32 COtherDTD::CreateContextStackFor(eHTMLTags aChildTag){
* @param
* @return
*/
PRInt32 COtherDTD::ReduceContextStackFor(eHTMLTags aChildTag){
nsresult COtherDTD::ReduceContextStackFor(eHTMLTags aChildTag){
return CNavDTD::ReduceContextStackFor(aChildTag);
}
@ -761,7 +761,7 @@ PRInt32 COtherDTD::ReduceContextStackFor(eHTMLTags aChildTag){
* @param aTag is the id of the html container being opened
* @return 0 if all is well.
*/
PRInt32 COtherDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag){
nsresult COtherDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualTag){
return CNavDTD::UpdateStyleStackForOpenTag(aTag,anActualTag);
} //update...
@ -773,7 +773,7 @@ PRInt32 COtherDTD::UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags anActualT
* @param
* @return 0 if all went well (which it always does)
*/
PRInt32 COtherDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTag){
nsresult COtherDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActualTag){
return CNavDTD::UpdateStyleStackForCloseTag(aTag,anActualTag);
} //update...
@ -794,7 +794,7 @@ PRInt32 COtherDTD::UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags anActual
* @param aToken is the out arg holding our new token
* @return error code (may return kInterrupted).
*/
PRInt32 COtherDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult COtherDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
return CNavDTD::ConsumeTag(aChar,aScanner,aToken);
}
@ -807,7 +807,7 @@ PRInt32 COtherDTD::ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken
* @param aScanner: see nsScanner.h
* @return
*/
PRInt32 COtherDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken) {
nsresult COtherDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken) {
return CNavDTD::ConsumeAttributes(aChar,aScanner,aToken);
}
@ -820,7 +820,7 @@ PRInt32 COtherDTD::ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartTo
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult COtherDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
return CNavDTD::ConsumeContentToEndTag(aString,aChar,aScanner,aToken);
}
@ -834,7 +834,7 @@ PRInt32 COtherDTD::ConsumeContentToEndTag(const nsString& aString,PRUnichar aCha
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult COtherDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
return CNavDTD::ConsumeStartTag(aChar,aScanner,aToken);
}
@ -848,7 +848,7 @@ PRInt32 COtherDTD::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& a
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult COtherDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
return CNavDTD::ConsumeEntity(aChar,aScanner,aToken);
}
@ -862,7 +862,7 @@ PRInt32 COtherDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
nsresult COtherDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
return CNavDTD::ConsumeWhitespace(aChar,aScanner,aToken);
}
@ -876,7 +876,7 @@ PRInt32 COtherDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*&
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult COtherDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
return CNavDTD::ConsumeComment(aChar,aScanner,aToken);
}
@ -890,7 +890,7 @@ PRInt32 COtherDTD::ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aT
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken){
nsresult COtherDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken){
return CNavDTD::ConsumeText(aString,aScanner,aToken);
}
@ -903,7 +903,7 @@ PRInt32 COtherDTD::ConsumeText(const nsString& aString,CScanner& aScanner,CToken
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
nsresult COtherDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken){
return CNavDTD::ConsumeNewline(aChar,aScanner,aToken);
}
@ -919,7 +919,7 @@ PRInt32 COtherDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aT
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 COtherDTD::ConsumeToken(CToken*& aToken){
nsresult COtherDTD::ConsumeToken(CToken*& aToken){
return CNavDTD::ConsumeToken(aToken);
}
@ -940,8 +940,8 @@ CToken* COtherDTD::CreateTokenOfType(eHTMLTokenTypes aType) {
* @param
* @return
*/
void COtherDTD::WillResumeParse(void){
CNavDTD::WillResumeParse();
nsresult COtherDTD::WillResumeParse(void){
return CNavDTD::WillResumeParse();
}
/**
@ -950,7 +950,7 @@ void COtherDTD::WillResumeParse(void){
* @param
* @return
*/
void COtherDTD::WillInterruptParse(void){
CNavDTD::WillInterruptParse();
nsresult COtherDTD::WillInterruptParse(void){
return CNavDTD::WillInterruptParse();
}

Просмотреть файл

@ -87,7 +87,7 @@ class COtherDTD : public CNavDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aString);
NS_IMETHOD WillBuildModel(nsString& aString);
/**
*
@ -95,7 +95,7 @@ class COtherDTD : public CNavDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -103,7 +103,7 @@ class COtherDTD : public CNavDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
* Cause the tokenizer to consume the next token, and
@ -113,7 +113,7 @@ class COtherDTD : public CNavDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -122,7 +122,7 @@ class COtherDTD : public CNavDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -130,7 +130,7 @@ class COtherDTD : public CNavDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* This method is called to determine whether or not a tag
@ -225,7 +225,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the start token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleStartToken(CToken* aToken);
nsresult HandleStartToken(CToken* aToken);
/**
* This method gets called when a start token has been consumed, and
@ -238,7 +238,7 @@ class COtherDTD : public CNavDTD {
* @param aNode is a node be updated with info from given token
* @return TRUE if the token was handled.
*/
PRInt32 HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode);
nsresult HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode);
/**
* This method gets called when an end token has been consumed and needs
@ -247,7 +247,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the end token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleEndToken(CToken* aToken);
nsresult HandleEndToken(CToken* aToken);
/**
* This method gets called when an entity token has been consumed and needs
@ -256,7 +256,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the entity token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleEntityToken(CToken* aToken);
nsresult HandleEntityToken(CToken* aToken);
/**
* This method gets called when a comment token has been consumed and needs
@ -265,7 +265,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the comment token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleCommentToken(CToken* aToken);
nsresult HandleCommentToken(CToken* aToken);
/**
* This method gets called when a skipped-content token has been consumed and needs
@ -274,7 +274,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the skipped-content token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleSkippedContentToken(CToken* aToken);
nsresult HandleSkippedContentToken(CToken* aToken);
/**
* This method gets called when an attribute token has been consumed and needs
@ -283,7 +283,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the attribute token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleAttributeToken(CToken* aToken);
nsresult HandleAttributeToken(CToken* aToken);
/**
* This method gets called when a script token has been consumed and needs
@ -292,7 +292,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the script token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleScriptToken(CToken* aToken);
nsresult HandleScriptToken(CToken* aToken);
/**
* This method gets called when a style token has been consumed and needs
@ -301,7 +301,7 @@ class COtherDTD : public CNavDTD {
* @param aToken is the style token to be handled
* @return TRUE if the token was handled.
*/
PRInt32 HandleStyleToken(CToken* aToken);
nsresult HandleStyleToken(CToken* aToken);
private:
@ -318,7 +318,7 @@ private:
* @param HTML (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenHTML(const nsIParserNode& aNode);
nsresult OpenHTML(const nsIParserNode& aNode);
/**
*
@ -326,7 +326,7 @@ private:
* @param
* @return
*/
PRInt32 CloseHTML(const nsIParserNode& aNode);
nsresult CloseHTML(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a head item in
@ -335,7 +335,7 @@ private:
* @param HEAD (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenHead(const nsIParserNode& aNode);
nsresult OpenHead(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink head to be closed
@ -343,7 +343,7 @@ private:
* @param aNode is the node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseHead(const nsIParserNode& aNode);
nsresult CloseHead(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a body item in
@ -352,7 +352,7 @@ private:
* @param BODY (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenBody(const nsIParserNode& aNode);
nsresult OpenBody(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink body to be closed
@ -360,7 +360,7 @@ private:
* @param aNode is the body node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseBody(const nsIParserNode& aNode);
nsresult CloseBody(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a form item in
@ -369,7 +369,7 @@ private:
* @param FORM (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenForm(const nsIParserNode& aNode);
nsresult OpenForm(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink form to be closed
@ -377,7 +377,7 @@ private:
* @param aNode is the form node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseForm(const nsIParserNode& aNode);
nsresult CloseForm(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a form item in
@ -386,7 +386,7 @@ private:
* @param FORM (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenMap(const nsIParserNode& aNode);
nsresult OpenMap(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink form to be closed
@ -394,7 +394,7 @@ private:
* @param aNode is the form node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseMap(const nsIParserNode& aNode);
nsresult CloseMap(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a frameset item in
@ -403,7 +403,7 @@ private:
* @param FRAMESET (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenFrameset(const nsIParserNode& aNode);
nsresult OpenFrameset(const nsIParserNode& aNode);
/**
* This cover method causes the content-sink frameset to be closed
@ -411,7 +411,7 @@ private:
* @param aNode is the frameeset node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseFrameset(const nsIParserNode& aNode);
nsresult CloseFrameset(const nsIParserNode& aNode);
/**
* This cover method opens the given node as a generic container in
@ -420,7 +420,7 @@ private:
* @param generic container (node) to be opened in content sink.
* @return TRUE if all went well.
*/
PRInt32 OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack);
nsresult OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack);
/**
* This cover method causes a generic containre in the content-sink to be closed
@ -428,14 +428,14 @@ private:
* @param aNode is the node to be closed in sink (usually ignored)
* @return TRUE if all went well.
*/
PRInt32 CloseContainer(const nsIParserNode& aNode,eHTMLTags anActualTag,PRBool aUpdateStyles);
nsresult CloseContainer(const nsIParserNode& aNode,eHTMLTags anActualTag,PRBool aUpdateStyles);
/**
* This cover method causes the topmost container to be closed in sink
* @update gess5/11/98
* @return TRUE if all went well.
*/
PRInt32 CloseTopmostContainer();
nsresult CloseTopmostContainer();
/**
* Cause all containers down to topmost given tag to be closed
@ -443,7 +443,7 @@ private:
* @param aTag is the tag at which auto-closure should stop (inclusive)
* @return TRUE if all went well -- otherwise FALSE
*/
PRInt32 CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles);
nsresult CloseContainersTo(eHTMLTags aTag,PRBool aUpdateStyles);
/**
* Cause all containers down to given position to be closed
@ -451,7 +451,7 @@ private:
* @param anIndex is the stack pos at which auto-closure should stop (inclusive)
* @return TRUE if all went well -- otherwise FALSE
*/
PRInt32 CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles);
nsresult CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aUpdateStyles);
/**
* Causes leaf to be added to sink at current vector pos.
@ -459,7 +459,7 @@ private:
* @param aNode is leaf node to be added.
* @return TRUE if all went well -- FALSE otherwise.
*/
PRInt32 AddLeaf(const nsIParserNode& aNode);
nsresult AddLeaf(const nsIParserNode& aNode);
/**
* Causes auto-closures of context vector stack in order to find a
@ -469,7 +469,7 @@ private:
* @param child to be added (somewhere) to context vector stack.
* @return TRUE if succeeds, otherwise FALSE
*/
PRInt32 ReduceContextStackFor(eHTMLTags aChildTag);
nsresult ReduceContextStackFor(eHTMLTags aChildTag);
/**
* Attempt forward and/or backward propagation for the given
@ -478,12 +478,12 @@ private:
* @param type of child to be propagated.
* @return TRUE if succeeds, otherwise FALSE
*/
PRInt32 CreateContextStackFor(eHTMLTags aChildTag);
nsresult CreateContextStackFor(eHTMLTags aChildTag);
PRInt32 OpenTransientStyles(eHTMLTags aTag);
PRInt32 CloseTransientStyles(eHTMLTags aTag);
PRInt32 UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags aActualTag);
PRInt32 UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags aActualTag);
nsresult OpenTransientStyles(eHTMLTags aTag);
nsresult CloseTransientStyles(eHTMLTags aTag);
nsresult UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags aActualTag);
nsresult UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags aActualTag);
/****************************************************
@ -507,7 +507,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve next START tag from given scanner.
@ -516,7 +516,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve collection of HTML/XML attributes from given scanner
@ -525,7 +525,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken);
nsresult ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,CStartToken* aToken);
/**
* Retrieve a sequence of text from given scanner.
@ -535,7 +535,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeText(const nsString& aString,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve an entity from given scanner
@ -545,7 +545,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve a whitespace sequence from the given scanner
@ -555,7 +555,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve a comment from the given scanner
@ -565,7 +565,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeComment(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Retrieve newlines from given scanner
@ -575,7 +575,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
PRInt32 ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
nsresult ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
/**
* Causes content to be skipped up to sequence contained in aString.
@ -586,7 +586,7 @@ private:
* @param aToken is the next token (or null)
* @return error code
*/
virtual PRInt32 ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
virtual nsresult ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,CToken*& aToken);
protected:

Просмотреть файл

@ -251,8 +251,8 @@ eAutoDetectResult CRtfDTD::AutoDetectContentType(nsString& aBuffer,nsString& aTy
* @param
* @return
*/
PRInt32 CRtfDTD::WillBuildModel(nsString& aFilename){
PRInt32 result=0;
NS_IMETHODIMP CRtfDTD::WillBuildModel(nsString& aFilename){
nsresult result=NS_OK;
return result;
}
@ -262,8 +262,8 @@ PRInt32 CRtfDTD::WillBuildModel(nsString& aFilename){
* @param
* @return
*/
PRInt32 CRtfDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
NS_IMETHODIMP CRtfDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result=NS_OK;
return result;
}
@ -371,12 +371,12 @@ PRInt32 CRtfDTD::ConsumeContent(PRUnichar aChar,CToken*& aToken){
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CRtfDTD::ConsumeToken(CToken*& aToken){
nsresult CRtfDTD::ConsumeToken(CToken*& aToken){
CScanner* theScanner=mParser->GetScanner();
PRUnichar aChar;
PRInt32 result=theScanner->GetChar(aChar);
nsresult result=theScanner->GetChar(aChar);
switch(result) {
case kEOF:
@ -386,7 +386,7 @@ PRInt32 CRtfDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(aChar) {
case kLeftBrace:
@ -409,7 +409,7 @@ PRInt32 CRtfDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
return result;
}
@ -420,8 +420,8 @@ PRInt32 CRtfDTD::ConsumeToken(CToken*& aToken){
* @param
* @return
*/
void CRtfDTD::WillResumeParse(void){
return;
nsresult CRtfDTD::WillResumeParse(void){
return NS_OK;
}
/**
@ -430,8 +430,8 @@ void CRtfDTD::WillResumeParse(void){
* @param
* @return
*/
void CRtfDTD::WillInterruptParse(void){
return;
nsresult CRtfDTD::WillInterruptParse(void){
return NS_OK;
}
/**
@ -496,8 +496,8 @@ PRInt32 CRtfDTD::HandleContent(CToken* aToken){
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
PRInt32 CRtfDTD::HandleToken(CToken* aToken) {
PRInt32 result=0;
nsresult CRtfDTD::HandleToken(CToken* aToken) {
nsresult result=NS_OK;
if(aToken) {
eRTFTokenTypes theType=eRTFTokenTypes(aToken->GetTokenType());

Просмотреть файл

@ -190,7 +190,7 @@ class CRtfDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename);
NS_IMETHOD WillBuildModel(nsString& aFilename);
/**
*
@ -198,7 +198,7 @@ class CRtfDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -230,7 +230,7 @@ class CRtfDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -279,7 +279,7 @@ class CRtfDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -288,7 +288,7 @@ class CRtfDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -296,7 +296,7 @@ class CRtfDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* Select given content sink into parser for parser output

Просмотреть файл

@ -22,7 +22,7 @@ LIBRARY_NAME = raptorhtmlpars
DEFINES = -D_IMPL_NS_HTMLPARS
CPPSRCS = \
nsHTMLContentSink.cpp \
nsHTMLNullSink.cpp \
nsParserNode.cpp \
nsDTDDebug.cpp \
nsScanner.cpp \

Просмотреть файл

@ -24,34 +24,32 @@ MODULE=raptor
REQUIRES=xpcom raptor netlib
CPPSRCS= \
CNavDTD.obj \
COtherDTD.obj \
CRTFDTD.obj \
nsWellFormedDTD.obj \
nsValidDTD.obj \
nsDTDDebug.obj \
nsHTMLContentSink.obj \
nsHTMLTags.obj \
nsHTMLTokens.obj \
nsParser.obj \
CParserContext.obj \
nsParserNode.obj \
nsScanner.obj \
nsToken.obj \
nsTokenHandler.obj \
nsHTMLContentSinkStream.obj \
nsXIFDTD.obj \
prstrm.obj \
CNavDTD.cpp \
COtherDTD.cpp \
CRtfDTD.cpp \
nsDTDDebug.cpp \
nsHTMLNullSink.cpp \
nsHTMLTags.cpp \
nsHTMLTokens.cpp \
nsParser.cpp \
CParserContext.cpp \
nsParserNode.cpp \
nsScanner.cpp \
nsToken.cpp \
nsTokenHandler.cpp \
nsHTMLContentSinkStream.cpp \
nsValid.cpp \
nsWellFormed.cpp \
nsXIFDTD.cpp \
prstrm.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\CNavDTD.obj \
.\$(OBJDIR)\CRTFDTD.obj \
.\$(OBJDIR)\COtherDTD.obj \
.\$(OBJDIR)\nsWellFormedDTD.obj \
.\$(OBJDIR)\nsValidDTD.obj \
.\$(OBJDIR)\CRtfDTD.obj \
.\$(OBJDIR)\nsDTDDebug.obj \
.\$(OBJDIR)\nsHTMLContentSink.obj \
.\$(OBJDIR)\nsHTMLNullSink.obj \
.\$(OBJDIR)\nsHTMLTags.obj \
.\$(OBJDIR)\nsHTMLTokens.obj \
.\$(OBJDIR)\nsParser.obj \
@ -60,7 +58,9 @@ CPP_OBJS= \
.\$(OBJDIR)\nsScanner.obj \
.\$(OBJDIR)\nsToken.obj \
.\$(OBJDIR)\nsTokenHandler.obj \
.\$(OBJDIR)\nsHTMLContentSinkStream.obj \
.\$(OBJDIR)\nsHTMLContentSinkStream.obj \
.\$(OBJDIR)\nsValidDTD.obj \
.\$(OBJDIR)\nsWellFormedDTD.obj \
.\$(OBJDIR)\nsXIFDTD.obj \
.\$(OBJDIR)\prstrm.obj \
$(NULL)
@ -69,7 +69,7 @@ EXPORTS= \
nshtmlpars.h \
nsIContentSink.h \
nsIHTMLContentSink.h \
nsHTMLContentSinkStream.h \
nsHTMLContentSinkStream.h \
nsHTMLTokens.h \
nsIParserNode.h \
nsIParser.h \
@ -77,12 +77,12 @@ EXPORTS= \
nsIDTDDebug.h \
nsIParserFilter.h \
CNavDTD.h \
nsWellFormedDTD.h \
nsValidDTD.h \
nsWellFormedDTD.h \
nsValidDTD.h \
CRTFDTD.h \
COtherDTD.h \
nsIDTD.h \
nsXIFDTD.h \
nsXIFDTD.h \
$(NULL)
EXTRA_EXPORTS= \

Просмотреть файл

@ -1,169 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/**
* MODULE NOTES:
* @update gess 4/1/98
*
* This file declares the concrete HTMLContentSink class.
* This class is used during the parsing process as the
* primary interface between the parser and the content
* model.
*
* After the tokenizer completes, the parser iterates over
* the known token list. As the parser identifies valid
* elements, it calls the contentsink interface to notify
* the content model that a new node or child node is being
* created and added to the content model.
*
* The HTMLContentSink interface assumes 4 underlying
* containers: HTML, HEAD, BODY and FRAMESET. Before
* accessing any these, the parser will call the appropriate
* OpenXXX method: OpenHTML,OpenHead,OpenBody,OpenFrameSet;
* likewise, the CloseXXX version will be called when the
* parser is done with a given section.
*
* IMPORTANT: The parser may Open each container more than
* once! This is due to the irregular nature of HTML files.
* For example, it is possible to encounter plain text at
* the start of an HTML document (that preceeds the HTML tag).
* Such text is treated as if it were part of the body.
* In such cases, the parser will Open the body, pass the text-
* node in and then Close the body. The body will likely be
* re-Opened later when the actual <BODY> tag has been seen.
*
* Containers within the body are Opened and Closed
* using the OpenContainer(...) and CloseContainer(...) calls.
* It is assumed that the document or contentSink is
* maintaining its state to manage where new content should
* be added to the underlying document.
*
* NOTE: OpenHTML() and OpenBody() may get called multiple times
* in the same document. That's fine, and it doesn't mean
* that we have multiple bodies or HTML's.
*
* NOTE: I haven't figured out how sub-documents (non-frames)
* are going to be handled. Stay tuned.
*/
#ifndef NS_HTMLCONTENTSINK
#define NS_HTMLCONTENTSINK
#include "nsIParserNode.h"
#include "nsIHTMLContentSink.h"
#include "nsIContentSink.h"
#include "nsString.h"
#define NS_HTMLCONTENTSINK_IID \
{0x803f8110, 0xc287, 0x11d1, \
{0x80, 0x22, 0x00, 0x60, 0x08, 0x14, 0x98, 0x89}}
class nsHTMLContentSink : public nsIHTMLContentSink {
public:
enum eSection {eNone=0,eHTML,eHead,eBody,eContainer};
nsHTMLContentSink();
~nsHTMLContentSink();
NS_DECL_ISUPPORTS
PRBool SetTitle(const nsString& aValue);
// Called when Opening or closing the main HTML container
PRInt32 OpenHTML(const nsIParserNode& aNode);
PRInt32 CloseHTML(const nsIParserNode& aNode);
// Called when Opening or closing the main HEAD container
PRInt32 OpenHead(const nsIParserNode& aNode);
PRInt32 CloseHead(const nsIParserNode& aNode);
// Called when Opening or closing the main BODY container
PRInt32 OpenBody(const nsIParserNode& aNode);
PRInt32 CloseBody(const nsIParserNode& aNode);
// Called when Opening or closing FORM containers
PRInt32 OpenForm(const nsIParserNode& aNode);
PRInt32 CloseForm(const nsIParserNode& aNode);
// Called when Opening or closing the main FRAMESET container
PRInt32 OpenFrameset(const nsIParserNode& aNode);
PRInt32 CloseFrameset(const nsIParserNode& aNode);
// Called when Opening or closing a general container
// This includes: OL,UL,DIR,SPAN,TABLE,H[1..6],etc.
// Until proven otherwise, I also plan to toss STYLE,
// FRAME, SCRIPT, etc. here too!
virtual PRInt32 OpenContainer(const nsIParserNode& aNode);
virtual PRInt32 CloseContainer(const nsIParserNode& aNode);
virtual PRInt32 CloseTopmostContainer();
virtual PRInt32 AddLeaf(const nsIParserNode& aNode);
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
*/
virtual void WillBuildModel(void);
/**
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
virtual void DidBuildModel(PRInt32 aQualityLevel);
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
*/
virtual void WillInterrupt(void);
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
virtual void WillResume(void);
PRInt32 NodeAt(PRInt32 aPos) {return mNodeStack[aPos];}
PRInt32 TopNode() {return mNodeStack[mNodeStackPos-1];}
PRInt32 GetStackPos() {return mNodeStackPos;}
protected:
PRInt32 mNodeStack[100];
PRInt32 mNodeStackPos;
nsString mTitle;
};
#endif

Просмотреть файл

@ -1,19 +1,20 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
/**
@ -33,10 +34,9 @@
#include "nsString.h"
#include "nsParserTypes.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIContentSinkIID,NS_IHTMLCONTENTSINK_IID);
static NS_DEFINE_IID(kClassIID, NS_HTMLCONTENTSINK_STREAM_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENT_SINK_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
static char* gHeaderComment = "<!-- This page was created by the NGLayout output system. -->";
static char* gDocTypeHeader = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">";
@ -53,21 +53,21 @@ static char gBuffer[500];
* @param aInstancePtr ptr to newly discovered interface
* @return NS_xxx result code
*/
nsresult nsHTMLContentSinkStream::QueryInterface(const nsIID& aIID, void** aInstancePtr)
nsresult
nsHTMLContentSinkStream::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if(aIID.Equals(kISupportsIID)) { //do IUnknown...
*aInstancePtr = (nsIContentSink*)(this);
if(aIID.Equals(kISupportsIID)) {
*aInstancePtr = (nsIContentSink*)(this);
}
else if(aIID.Equals(kIContentSinkIID)) { //do IParser base class...
*aInstancePtr = (nsIContentSink*)(this);
else if(aIID.Equals(kIContentSinkIID)) {
*aInstancePtr = (nsIContentSink*)(this);
}
else if(aIID.Equals(kIHTMLContentSinkIID)) {
*aInstancePtr = (nsIHTMLContentSink*)(this);
}
else if(aIID.Equals(kClassIID)) { //do this class...
*aInstancePtr = (nsHTMLContentSinkStream*)(this);
}
else {
*aInstancePtr=0;
return NS_NOINTERFACE;
@ -89,14 +89,14 @@ NS_IMPL_RELEASE(nsHTMLContentSinkStream)
* @param nsIParser** ptr to newly instantiated parser
* @return NS_xxx error result
*/
NS_HTMLPARS nsresult NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult) {
NS_HTMLPARS nsresult
NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult) {
nsHTMLContentSinkStream* it = new nsHTMLContentSinkStream();
if (it == 0) {
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
return it->QueryInterface(kIHTMLContentSinkIID, (void **)aInstancePtrResult);
}
/**
@ -248,6 +248,12 @@ void WritePair(eHTMLTags aTag,const nsString& theContent,int tab,ostream& aStrea
CloseTag(titleStr,0,aStream);
}
NS_IMETHODIMP
nsHTMLContentSinkStream::PushMark()
{
// XXX We need to defer our output when this occurs
return NS_OK;
}
/**
* This method gets called by the parser when it encounters
@ -257,12 +263,12 @@ void WritePair(eHTMLTags aTag,const nsString& theContent,int tab,ostream& aStrea
* @param nsString reference to new title value
* @return PR_TRUE if successful.
*/
PRBool nsHTMLContentSinkStream::SetTitle(const nsString& aValue){
PRBool result=PR_FALSE;
NS_IMETHODIMP
nsHTMLContentSinkStream::SetTitle(const nsString& aValue){
if(mOutput) {
WritePair(eHTMLTag_title,aValue,1+mTabLevel,*mOutput);
}
return result;
return NS_OK;
}
@ -273,14 +279,14 @@ PRBool nsHTMLContentSinkStream::SetTitle(const nsString& aValue){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenHTML(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenHTML(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_html)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -291,15 +297,15 @@ PRInt32 nsHTMLContentSinkStream::OpenHTML(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseHTML(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseHTML(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_html)
AddEndTag(aNode,*mOutput);
mOutput->flush();
}
return result;
return NS_OK;
}
@ -310,14 +316,14 @@ PRInt32 nsHTMLContentSinkStream::CloseHTML(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_head)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -328,14 +334,14 @@ PRInt32 nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseHead(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseHead(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_head)
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -346,14 +352,14 @@ PRInt32 nsHTMLContentSinkStream::CloseHead(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenBody(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenBody(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_body)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -364,14 +370,14 @@ PRInt32 nsHTMLContentSinkStream::OpenBody(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseBody(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseBody(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_body)
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -382,14 +388,14 @@ PRInt32 nsHTMLContentSinkStream::CloseBody(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenForm(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenForm(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_form)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -400,14 +406,49 @@ PRInt32 nsHTMLContentSinkStream::OpenForm(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseForm(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseForm(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_form)
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
/**
* This method is used to open a new FORM container.
*
* @update 07/12/98 gpk
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenMap(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_map)
AddStartTag(aNode,*mOutput);
}
return NS_OK;
}
/**
* This method is used to close the outer FORM container.
*
* @update 07/12/98 gpk
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseMap(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_map)
AddEndTag(aNode,*mOutput);
}
return NS_OK;
}
@ -418,14 +459,14 @@ PRInt32 nsHTMLContentSinkStream::CloseForm(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenFrameset(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenFrameset(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_frameset)
AddStartTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -436,14 +477,14 @@ PRInt32 nsHTMLContentSinkStream::OpenFrameset(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseFrameset(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseFrameset(const nsIParserNode& aNode){
if(mOutput) {
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_frameset)
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -572,8 +613,8 @@ void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode, ostream& aSt
* @param
* @return
*/
PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream){
PRInt32 result=kNoError;
nsresult
nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream){
eHTMLTags type = (eHTMLTags)aNode.GetNodeType();
eHTMLTags tag = mHTMLTagStack[mHTMLStackPos-1];
@ -685,7 +726,7 @@ PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aS
}
}
return result;
return NS_OK;
}
@ -698,13 +739,13 @@ PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aS
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode){
if(mOutput) {
AddStartTag(aNode,*mOutput);
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
}
return result;
return NS_OK;
}
@ -715,12 +756,12 @@ PRInt32 nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::CloseContainer(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::CloseContainer(const nsIParserNode& aNode){
if(mOutput) {
AddEndTag(aNode,*mOutput);
}
return result;
return NS_OK;
}
@ -732,10 +773,11 @@ PRInt32 nsHTMLContentSinkStream::CloseContainer(const nsIParserNode& aNode){
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode){
PRInt32 result=0;
NS_IMETHODIMP
nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode){
nsresult result = NS_OK;
if(mOutput) {
AddLeaf(aNode,*mOutput);
result = AddLeaf(aNode,*mOutput);
}
return result;
}
@ -747,12 +789,14 @@ PRInt32 nsHTMLContentSinkStream::AddLeaf(const nsIParserNode& aNode){
*
* @update 5/7/98 gess
*/
void nsHTMLContentSinkStream::WillBuildModel(void){
NS_IMETHODIMP
nsHTMLContentSinkStream::WillBuildModel(void){
mTabLevel=-1;
if(mOutput) {
(*mOutput) << gHeaderComment << endl;
(*mOutput) << gDocTypeHeader << endl;
}
return NS_OK;
}
@ -764,7 +808,9 @@ void nsHTMLContentSinkStream::WillBuildModel(void){
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
void nsHTMLContentSinkStream::DidBuildModel(PRInt32 aQualityLevel) {
NS_IMETHODIMP
nsHTMLContentSinkStream::DidBuildModel(PRInt32 aQualityLevel) {
return NS_OK;
}
@ -775,7 +821,9 @@ void nsHTMLContentSinkStream::DidBuildModel(PRInt32 aQualityLevel) {
*
* @update 5/7/98 gess
*/
void nsHTMLContentSinkStream::WillInterrupt(void) {
NS_IMETHODIMP
nsHTMLContentSinkStream::WillInterrupt(void) {
return NS_OK;
}
@ -785,7 +833,9 @@ void nsHTMLContentSinkStream::WillInterrupt(void) {
*
* @update 5/7/98 gess
*/
void nsHTMLContentSinkStream::WillResume(void) {
NS_IMETHODIMP
nsHTMLContentSinkStream::WillResume(void) {
return NS_OK;
}

Просмотреть файл

@ -53,8 +53,6 @@ class ostream;
class nsHTMLContentSinkStream : public nsIHTMLContentSink {
public:
NS_DECL_ISUPPORTS
/**
*
* @update gess7/7/98
@ -79,6 +77,33 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSink {
*/
virtual ~nsHTMLContentSinkStream();
// nsISupports
NS_DECL_ISUPPORTS
// nsIContentSink
NS_IMETHOD WillBuildModel(void);
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel);
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsIParserNode& aNode);
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
// nsIHTMLContentSink
NS_IMETHOD PushMark();
NS_IMETHOD SetTitle(const nsString& aValue);
NS_IMETHOD OpenHTML(const nsIParserNode& aNode);
NS_IMETHOD CloseHTML(const nsIParserNode& aNode);
NS_IMETHOD OpenHead(const nsIParserNode& aNode);
NS_IMETHOD CloseHead(const nsIParserNode& aNode);
NS_IMETHOD OpenBody(const nsIParserNode& aNode);
NS_IMETHOD CloseBody(const nsIParserNode& aNode);
NS_IMETHOD OpenForm(const nsIParserNode& aNode);
NS_IMETHOD CloseForm(const nsIParserNode& aNode);
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
/**
*
@ -88,183 +113,13 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSink {
*/
void SetOutputStream(ostream& aStream);
/**
* This method gets called by the parser when it encounters
* a title tag and wants to set the document title in the sink.
*
* @update 4/1/98 gess
* @param nsString reference to new title value
* @return PR_TRUE if successful.
*/
virtual PRBool SetTitle(const nsString& aValue);
/**
* This method is used to open the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenHTML(const nsIParserNode& aNode);
/**
* This method is used to close the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseHTML(const nsIParserNode& aNode);
/**
* This method is used to open the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenHead(const nsIParserNode& aNode);
/**
* This method is used to close the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseHead(const nsIParserNode& aNode);
/**
* This method is used to open the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenBody(const nsIParserNode& aNode);
/**
* This method is used to close the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseBody(const nsIParserNode& aNode);
/**
* This method is used to open a new FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenForm(const nsIParserNode& aNode);
/**
* This method is used to close the outer FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseForm(const nsIParserNode& aNode);
/**
* This method is used to open the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenFrameset(const nsIParserNode& aNode);
/**
* This method is used to close the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseFrameset(const nsIParserNode& aNode);
/**
* This method is used to a general container.
* This includes: OL,UL,DIR,SPAN,TABLE,H[1..6],etc.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenContainer(const nsIParserNode& aNode);
/**
* This method is used to close a generic container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseContainer(const nsIParserNode& aNode);
/**
* This method is used to add a leaf to the currently
* open container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 AddLeaf(const nsIParserNode& aNode);
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
*/
virtual void WillBuildModel(void);
/**
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
virtual void DidBuildModel(PRInt32 aQualityLevel);
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
*/
virtual void WillInterrupt(void);
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
virtual void WillResume(void);
/*
* PrettyPrinting Methods
*
*/
public:
void SetLowerCaseTags(PRBool aDoLowerCase) { mLowerCaseTags = aDoLowerCase; }
protected:
PRInt32 AddLeaf(const nsIParserNode& aNode, ostream& aStream);
nsresult AddLeaf(const nsIParserNode& aNode, ostream& aStream);
void WriteAttributes(const nsIParserNode& aNode,ostream& aStream);
void AddStartTag(const nsIParserNode& aNode, ostream& aStream);
void AddEndTag(const nsIParserNode& aNode, ostream& aStream);
@ -355,7 +210,8 @@ protected:
};
extern NS_HTMLPARS nsresult NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult);
extern NS_HTMLPARS nsresult
NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult);
#endif

Просмотреть файл

@ -1,22 +1,22 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsHTMLContentSink.h"
#include "nsIHTMLContentSink.h"
#include "nsHTMLTokens.h"
#include "nsParserTypes.h"
#include "prtypes.h"
@ -25,10 +25,49 @@
#define VERBOSE_DEBUG
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENTSINK_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTMLCONTENTSINK_IID);
static NS_DEFINE_IID(kClassIID, NS_HTMLCONTENTSINK_IID);
static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENT_SINK_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
class nsHTMLNullSink : public nsIHTMLContentSink {
public:
nsHTMLNullSink();
~nsHTMLNullSink();
enum eSection {eNone=0,eHTML,eHead,eBody,eContainer};
// nsISupports
NS_DECL_ISUPPORTS
// nsIContentSink
NS_IMETHOD WillBuildModel(void);
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel);
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsIParserNode& aNode);
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
// nsIHTMLContentSink
NS_IMETHOD PushMark();
NS_IMETHOD SetTitle(const nsString& aValue);
NS_IMETHOD OpenHTML(const nsIParserNode& aNode);
NS_IMETHOD CloseHTML(const nsIParserNode& aNode);
NS_IMETHOD OpenHead(const nsIParserNode& aNode);
NS_IMETHOD CloseHead(const nsIParserNode& aNode);
NS_IMETHOD OpenBody(const nsIParserNode& aNode);
NS_IMETHOD CloseBody(const nsIParserNode& aNode);
NS_IMETHOD OpenForm(const nsIParserNode& aNode);
NS_IMETHOD CloseForm(const nsIParserNode& aNode);
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
protected:
PRInt32 mNodeStack[100];
PRInt32 mNodeStackPos;
nsString mTitle;
};
/**
@ -39,15 +78,14 @@ static NS_DEFINE_IID(kClassIID, NS_HTMLCONTENTSINK_IID);
* @param
* @return
*/
nsresult NS_NewHTMLContentSink(nsIContentSink** aInstancePtrResult)
nsresult
NS_NewHTMLNullSink(nsIContentSink** aInstancePtrResult)
{
nsHTMLContentSink *it = new nsHTMLContentSink();
if (it == 0) {
nsHTMLNullSink *it = new nsHTMLNullSink();
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
return it->QueryInterface(kIContentSinkIID, (void **) aInstancePtrResult);
}
@ -58,7 +96,7 @@ nsresult NS_NewHTMLContentSink(nsIContentSink** aInstancePtrResult)
* @param
* @return
*/
nsHTMLContentSink::nsHTMLContentSink() : nsIHTMLContentSink(), mTitle("") {
nsHTMLNullSink::nsHTMLNullSink() : nsIHTMLContentSink(), mTitle("") {
mNodeStackPos=0;
memset(mNodeStack,0,sizeof(mNodeStack));
}
@ -72,7 +110,7 @@ nsHTMLContentSink::nsHTMLContentSink() : nsIHTMLContentSink(), mTitle("") {
* @param
* @return
*/
nsHTMLContentSink::~nsHTMLContentSink() {
nsHTMLNullSink::~nsHTMLNullSink() {
}
#ifdef VERBOSE_DEBUG
@ -94,8 +132,8 @@ static void DebugDump(const char* str1,const nsString& str2,PRInt32 tabs) {
* @param
* @return
*/
NS_IMPL_ADDREF(nsHTMLContentSink)
NS_IMPL_RELEASE(nsHTMLContentSink)
NS_IMPL_ADDREF(nsHTMLNullSink)
NS_IMPL_RELEASE(nsHTMLNullSink)
@ -109,24 +147,21 @@ NS_IMPL_RELEASE(nsHTMLContentSink)
* @param
* @return
*/
nsresult nsHTMLContentSink::QueryInterface(const nsIID& aIID, void** aInstancePtr)
nsresult
nsHTMLNullSink::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if(aIID.Equals(kISupportsIID)) { //do IUnknown...
*aInstancePtr = (nsIContentSink*)(this);
if(aIID.Equals(kISupportsIID)) {
*aInstancePtr = (nsIContentSink*)(this);
}
else if(aIID.Equals(kIContentSinkIID)) { //do nsIContentSink base class...
*aInstancePtr = (nsIContentSink*)(this);
else if(aIID.Equals(kIContentSinkIID)) {
*aInstancePtr = (nsIContentSink*)(this);
}
else if(aIID.Equals(kIHTMLContentSinkIID)) { //do nsIHTMLContentSink base class...
*aInstancePtr = (nsIHTMLContentSink*)(this);
else if(aIID.Equals(kIHTMLContentSinkIID)) {
*aInstancePtr = (nsIHTMLContentSink*)(this);
}
else if(aIID.Equals(kClassIID)) { //do this class...
*aInstancePtr = (nsHTMLContentSink*)(this);
}
else {
*aInstancePtr=0;
return NS_NOINTERFACE;
@ -135,6 +170,12 @@ nsresult nsHTMLContentSink::QueryInterface(const nsIID& aIID, void** aInstancePt
return NS_OK;
}
NS_IMETHODIMP
nsHTMLNullSink::PushMark()
{
// XXX We need to defer our output when this occurs
return NS_OK;
}
/**
* This method gets called by the parser when a <HTML>
@ -144,16 +185,14 @@ nsresult nsHTMLContentSink::QueryInterface(const nsIID& aIID, void** aInstancePt
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenHTML(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenHTML(const nsIParserNode& aNode){
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -163,18 +202,18 @@ PRInt32 nsHTMLContentSink::OpenHTML(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseHTML(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseHTML(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -187,15 +226,15 @@ PRInt32 nsHTMLContentSink::CloseHTML(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenHead(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenHead(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -206,17 +245,17 @@ PRInt32 nsHTMLContentSink::OpenHead(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseHead(const nsIParserNode& aNode) {
NS_IMETHODIMP
nsHTMLNullSink::CloseHead(const nsIParserNode& aNode) {
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
@ -227,10 +266,10 @@ PRInt32 nsHTMLContentSink::CloseHead(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::SetTitle(const nsString& aValue){
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::SetTitle(const nsString& aValue){
mTitle=aValue;
return result;
return NS_OK;
}
/**
@ -241,15 +280,15 @@ PRInt32 nsHTMLContentSink::SetTitle(const nsString& aValue){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenBody(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenBody(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
#endif
return result;
return NS_OK;
}
/**
@ -260,16 +299,16 @@ PRInt32 nsHTMLContentSink::OpenBody(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseBody(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseBody(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
@ -280,15 +319,15 @@ PRInt32 nsHTMLContentSink::CloseBody(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenForm(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenForm(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -299,17 +338,57 @@ PRInt32 nsHTMLContentSink::OpenForm(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseForm(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseForm(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
* This method gets called by the parser when a <FORM>
* tag has been consumed.
*
* @updated gess 3/25/98
* @param
* @return
*/
NS_IMETHODIMP
nsHTMLNullSink::OpenMap(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return NS_OK;
}
/**
* This method gets called by the parser when a </FORM>
* tag has been consumed.
*
* @updated gess 3/25/98
* @param
* @return
*/
NS_IMETHODIMP
nsHTMLNullSink::CloseMap(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return NS_OK;
}
/**
@ -320,15 +399,15 @@ PRInt32 nsHTMLContentSink::CloseForm(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenFrameset(const nsIParserNode& aNode) {
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenFrameset(const nsIParserNode& aNode) {
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
#endif
return result;
return NS_OK;
}
/**
@ -339,17 +418,17 @@ PRInt32 nsHTMLContentSink::OpenFrameset(const nsIParserNode& aNode) {
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseFrameset(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
@ -361,15 +440,15 @@ PRInt32 nsHTMLContentSink::CloseFrameset(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::OpenContainer(const nsIParserNode& aNode){
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::OpenContainer(const nsIParserNode& aNode){
mNodeStack[mNodeStackPos++]=(eHTMLTags)aNode.GetNodeType();
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos-1)*2);
#endif
return result;
return NS_OK;
}
/**
@ -380,32 +459,17 @@ PRInt32 nsHTMLContentSink::OpenContainer(const nsIParserNode& aNode){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseContainer(const nsIParserNode& aNode){
NS_IMETHODIMP
nsHTMLNullSink::CloseContainer(const nsIParserNode& aNode){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[--mNodeStackPos]=eHTMLTag_unknown;
#ifdef VERBOSE_DEBUG
DebugDump("</",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
}
/**
* This causes the topmost container to be closed,
* regardless of its type.
*
* @updated gess 3/25/98
* @param
* @return
*/
PRInt32 nsHTMLContentSink::CloseTopmostContainer(){
NS_PRECONDITION(mNodeStackPos > 0, "node stack empty");
PRInt32 result=kNoError;
mNodeStack[mNodeStackPos--]=eHTMLTag_unknown;
return result;
return NS_OK;
}
/**
@ -417,14 +481,14 @@ PRInt32 nsHTMLContentSink::CloseTopmostContainer(){
* @param
* @return
*/
PRInt32 nsHTMLContentSink::AddLeaf(const nsIParserNode& aNode){
PRInt32 result=kNoError;
NS_IMETHODIMP
nsHTMLNullSink::AddLeaf(const nsIParserNode& aNode){
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
#endif
return result;
return NS_OK;
}
/**
@ -433,7 +497,9 @@ PRInt32 nsHTMLContentSink::AddLeaf(const nsIParserNode& aNode){
*
* @update 5/7/98 gess
*/
void nsHTMLContentSink::WillBuildModel(void){
NS_IMETHODIMP
nsHTMLNullSink::WillBuildModel(void){
return NS_OK;
}
/**
@ -442,7 +508,9 @@ void nsHTMLContentSink::WillBuildModel(void){
*
* @update 5/7/98 gess
*/
void nsHTMLContentSink::DidBuildModel(PRInt32 aQualityLevel){
NS_IMETHODIMP
nsHTMLNullSink::DidBuildModel(PRInt32 aQualityLevel){
return NS_OK;
}
/**
@ -452,7 +520,9 @@ void nsHTMLContentSink::DidBuildModel(PRInt32 aQualityLevel){
*
* @update 5/7/98 gess
*/
void nsHTMLContentSink::WillInterrupt(void) {
NS_IMETHODIMP
nsHTMLNullSink::WillInterrupt(void) {
return NS_OK;
}
/**
@ -461,7 +531,9 @@ void nsHTMLContentSink::WillInterrupt(void) {
*
* @update 5/7/98 gess
*/
void nsHTMLContentSink::WillResume(void) {
NS_IMETHODIMP
nsHTMLNullSink::WillResume(void) {
return NS_OK;
}

Просмотреть файл

@ -240,7 +240,7 @@ PRBool CStartToken::IsEmpty(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CStartToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CStartToken::Consume(PRUnichar aChar, CScanner& aScanner) {
//if you're here, we've already Consumed the < char, and are
//ready to Consume the rest of the open tag identifier.
@ -248,16 +248,16 @@ PRInt32 CStartToken::Consume(PRUnichar aChar, CScanner& aScanner) {
//NOTE: We don't Consume the tag attributes here, nor do we eat the ">"
mTextValue=aChar;
PRInt32 result=aScanner.ReadWhile(mTextValue,gIdentChars,PR_FALSE);
nsresult result=aScanner.ReadWhile(mTextValue,gIdentChars,PR_FALSE);
//Good. Now, let's skip whitespace after the identifier,
//and see if the next char is ">". If so, we have a complete
//tag without attributes.
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.SkipWhitespace();
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.GetChar(aChar);
if(kNoError==result) {
if(NS_OK==result) {
if(kGreaterThan!=aChar) { //look for '>'
//push that char back, since we apparently have attributes...
aScanner.PutBack(aChar);
@ -305,7 +305,7 @@ CEndToken::CEndToken(const nsString& aName) : CHTMLToken(aName) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CEndToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CEndToken::Consume(PRUnichar aChar, CScanner& aScanner) {
//if you're here, we've already Consumed the <! chars, and are
//ready to Consume the rest of the open tag identifier.
@ -314,8 +314,8 @@ PRInt32 CEndToken::Consume(PRUnichar aChar, CScanner& aScanner) {
mTextValue="";
static nsAutoString terminals(">");
PRInt32 result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
if(kNoError==result)
nsresult result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
if(NS_OK==result)
result=aScanner.GetChar(aChar); //eat the closing '>;
return result;
};
@ -426,9 +426,9 @@ PRInt32 CTextToken::GetTokenType(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CTextToken::Consume(PRUnichar, CScanner& aScanner) {
nsresult CTextToken::Consume(PRUnichar, CScanner& aScanner) {
static nsAutoString terminals("&<\r\n");
PRInt32 result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
nsresult result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
return result;
};
@ -453,10 +453,10 @@ CCommentToken::CCommentToken(const nsString& aName) : CHTMLToken(aName) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CCommentToken::Consume(PRUnichar, CScanner& aScanner) {
nsresult CCommentToken::Consume(PRUnichar, CScanner& aScanner) {
PRUnichar ch,ch2;
PRInt32 result=kNoError;
nsresult result=NS_OK;
static nsAutoString terminals(">");
@ -464,12 +464,12 @@ PRInt32 CCommentToken::Consume(PRUnichar, CScanner& aScanner) {
mTextValue="<!";
if(kMinus==ch) {
result=aScanner.GetChar(ch2);
if(kNoError==result) {
if(NS_OK==result) {
if(kMinus==ch2) {
//in this case, we're reading a long-form comment <-- xxx -->
mTextValue+="--";
PRInt32 findpos=-1;
while((findpos==kNotFound) && (kNoError==result)) {
while((findpos==kNotFound) && (NS_OK==result)) {
result=aScanner.ReadUntil(mTextValue,terminals,PR_TRUE);
findpos=mTextValue.RFind("-->");
}
@ -557,14 +557,14 @@ nsString& CNewlineToken::GetText(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CNewlineToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CNewlineToken::Consume(PRUnichar aChar, CScanner& aScanner) {
mTextValue=aChar;
//we already read the \r or \n, let's see what's next!
PRUnichar nextChar;
PRInt32 result=aScanner.Peek(nextChar);
nsresult result=aScanner.Peek(nextChar);
if(kNoError==result) {
if(NS_OK==result) {
switch(aChar) {
case kNewLine:
if(kCR==nextChar) {
@ -704,21 +704,21 @@ PRInt32 ConsumeAttributeValueText(PRUnichar,nsString& aString,CScanner& aScanner
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CAttributeToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CAttributeToken::Consume(PRUnichar aChar, CScanner& aScanner) {
aScanner.SkipWhitespace(); //skip leading whitespace
PRInt32 result=aScanner.Peek(aChar);
if(kNoError==result) {
nsresult result=aScanner.Peek(aChar);
if(NS_OK==result) {
if(kQuote==aChar) { //if you're here, handle quoted key...
result=aScanner.GetChar(aChar); //skip the quote sign...
if(kNoError==result) {
if(NS_OK==result) {
mTextKey=aChar;
result=ConsumeQuotedString(aChar,mTextKey,aScanner);
}
}
else if(kHashsign==aChar) {
result=aScanner.GetChar(aChar); //skip the hash sign...
if(kNoError==result) {
if(NS_OK==result) {
mTextKey=aChar;
result=aScanner.ReadWhile(mTextKey,gDigits,PR_TRUE);
}
@ -731,15 +731,15 @@ PRInt32 CAttributeToken::Consume(PRUnichar aChar, CScanner& aScanner) {
}
//now it's time to Consume the (optional) value...
if(!(result=aScanner.SkipWhitespace())) {
if(!(result=aScanner.Peek(aChar))) {
if(NS_OK == (result=aScanner.SkipWhitespace())) {
if(NS_OK == (result=aScanner.Peek(aChar))) {
if(kEqual==aChar){
result=aScanner.GetChar(aChar); //skip the equal sign...
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.SkipWhitespace(); //now skip any intervening whitespace
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.GetChar(aChar); //and grab the next char.
if(kNoError==result) {
if(NS_OK==result) {
if((kQuote==aChar) || (kApostrophe==aChar)) {
mTextValue=aChar;
result=ConsumeQuotedString(aChar,mTextValue,aScanner);
@ -749,14 +749,14 @@ PRInt32 CAttributeToken::Consume(PRUnichar aChar, CScanner& aScanner) {
result=ConsumeAttributeValueText(aChar,mTextValue,aScanner);
}
}//if
if(kNoError==result)
if(NS_OK==result)
result=aScanner.SkipWhitespace();
}//if
}//if
}//if
}//if
}
if(kNoError==result) {
if(NS_OK==result) {
result=aScanner.Peek(aChar);
mLastAttribute= PRBool((kGreaterThan==aChar) || (kEOF==result));
}
@ -826,12 +826,12 @@ PRInt32 CWhitespaceToken::GetTokenType(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CWhitespaceToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CWhitespaceToken::Consume(PRUnichar aChar, CScanner& aScanner) {
mTextValue=aChar;
PRInt32 result=aScanner.ReadWhile(mTextValue,gWhitespace,PR_FALSE);
if(kNoError==result) {
nsresult result=aScanner.ReadWhile(mTextValue,gWhitespace,PR_FALSE);
if(NS_OK==result) {
mTextValue.StripChars("\r");
}
return result;
@ -861,10 +861,10 @@ CEntityToken::CEntityToken(const nsString& aName) : CHTMLToken(aName) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CEntityToken::Consume(PRUnichar aChar, CScanner& aScanner) {
nsresult CEntityToken::Consume(PRUnichar aChar, CScanner& aScanner) {
if(aChar)
mTextValue=aChar;
PRInt32 result=ConsumeEntity(aChar,mTextValue,aScanner);
nsresult result=ConsumeEntity(aChar,mTextValue,aScanner);
return result;
}
@ -1198,13 +1198,13 @@ PRInt32 CSkippedContentToken::GetTokenType(void) {
* @param aScanner -- controller of underlying input source
* @return error result
*/
PRInt32 CSkippedContentToken::Consume(PRUnichar,CScanner& aScanner) {
nsresult CSkippedContentToken::Consume(PRUnichar,CScanner& aScanner) {
PRBool done=PR_FALSE;
PRInt32 result=kNoError;
nsresult result=NS_OK;
nsString temp;
// while((!done) && (!aScanner.Eof())) {
while((!done) && (kNoError==result)) {
while((!done) && (NS_OK==result)) {
static nsAutoString terminals(">");
result=aScanner.ReadUntil(temp,terminals,PR_TRUE);
done=PRBool(kNotFound!=temp.RFind(mTextValue,PR_TRUE));

Просмотреть файл

@ -80,7 +80,7 @@ class CStartToken: public CHTMLToken {
public:
CStartToken(eHTMLTags aTag);
CStartToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual PRInt32 GetTypeID(void);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
@ -106,7 +106,7 @@ class CStartToken: public CHTMLToken {
class CEndToken: public CHTMLToken {
public:
CEndToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual PRInt32 GetTypeID(void);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
@ -125,7 +125,7 @@ class CEndToken: public CHTMLToken {
class CCommentToken: public CHTMLToken {
public:
CCommentToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
char mLeadingChar;
@ -145,7 +145,7 @@ class CEntityToken : public CHTMLToken {
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
PRInt32 TranslateToUnicodeStr(nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
static PRInt32 ConsumeEntity(PRUnichar aChar,nsString& aString,CScanner& aScanner);
static PRInt32 TranslateToUnicodeStr(PRInt32 aValue,nsString& aString);
static PRInt32 FindEntityIndex(nsString& aString);
@ -169,7 +169,7 @@ class CEntityToken : public CHTMLToken {
class CWhitespaceToken: public CHTMLToken {
public:
CWhitespaceToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
};
@ -184,7 +184,7 @@ class CWhitespaceToken: public CHTMLToken {
class CTextToken: public CHTMLToken {
public:
CTextToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
};
@ -202,7 +202,7 @@ class CAttributeToken: public CHTMLToken {
public:
CAttributeToken(const nsString& aString);
CAttributeToken(const nsString& aKey, const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual nsString& GetKey(void) {return mTextKey;}
@ -224,7 +224,7 @@ class CAttributeToken: public CHTMLToken {
class CNewlineToken: public CHTMLToken {
public:
CNewlineToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual nsString& GetText(void);
@ -276,7 +276,7 @@ class CStyleToken: public CHTMLToken {
class CSkippedContentToken: public CAttributeToken {
public:
CSkippedContentToken(const nsString& aString);
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
protected:

Просмотреть файл

@ -1,20 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsIContentSink_h___
#define nsIContentSink_h___
/**
* MODULE NOTES:
@ -24,95 +27,76 @@
* This pure virtual interface is used as the "glue" that
* connects the parsing process to the content model
* construction process.
*
*/
#ifndef ICONTENTSINK
#define ICONTENTSINK
#include "nsIParserNode.h"
#include "nsISupports.h"
#define NS_ICONTENTSINK_IID \
{0x4c2f7e34, 0xc286, 0x11d1, \
{0x80, 0x22, 0x00, 0x60, 0x08, 0x14, 0x98, 0x89}}
#define NS_ICONTENT_SINK_IID \
{ 0xa6cf9052, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
class nsIContentSink : public nsISupports {
public:
/**
* This method is used to open a generic container in the sink.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenContainer(const nsIParserNode& aNode) = 0;
/**
* This method gets called by the parser when a close
* container tag has been consumed and needs to be closed.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseContainer(const nsIParserNode& aNode) = 0;
/**
* This gets called by the parser when you want to add
* a leaf node to the current container in the content
* model.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 AddLeaf(const nsIParserNode& aNode) = 0;
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
public:
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
*/
virtual void WillBuildModel(void)=0;
/**
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
virtual void DidBuildModel(PRInt32 aQualityLevel)=0;
NS_IMETHOD WillBuildModel(void)=0;
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel)=0;
virtual void WillInterrupt(void)=0;
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
*/
NS_IMETHOD WillInterrupt(void)=0;
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
virtual void WillResume(void)=0;
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
NS_IMETHOD WillResume(void)=0;
/**
* This method is used to open a generic container in the sink.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenContainer(const nsIParserNode& aNode) = 0;
/**
* This method gets called by the parser when a close
* container tag has been consumed and needs to be closed.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseContainer(const nsIParserNode& aNode) = 0;
/**
* This gets called by the parser when you want to add
* a leaf node to the current container in the content
* model.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD AddLeaf(const nsIParserNode& aNode) = 0;
};
extern nsresult NS_NewHTMLContentSink(nsIContentSink** aInstancePtrResult);
#endif
#endif /* nsIContentSink_h___ */

Просмотреть файл

@ -15,6 +15,8 @@
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIDTD_h___
#define nsIDTD_h___
/**
* MODULE NOTES:
@ -22,18 +24,12 @@
*
*
*/
#ifndef NS_IDTD__
#define NS_IDTD__
#include "nshtmlpars.h"
#include "nsISupports.h"
#include "prtypes.h"
#define NS_IDTD_IID \
{0x75634940, 0xcfdc, 0x11d1, \
{0xaa, 0xda, 0x00, 0x80, 0x5f, 0x8a, 0x3e, 0x14}}
#define NS_IDTD_IID \
{ 0xa6cf9053, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
class nsIParser;
class CToken;
@ -44,20 +40,7 @@ class nsString;
enum eAutoDetectResult {eUnknownDetect, eValidDetect, eInvalidDetect};
// XXX: Disable warning message about nsISupports not being exported. I *believe* this
// to be a harmless warning message on windows, a better fix would be to export
// the nsISupports interface.
#if defined(XP_PC)
#pragma warning( disable : 4275 )
#endif
CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
#if defined(XP_PC)
#pragma warning( default : 4275 )
#endif
class nsIDTD : public nsISupports {
public:
/**
@ -112,7 +95,7 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename)=0;
NS_IMETHOD WillBuildModel(nsString& aFilename)=0;
/**
*
@ -120,27 +103,22 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode)=0;
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode)=0;
/**
*
* @update gess 3/25/98
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken)=0;
NS_IMETHOD HandleToken(CToken* aToken)=0;
/**
* Cause the tokenizer to consume the next token, and
* return an error result.
*
* @update gess 3/25/98
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken)=0;
NS_IMETHOD ConsumeToken(CToken*& aToken)=0;
/**
*
@ -148,7 +126,7 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
* @param
* @return
*/
virtual void WillResumeParse(void)=0;
NS_IMETHOD WillResumeParse(void)=0;
/**
*
@ -156,7 +134,7 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
* @param
* @return
*/
virtual void WillInterruptParse(void)=0;
NS_IMETHOD WillInterruptParse(void)=0;
/**
* This method is called to determine whether or not a tag
@ -169,7 +147,6 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
*/
virtual PRBool CanContain(PRInt32 aParent,PRInt32 aChild)=0;
/**
*
* @update jevering6/23/98
@ -179,8 +156,4 @@ CLASS_EXPORT_HTMLPARS nsIDTD : public nsISupports {
virtual void SetDTDDebug(nsIDTDDebug * aDTDDebug) = 0;
};
#endif
#endif /* nsIDTD_h___ */

Просмотреть файл

@ -1,20 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsIHTMLContentSink_h___
#define nsIHTMLContentSink_h___
/**
* MODULE NOTES:
@ -34,8 +37,8 @@
* The HTMLContentSink interface assumes 4 underlying
* containers: HTML, HEAD, BODY and FRAMESET. Before
* accessing any these, the parser will call the appropriate
* OpenXXX method: OpenHTML,OpenHead,OpenBody,OpenFrameSet;
* likewise, the CloseXXX version will be called when the
* OpennsIHTMLContentSink method: OpenHTML,OpenHead,OpenBody,OpenFrameSet;
* likewise, the ClosensIHTMLContentSink version will be called when the
* parser is done with a given section.
*
* IMPORTANT: The parser may Open each container more than
@ -60,190 +63,126 @@
* NOTE: I haven't figured out how sub-documents (non-frames)
* are going to be handled. Stay tuned.
*/
#ifndef NS_IHTMLCONTENTSINK
#define NS_IHTMLCONTENTSINK
#include "nsIParserNode.h"
#include "nsIContentSink.h"
#define NS_IHTMLCONTENTSINK_IID \
{0xd690e200, 0xc286, 0x11d1, \
{0x80, 0x22, 0x00, 0x60, 0x08, 0x14, 0x98, 0x89}}
#define NS_IHTML_CONTENT_SINK_IID \
{ 0xa6cf9051, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
class nsIHTMLContentSink : public nsIContentSink {
public:
public:
/**
* This method is called to inform the content sink to push a
* new mark.
*/
NS_IMETHOD PushMark(void) = 0;
/**
* This method gets called by the parser when it encounters
* a title tag and wants to set the document title in the sink.
*
* @update 4/1/98 gess
* @param nsString reference to new title value
* @return PR_TRUE if successful.
*/
virtual PRBool SetTitle(const nsString& aValue)=0;
/**
* This method gets called by the parser when it encounters
* a title tag and wants to set the document title in the sink.
*
* @update 4/1/98 gess
* @param nsString reference to new title value
*/
NS_IMETHOD SetTitle(const nsString& aValue)=0;
/**
* This method is used to open the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenHTML(const nsIParserNode& aNode)=0;
/**
* This method is used to open the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenHTML(const nsIParserNode& aNode)=0;
/**
* This method is used to close the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseHTML(const nsIParserNode& aNode)=0;
/**
* This method is used to close the outer HTML container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseHTML(const nsIParserNode& aNode)=0;
/**
* This method is used to open the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenHead(const nsIParserNode& aNode)=0;
/**
* This method is used to open the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenHead(const nsIParserNode& aNode)=0;
/**
* This method is used to close the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseHead(const nsIParserNode& aNode)=0;
/**
* This method is used to close the only HEAD container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseHead(const nsIParserNode& aNode)=0;
/**
* This method is used to open the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenBody(const nsIParserNode& aNode)=0;
/**
* This method is used to open the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenBody(const nsIParserNode& aNode)=0;
/**
* This method is used to close the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseBody(const nsIParserNode& aNode)=0;
/**
* This method is used to close the main BODY container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseBody(const nsIParserNode& aNode)=0;
/**
* This method is used to open a new FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenForm(const nsIParserNode& aNode)=0;
/**
* This method is used to open a new FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenForm(const nsIParserNode& aNode)=0;
/**
* This method is used to close the outer FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseForm(const nsIParserNode& aNode)=0;
/**
* This method is used to close the outer FORM container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseForm(const nsIParserNode& aNode)=0;
/**
* This method is used to open a new MAP container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenMap(const nsIParserNode& aNode)=0;
/**
* This method is used to close the MAP container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseMap(const nsIParserNode& aNode)=0;
/**
* This method is used to open the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenFrameset(const nsIParserNode& aNode)=0;
/**
* This method is used to close the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseFrameset(const nsIParserNode& aNode)=0;
/**
* This method is used to a general container.
* This includes: OL,UL,DIR,SPAN,TABLE,H[1..6],etc.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 OpenContainer(const nsIParserNode& aNode)=0;
/**
* This method is used to close a generic container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 CloseContainer(const nsIParserNode& aNode)=0;
/**
* This method is used to add a leaf to the currently
* open container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
* @return PR_TRUE if successful.
*/
virtual PRInt32 AddLeaf(const nsIParserNode& aNode)=0;
/**
* This method gets called when the parser begins the process
* of building the content model via the content sink.
*
* @update 5/7/98 gess
*/
virtual void WillBuildModel(void)=0;
/**
* This method gets called when the parser concludes the process
* of building the content model via the content sink.
*
* @param aQualityLevel describes how well formed the doc was.
* 0=GOOD; 1=FAIR; 2=POOR;
* @update 5/7/98 gess
*/
virtual void DidBuildModel(PRInt32 aQualityLevel)=0;
/**
* This method gets called when the parser gets i/o blocked,
* and wants to notify the sink that it may be a while before
* more data is available.
*
* @update 5/7/98 gess
*/
virtual void WillInterrupt(void)=0;
/**
* This method gets called when the parser i/o gets unblocked,
* and we're about to start dumping content again to the sink.
*
* @update 5/7/98 gess
*/
virtual void WillResume(void)=0;
/**
* This method is used to open the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode)=0;
/**
* This method is used to close the FRAMESET container.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode)=0;
};
extern nsresult NS_NewHTMLNullSink(nsIContentSink** aInstancePtrResult);
#endif
#endif /* nsIHTMLContentSink_h___ */

Просмотреть файл

@ -30,7 +30,7 @@
#include "nsIDTDDebug.h"
#include "nshtmlpars.h"
#define rickgdebug 1
#undef rickgdebug
#ifdef rickgdebug
#include "CRtfDTD.h"
#include "nsWellFormedDTD.h"

Просмотреть файл

@ -32,6 +32,7 @@
* ===========================================================*/
#include "prtypes.h"
#include "nsError.h"
enum eParseMode {
@ -50,7 +51,7 @@ const PRInt32 kBadFilename = -4;
const PRInt32 kBadURL = -3;
const PRInt32 kInterrupted = -2;
const PRInt32 kNotFound = -1;
const PRInt32 kNoError = 0;
const PRInt32 kNoError = NS_OK;
const PRUint32 kNewLine = '\n';
const PRUint32 kCR = '\r';

Просмотреть файл

@ -192,8 +192,8 @@ PRBool CScanner::Append(const char* aBuffer, PRInt32 aLen){
* @update gess4/3/98
* @return error code
*/
PRInt32 CScanner::FillBuffer(void) {
PRInt32 anError=0;
nsresult CScanner::FillBuffer(void) {
nsresult anError=NS_OK;
_PreCompressBuffer(mBuffer,mOffset,mMarkPos);
@ -233,15 +233,18 @@ PRInt32 CScanner::FillBuffer(void) {
* @param
* @return 0=!eof 1=eof kInterrupted=interrupted
*/
PRInt32 CScanner::Eof() {
PRInt32 theError=0;
nsresult CScanner::Eof() {
nsresult theError=NS_OK;
if(mOffset>=mBuffer.Length()) {
theError=FillBuffer();
}
if(0==theError)
return (0==mBuffer.Length());
if(NS_OK==theError) {
if (0==mBuffer.Length()) {
return kEOF;
}
}
return theError;
}
@ -253,11 +256,10 @@ PRInt32 CScanner::Eof() {
* @param
* @return error code reflecting read status
*/
PRInt32 CScanner::GetChar(PRUnichar& aChar) {
PRInt32 result=Eof();
if(!result) {
nsresult CScanner::GetChar(PRUnichar& aChar) {
nsresult result=Eof();
if(NS_OK == result) {
aChar=mBuffer[mOffset++];
result=kNoError;
}
return result;
}
@ -271,11 +273,10 @@ PRInt32 CScanner::GetChar(PRUnichar& aChar) {
* @param
* @return
*/
PRInt32 CScanner::Peek(PRUnichar& aChar) {
PRInt32 result=Eof();
if(!result) {
nsresult CScanner::Peek(PRUnichar& aChar) {
nsresult result=Eof();
if(NS_OK == result) {
aChar=mBuffer[mOffset];
result=kNoError;
}
return result;
}
@ -288,11 +289,11 @@ PRInt32 CScanner::Peek(PRUnichar& aChar) {
* @param
* @return error code
*/
PRInt32 CScanner::PutBack(PRUnichar aChar) {
nsresult CScanner::PutBack(PRUnichar aChar) {
if(mOffset>0)
mOffset--;
else mBuffer.Insert(aChar,0);
return kNoError;
return NS_OK;
}
@ -303,7 +304,7 @@ PRInt32 CScanner::PutBack(PRUnichar aChar) {
* @param
* @return error status
*/
PRInt32 CScanner::SkipWhitespace(void) {
nsresult CScanner::SkipWhitespace(void) {
static nsAutoString chars(" \n\r\t");
return SkipOver(chars);
}
@ -315,13 +316,13 @@ PRInt32 CScanner::SkipWhitespace(void) {
* @param
* @return error code
*/
PRInt32 CScanner::SkipOver(PRUnichar aSkipChar){
nsresult CScanner::SkipOver(PRUnichar aSkipChar){
PRUnichar ch=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
while(kNoError==result) {
while(NS_OK==result) {
result=GetChar(ch);
if(!result) {
if(NS_OK == result) {
if(ch!=aSkipChar) {
PutBack(ch);
break;
@ -339,13 +340,13 @@ PRInt32 CScanner::SkipOver(PRUnichar aSkipChar){
* @param
* @return error code
*/
PRInt32 CScanner::SkipOver(nsString& aSkipSet){
nsresult CScanner::SkipOver(nsString& aSkipSet){
PRUnichar ch=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
while(kNoError==result) {
while(NS_OK==result) {
result=GetChar(ch);
if(!result) {
if(NS_OK == result) {
PRInt32 pos=aSkipSet.Find(ch);
if(kNotFound==pos) {
PutBack(ch);
@ -364,9 +365,9 @@ PRInt32 CScanner::SkipOver(nsString& aSkipSet){
* @param
* @return error code
*/
PRInt32 CScanner::SkipPast(nsString& aValidSet){
nsresult CScanner::SkipPast(nsString& aValidSet){
NS_NOTYETIMPLEMENTED("Error: SkipPast not yet implemented.");
return kNoError;
return NS_OK;
}
/**
@ -377,14 +378,16 @@ PRInt32 CScanner::SkipPast(nsString& aValidSet){
* @param
* @return error code
*/
PRInt32 CScanner::ReadWhile(nsString& aString,nsString& aValidSet,PRBool addTerminal){
nsresult CScanner::ReadWhile(nsString& aString,
nsString& aValidSet,
PRBool addTerminal){
PRUnichar theChar=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
PRInt32 wrPos=0;
while(kNoError==result) {
while(NS_OK==result) {
result=GetChar(theChar);
if(kNoError==result) {
if(NS_OK==result) {
PRInt32 pos=aValidSet.Find(theChar);
if(kNotFound==pos) {
if(addTerminal)
@ -407,13 +410,15 @@ PRInt32 CScanner::ReadWhile(nsString& aString,nsString& aValidSet,PRBool addTerm
* @param
* @return error code
*/
PRInt32 CScanner::ReadUntil(nsString& aString,nsString& aTerminalSet,PRBool addTerminal){
nsresult CScanner::ReadUntil(nsString& aString,
nsString& aTerminalSet,
PRBool addTerminal){
PRUnichar ch=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
while(!result) {
while(NS_OK == result) {
result=GetChar(ch);
if(kNoError==result) {
if(NS_OK==result) {
PRInt32 pos=aTerminalSet.Find(ch);
if(kNotFound!=pos) {
if(addTerminal)
@ -435,11 +440,13 @@ PRInt32 CScanner::ReadUntil(nsString& aString,nsString& aTerminalSet,PRBool addT
* @param
* @return error code
*/
PRInt32 CScanner::ReadUntil(nsString& aString,PRUnichar aTerminalChar,PRBool addTerminal){
nsresult CScanner::ReadUntil(nsString& aString,
PRUnichar aTerminalChar,
PRBool addTerminal){
PRUnichar ch=0;
PRInt32 result=kNoError;
nsresult result=NS_OK;
while(kNoError==result) {
while(NS_OK==result) {
result=GetChar(ch);
if(ch==aTerminalChar) {
if(addTerminal)

Просмотреть файл

@ -70,7 +70,7 @@ class CScanner {
* @param ch is the char to accept new value
* @return error code reflecting read status
*/
PRInt32 GetChar(PRUnichar& ch);
nsresult GetChar(PRUnichar& ch);
/**
* peek ahead to consume next char from scanner's internal
@ -80,7 +80,7 @@ class CScanner {
* @param ch is the char to accept new value
* @return error code reflecting read status
*/
PRInt32 Peek(PRUnichar& ch);
nsresult Peek(PRUnichar& ch);
/**
* Push the given char back onto the scanner
@ -89,7 +89,7 @@ class CScanner {
* @param character to be pushed
* @return error code
*/
PRInt32 PutBack(PRUnichar ch);
nsresult PutBack(PRUnichar ch);
/**
* Skip over chars as long as they're in aSkipSet
@ -98,7 +98,7 @@ class CScanner {
* @param set of chars to be skipped
* @return error code
*/
PRInt32 SkipOver(nsString& SkipChars);
nsresult SkipOver(nsString& SkipChars);
/**
* Skip over chars as long as they equal given char
@ -107,7 +107,7 @@ class CScanner {
* @param char to be skipped
* @return error code
*/
PRInt32 SkipOver(PRUnichar aSkipChar);
nsresult SkipOver(PRUnichar aSkipChar);
/**
* Skip over chars as long as they're in aSequence
@ -116,7 +116,7 @@ class CScanner {
* @param contains sequence to be skipped
* @return error code
*/
PRInt32 SkipPast(nsString& aSequence);
nsresult SkipPast(nsString& aSequence);
/**
* Skip whitespace on scanner input stream
@ -124,7 +124,7 @@ class CScanner {
* @update gess 3/25/98
* @return error status
*/
PRInt32 SkipWhitespace(void);
nsresult SkipWhitespace(void);
/**
* Determine if the scanner has reached EOF.
@ -134,7 +134,7 @@ class CScanner {
* @update gess 3/25/98
* @return PR_TRUE upon eof condition
*/
PRInt32 Eof(void);
nsresult Eof(void);
/**
* Consume characters until you find the terminal char
@ -145,7 +145,7 @@ class CScanner {
* @param addTerminal tells us whether to append terminal to aString
* @return error code
*/
PRInt32 ReadUntil(nsString& aString,PRUnichar aTerminal,PRBool addTerminal);
nsresult ReadUntil(nsString& aString,PRUnichar aTerminal,PRBool addTerminal);
/**
* Consume characters until you find one contained in given
@ -157,7 +157,7 @@ class CScanner {
* @param addTerminal tells us whether to append terminal to aString
* @return error code
*/
PRInt32 ReadUntil(nsString& aString,nsString& aTermSet,PRBool addTerminal);
nsresult ReadUntil(nsString& aString,nsString& aTermSet,PRBool addTerminal);
/**
* Consume characters while they're members of anInputSet
@ -168,7 +168,7 @@ class CScanner {
* @param addTerminal tells us whether to append terminal to aString
* @return error code
*/
PRInt32 ReadWhile(nsString& aString,nsString& anInputSet,PRBool addTerminal);
nsresult ReadWhile(nsString& aString,nsString& anInputSet,PRBool addTerminal);
/**
* Records current offset position in input stream. This allows us
@ -240,10 +240,8 @@ class CScanner {
* be filled with data.
*
* @update gess4/3/98
* @param anError is the resulting error code (hopefully 0)
* @return number of new bytes read
*/
PRInt32 FillBuffer(void);
nsresult FillBuffer(void);
fstream* mFileStream;

Просмотреть файл

@ -59,8 +59,8 @@ CToken::~CToken() {
* @param aScanner -- object to retrieve data from
* @return int error code
*/
PRInt32 CToken::Consume(PRUnichar aChar,CScanner& aScanner) {
PRInt32 result=kNoError;
nsresult CToken::Consume(PRUnichar aChar,CScanner& aScanner) {
nsresult result=NS_OK;
return result;
}

Просмотреть файл

@ -130,7 +130,7 @@ class CToken {
* @param aScanner -- input source where token should get data
* @return error code (0 means ok)
*/
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner);
/**
* Causes token to dump itself in debug form to given output stream

Просмотреть файл

@ -190,8 +190,8 @@ eAutoDetectResult CValidDTD::AutoDetectContentType(nsString& aBuffer,nsString& a
* @param
* @return
*/
PRInt32 CValidDTD::WillBuildModel(nsString& aFilename){
PRInt32 result=0;
NS_IMETHODIMP CValidDTD::WillBuildModel(nsString& aFilename){
nsresult result=NS_OK;
return result;
}
@ -201,8 +201,8 @@ PRInt32 CValidDTD::WillBuildModel(nsString& aFilename){
* @param
* @return
*/
PRInt32 CValidDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
NS_IMETHODIMP CValidDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result=NS_OK;
return result;
}
@ -249,12 +249,12 @@ nsIContentSink* CValidDTD::SetContentSink(nsIContentSink* aSink) {
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CValidDTD::ConsumeToken(CToken*& aToken){
NS_IMETHODIMP CValidDTD::ConsumeToken(CToken*& aToken){
CScanner* theScanner=mParser->GetScanner();
PRUnichar aChar;
PRInt32 result=theScanner->GetChar(aChar);
nsresult result=theScanner->GetChar(aChar);
switch(result) {
case kEOF:
@ -264,7 +264,7 @@ PRInt32 CValidDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(aChar) {
case kLessThan:
@ -273,7 +273,7 @@ PRInt32 CValidDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
return result;
}
@ -284,8 +284,8 @@ PRInt32 CValidDTD::ConsumeToken(CToken*& aToken){
* @param
* @return
*/
void CValidDTD::WillResumeParse(void){
return;
NS_IMETHODIMP CValidDTD::WillResumeParse(void){
return NS_OK;
}
/**
@ -294,8 +294,8 @@ void CValidDTD::WillResumeParse(void){
* @param
* @return
*/
void CValidDTD::WillInterruptParse(void){
return;
NS_IMETHODIMP CValidDTD::WillInterruptParse(void){
return NS_OK;
}
/**
@ -327,8 +327,8 @@ PRBool CValidDTD::CanContain(PRInt32 aParent,PRInt32 aChild){
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
PRInt32 CValidDTD::HandleToken(CToken* aToken) {
PRInt32 result=0;
NS_IMETHODIMP CValidDTD::HandleToken(CToken* aToken) {
nsresult result=NS_OK;
return result;
}

Просмотреть файл

@ -108,7 +108,7 @@ class CValidDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename);
NS_IMETHOD WillBuildModel(nsString& aFilename);
/**
*
@ -116,7 +116,7 @@ class CValidDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -124,7 +124,7 @@ class CValidDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -143,7 +143,7 @@ class CValidDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -152,7 +152,7 @@ class CValidDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -160,7 +160,7 @@ class CValidDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* Select given content sink into parser for parser output

Просмотреть файл

@ -177,8 +177,8 @@ eAutoDetectResult CWellFormedDTD::AutoDetectContentType(nsString& aBuffer,nsStri
* @param
* @return
*/
PRInt32 CWellFormedDTD::WillBuildModel(nsString& aFilename){
PRInt32 result=0;
NS_IMETHODIMP CWellFormedDTD::WillBuildModel(nsString& aFilename){
nsresult result=NS_OK;
return result;
}
@ -188,8 +188,8 @@ PRInt32 CWellFormedDTD::WillBuildModel(nsString& aFilename){
* @param
* @return
*/
PRInt32 CWellFormedDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
NS_IMETHODIMP CWellFormedDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result=NS_OK;
return result;
}
@ -236,12 +236,12 @@ nsIContentSink* CWellFormedDTD::SetContentSink(nsIContentSink* aSink) {
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 CWellFormedDTD::ConsumeToken(CToken*& aToken){
NS_IMETHODIMP CWellFormedDTD::ConsumeToken(CToken*& aToken){
CScanner* theScanner=mParser->GetScanner();
PRUnichar aChar;
PRInt32 result=theScanner->GetChar(aChar);
nsresult result=theScanner->GetChar(aChar);
switch(result) {
case kEOF:
@ -251,7 +251,7 @@ PRInt32 CWellFormedDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(aChar) {
case kLessThan:
@ -260,7 +260,7 @@ PRInt32 CWellFormedDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
return result;
}
@ -271,8 +271,8 @@ PRInt32 CWellFormedDTD::ConsumeToken(CToken*& aToken){
* @param
* @return
*/
void CWellFormedDTD::WillResumeParse(void){
return;
NS_IMETHODIMP CWellFormedDTD::WillResumeParse(void){
return NS_OK;
}
/**
@ -281,8 +281,8 @@ void CWellFormedDTD::WillResumeParse(void){
* @param
* @return
*/
void CWellFormedDTD::WillInterruptParse(void){
return;
NS_IMETHODIMP CWellFormedDTD::WillInterruptParse(void){
return NS_OK;
}
/**
@ -314,8 +314,8 @@ PRBool CWellFormedDTD::CanContain(PRInt32 aParent,PRInt32 aChild){
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
PRInt32 CWellFormedDTD::HandleToken(CToken* aToken) {
PRInt32 result=0;
NS_IMETHODIMP CWellFormedDTD::HandleToken(CToken* aToken) {
nsresult result=NS_OK;
return result;
}

Просмотреть файл

@ -97,7 +97,7 @@ class CWellFormedDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFilename);
NS_IMETHOD WillBuildModel(nsString& aFilename);
/**
*
@ -105,7 +105,7 @@ class CWellFormedDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 anErrorCode);
NS_IMETHOD DidBuildModel(PRInt32 anErrorCode);
/**
*
@ -113,7 +113,7 @@ class CWellFormedDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -132,7 +132,7 @@ class CWellFormedDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -141,7 +141,7 @@ class CWellFormedDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -149,7 +149,7 @@ class CWellFormedDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
* Select given content sink into parser for parser output

Просмотреть файл

@ -397,8 +397,8 @@ eAutoDetectResult nsXIFDTD::AutoDetectContentType(nsString& aBuffer,nsString& aT
* @param
* @return
*/
PRInt32 nsXIFDTD::WillBuildModel(nsString& aFileName){
PRInt32 result=0;
nsresult nsXIFDTD::WillBuildModel(nsString& aFileName){
nsresult result=NS_OK;
if(mSink)
{
@ -422,12 +422,12 @@ PRInt32 nsXIFDTD::WillBuildModel(nsString& aFileName){
* @param
* @return
*/
PRInt32 nsXIFDTD::DidBuildModel(PRInt32 anErrorCode){
PRInt32 result=0;
nsresult nsXIFDTD::DidBuildModel(PRInt32 anErrorCode){
nsresult result=NS_OK;
if(mSink)
{
mSink->DidBuildModel(anErrorCode);
result = mSink->DidBuildModel(anErrorCode);
if (mOut != nsnull)
{
@ -452,8 +452,8 @@ PRInt32 nsXIFDTD::DidBuildModel(PRInt32 anErrorCode){
* @param aParser
* @return
*/
PRInt32 nsXIFDTD::HandleToken(CToken* aToken){
PRInt32 result=0;
nsresult nsXIFDTD::HandleToken(CToken* aToken){
nsresult result=NS_OK;
if(aToken) {
CHTMLToken* theToken= (CHTMLToken*)(aToken);
@ -1621,7 +1621,7 @@ PRInt32 nsXIFDTD::ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aTo
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
PRInt32 nsXIFDTD::ConsumeToken(CToken*& aToken){
nsresult nsXIFDTD::ConsumeToken(CToken*& aToken){
aToken=0;
if(mTokenDeque.GetSize()>0) {
@ -1629,9 +1629,9 @@ PRInt32 nsXIFDTD::ConsumeToken(CToken*& aToken){
return kNoError;
}
PRInt32 result=kNoError;
nsresult result=NS_OK;
CScanner* theScanner=mParser->GetScanner();
if(kNoError==result){
if(NS_OK==result){
PRUnichar aChar;
result=theScanner->GetChar(aChar);
@ -1643,7 +1643,7 @@ PRInt32 nsXIFDTD::ConsumeToken(CToken*& aToken){
theScanner->RewindToMark();
break;
case kNoError:
case NS_OK:
default:
switch(aChar) {
case kLessThan:
@ -1668,7 +1668,7 @@ PRInt32 nsXIFDTD::ConsumeToken(CToken*& aToken){
} //switch
break;
} //switch
if(kNoError==result)
if(NS_OK==result)
result=theScanner->Eof();
} //while
return result;
@ -1691,11 +1691,12 @@ CToken* nsXIFDTD::CreateTokenOfType(eHTMLTokenTypes aType) {
* @param
* @return
*/
void nsXIFDTD::WillResumeParse(void){
nsresult nsXIFDTD::WillResumeParse(void){
nsresult result = NS_OK;
if(mSink) {
mSink->WillResume();
result = mSink->WillResume();
}
return;
return result;
}
/**
@ -1704,11 +1705,12 @@ void nsXIFDTD::WillResumeParse(void){
* @param
* @return
*/
void nsXIFDTD::WillInterruptParse(void){
nsresult nsXIFDTD::WillInterruptParse(void){
nsresult result = NS_OK;
if(mSink) {
mSink->WillInterrupt();
result = mSink->WillInterrupt();
}
return;
return result;
}

Просмотреть файл

@ -154,7 +154,7 @@ class nsXIFDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 WillBuildModel(nsString& aFileName);
NS_IMETHOD WillBuildModel(nsString& aFileName);
/**
*
@ -162,7 +162,7 @@ class nsXIFDTD : public nsIDTD {
* @param
* @return
*/
virtual PRInt32 DidBuildModel(PRInt32 aQualityLevel);
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel);
/**
*
@ -170,7 +170,7 @@ class nsXIFDTD : public nsIDTD {
* @param aToken -- token object to be put into content model
* @return 0 if all is well; non-zero is an error
*/
virtual PRInt32 HandleToken(CToken* aToken);
NS_IMETHOD HandleToken(CToken* aToken);
/**
*
@ -189,7 +189,7 @@ class nsXIFDTD : public nsIDTD {
* @param anError -- ref to error code
* @return new token or null
*/
virtual PRInt32 ConsumeToken(CToken*& aToken);
NS_IMETHOD ConsumeToken(CToken*& aToken);
/**
@ -198,7 +198,7 @@ class nsXIFDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillResumeParse(void);
NS_IMETHOD WillResumeParse(void);
/**
*
@ -206,7 +206,7 @@ class nsXIFDTD : public nsIDTD {
* @param
* @return
*/
virtual void WillInterruptParse(void);
NS_IMETHOD WillInterruptParse(void);
/**
*