| Index: third_party/WebKit/Source/core/dom/Document.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
|
| index fa3e9134e84b79286012914bc05b8ff47bc49d5a..a308e3fd0803e0ecd966d13add0c4d98e8799ae3 100644
|
| --- a/third_party/WebKit/Source/core/dom/Document.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp
|
| @@ -1747,6 +1747,9 @@ void Document::updateLayoutTreeIfNeeded()
|
| return;
|
| }
|
|
|
| + if (m_frame && m_frame->isMainFrame() && isInitialEmptyDocument())
|
| + return;
|
| +
|
| if (inStyleRecalc())
|
| return;
|
|
|
| @@ -1999,6 +2002,9 @@ void Document::clearFocusedElementTimerFired(Timer<Document>*)
|
| // to instead suspend JavaScript execution.
|
| void Document::updateLayoutTreeIgnorePendingStylesheets()
|
| {
|
| + // TODO(kouhei): We need forced layout at this point. Bail out from skip layout tree path.
|
| + markNonInitialEmptyDocument();
|
| +
|
| StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine());
|
|
|
| if (styleEngine().hasPendingSheets()) {
|
| @@ -2803,7 +2809,7 @@ void Document::dispatchUnloadEvents()
|
| return;
|
|
|
| // Don't remove event listeners from a transitional empty document (see https://bugs.webkit.org/show_bug.cgi?id=28716 for more information).
|
| - bool keepEventListeners = m_frame->loader().stateMachine()->isDisplayingInitialEmptyDocument() && m_frame->loader().provisionalDocumentLoader()
|
| + bool keepEventListeners = isInitialEmptyDocument() && m_frame->loader().provisionalDocumentLoader()
|
| && isSecureTransitionTo(m_frame->loader().provisionalDocumentLoader()->url());
|
| if (!keepEventListeners)
|
| removeAllEventListenersRecursively();
|
| @@ -5510,6 +5516,20 @@ bool Document::hasActiveParser()
|
| return m_activeParserCount || (m_parser && m_parser->processingData());
|
| }
|
|
|
| +bool Document::isInitialEmptyDocument() const
|
| +{
|
| + return m_frame && m_frame->loader().stateMachine()->isDisplayingInitialEmptyDocument();
|
| +}
|
| +
|
| +void Document::markNonInitialEmptyDocument()
|
| +{
|
| + if (!m_frame)
|
| + return;
|
| + auto stateMachine = m_frame->loader().stateMachine();
|
| + if (stateMachine->isDisplayingInitialEmptyDocument())
|
| + stateMachine->advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
|
| +}
|
| +
|
| void Document::setContextFeatures(ContextFeatures& features)
|
| {
|
| m_contextFeatures = PassRefPtrWillBeRawPtr<ContextFeatures>(features);
|
|
|