Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1397713004: Don't bother layout until first navigation is done. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another attempt to fix tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698