Chromium Code Reviews| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 #include "core/html/FormController.h" | 116 #include "core/html/FormController.h" |
| 117 #include "core/html/HTMLAllCollection.h" | 117 #include "core/html/HTMLAllCollection.h" |
| 118 #include "core/html/HTMLAnchorElement.h" | 118 #include "core/html/HTMLAnchorElement.h" |
| 119 #include "core/html/HTMLBodyElement.h" | 119 #include "core/html/HTMLBodyElement.h" |
| 120 #include "core/html/HTMLCanvasElement.h" | 120 #include "core/html/HTMLCanvasElement.h" |
| 121 #include "core/html/HTMLCollection.h" | 121 #include "core/html/HTMLCollection.h" |
| 122 #include "core/html/HTMLDocument.h" | 122 #include "core/html/HTMLDocument.h" |
| 123 #include "core/html/HTMLFrameOwnerElement.h" | 123 #include "core/html/HTMLFrameOwnerElement.h" |
| 124 #include "core/html/HTMLHeadElement.h" | 124 #include "core/html/HTMLHeadElement.h" |
| 125 #include "core/html/HTMLIFrameElement.h" | 125 #include "core/html/HTMLIFrameElement.h" |
| 126 #include "core/html/HTMLImports.h" | |
| 126 #include "core/html/HTMLLinkElement.h" | 127 #include "core/html/HTMLLinkElement.h" |
| 127 #include "core/html/HTMLMapElement.h" | 128 #include "core/html/HTMLMapElement.h" |
| 128 #include "core/html/HTMLNameCollection.h" | 129 #include "core/html/HTMLNameCollection.h" |
| 129 #include "core/html/HTMLStyleElement.h" | 130 #include "core/html/HTMLStyleElement.h" |
| 130 #include "core/html/HTMLTitleElement.h" | 131 #include "core/html/HTMLTitleElement.h" |
| 131 #include "core/html/PluginDocument.h" | 132 #include "core/html/PluginDocument.h" |
| 132 #include "core/html/parser/HTMLDocumentParser.h" | 133 #include "core/html/parser/HTMLDocumentParser.h" |
| 133 #include "core/html/parser/HTMLParserIdioms.h" | 134 #include "core/html/parser/HTMLParserIdioms.h" |
| 134 #include "core/html/parser/NestingLevelIncrementer.h" | 135 #include "core/html/parser/NestingLevelIncrementer.h" |
| 135 #include "core/inspector/InspectorCounters.h" | 136 #include "core/inspector/InspectorCounters.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 m_titleElement = 0; | 632 m_titleElement = 0; |
| 632 m_documentElement = 0; | 633 m_documentElement = 0; |
| 633 m_contextFeatures = ContextFeatures::defaultSwitch(); | 634 m_contextFeatures = ContextFeatures::defaultSwitch(); |
| 634 m_userActionElements.documentDidRemoveLastRef(); | 635 m_userActionElements.documentDidRemoveLastRef(); |
| 635 m_fullScreenElement = 0; | 636 m_fullScreenElement = 0; |
| 636 m_fullScreenElementStack.clear(); | 637 m_fullScreenElementStack.clear(); |
| 637 | 638 |
| 638 detachParser(); | 639 detachParser(); |
| 639 | 640 |
| 640 m_registry.clear(); | 641 m_registry.clear(); |
| 642 m_imports.clear(); | |
| 641 | 643 |
| 642 // removeDetachedChildren() doesn't always unregister IDs, | 644 // removeDetachedChildren() doesn't always unregister IDs, |
| 643 // so tear down scope information upfront to avoid having stale references i n the map. | 645 // so tear down scope information upfront to avoid having stale references i n the map. |
| 644 destroyTreeScopeData(); | 646 destroyTreeScopeData(); |
| 645 removeDetachedChildren(); | 647 removeDetachedChildren(); |
| 646 // removeDetachedChildren() can access FormController. | 648 // removeDetachedChildren() can access FormController. |
| 647 m_formController.clear(); | 649 m_formController.clear(); |
| 648 | 650 |
| 649 m_markers->detach(); | 651 m_markers->detach(); |
| 650 | 652 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 | 858 |
| 857 CustomElementRegistry* Document::ensureCustomElementRegistry() | 859 CustomElementRegistry* Document::ensureCustomElementRegistry() |
| 858 { | 860 { |
| 859 if (!m_registry) { | 861 if (!m_registry) { |
| 860 ASSERT(isHTMLDocument() || isXHTMLDocument()); | 862 ASSERT(isHTMLDocument() || isXHTMLDocument()); |
| 861 m_registry = adoptRef(new CustomElementRegistry(this)); | 863 m_registry = adoptRef(new CustomElementRegistry(this)); |
| 862 } | 864 } |
| 863 return m_registry.get(); | 865 return m_registry.get(); |
| 864 } | 866 } |
| 865 | 867 |
| 868 HTMLImports* Document::imports() | |
|
dglazkov
2013/05/28 17:12:47
Don't we usually use ensure* pattern for RIIA acce
Hajime Morrita
2013/05/29 01:36:00
Done.
| |
| 869 { | |
| 870 if (!m_imports) | |
| 871 m_imports = HTMLImports::create(this); | |
| 872 return m_imports.get(); | |
| 873 } | |
| 874 | |
| 875 void Document::didLoadAllImports() | |
| 876 { | |
| 877 executeScriptsWaitingForResourcesIfNeeded(); | |
| 878 } | |
| 879 | |
| 880 SecurityContext* Document::importsContext() OVERRIDE | |
| 881 { | |
| 882 return this; | |
| 883 } | |
| 884 | |
| 885 void Document::showSecurityErrorMessage(const String& message) OVERRIDE | |
| 886 { | |
| 887 addConsoleMessage(JSMessageSource, ErrorMessageLevel, message); | |
| 888 } | |
| 889 | |
| 890 bool Document::haveImportsLoaded() const | |
| 891 { | |
| 892 return !m_imports || m_imports->haveLoaded(); | |
| 893 } | |
| 894 | |
| 866 PassRefPtr<DocumentFragment> Document::createDocumentFragment() | 895 PassRefPtr<DocumentFragment> Document::createDocumentFragment() |
| 867 { | 896 { |
| 868 return DocumentFragment::create(document()); | 897 return DocumentFragment::create(document()); |
| 869 } | 898 } |
| 870 | 899 |
| 871 PassRefPtr<Text> Document::createTextNode(const String& data) | 900 PassRefPtr<Text> Document::createTextNode(const String& data) |
| 872 { | 901 { |
| 873 return Text::create(this, data); | 902 return Text::create(this, data); |
| 874 } | 903 } |
| 875 | 904 |
| (...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2618 void Document::seamlessParentUpdatedStylesheets() | 2647 void Document::seamlessParentUpdatedStylesheets() |
| 2619 { | 2648 { |
| 2620 styleResolverChanged(RecalcStyleImmediately); | 2649 styleResolverChanged(RecalcStyleImmediately); |
| 2621 } | 2650 } |
| 2622 | 2651 |
| 2623 void Document::didRemoveAllPendingStylesheet() | 2652 void Document::didRemoveAllPendingStylesheet() |
| 2624 { | 2653 { |
| 2625 m_needsNotifyRemoveAllPendingStylesheet = false; | 2654 m_needsNotifyRemoveAllPendingStylesheet = false; |
| 2626 | 2655 |
| 2627 styleResolverChanged(RecalcStyleIfNeeded); | 2656 styleResolverChanged(RecalcStyleIfNeeded); |
| 2628 | 2657 executeScriptsWaitingForResourcesIfNeeded(); |
| 2629 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) | |
| 2630 parser->executeScriptsWaitingForStylesheets(); | |
| 2631 | 2658 |
| 2632 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) | 2659 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) |
| 2633 view()->scrollToFragment(m_url); | 2660 view()->scrollToFragment(m_url); |
| 2634 } | 2661 } |
| 2635 | 2662 |
| 2663 void Document::executeScriptsWaitingForResourcesIfNeeded() | |
| 2664 { | |
| 2665 if (!haveStylesheetsAndImportsLoaded()) | |
|
dglazkov
2013/05/28 17:12:47
Why is this check here now, but not in the old cod
| |
| 2666 return; | |
| 2667 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) | |
| 2668 parser->executeScriptsWaitingForResources(); | |
| 2669 } | |
| 2670 | |
| 2671 | |
| 2636 CSSStyleSheet* Document::elementSheet() | 2672 CSSStyleSheet* Document::elementSheet() |
| 2637 { | 2673 { |
| 2638 if (!m_elemSheet) | 2674 if (!m_elemSheet) |
| 2639 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); | 2675 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); |
| 2640 return m_elemSheet.get(); | 2676 return m_elemSheet.get(); |
| 2641 } | 2677 } |
| 2642 | 2678 |
| 2643 int Document::nodeAbsIndex(Node *node) | 2679 int Document::nodeAbsIndex(Node *node) |
| 2644 { | 2680 { |
| 2645 ASSERT(node->document() == this); | 2681 ASSERT(node->document() == this); |
| (...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5621 return; | 5657 return; |
| 5622 | 5658 |
| 5623 Vector<RefPtr<Element> > associatedFormControls; | 5659 Vector<RefPtr<Element> > associatedFormControls; |
| 5624 copyToVector(m_associatedFormControls, associatedFormControls); | 5660 copyToVector(m_associatedFormControls, associatedFormControls); |
| 5625 | 5661 |
| 5626 frame()->page()->chrome().client()->didAssociateFormControls(associatedFormC ontrols); | 5662 frame()->page()->chrome().client()->didAssociateFormControls(associatedFormC ontrols); |
| 5627 m_associatedFormControls.clear(); | 5663 m_associatedFormControls.clear(); |
| 5628 } | 5664 } |
| 5629 | 5665 |
| 5630 } // namespace WebCore | 5666 } // namespace WebCore |
| OLD | NEW |