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

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

Issue 18467003: Refactoring: Introduce HTMLImport interface to form import tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added missing checks and a clearance. Created 7 years, 5 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/HTMLImport.h » ('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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #include "core/editing/FrameSelection.h" 98 #include "core/editing/FrameSelection.h"
99 #include "core/html/FormController.h" 99 #include "core/html/FormController.h"
100 #include "core/html/HTMLAllCollection.h" 100 #include "core/html/HTMLAllCollection.h"
101 #include "core/html/HTMLAnchorElement.h" 101 #include "core/html/HTMLAnchorElement.h"
102 #include "core/html/HTMLCanvasElement.h" 102 #include "core/html/HTMLCanvasElement.h"
103 #include "core/html/HTMLCollection.h" 103 #include "core/html/HTMLCollection.h"
104 #include "core/html/HTMLDocument.h" 104 #include "core/html/HTMLDocument.h"
105 #include "core/html/HTMLFrameOwnerElement.h" 105 #include "core/html/HTMLFrameOwnerElement.h"
106 #include "core/html/HTMLHeadElement.h" 106 #include "core/html/HTMLHeadElement.h"
107 #include "core/html/HTMLIFrameElement.h" 107 #include "core/html/HTMLIFrameElement.h"
108 #include "core/html/HTMLImportsController.h" 108 #include "core/html/HTMLImport.h"
109 #include "core/html/HTMLLinkElement.h" 109 #include "core/html/HTMLLinkElement.h"
110 #include "core/html/HTMLNameCollection.h" 110 #include "core/html/HTMLNameCollection.h"
111 #include "core/html/HTMLScriptElement.h" 111 #include "core/html/HTMLScriptElement.h"
112 #include "core/html/HTMLStyleElement.h" 112 #include "core/html/HTMLStyleElement.h"
113 #include "core/html/HTMLTitleElement.h" 113 #include "core/html/HTMLTitleElement.h"
114 #include "core/html/PluginDocument.h" 114 #include "core/html/PluginDocument.h"
115 #include "core/html/parser/HTMLDocumentParser.h" 115 #include "core/html/parser/HTMLDocumentParser.h"
116 #include "core/html/parser/HTMLParserIdioms.h" 116 #include "core/html/parser/HTMLParserIdioms.h"
117 #include "core/html/parser/NestingLevelIncrementer.h" 117 #include "core/html/parser/NestingLevelIncrementer.h"
118 #include "core/inspector/InspectorCounters.h" 118 #include "core/inspector/InspectorCounters.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 , m_referrerPolicy(ReferrerPolicyDefault) 434 , m_referrerPolicy(ReferrerPolicyDefault)
435 , m_directionSetOnDocumentElement(false) 435 , m_directionSetOnDocumentElement(false)
436 , m_writingModeSetOnDocumentElement(false) 436 , m_writingModeSetOnDocumentElement(false)
437 , m_writeRecursionIsTooDeep(false) 437 , m_writeRecursionIsTooDeep(false)
438 , m_writeRecursionDepth(0) 438 , m_writeRecursionDepth(0)
439 , m_wheelEventHandlerCount(0) 439 , m_wheelEventHandlerCount(0)
440 , m_lastHandledUserGestureTimestamp(0) 440 , m_lastHandledUserGestureTimestamp(0)
441 , m_prerenderer(Prerenderer::create(this)) 441 , m_prerenderer(Prerenderer::create(this))
442 , m_textAutosizer(TextAutosizer::create(this)) 442 , m_textAutosizer(TextAutosizer::create(this))
443 , m_pendingTasksTimer(this, &Document::pendingTasksTimerFired) 443 , m_pendingTasksTimer(this, &Document::pendingTasksTimerFired)
444 , m_import(0)
444 , m_scheduledTasksAreSuspended(false) 445 , m_scheduledTasksAreSuspended(false)
445 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi red) 446 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi red)
446 #ifndef NDEBUG 447 #ifndef NDEBUG
447 , m_didDispatchViewportPropertiesChanged(false) 448 , m_didDispatchViewportPropertiesChanged(false)
448 #endif 449 #endif
449 , m_timeline(DocumentTimeline::create(this)) 450 , m_timeline(DocumentTimeline::create(this))
450 , m_templateDocumentHost(0) 451 , m_templateDocumentHost(0)
451 , m_fontloader(0) 452 , m_fontloader(0)
452 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) 453 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired)
453 { 454 {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 m_renderArena.clear(); 541 m_renderArena.clear();
541 542
542 if (this == topDocument()) 543 if (this == topDocument())
543 clearAXObjectCache(); 544 clearAXObjectCache();
544 545
545 m_decoder = 0; 546 m_decoder = 0;
546 547
547 if (m_styleSheetList) 548 if (m_styleSheetList)
548 m_styleSheetList->detachFromDocument(); 549 m_styleSheetList->detachFromDocument();
549 550
551 if (m_import) {
552 m_import->wasDetachedFromDocument();
553 m_import = 0;
554 }
555
550 m_styleSheetCollection.clear(); 556 m_styleSheetCollection.clear();
551 557
552 if (m_elemSheet) 558 if (m_elemSheet)
553 m_elemSheet->clearOwnerNode(); 559 m_elemSheet->clearOwnerNode();
554 560
555 clearStyleResolver(); // We need to destory CSSFontSelector before destroyin g m_cachedResourceLoader. 561 clearStyleResolver(); // We need to destory CSSFontSelector before destroyin g m_cachedResourceLoader.
556 562
557 // It's possible for multiple Documents to end up referencing the same Cache dResourceLoader (e.g., SVGImages 563 // It's possible for multiple Documents to end up referencing the same Cache dResourceLoader (e.g., SVGImages
558 // load the initial empty document and the SVGDocument with the same Documen tLoader). 564 // load the initial empty document and the SVGDocument with the same Documen tLoader).
559 if (m_cachedResourceLoader->document() == this) 565 if (m_cachedResourceLoader->document() == this)
(...skipping 25 matching lines...) Expand all
585 m_hoverNode = 0; 591 m_hoverNode = 0;
586 m_activeElement = 0; 592 m_activeElement = 0;
587 m_titleElement = 0; 593 m_titleElement = 0;
588 m_documentElement = 0; 594 m_documentElement = 0;
589 m_contextFeatures = ContextFeatures::defaultSwitch(); 595 m_contextFeatures = ContextFeatures::defaultSwitch();
590 m_userActionElements.documentDidRemoveLastRef(); 596 m_userActionElements.documentDidRemoveLastRef();
591 597
592 detachParser(); 598 detachParser();
593 599
594 m_registrationContext.clear(); 600 m_registrationContext.clear();
595 m_imports.clear(); 601
602 if (m_import) {
603 m_import->wasDetachedFromDocument();
604 m_import = 0;
605 }
596 606
597 // removeDetachedChildren() doesn't always unregister IDs, 607 // removeDetachedChildren() doesn't always unregister IDs,
598 // so tear down scope information upfront to avoid having stale references i n the map. 608 // so tear down scope information upfront to avoid having stale references i n the map.
599 destroyTreeScopeData(); 609 destroyTreeScopeData();
600 removeDetachedChildren(); 610 removeDetachedChildren();
601 // removeDetachedChildren() can access FormController. 611 // removeDetachedChildren() can access FormController.
602 m_formController.clear(); 612 m_formController.clear();
603 613
604 m_markers->detach(); 614 m_markers->detach();
605 615
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 return registerElement(state, name, Dictionary(), ec); 761 return registerElement(state, name, Dictionary(), ec);
752 } 762 }
753 763
754 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, const Dictionary& options, ExceptionCode& ec) 764 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, const Dictionary& options, ExceptionCode& ec)
755 { 765 {
756 CustomElementConstructorBuilder constructorBuilder(state, &options); 766 CustomElementConstructorBuilder constructorBuilder(state, &options);
757 registrationContext()->registerElement(this, &constructorBuilder, name, ec); 767 registrationContext()->registerElement(this, &constructorBuilder, name, ec);
758 return constructorBuilder.bindingsReturnValue(); 768 return constructorBuilder.bindingsReturnValue();
759 } 769 }
760 770
761 void Document::setImports(PassRefPtr<HTMLImportsController> imports) 771 void Document::setImport(HTMLImport* import)
762 { 772 {
763 ASSERT(!m_imports); 773 ASSERT(!m_import || !import);
764 m_imports = imports; 774 m_import = import;
765 } 775 }
766 776
767 void Document::didLoadAllImports() 777 void Document::didLoadAllImports()
768 { 778 {
769 executeScriptsWaitingForResourcesIfNeeded(); 779 executeScriptsWaitingForResourcesIfNeeded();
770 } 780 }
771 781
772 bool Document::haveImportsLoaded() const 782 bool Document::haveImportsLoaded() const
773 { 783 {
774 return !m_imports || m_imports->haveLoaded(); 784 return !m_import || m_import->haveChildrenLoaded();
775 } 785 }
776 786
777 PassRefPtr<DocumentFragment> Document::createDocumentFragment() 787 PassRefPtr<DocumentFragment> Document::createDocumentFragment()
778 { 788 {
779 return DocumentFragment::create(document()); 789 return DocumentFragment::create(document());
780 } 790 }
781 791
782 PassRefPtr<Text> Document::createTextNode(const String& data) 792 PassRefPtr<Text> Document::createTextNode(const String& data)
783 { 793 {
784 return Text::create(this, data); 794 return Text::create(this, data);
(...skipping 4371 matching lines...) Expand 10 before | Expand all | Expand 10 after
5156 { 5166 {
5157 return DocumentLifecycleNotifier::create(this); 5167 return DocumentLifecycleNotifier::create(this);
5158 } 5168 }
5159 5169
5160 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5170 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5161 { 5171 {
5162 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5172 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5163 } 5173 }
5164 5174
5165 } // namespace WebCore 5175 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/html/HTMLImport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698