fixed bug 18312; it's not PDT+, but it's something Phil has been *really* anxious to fix. r=nisheeth

git-svn-id: svn://10.0.0.236/trunk@54243 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg%netscape.com 1999-11-23 03:07:09 +00:00
parent e7d7a8170e
commit 7301979853
4 changed files with 52 additions and 10 deletions

View File

@ -1062,11 +1062,13 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
if(mParser) {
CObserverService& theService=mParser->GetObserverService();
CParserContext* pc=mParser->PeekContext();
void* theDocID=(pc)? pc->mKey:0;
CObserverService* theService=mParser->GetObserverService();
if(theService) {
CParserContext* pc=mParser->PeekContext();
void* theDocID=(pc)? pc->mKey:0;
result=theService.Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser);
result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser);
}
}
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));

View File

@ -206,7 +206,8 @@ nsParser::nsParser(nsITokenObserver* anObserver) : mCommand(""), mUnusedInput(""
mDTDVerification=PR_FALSE;
mCharsetSource=kCharsetUninitialized;
mInternalState=NS_OK;
mObserversEnabled=PR_TRUE;
MOZ_TIMER_DEBUGLOG(("Reset: Parse Time: nsParser::nsParser(), this=%p\n", this));
MOZ_TIMER_RESET(mParseTime);
MOZ_TIMER_RESET(mDTDTime);
@ -923,7 +924,10 @@ nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITag
if(theBuffer.Length()){
//now it's time to try to build the model from this fragment
mObserversEnabled=PR_FALSE; //disable observers for fragments
result=Parse(theBuffer,(void*)&theBuffer,aContentType,PR_FALSE,PR_TRUE);
mObserversEnabled=PR_TRUE; //now reenable.
}
return result;
@ -1499,3 +1503,18 @@ nsParser::GetDTD(nsIDTD** aDTD)
return NS_OK;
}
/**
* Get the observer service
*
* @update rickg 11/22/99
* @return ptr to server or NULL
*/
CObserverService* nsParser::GetObserverService(void) {
//XXX Hack! this should be XPCOM based!
if(mObserversEnabled)
return &mObserverService;
return 0;
}

View File

@ -1062,11 +1062,13 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
if(mParser) {
CObserverService& theService=mParser->GetObserverService();
CParserContext* pc=mParser->PeekContext();
void* theDocID=(pc)? pc->mKey:0;
CObserverService* theService=mParser->GetObserverService();
if(theService) {
CParserContext* pc=mParser->PeekContext();
void* theDocID=(pc)? pc->mKey:0;
result=theService.Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser);
result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser);
}
}
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillHandleStartTag(), this=%p\n", this));

View File

@ -206,7 +206,8 @@ nsParser::nsParser(nsITokenObserver* anObserver) : mCommand(""), mUnusedInput(""
mDTDVerification=PR_FALSE;
mCharsetSource=kCharsetUninitialized;
mInternalState=NS_OK;
mObserversEnabled=PR_TRUE;
MOZ_TIMER_DEBUGLOG(("Reset: Parse Time: nsParser::nsParser(), this=%p\n", this));
MOZ_TIMER_RESET(mParseTime);
MOZ_TIMER_RESET(mDTDTime);
@ -923,7 +924,10 @@ nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITag
if(theBuffer.Length()){
//now it's time to try to build the model from this fragment
mObserversEnabled=PR_FALSE; //disable observers for fragments
result=Parse(theBuffer,(void*)&theBuffer,aContentType,PR_FALSE,PR_TRUE);
mObserversEnabled=PR_TRUE; //now reenable.
}
return result;
@ -1499,3 +1503,18 @@ nsParser::GetDTD(nsIDTD** aDTD)
return NS_OK;
}
/**
* Get the observer service
*
* @update rickg 11/22/99
* @return ptr to server or NULL
*/
CObserverService* nsParser::GetObserverService(void) {
//XXX Hack! this should be XPCOM based!
if(mObserversEnabled)
return &mObserverService;
return 0;
}