Bug 1539714 - Trigger initial localization even if layout started. r=bzbarsky

Differential Revision: https://phabricator.services.mozilla.com/D34400

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Zibi Braniecki 2019-06-10 20:06:08 +00:00
parent 9ba5553f62
commit 963c84b982

View File

@ -168,21 +168,22 @@ nsHtml5TreeOpExecutor::DidBuildModel(bool aTerminated) {
// forced termination.
DidBuildModelImpl(aTerminated || NS_FAILED(IsBroken()));
if (!mLayoutStarted) {
// We never saw the body, and layout never got started. Force
// layout *now*, to get an initial reflow.
bool destroying = true;
if (mDocShell) {
mDocShell->IsBeingDestroyed(&destroying);
}
// 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.
bool destroying = true;
if (mDocShell) {
mDocShell->IsBeingDestroyed(&destroying);
}
if (!destroying) {
mDocument->TriggerInitialDocumentTranslation();
if (!destroying) {
mDocument->TriggerInitialDocumentTranslation();
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.
nsContentSink::StartLayout(false);
}
}