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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 202813002: [HTML Import] Let script block by pending resources created by lifecycle callback (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Landing Created 6 years, 9 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 | Annotate | Revision Log
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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 registrationContext()->registerElement(this, &constructorBuilder, name, vali dNames, exceptionState); 808 registrationContext()->registerElement(this, &constructorBuilder, name, vali dNames, exceptionState);
809 return constructorBuilder.bindingsReturnValue(); 809 return constructorBuilder.bindingsReturnValue();
810 } 810 }
811 811
812 void Document::setImport(HTMLImport* import) 812 void Document::setImport(HTMLImport* import)
813 { 813 {
814 ASSERT(!m_import || !import); 814 ASSERT(!m_import || !import);
815 m_import = import; 815 m_import = import;
816 } 816 }
817 817
818 void Document::didLoadAllImports()
819 {
820 executeScriptsWaitingForResourcesIfNeeded();
821 }
822
823 bool Document::haveImportsLoaded() const 818 bool Document::haveImportsLoaded() const
824 { 819 {
825 return !m_import || !m_import->state().shouldBlockScriptExecution(); 820 return !m_import || !m_import->state().shouldBlockScriptExecution();
826 } 821 }
827 822
828 DOMWindow* Document::executingWindow() 823 DOMWindow* Document::executingWindow()
829 { 824 {
830 if (DOMWindow* owningWindow = domWindow()) 825 if (DOMWindow* owningWindow = domWindow())
831 return owningWindow; 826 return owningWindow;
832 if (HTMLImport* import = this->import()) 827 if (HTMLImport* import = this->import())
(...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 2831
2837 while (ancestorFrame) { 2832 while (ancestorFrame) {
2838 if (!ancestorFrame->document()->securityOrigin()->canAccess(securityOrig in())) 2833 if (!ancestorFrame->document()->securityOrigin()->canAccess(securityOrig in()))
2839 return currentFrame; 2834 return currentFrame;
2840 currentFrame = ancestorFrame; 2835 currentFrame = ancestorFrame;
2841 ancestorFrame = ancestorFrame->tree().parent(); 2836 ancestorFrame = ancestorFrame->tree().parent();
2842 } 2837 }
2843 return 0; 2838 return 0;
2844 } 2839 }
2845 2840
2841 void Document::didLoadAllImports()
2842 {
2843 if (!haveStylesheetsLoaded())
2844 return;
2845
2846 didLoadAllScriptBlockingResources();
2847 }
2848
2846 void Document::didRemoveAllPendingStylesheet() 2849 void Document::didRemoveAllPendingStylesheet()
2847 { 2850 {
2848 m_needsNotifyRemoveAllPendingStylesheet = false; 2851 m_needsNotifyRemoveAllPendingStylesheet = false;
2849 2852
2850 styleResolverChanged(RecalcStyleDeferred, hasNodesWithPlaceholderStyle() ? F ullStyleUpdate : AnalyzedStyleUpdate); 2853 styleResolverChanged(RecalcStyleDeferred, hasNodesWithPlaceholderStyle() ? F ullStyleUpdate : AnalyzedStyleUpdate);
2854
2855 if (m_import)
2856 m_import->didRemoveAllPendingStylesheet();
2857 if (!haveImportsLoaded())
2858 return;
2859
2860 didLoadAllScriptBlockingResources();
2861 }
2862
2863 void Document::didLoadAllScriptBlockingResources()
2864 {
2851 executeScriptsWaitingForResourcesIfNeeded(); 2865 executeScriptsWaitingForResourcesIfNeeded();
2852 2866
2853 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) 2867 if (m_gotoAnchorNeededAfterStylesheetsLoad && view())
2854 view()->scrollToFragment(m_url); 2868 view()->scrollToFragment(m_url);
2869 }
2855 2870
2856 if (m_import)
2857 m_import->didRemoveAllPendingStylesheet();
2858 }
2859 2871
2860 void Document::executeScriptsWaitingForResourcesIfNeeded() 2872 void Document::executeScriptsWaitingForResourcesIfNeeded()
2861 { 2873 {
2862 if (!haveStylesheetsAndImportsLoaded()) 2874 if (!haveStylesheetsAndImportsLoaded())
2863 return; 2875 return;
2864 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) 2876 if (ScriptableDocumentParser* parser = scriptableDocumentParser())
2865 parser->executeScriptsWaitingForResources(); 2877 parser->executeScriptsWaitingForResources();
2866 } 2878 }
2867 2879
2868 2880
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after
5443 } 5455 }
5444 5456
5445 void Document::invalidateNodeListCaches(const QualifiedName* attrName) 5457 void Document::invalidateNodeListCaches(const QualifiedName* attrName)
5446 { 5458 {
5447 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( ); 5459 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( );
5448 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it) 5460 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it)
5449 (*it)->invalidateCache(attrName); 5461 (*it)->invalidateCache(attrName);
5450 } 5462 }
5451 5463
5452 } // namespace WebCore 5464 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698