| OLD | NEW |
| 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 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 if (lifecycle().state() < DocumentLifecycle::StyleClean) { | 1740 if (lifecycle().state() < DocumentLifecycle::StyleClean) { |
| 1741 // needsLayoutTreeUpdate may change to false without any actual layo
ut tree update. | 1741 // needsLayoutTreeUpdate may change to false without any actual layo
ut tree update. |
| 1742 // For example, needsAnimationTimingUpdate may change to false when
time elapses. | 1742 // For example, needsAnimationTimingUpdate may change to false when
time elapses. |
| 1743 // Advance lifecycle to StyleClean because style is actually clean n
ow. | 1743 // Advance lifecycle to StyleClean because style is actually clean n
ow. |
| 1744 lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc); | 1744 lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc); |
| 1745 lifecycle().advanceTo(DocumentLifecycle::StyleClean); | 1745 lifecycle().advanceTo(DocumentLifecycle::StyleClean); |
| 1746 } | 1746 } |
| 1747 return; | 1747 return; |
| 1748 } | 1748 } |
| 1749 | 1749 |
| 1750 if (m_frame && m_frame->isMainFrame() && isInitialEmptyDocument()) |
| 1751 return; |
| 1752 |
| 1750 if (inStyleRecalc()) | 1753 if (inStyleRecalc()) |
| 1751 return; | 1754 return; |
| 1752 | 1755 |
| 1753 // Entering here from inside layout or paint would be catastrophic since rec
alcStyle can | 1756 // 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 | 1757 // 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. | 1758 // someone managed to get into here from inside layout or paint. |
| 1756 RELEASE_ASSERT(!view()->isInPerformLayout()); | 1759 RELEASE_ASSERT(!view()->isInPerformLayout()); |
| 1757 RELEASE_ASSERT(!view()->isPainting()); | 1760 RELEASE_ASSERT(!view()->isPainting()); |
| 1758 | 1761 |
| 1759 // Script can run below in WidgetUpdates, so protect the LocalFrame. | 1762 // Script can run below in WidgetUpdates, so protect the LocalFrame. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 } | 1995 } |
| 1993 | 1996 |
| 1994 // FIXME: This is a bad idea and needs to be removed eventually. | 1997 // FIXME: This is a bad idea and needs to be removed eventually. |
| 1995 // Other browsers load stylesheets before they continue parsing the web page. | 1998 // Other browsers load stylesheets before they continue parsing the web page. |
| 1996 // Since we don't, we can run JavaScript code that needs answers before the | 1999 // Since we don't, we can run JavaScript code that needs answers before the |
| 1997 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets | 2000 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets |
| 1998 // lets us get reasonable answers. The long term solution to this problem is | 2001 // lets us get reasonable answers. The long term solution to this problem is |
| 1999 // to instead suspend JavaScript execution. | 2002 // to instead suspend JavaScript execution. |
| 2000 void Document::updateLayoutTreeIgnorePendingStylesheets() | 2003 void Document::updateLayoutTreeIgnorePendingStylesheets() |
| 2001 { | 2004 { |
| 2005 // TODO(kouhei): We need forced layout at this point. Bail out from skip lay
out tree path. |
| 2006 markNonInitialEmptyDocument(); |
| 2007 |
| 2002 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); | 2008 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); |
| 2003 | 2009 |
| 2004 if (styleEngine().hasPendingSheets()) { | 2010 if (styleEngine().hasPendingSheets()) { |
| 2005 // FIXME: We are willing to attempt to suppress painting with outdated s
tyle info only once. | 2011 // FIXME: We are willing to attempt to suppress painting with outdated s
tyle info only once. |
| 2006 // Our assumption is that it would be dangerous to try to stop it a seco
nd time, after page | 2012 // Our assumption is that it would be dangerous to try to stop it a seco
nd time, after page |
| 2007 // content has already been loaded and displayed with accurate style inf
ormation. (Our | 2013 // content has already been loaded and displayed with accurate style inf
ormation. (Our |
| 2008 // suppression involves blanking the whole page at the moment. If it wer
e more refined, we | 2014 // suppression involves blanking the whole page at the moment. If it wer
e more refined, we |
| 2009 // might be able to do something better.) It's worth noting though that
this entire method | 2015 // might be able to do something better.) It's worth noting though that
this entire method |
| 2010 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with | 2016 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with |
| 2011 // inaccurate information. | 2017 // inaccurate information. |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2796 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, m_frame->d
ocument()); | 2802 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, m_frame->d
ocument()); |
| 2797 } | 2803 } |
| 2798 } | 2804 } |
| 2799 m_loadEventProgress = UnloadEventHandled; | 2805 m_loadEventProgress = UnloadEventHandled; |
| 2800 } | 2806 } |
| 2801 | 2807 |
| 2802 if (!m_frame) | 2808 if (!m_frame) |
| 2803 return; | 2809 return; |
| 2804 | 2810 |
| 2805 // Don't remove event listeners from a transitional empty document (see http
s://bugs.webkit.org/show_bug.cgi?id=28716 for more information). | 2811 // Don't remove event listeners from a transitional empty document (see http
s://bugs.webkit.org/show_bug.cgi?id=28716 for more information). |
| 2806 bool keepEventListeners = m_frame->loader().stateMachine()->isDisplayingInit
ialEmptyDocument() && m_frame->loader().provisionalDocumentLoader() | 2812 bool keepEventListeners = isInitialEmptyDocument() && m_frame->loader().prov
isionalDocumentLoader() |
| 2807 && isSecureTransitionTo(m_frame->loader().provisionalDocumentLoader()->u
rl()); | 2813 && isSecureTransitionTo(m_frame->loader().provisionalDocumentLoader()->u
rl()); |
| 2808 if (!keepEventListeners) | 2814 if (!keepEventListeners) |
| 2809 removeAllEventListenersRecursively(); | 2815 removeAllEventListenersRecursively(); |
| 2810 } | 2816 } |
| 2811 | 2817 |
| 2812 Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const | 2818 Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const |
| 2813 { | 2819 { |
| 2814 if (m_loadEventProgress == BeforeUnloadEventInProgress) | 2820 if (m_loadEventProgress == BeforeUnloadEventInProgress) |
| 2815 return BeforeUnloadDismissal; | 2821 return BeforeUnloadDismissal; |
| 2816 if (m_loadEventProgress == PageHideInProgress) | 2822 if (m_loadEventProgress == PageHideInProgress) |
| (...skipping 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5503 bool Document::threadedParsingEnabledForTesting() | 5509 bool Document::threadedParsingEnabledForTesting() |
| 5504 { | 5510 { |
| 5505 return s_threadedParsingEnabledForTesting; | 5511 return s_threadedParsingEnabledForTesting; |
| 5506 } | 5512 } |
| 5507 | 5513 |
| 5508 bool Document::hasActiveParser() | 5514 bool Document::hasActiveParser() |
| 5509 { | 5515 { |
| 5510 return m_activeParserCount || (m_parser && m_parser->processingData()); | 5516 return m_activeParserCount || (m_parser && m_parser->processingData()); |
| 5511 } | 5517 } |
| 5512 | 5518 |
| 5519 bool Document::isInitialEmptyDocument() const |
| 5520 { |
| 5521 return m_frame && m_frame->loader().stateMachine()->isDisplayingInitialEmpty
Document(); |
| 5522 } |
| 5523 |
| 5524 void Document::markNonInitialEmptyDocument() |
| 5525 { |
| 5526 if (!m_frame) |
| 5527 return; |
| 5528 auto stateMachine = m_frame->loader().stateMachine(); |
| 5529 if (stateMachine->isDisplayingInitialEmptyDocument()) |
| 5530 stateMachine->advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad)
; |
| 5531 } |
| 5532 |
| 5513 void Document::setContextFeatures(ContextFeatures& features) | 5533 void Document::setContextFeatures(ContextFeatures& features) |
| 5514 { | 5534 { |
| 5515 m_contextFeatures = PassRefPtrWillBeRawPtr<ContextFeatures>(features); | 5535 m_contextFeatures = PassRefPtrWillBeRawPtr<ContextFeatures>(features); |
| 5516 } | 5536 } |
| 5517 | 5537 |
| 5518 static LayoutObject* nearestCommonHoverAncestor(LayoutObject* obj1, LayoutObject
* obj2) | 5538 static LayoutObject* nearestCommonHoverAncestor(LayoutObject* obj1, LayoutObject
* obj2) |
| 5519 { | 5539 { |
| 5520 if (!obj1 || !obj2) | 5540 if (!obj1 || !obj2) |
| 5521 return 0; | 5541 return 0; |
| 5522 | 5542 |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5994 #ifndef NDEBUG | 6014 #ifndef NDEBUG |
| 5995 using namespace blink; | 6015 using namespace blink; |
| 5996 void showLiveDocumentInstances() | 6016 void showLiveDocumentInstances() |
| 5997 { | 6017 { |
| 5998 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 6018 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5999 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6019 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6000 for (Document* document : set) | 6020 for (Document* document : set) |
| 6001 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 6021 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 6002 } | 6022 } |
| 6003 #endif | 6023 #endif |
| OLD | NEW |