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

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

Issue 19002005: Share Custom Element registration contexts between related documents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tweak the test to do lazy wrapping in both cases. 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/editing/markup.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/css/MediaQueryMatcher.h" 46 #include "core/css/MediaQueryMatcher.h"
47 #include "core/css/StylePropertySet.h" 47 #include "core/css/StylePropertySet.h"
48 #include "core/css/StyleSheetContents.h" 48 #include "core/css/StyleSheetContents.h"
49 #include "core/css/StyleSheetList.h" 49 #include "core/css/StyleSheetList.h"
50 #include "core/css/resolver/StyleResolver.h" 50 #include "core/css/resolver/StyleResolver.h"
51 #include "core/dom/Attr.h" 51 #include "core/dom/Attr.h"
52 #include "core/dom/CDATASection.h" 52 #include "core/dom/CDATASection.h"
53 #include "core/dom/Comment.h" 53 #include "core/dom/Comment.h"
54 #include "core/dom/ContextFeatures.h" 54 #include "core/dom/ContextFeatures.h"
55 #include "core/dom/CustomElementRegistrationContext.h" 55 #include "core/dom/CustomElementRegistrationContext.h"
56 #include "core/dom/CustomElementRegistrationContextualizer.h"
56 #include "core/dom/DOMImplementation.h" 57 #include "core/dom/DOMImplementation.h"
57 #include "core/dom/DOMNamedFlowCollection.h" 58 #include "core/dom/DOMNamedFlowCollection.h"
58 #include "core/dom/DocumentEventQueue.h" 59 #include "core/dom/DocumentEventQueue.h"
59 #include "core/dom/DocumentFragment.h" 60 #include "core/dom/DocumentFragment.h"
60 #include "core/dom/DocumentLifecycleObserver.h" 61 #include "core/dom/DocumentLifecycleObserver.h"
61 #include "core/dom/DocumentMarkerController.h" 62 #include "core/dom/DocumentMarkerController.h"
62 #include "core/dom/DocumentSharedObjectPool.h" 63 #include "core/dom/DocumentSharedObjectPool.h"
63 #include "core/dom/DocumentStyleSheetCollection.h" 64 #include "core/dom/DocumentStyleSheetCollection.h"
64 #include "core/dom/DocumentType.h" 65 #include "core/dom/DocumentType.h"
65 #include "core/dom/Element.h" 66 #include "core/dom/Element.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 if ((m_frame && m_frame->ownerElement()) || !url.isEmpty()) 473 if ((m_frame && m_frame->ownerElement()) || !url.isEmpty())
473 setURL(url); 474 setURL(url);
474 475
475 initSecurityContext(); 476 initSecurityContext();
476 initDNSPrefetch(); 477 initDNSPrefetch();
477 478
478 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) 479 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++)
479 m_nodeListCounts[i] = 0; 480 m_nodeListCounts[i] = 0;
480 481
481 InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter); 482 InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter);
482
483 bool shouldProcessCustomElements =
484 (isHTMLDocument() || isXHTMLDocument())
485 && RuntimeEnabledFeatures::customDOMElementsEnabled();
486 m_registrationContext = shouldProcessCustomElements
487 ? CustomElementRegistrationContext::create()
488 : CustomElementRegistrationContext::nullRegistrationContext();
489 } 483 }
490 484
491 static void histogramMutationEventUsage(const unsigned short& listenerTypes) 485 static void histogramMutationEventUsage(const unsigned short& listenerTypes)
492 { 486 {
493 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMSubtreeModified", static_cast<bool>(listenerTypes & Document::DOMSUBTREEMODI FIED_LISTENER), 2); 487 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMSubtreeModified", static_cast<bool>(listenerTypes & Document::DOMSUBTREEMODI FIED_LISTENER), 2);
494 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeInserted", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTED_L ISTENER), 2); 488 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeInserted", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTED_L ISTENER), 2);
495 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeRemoved", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVED_LIS TENER), 2); 489 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeRemoved", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVED_LIS TENER), 2);
496 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeRemovedFromDocument", static_cast<bool>(listenerTypes & Document::DOMNOD EREMOVEDFROMDOCUMENT_LISTENER), 2); 490 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeRemovedFromDocument", static_cast<bool>(listenerTypes & Document::DOMNOD EREMOVEDFROMDOCUMENT_LISTENER), 2);
497 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeInsertedIntoDocument", static_cast<bool>(listenerTypes & Document::DOMNO DEINSERTEDINTODOCUMENT_LISTENER), 2); 491 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeInsertedIntoDocument", static_cast<bool>(listenerTypes & Document::DOMNO DEINSERTEDINTODOCUMENT_LISTENER), 2);
498 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARA CTERDATAMODIFIED_LISTENER), 2); 492 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARA CTERDATAMODIFIED_LISTENER), 2);
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 return registerElement(state, name, Dictionary(), ec); 755 return registerElement(state, name, Dictionary(), ec);
762 } 756 }
763 757
764 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, const Dictionary& options, ExceptionCode& ec) 758 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, const Dictionary& options, ExceptionCode& ec)
765 { 759 {
766 CustomElementConstructorBuilder constructorBuilder(state, &options); 760 CustomElementConstructorBuilder constructorBuilder(state, &options);
767 registrationContext()->registerElement(this, &constructorBuilder, name, ec); 761 registrationContext()->registerElement(this, &constructorBuilder, name, ec);
768 return constructorBuilder.bindingsReturnValue(); 762 return constructorBuilder.bindingsReturnValue();
769 } 763 }
770 764
765 void Document::setRegistrationContext(PassRefPtr<CustomElementRegistrationContex t> context)
766 {
767 ASSERT(!registrationContext());
768 m_registrationContext = context;
769 }
770
771 void Document::setImport(HTMLImport* import) 771 void Document::setImport(HTMLImport* import)
772 { 772 {
773 ASSERT(!m_import || !import); 773 ASSERT(!m_import || !import);
774 m_import = import; 774 m_import = import;
775 } 775 }
776 776
777 void Document::didLoadAllImports() 777 void Document::didLoadAllImports()
778 { 778 {
779 executeScriptsWaitingForResourcesIfNeeded(); 779 executeScriptsWaitingForResourcesIfNeeded();
780 } 780 }
(...skipping 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3898 UseCounter::count(this, UseCounter::XSLProcessingInstruction); 3898 UseCounter::count(this, UseCounter::XSLProcessingInstruction);
3899 RefPtr<XSLTProcessor> processor = XSLTProcessor::create(); 3899 RefPtr<XSLTProcessor> processor = XSLTProcessor::create();
3900 processor->setXSLStyleSheet(static_cast<XSLStyleSheet*>(pi->sheet())); 3900 processor->setXSLStyleSheet(static_cast<XSLStyleSheet*>(pi->sheet()));
3901 String resultMIMEType; 3901 String resultMIMEType;
3902 String newSource; 3902 String newSource;
3903 String resultEncoding; 3903 String resultEncoding;
3904 if (!processor->transformToString(this, resultMIMEType, newSource, resultEnc oding)) 3904 if (!processor->transformToString(this, resultMIMEType, newSource, resultEnc oding))
3905 return; 3905 return;
3906 // FIXME: If the transform failed we should probably report an error (like M ozilla does). 3906 // FIXME: If the transform failed we should probably report an error (like M ozilla does).
3907 Frame* ownerFrame = frame(); 3907 Frame* ownerFrame = frame();
3908 processor->createDocumentFromSource(newSource, resultEncoding, resultMIMETyp e, this, ownerFrame); 3908 processor->createDocumentFromSource(newSource, resultEncoding, resultMIMETyp e, this, ownerFrame, CustomElementRegistrationContextualizer::DocumentWithXSLTPI );
3909 InspectorInstrumentation::frameDocumentUpdated(ownerFrame); 3909 InspectorInstrumentation::frameDocumentUpdated(ownerFrame);
3910 } 3910 }
3911 3911
3912 void Document::setTransformSource(PassOwnPtr<TransformSource> source) 3912 void Document::setTransformSource(PassOwnPtr<TransformSource> source)
3913 { 3913 {
3914 m_transformSource = source; 3914 m_transformSource = source;
3915 } 3915 }
3916 3916
3917 void Document::setDesignMode(InheritedBool value) 3917 void Document::setDesignMode(InheritedBool value)
3918 { 3918 {
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
5116 { 5116 {
5117 if (const Document* document = templateDocument()) 5117 if (const Document* document = templateDocument())
5118 return const_cast<Document*>(document); 5118 return const_cast<Document*>(document);
5119 5119
5120 if (isHTMLDocument()) 5120 if (isHTMLDocument())
5121 m_templateDocument = HTMLDocument::create(0, blankURL()); 5121 m_templateDocument = HTMLDocument::create(0, blankURL());
5122 else 5122 else
5123 m_templateDocument = Document::create(0, blankURL()); 5123 m_templateDocument = Document::create(0, blankURL());
5124 5124
5125 m_templateDocument->setTemplateDocumentHost(this); // balanced in dtor. 5125 m_templateDocument->setTemplateDocumentHost(this); // balanced in dtor.
5126 CustomElementRegistrationContextualizer::didCreateRelatedDocument(registrati onContext(), CustomElementRegistrationContextualizer::Template, m_templateDocume nt.get());
5126 5127
5127 return m_templateDocument.get(); 5128 return m_templateDocument.get();
5128 } 5129 }
5129 5130
5130 PassRefPtr<FontLoader> Document::fontloader() 5131 PassRefPtr<FontLoader> Document::fontloader()
5131 { 5132 {
5132 if (!m_fontloader) 5133 if (!m_fontloader)
5133 m_fontloader = FontLoader::create(this); 5134 m_fontloader = FontLoader::create(this);
5134 return m_fontloader; 5135 return m_fontloader;
5135 } 5136 }
(...skipping 24 matching lines...) Expand all
5160 { 5161 {
5161 return DocumentLifecycleNotifier::create(this); 5162 return DocumentLifecycleNotifier::create(this);
5162 } 5163 }
5163 5164
5164 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5165 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5165 { 5166 {
5166 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5167 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5167 } 5168 }
5168 5169
5169 } // namespace WebCore 5170 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698