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

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: Re-landing with another fix 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/html/imports/HTMLImportsController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 registrationContext()->registerElement(this, &constructorBuilder, name, vali dNames, exceptionState); 809 registrationContext()->registerElement(this, &constructorBuilder, name, vali dNames, exceptionState);
810 return constructorBuilder.bindingsReturnValue(); 810 return constructorBuilder.bindingsReturnValue();
811 } 811 }
812 812
813 void Document::setImport(HTMLImport* import) 813 void Document::setImport(HTMLImport* import)
814 { 814 {
815 ASSERT(!m_import || !import); 815 ASSERT(!m_import || !import);
816 m_import = import; 816 m_import = import;
817 } 817 }
818 818
819 void Document::didLoadAllImports()
820 {
821 executeScriptsWaitingForResourcesIfNeeded();
822 }
823
824 bool Document::haveImportsLoaded() const 819 bool Document::haveImportsLoaded() const
825 { 820 {
826 return !m_import || !m_import->state().shouldBlockScriptExecution(); 821 return !m_import || !m_import->state().shouldBlockScriptExecution();
827 } 822 }
828 823
829 DOMWindow* Document::executingWindow() 824 DOMWindow* Document::executingWindow()
830 { 825 {
831 if (DOMWindow* owningWindow = domWindow()) 826 if (DOMWindow* owningWindow = domWindow())
832 return owningWindow; 827 return owningWindow;
833 if (HTMLImport* import = this->import()) 828 if (HTMLImport* import = this->import())
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after
2838 2833
2839 while (ancestorFrame) { 2834 while (ancestorFrame) {
2840 if (!ancestorFrame->document()->securityOrigin()->canAccess(securityOrig in())) 2835 if (!ancestorFrame->document()->securityOrigin()->canAccess(securityOrig in()))
2841 return currentFrame; 2836 return currentFrame;
2842 currentFrame = ancestorFrame; 2837 currentFrame = ancestorFrame;
2843 ancestorFrame = ancestorFrame->tree().parent(); 2838 ancestorFrame = ancestorFrame->tree().parent();
2844 } 2839 }
2845 return 0; 2840 return 0;
2846 } 2841 }
2847 2842
2843 void Document::didLoadAllImports()
2844 {
2845 if (!haveStylesheetsLoaded())
2846 return;
2847
2848 didLoadAllScriptBlockingResources();
2849 }
2850
2848 void Document::didRemoveAllPendingStylesheet() 2851 void Document::didRemoveAllPendingStylesheet()
2849 { 2852 {
2850 m_needsNotifyRemoveAllPendingStylesheet = false; 2853 m_needsNotifyRemoveAllPendingStylesheet = false;
2851 2854
2852 styleResolverChanged(RecalcStyleDeferred, hasNodesWithPlaceholderStyle() ? F ullStyleUpdate : AnalyzedStyleUpdate); 2855 styleResolverChanged(RecalcStyleDeferred, hasNodesWithPlaceholderStyle() ? F ullStyleUpdate : AnalyzedStyleUpdate);
2856
2857 if (m_import)
2858 m_import->didRemoveAllPendingStylesheet();
2859 if (!haveImportsLoaded())
2860 return;
2861
2862 didLoadAllScriptBlockingResources();
2863 }
2864
2865 void Document::didLoadAllScriptBlockingResources()
2866 {
2853 executeScriptsWaitingForResourcesIfNeeded(); 2867 executeScriptsWaitingForResourcesIfNeeded();
2854 2868
2855 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) 2869 if (m_gotoAnchorNeededAfterStylesheetsLoad && view())
2856 view()->scrollToFragment(m_url); 2870 view()->scrollToFragment(m_url);
2871 }
2857 2872
2858 if (m_import)
2859 m_import->didRemoveAllPendingStylesheet();
2860 }
2861 2873
2862 void Document::executeScriptsWaitingForResourcesIfNeeded() 2874 void Document::executeScriptsWaitingForResourcesIfNeeded()
2863 { 2875 {
2864 if (!haveStylesheetsAndImportsLoaded()) 2876 if (!haveStylesheetsAndImportsLoaded())
2865 return; 2877 return;
2866 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) 2878 if (ScriptableDocumentParser* parser = scriptableDocumentParser())
2867 parser->executeScriptsWaitingForResources(); 2879 parser->executeScriptsWaitingForResources();
2868 } 2880 }
2869 2881
2870 2882
(...skipping 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after
5453 } 5465 }
5454 5466
5455 void Document::invalidateNodeListCaches(const QualifiedName* attrName) 5467 void Document::invalidateNodeListCaches(const QualifiedName* attrName)
5456 { 5468 {
5457 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( ); 5469 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( );
5458 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it) 5470 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it)
5459 (*it)->invalidateCache(attrName); 5471 (*it)->invalidateCache(attrName);
5460 } 5472 }
5461 5473
5462 } // namespace WebCore 5474 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/html/imports/HTMLImportsController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698