Bug 540574 - Make the HTML5 parser break out of doc update on <body> and remove trailing white space from test_bug386782.html. r=bnewman.
This commit is contained in:
@@ -150,10 +150,29 @@ nsHtml5TreeOpExecutor::DidBuildModel(PRBool aTerminated)
|
||||
|
||||
static_cast<nsHtml5Parser*> (mParser.get())->DropStreamParser();
|
||||
|
||||
// This is comes from nsXMLContentSink
|
||||
// This is comes from nsXMLContentSink and nsHTMLContentSink
|
||||
DidBuildModelImpl(aTerminated);
|
||||
mDocument->ScriptLoader()->RemoveObserver(this);
|
||||
|
||||
if (!mLayoutStarted) {
|
||||
// We never saw the body, and layout never got started. Force
|
||||
// layout *now*, to get an initial reflow.
|
||||
|
||||
// NOTE: only force the layout if we are NOT destroying the
|
||||
// docshell. If we are destroying it, then starting layout will
|
||||
// likely cause us to crash, or at best waste a lot of time as we
|
||||
// are just going to tear it down anyway.
|
||||
PRBool destroying = PR_TRUE;
|
||||
if (mDocShell) {
|
||||
mDocShell->IsBeingDestroyed(&destroying);
|
||||
}
|
||||
|
||||
if (!destroying) {
|
||||
nsContentSink::StartLayout(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
ScrollToRef();
|
||||
mDocument->ScriptLoader()->RemoveObserver(this);
|
||||
mDocument->RemoveObserver(this);
|
||||
if (!mParser) {
|
||||
// DidBuildModelImpl may cause mParser to be nulled out
|
||||
@@ -526,6 +545,24 @@ nsHtml5TreeOpExecutor::DocumentMode(nsHtml5DocumentMode m)
|
||||
htmlDocument->SetCompatibilityMode(mode);
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeOpExecutor::StartLayout() {
|
||||
if (mLayoutStarted || !mDocument) {
|
||||
return;
|
||||
}
|
||||
|
||||
EndDocUpdate();
|
||||
|
||||
if(NS_UNLIKELY(!mParser)) {
|
||||
// got terminate
|
||||
return;
|
||||
}
|
||||
|
||||
nsContentSink::StartLayout(PR_FALSE);
|
||||
|
||||
BeginDocUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* The reason why this code is here and not in the tree builder even in the
|
||||
* main-thread case is to allow the control to return from the tokenizer
|
||||
|
||||
Reference in New Issue
Block a user