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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 ASSERT(isMainThread()); 1729 ASSERT(isMainThread());
1730 1730
1731 ScriptForbiddenScope forbidScript; 1731 ScriptForbiddenScope forbidScript;
1732 1732
1733 if (!view() || !isActive()) 1733 if (!view() || !isActive())
1734 return; 1734 return;
1735 1735
1736 if (view()->shouldThrottleRendering()) 1736 if (view()->shouldThrottleRendering())
1737 return; 1737 return;
1738 1738
1739 if (change != Force && !needsLayoutTreeUpdate()) { 1739 if (change != Force) {
1740 if (lifecycle().state() < DocumentLifecycle::StyleClean) { 1740 if (isInitialEmptyDocument())
1741 // needsLayoutTreeUpdate may change to false without any actual layo ut tree update. 1741 return;
1742 // For example, needsAnimationTimingUpdate may change to false when time elapses. 1742
1743 // Advance lifecycle to StyleClean because style is actually clean n ow. 1743 if (!needsLayoutTreeUpdate()) {
1744 lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc); 1744 if (lifecycle().state() < DocumentLifecycle::StyleClean) {
1745 lifecycle().advanceTo(DocumentLifecycle::StyleClean); 1745 // needsLayoutTreeUpdate may change to false without any actual layout tree update.
1746 // For example, needsAnimationTimingUpdate may change to false w hen time elapses.
1747 // Advance lifecycle to StyleClean because style is actually cle an now.
1748 lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc);
1749 lifecycle().advanceTo(DocumentLifecycle::StyleClean);
1750 }
1751 return;
1746 } 1752 }
1747 return;
1748 } 1753 }
1749 1754
1750 if (inStyleRecalc()) 1755 if (inStyleRecalc())
1751 return; 1756 return;
1752 1757
1753 // Entering here from inside layout or paint would be catastrophic since rec alcStyle can 1758 // Entering here from inside layout or paint would be catastrophic since rec alcStyle can
1754 // tear down the layout tree or (unfortunately) run script. Kill the whole l ayoutObject if 1759 // tear down the layout tree or (unfortunately) run script. Kill the whole l ayoutObject if
1755 // someone managed to get into here from inside layout or paint. 1760 // someone managed to get into here from inside layout or paint.
1756 RELEASE_ASSERT(!view()->isInPerformLayout()); 1761 RELEASE_ASSERT(!view()->isInPerformLayout());
1757 RELEASE_ASSERT(!view()->isPainting()); 1762 RELEASE_ASSERT(!view()->isPainting());
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, m_frame->d ocument()); 2798 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, m_frame->d ocument());
2794 } 2799 }
2795 } 2800 }
2796 m_loadEventProgress = UnloadEventHandled; 2801 m_loadEventProgress = UnloadEventHandled;
2797 } 2802 }
2798 2803
2799 if (!m_frame) 2804 if (!m_frame)
2800 return; 2805 return;
2801 2806
2802 // Don't remove event listeners from a transitional empty document (see http s://bugs.webkit.org/show_bug.cgi?id=28716 for more information). 2807 // Don't remove event listeners from a transitional empty document (see http s://bugs.webkit.org/show_bug.cgi?id=28716 for more information).
2803 bool keepEventListeners = m_frame->loader().stateMachine()->isDisplayingInit ialEmptyDocument() && m_frame->loader().provisionalDocumentLoader() 2808 bool keepEventListeners = isInitialEmptyDocument() && m_frame->loader().prov isionalDocumentLoader()
2804 && isSecureTransitionTo(m_frame->loader().provisionalDocumentLoader()->u rl()); 2809 && isSecureTransitionTo(m_frame->loader().provisionalDocumentLoader()->u rl());
2805 if (!keepEventListeners) 2810 if (!keepEventListeners)
2806 removeAllEventListenersRecursively(); 2811 removeAllEventListenersRecursively();
2807 } 2812 }
2808 2813
2809 Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const 2814 Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const
2810 { 2815 {
2811 if (m_loadEventProgress == BeforeUnloadEventInProgress) 2816 if (m_loadEventProgress == BeforeUnloadEventInProgress)
2812 return BeforeUnloadDismissal; 2817 return BeforeUnloadDismissal;
2813 if (m_loadEventProgress == PageHideInProgress) 2818 if (m_loadEventProgress == PageHideInProgress)
(...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after
5460 bool Document::threadedParsingEnabledForTesting() 5465 bool Document::threadedParsingEnabledForTesting()
5461 { 5466 {
5462 return s_threadedParsingEnabledForTesting; 5467 return s_threadedParsingEnabledForTesting;
5463 } 5468 }
5464 5469
5465 bool Document::hasActiveParser() 5470 bool Document::hasActiveParser()
5466 { 5471 {
5467 return m_activeParserCount || (m_parser && m_parser->processingData()); 5472 return m_activeParserCount || (m_parser && m_parser->processingData());
5468 } 5473 }
5469 5474
5475 bool Document::isInitialEmptyDocument() const
5476 {
5477 return m_frame && m_frame->loader().stateMachine()->isDisplayingInitialEmpty Document();
5478 }
5479
5470 void Document::setContextFeatures(ContextFeatures& features) 5480 void Document::setContextFeatures(ContextFeatures& features)
5471 { 5481 {
5472 m_contextFeatures = PassRefPtrWillBeRawPtr<ContextFeatures>(features); 5482 m_contextFeatures = PassRefPtrWillBeRawPtr<ContextFeatures>(features);
5473 } 5483 }
5474 5484
5475 static LayoutObject* nearestCommonHoverAncestor(LayoutObject* obj1, LayoutObject * obj2) 5485 static LayoutObject* nearestCommonHoverAncestor(LayoutObject* obj1, LayoutObject * obj2)
5476 { 5486 {
5477 if (!obj1 || !obj2) 5487 if (!obj1 || !obj2)
5478 return 0; 5488 return 0;
5479 5489
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
5945 #ifndef NDEBUG 5955 #ifndef NDEBUG
5946 using namespace blink; 5956 using namespace blink;
5947 void showLiveDocumentInstances() 5957 void showLiveDocumentInstances()
5948 { 5958 {
5949 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5959 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5950 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5960 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5951 for (Document* document : set) 5961 for (Document* document : set)
5952 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5962 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5953 } 5963 }
5954 #endif 5964 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698