Bug 5569. Make sure that Terminate() can propogate DidBuildModel() to the sink, and that the sink will ensure an initial reflow has occurred. r=harishd, sr=jst

This commit is contained in:
waterson%netscape.com 2001-04-10 00:49:49 +00:00
Родитель 08f286132c
Коммит b5d9f94eaf
3 изменённых файлов: 17 добавлений и 9 удалений

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

@ -2383,12 +2383,14 @@ HTMLContentSink::Init(nsIDocument* aDoc,
mCurrentContext->Begin(eHTMLTag_html, mRoot, 0, -1);
mContextStack.AppendElement(mCurrentContext);
#ifdef NS_DEBUG
char* spec;
(void)aURL->GetSpec(&spec);
SINK_TRACE(SINK_TRACE_CALLS,
("HTMLContentSink::Init: this=%p url='%s'",
this, spec));
nsCRT::free(spec);
#endif
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
@ -2443,11 +2445,19 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
// Reflow the last batch of content
if (nsnull != mBody) {
if (mBody) {
SINK_TRACE(SINK_TRACE_REFLOW,
("HTMLContentSink::DidBuildModel: layout final content"));
mCurrentContext->FlushTags(PR_TRUE);
}
else if (!mLayoutStarted) {
// We never saw the body, and layout never got started. Force
// layout *now*, to get an initial reflow.
SINK_TRACE(SINK_TRACE_REFLOW,
("HTMLContentSink::DidBuildModel: forcing reflow on empty document"));
StartLayout();
}
ScrollToRef();

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

@ -1414,7 +1414,7 @@ nsresult nsParser::DidBuildModel(nsresult anErrorCode) {
//One last thing...close any open containers.
nsresult result=anErrorCode;
if(mParserEnabled && mParserContext && !mParserContext->mPrevContext) {
if(mParserContext && !mParserContext->mPrevContext) {
if(mParserContext->mDTD) {
result=mParserContext->mDTD->DidBuildModel(anErrorCode,PRBool(0==mParserContext->mPrevContext),this,mSink);
}
@ -1491,11 +1491,10 @@ nsresult nsParser::Terminate(void){
// Hack - Hold a reference until we are completely done...
nsCOMPtr<nsIParser> kungFuDeathGrip(this);
mInternalState=result;
result=DidBuildModel(result);
DidBuildModel(result);
}
}
return result;
}
}
return mInternalState;
}

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

@ -1414,7 +1414,7 @@ nsresult nsParser::DidBuildModel(nsresult anErrorCode) {
//One last thing...close any open containers.
nsresult result=anErrorCode;
if(mParserEnabled && mParserContext && !mParserContext->mPrevContext) {
if(mParserContext && !mParserContext->mPrevContext) {
if(mParserContext->mDTD) {
result=mParserContext->mDTD->DidBuildModel(anErrorCode,PRBool(0==mParserContext->mPrevContext),this,mSink);
}
@ -1491,11 +1491,10 @@ nsresult nsParser::Terminate(void){
// Hack - Hold a reference until we are completely done...
nsCOMPtr<nsIParser> kungFuDeathGrip(this);
mInternalState=result;
result=DidBuildModel(result);
DidBuildModel(result);
}
}
return result;
}
}
return mInternalState;
}