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

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: move the check to Document::updateLayoutTree 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
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 ea7f805bbf5f360876100e88fef50b44a8d69660..dbda6a31b173151b89a294bd4ea5809212ea5668 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1736,15 +1736,20 @@ void Document::updateLayoutTree(StyleRecalcChange change)
if (view()->shouldThrottleRendering())
return;
- if (change != Force && !needsLayoutTreeUpdate()) {
- if (lifecycle().state() < DocumentLifecycle::StyleClean) {
- // needsLayoutTreeUpdate may change to false without any actual layout tree update.
- // For example, needsAnimationTimingUpdate may change to false when time elapses.
- // Advance lifecycle to StyleClean because style is actually clean now.
- lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc);
- lifecycle().advanceTo(DocumentLifecycle::StyleClean);
+ if (change != Force) {
+ if (isInitialEmptyDocument())
+ return;
+
+ if (!needsLayoutTreeUpdate()) {
+ if (lifecycle().state() < DocumentLifecycle::StyleClean) {
+ // needsLayoutTreeUpdate may change to false without any actual layout tree update.
+ // For example, needsAnimationTimingUpdate may change to false when time elapses.
+ // Advance lifecycle to StyleClean because style is actually clean now.
+ lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc);
+ lifecycle().advanceTo(DocumentLifecycle::StyleClean);
+ }
+ return;
}
- return;
}
if (inStyleRecalc())
@@ -2800,7 +2805,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();
@@ -5467,6 +5472,11 @@ 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::setContextFeatures(ContextFeatures& features)
{
m_contextFeatures = PassRefPtrWillBeRawPtr<ContextFeatures>(features);

Powered by Google App Engine
This is Rietveld 408576698