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

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

Issue 201673005: Revert 169577 "[HTML Import] Let script block by pending resourc..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: 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 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
819 bool Document::haveImportsLoaded() const 824 bool Document::haveImportsLoaded() const
820 { 825 {
821 return !m_import || !m_import->state().shouldBlockScriptExecution(); 826 return !m_import || !m_import->state().shouldBlockScriptExecution();
822 } 827 }
823 828
824 DOMWindow* Document::executingWindow() 829 DOMWindow* Document::executingWindow()
825 { 830 {
826 if (DOMWindow* owningWindow = domWindow()) 831 if (DOMWindow* owningWindow = domWindow())
827 return owningWindow; 832 return owningWindow;
828 if (HTMLImport* import = this->import()) 833 if (HTMLImport* import = this->import())
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 2838
2834 while (ancestorFrame) { 2839 while (ancestorFrame) {
2835 if (!ancestorFrame->document()->securityOrigin()->canAccess(securityOrig in())) 2840 if (!ancestorFrame->document()->securityOrigin()->canAccess(securityOrig in()))
2836 return currentFrame; 2841 return currentFrame;
2837 currentFrame = ancestorFrame; 2842 currentFrame = ancestorFrame;
2838 ancestorFrame = ancestorFrame->tree().parent(); 2843 ancestorFrame = ancestorFrame->tree().parent();
2839 } 2844 }
2840 return 0; 2845 return 0;
2841 } 2846 }
2842 2847
2843 void Document::didLoadAllImports()
2844 {
2845 if (!haveStylesheetsLoaded())
2846 return;
2847
2848 didLoadAllScriptBlockingResources();
2849 }
2850
2851 void Document::didRemoveAllPendingStylesheet() 2848 void Document::didRemoveAllPendingStylesheet()
2852 { 2849 {
2853 m_needsNotifyRemoveAllPendingStylesheet = false; 2850 m_needsNotifyRemoveAllPendingStylesheet = false;
2854 2851
2855 styleResolverChanged(RecalcStyleDeferred, hasNodesWithPlaceholderStyle() ? F ullStyleUpdate : AnalyzedStyleUpdate); 2852 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 {
2867 executeScriptsWaitingForResourcesIfNeeded(); 2853 executeScriptsWaitingForResourcesIfNeeded();
2868 2854
2869 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) 2855 if (m_gotoAnchorNeededAfterStylesheetsLoad && view())
2870 view()->scrollToFragment(m_url); 2856 view()->scrollToFragment(m_url);
2857
2858 if (m_import)
2859 m_import->didRemoveAllPendingStylesheet();
2871 } 2860 }
2872 2861
2873
2874 void Document::executeScriptsWaitingForResourcesIfNeeded() 2862 void Document::executeScriptsWaitingForResourcesIfNeeded()
2875 { 2863 {
2876 if (!haveStylesheetsAndImportsLoaded()) 2864 if (!haveStylesheetsAndImportsLoaded())
2877 return; 2865 return;
2878 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) 2866 if (ScriptableDocumentParser* parser = scriptableDocumentParser())
2879 parser->executeScriptsWaitingForResources(); 2867 parser->executeScriptsWaitingForResources();
2880 } 2868 }
2881 2869
2882 2870
2883 CSSStyleSheet& Document::elementSheet() 2871 CSSStyleSheet& Document::elementSheet()
(...skipping 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after
5465 } 5453 }
5466 5454
5467 void Document::invalidateNodeListCaches(const QualifiedName* attrName) 5455 void Document::invalidateNodeListCaches(const QualifiedName* attrName)
5468 { 5456 {
5469 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( ); 5457 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( );
5470 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it) 5458 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it)
5471 (*it)->invalidateCache(attrName); 5459 (*it)->invalidateCache(attrName);
5472 } 5460 }
5473 5461
5474 } // namespace WebCore 5462 } // namespace WebCore
OLDNEW
« no previous file with comments | « trunk/Source/core/dom/Document.h ('k') | trunk/Source/core/html/imports/HTMLImportsController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698