| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "core/css/FontLoader.h" | 45 #include "core/css/FontLoader.h" |
| 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/CustomElementRegistry.h" | 55 #include "core/dom/CustomElementRegistrationContext.h" |
| 56 #include "core/dom/DOMImplementation.h" | 56 #include "core/dom/DOMImplementation.h" |
| 57 #include "core/dom/DOMNamedFlowCollection.h" | 57 #include "core/dom/DOMNamedFlowCollection.h" |
| 58 #include "core/dom/DocumentEventQueue.h" | 58 #include "core/dom/DocumentEventQueue.h" |
| 59 #include "core/dom/DocumentFragment.h" | 59 #include "core/dom/DocumentFragment.h" |
| 60 #include "core/dom/DocumentLifecycleObserver.h" | 60 #include "core/dom/DocumentLifecycleObserver.h" |
| 61 #include "core/dom/DocumentMarkerController.h" | 61 #include "core/dom/DocumentMarkerController.h" |
| 62 #include "core/dom/DocumentSharedObjectPool.h" | 62 #include "core/dom/DocumentSharedObjectPool.h" |
| 63 #include "core/dom/DocumentStyleSheetCollection.h" | 63 #include "core/dom/DocumentStyleSheetCollection.h" |
| 64 #include "core/dom/DocumentType.h" | 64 #include "core/dom/DocumentType.h" |
| 65 #include "core/dom/Element.h" | 65 #include "core/dom/Element.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 if ((m_frame && m_frame->ownerElement()) || !url.isEmpty()) | 471 if ((m_frame && m_frame->ownerElement()) || !url.isEmpty()) |
| 472 setURL(url); | 472 setURL(url); |
| 473 | 473 |
| 474 initSecurityContext(); | 474 initSecurityContext(); |
| 475 initDNSPrefetch(); | 475 initDNSPrefetch(); |
| 476 | 476 |
| 477 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) | 477 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) |
| 478 m_nodeListCounts[i] = 0; | 478 m_nodeListCounts[i] = 0; |
| 479 | 479 |
| 480 InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter); | 480 InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter); |
| 481 |
| 482 bool shouldProcessCustomElements = |
| 483 (isHTMLDocument() || isXHTMLDocument()) |
| 484 && RuntimeEnabledFeatures::customDOMElementsEnabled(); |
| 485 m_registrationContext = shouldProcessCustomElements |
| 486 ? CustomElementRegistrationContext::create() |
| 487 : CustomElementRegistrationContext::nullRegistrationContext(); |
| 481 } | 488 } |
| 482 | 489 |
| 483 static void histogramMutationEventUsage(const unsigned short& listenerTypes) | 490 static void histogramMutationEventUsage(const unsigned short& listenerTypes) |
| 484 { | 491 { |
| 485 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMSubtreeModified", static_cast<bool>(listenerTypes & Document::DOMSUBTREEMODI
FIED_LISTENER), 2); | 492 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMSubtreeModified", static_cast<bool>(listenerTypes & Document::DOMSUBTREEMODI
FIED_LISTENER), 2); |
| 486 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMNodeInserted", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTED_L
ISTENER), 2); | 493 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMNodeInserted", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTED_L
ISTENER), 2); |
| 487 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMNodeRemoved", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVED_LIS
TENER), 2); | 494 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMNodeRemoved", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVED_LIS
TENER), 2); |
| 488 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMNodeRemovedFromDocument", static_cast<bool>(listenerTypes & Document::DOMNOD
EREMOVEDFROMDOCUMENT_LISTENER), 2); | 495 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMNodeRemovedFromDocument", static_cast<bool>(listenerTypes & Document::DOMNOD
EREMOVEDFROMDOCUMENT_LISTENER), 2); |
| 489 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMNodeInsertedIntoDocument", static_cast<bool>(listenerTypes & Document::DOMNO
DEINSERTEDINTODOCUMENT_LISTENER), 2); | 496 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMNodeInsertedIntoDocument", static_cast<bool>(listenerTypes & Document::DOMNO
DEINSERTEDINTODOCUMENT_LISTENER), 2); |
| 490 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARA
CTERDATAMODIFIED_LISTENER), 2); | 497 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage
.DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARA
CTERDATAMODIFIED_LISTENER), 2); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 m_focusedNode = 0; | 584 m_focusedNode = 0; |
| 578 m_hoverNode = 0; | 585 m_hoverNode = 0; |
| 579 m_activeElement = 0; | 586 m_activeElement = 0; |
| 580 m_titleElement = 0; | 587 m_titleElement = 0; |
| 581 m_documentElement = 0; | 588 m_documentElement = 0; |
| 582 m_contextFeatures = ContextFeatures::defaultSwitch(); | 589 m_contextFeatures = ContextFeatures::defaultSwitch(); |
| 583 m_userActionElements.documentDidRemoveLastRef(); | 590 m_userActionElements.documentDidRemoveLastRef(); |
| 584 | 591 |
| 585 detachParser(); | 592 detachParser(); |
| 586 | 593 |
| 587 m_registry.clear(); | 594 m_registrationContext.clear(); |
| 588 m_imports.clear(); | 595 m_imports.clear(); |
| 589 | 596 |
| 590 // removeDetachedChildren() doesn't always unregister IDs, | 597 // removeDetachedChildren() doesn't always unregister IDs, |
| 591 // so tear down scope information upfront to avoid having stale references i
n the map. | 598 // so tear down scope information upfront to avoid having stale references i
n the map. |
| 592 destroyTreeScopeData(); | 599 destroyTreeScopeData(); |
| 593 removeDetachedChildren(); | 600 removeDetachedChildren(); |
| 594 // removeDetachedChildren() can access FormController. | 601 // removeDetachedChildren() can access FormController. |
| 595 m_formController.clear(); | 602 m_formController.clear(); |
| 596 | 603 |
| 597 m_markers->detach(); | 604 m_markers->detach(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 | 704 |
| 698 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const
AtomicString& typeExtension, ExceptionCode& ec) | 705 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const
AtomicString& typeExtension, ExceptionCode& ec) |
| 699 { | 706 { |
| 700 if (!isValidName(localName)) { | 707 if (!isValidName(localName)) { |
| 701 ec = InvalidCharacterError; | 708 ec = InvalidCharacterError; |
| 702 return 0; | 709 return 0; |
| 703 } | 710 } |
| 704 | 711 |
| 705 RefPtr<Element> element; | 712 RefPtr<Element> element; |
| 706 | 713 |
| 707 if (CustomElementRegistry::isCustomTagName(localName)) | 714 if (CustomElementRegistrationContext::isCustomTagName(localName)) |
| 708 element = ensureCustomElementRegistry()->createCustomTagElement(this, Qu
alifiedName(nullAtom, localName, xhtmlNamespaceURI)); | 715 element = registrationContext()->createCustomTagElement(this, QualifiedN
ame(nullAtom, localName, xhtmlNamespaceURI)); |
| 709 else | 716 else |
| 710 element = createElement(localName, ec); | 717 element = createElement(localName, ec); |
| 711 | 718 |
| 712 if (!typeExtension.isNull()) { | 719 if (!typeExtension.isNull()) |
| 713 setTypeExtension(element.get(), typeExtension); | 720 registrationContext()->setTypeExtension(element.get(), typeExtension); |
| 714 ensureCustomElementRegistry()->didGiveTypeExtension(element.get(), typeE
xtension); | |
| 715 } | |
| 716 | 721 |
| 717 return element; | 722 return element; |
| 718 } | 723 } |
| 719 | 724 |
| 720 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const String& qualifiedName, const AtomicString& typeExtension, ExceptionCode& e
c) | 725 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const String& qualifiedName, const AtomicString& typeExtension, ExceptionCode& e
c) |
| 721 { | 726 { |
| 722 String prefix, localName; | 727 String prefix, localName; |
| 723 if (!parseQualifiedName(qualifiedName, prefix, localName, ec)) | 728 if (!parseQualifiedName(qualifiedName, prefix, localName, ec)) |
| 724 return 0; | 729 return 0; |
| 725 | 730 |
| 726 QualifiedName qName(prefix, localName, namespaceURI); | 731 QualifiedName qName(prefix, localName, namespaceURI); |
| 727 if (!hasValidNamespaceForElements(qName)) { | 732 if (!hasValidNamespaceForElements(qName)) { |
| 728 ec = NamespaceError; | 733 ec = NamespaceError; |
| 729 return 0; | 734 return 0; |
| 730 } | 735 } |
| 731 | 736 |
| 732 RefPtr<Element> element; | 737 RefPtr<Element> element; |
| 733 if (CustomElementRegistry::isCustomTagName(qName.localName())) | 738 if (CustomElementRegistrationContext::isCustomTagName(qName.localName())) |
| 734 element = ensureCustomElementRegistry()->createCustomTagElement(this, qN
ame); | 739 element = registrationContext()->createCustomTagElement(this, qName); |
| 735 else | 740 else |
| 736 element = createElementNS(namespaceURI, qualifiedName, ec); | 741 element = createElementNS(namespaceURI, qualifiedName, ec); |
| 737 | 742 |
| 738 if (!typeExtension.isNull()) { | 743 if (!typeExtension.isNull()) |
| 739 setTypeExtension(element.get(), typeExtension); | 744 registrationContext()->setTypeExtension(element.get(), typeExtension); |
| 740 ensureCustomElementRegistry()->didGiveTypeExtension(element.get(), typeE
xtension); | |
| 741 } | |
| 742 | 745 |
| 743 return element; | 746 return element; |
| 744 } | 747 } |
| 745 | 748 |
| 746 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, ExceptionCode& ec) | 749 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, ExceptionCode& ec) |
| 747 { | 750 { |
| 748 return registerElement(state, name, Dictionary(), ec); | 751 return registerElement(state, name, Dictionary(), ec); |
| 749 } | 752 } |
| 750 | 753 |
| 751 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, const Dictionary& options, ExceptionCode& ec) | 754 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, const Dictionary& options, ExceptionCode& ec) |
| 752 { | 755 { |
| 753 if (!isHTMLDocument() && !isXHTMLDocument()) { | |
| 754 ec = NotSupportedError; | |
| 755 return ScriptValue(); | |
| 756 } | |
| 757 | |
| 758 CustomElementConstructorBuilder constructorBuilder(state, &options); | 756 CustomElementConstructorBuilder constructorBuilder(state, &options); |
| 759 ensureCustomElementRegistry()->registerElement(this, &constructorBuilder, na
me, ec); | 757 registrationContext()->registerElement(this, &constructorBuilder, name, ec); |
| 760 return constructorBuilder.bindingsReturnValue(); | 758 return constructorBuilder.bindingsReturnValue(); |
| 761 } | 759 } |
| 762 | 760 |
| 763 CustomElementRegistry* Document::ensureCustomElementRegistry() | |
| 764 { | |
| 765 if (!m_registry) { | |
| 766 ASSERT(isHTMLDocument() || isXHTMLDocument()); | |
| 767 m_registry = adoptRef(new CustomElementRegistry()); | |
| 768 } | |
| 769 return m_registry.get(); | |
| 770 } | |
| 771 | |
| 772 void Document::setImports(PassRefPtr<HTMLImportsController> imports) | 761 void Document::setImports(PassRefPtr<HTMLImportsController> imports) |
| 773 { | 762 { |
| 774 ASSERT(!m_imports); | 763 ASSERT(!m_imports); |
| 775 m_imports = imports; | 764 m_imports = imports; |
| 776 } | 765 } |
| 777 | 766 |
| 778 void Document::didLoadAllImports() | 767 void Document::didLoadAllImports() |
| 779 { | 768 { |
| 780 executeScriptsWaitingForResourcesIfNeeded(); | 769 executeScriptsWaitingForResourcesIfNeeded(); |
| 781 } | 770 } |
| (...skipping 4359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5141 { | 5130 { |
| 5142 return DocumentLifecycleNotifier::create(this); | 5131 return DocumentLifecycleNotifier::create(this); |
| 5143 } | 5132 } |
| 5144 | 5133 |
| 5145 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5134 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
| 5146 { | 5135 { |
| 5147 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); | 5136 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); |
| 5148 } | 5137 } |
| 5149 | 5138 |
| 5150 } // namespace WebCore | 5139 } // namespace WebCore |
| OLD | NEW |