| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #include "core/dom/StaticNodeList.h" | 100 #include "core/dom/StaticNodeList.h" |
| 101 #include "core/dom/StyleChangeReason.h" | 101 #include "core/dom/StyleChangeReason.h" |
| 102 #include "core/dom/StyleEngine.h" | 102 #include "core/dom/StyleEngine.h" |
| 103 #include "core/dom/TaskRunnerHelper.h" | 103 #include "core/dom/TaskRunnerHelper.h" |
| 104 #include "core/dom/TouchList.h" | 104 #include "core/dom/TouchList.h" |
| 105 #include "core/dom/TransformSource.h" | 105 #include "core/dom/TransformSource.h" |
| 106 #include "core/dom/TreeWalker.h" | 106 #include "core/dom/TreeWalker.h" |
| 107 #include "core/dom/VisitedLinkState.h" | 107 #include "core/dom/VisitedLinkState.h" |
| 108 #include "core/dom/XMLDocument.h" | 108 #include "core/dom/XMLDocument.h" |
| 109 #include "core/dom/custom/CustomElement.h" | 109 #include "core/dom/custom/CustomElement.h" |
| 110 #include "core/dom/custom/CustomElementCreationScope.h" |
| 110 #include "core/dom/custom/CustomElementRegistry.h" | 111 #include "core/dom/custom/CustomElementRegistry.h" |
| 111 #include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h" | 112 #include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h" |
| 112 #include "core/dom/custom/V0CustomElementRegistrationContext.h" | 113 #include "core/dom/custom/V0CustomElementRegistrationContext.h" |
| 113 #include "core/dom/shadow/ElementShadow.h" | 114 #include "core/dom/shadow/ElementShadow.h" |
| 114 #include "core/dom/shadow/FlatTreeTraversal.h" | 115 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 115 #include "core/dom/shadow/ShadowRoot.h" | 116 #include "core/dom/shadow/ShadowRoot.h" |
| 116 #include "core/editing/DragCaretController.h" | 117 #include "core/editing/DragCaretController.h" |
| 117 #include "core/editing/EditingUtilities.h" | 118 #include "core/editing/EditingUtilities.h" |
| 118 #include "core/editing/Editor.h" | 119 #include "core/editing/Editor.h" |
| 119 #include "core/editing/FrameSelection.h" | 120 #include "core/editing/FrameSelection.h" |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 634 } |
| 634 | 635 |
| 635 Element* Document::createElement(const AtomicString& name, ExceptionState& excep
tionState) | 636 Element* Document::createElement(const AtomicString& name, ExceptionState& excep
tionState) |
| 636 { | 637 { |
| 637 if (!isValidName(name)) { | 638 if (!isValidName(name)) { |
| 638 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); | 639 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); |
| 639 return nullptr; | 640 return nullptr; |
| 640 } | 641 } |
| 641 | 642 |
| 642 if (isXHTMLDocument() || isHTMLDocument()) { | 643 if (isXHTMLDocument() || isHTMLDocument()) { |
| 643 if (CustomElement::shouldCreateCustomElement(name)) | 644 if (CustomElement::shouldCreateCustomElement(name)) { |
| 645 CustomElementCreationScope scope(this); |
| 644 return CustomElement::createCustomElementSync(*this, name, exception
State); | 646 return CustomElement::createCustomElementSync(*this, name, exception
State); |
| 647 } |
| 645 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *th
is, 0, CreatedByCreateElement); | 648 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *th
is, 0, CreatedByCreateElement); |
| 646 } | 649 } |
| 647 | 650 |
| 648 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); | 651 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); |
| 649 } | 652 } |
| 650 | 653 |
| 651 Element* Document::createElement(const AtomicString& localName, const AtomicStri
ng& typeExtension, ExceptionState& exceptionState) | 654 Element* Document::createElement(const AtomicString& localName, const AtomicStri
ng& typeExtension, ExceptionState& exceptionState) |
| 652 { | 655 { |
| 653 if (!isValidName(localName)) { | 656 if (!isValidName(localName)) { |
| 654 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + localName + "') is not a valid name."); | 657 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + localName + "') is not a valid name."); |
| 655 return nullptr; | 658 return nullptr; |
| 656 } | 659 } |
| 657 | 660 |
| 658 Element* element; | 661 Element* element; |
| 659 | 662 |
| 660 if (CustomElement::shouldCreateCustomElement(localName)) { | 663 if (CustomElement::shouldCreateCustomElement(localName)) { |
| 664 CustomElementCreationScope scope(this); |
| 661 element = CustomElement::createCustomElementSync(*this, localName, excep
tionState); | 665 element = CustomElement::createCustomElementSync(*this, localName, excep
tionState); |
| 662 } else if (V0CustomElement::isValidName(localName) && registrationContext())
{ | 666 } else if (V0CustomElement::isValidName(localName) && registrationContext())
{ |
| 663 element = registrationContext()->createCustomTagElement(*this, Qualified
Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); | 667 element = registrationContext()->createCustomTagElement(*this, Qualified
Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); |
| 664 } else { | 668 } else { |
| 665 element = createElement(localName, exceptionState); | 669 element = createElement(localName, exceptionState); |
| 666 if (exceptionState.hadException()) | 670 if (exceptionState.hadException()) |
| 667 return nullptr; | 671 return nullptr; |
| 668 } | 672 } |
| 669 | 673 |
| 670 if (!typeExtension.isEmpty()) | 674 if (!typeExtension.isEmpty()) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 687 | 691 |
| 688 return qName; | 692 return qName; |
| 689 } | 693 } |
| 690 | 694 |
| 691 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, ExceptionState& exceptionState) | 695 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, ExceptionState& exceptionState) |
| 692 { | 696 { |
| 693 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); | 697 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
| 694 if (qName == QualifiedName::null()) | 698 if (qName == QualifiedName::null()) |
| 695 return nullptr; | 699 return nullptr; |
| 696 | 700 |
| 697 if (CustomElement::shouldCreateCustomElement(qName)) | 701 if (CustomElement::shouldCreateCustomElement(qName)) { |
| 702 CustomElementCreationScope scope(this); |
| 698 return CustomElement::createCustomElementSync(*this, qName, exceptionSta
te); | 703 return CustomElement::createCustomElementSync(*this, qName, exceptionSta
te); |
| 704 } |
| 699 return createElement(qName, CreatedByCreateElement); | 705 return createElement(qName, CreatedByCreateElement); |
| 700 } | 706 } |
| 701 | 707 |
| 702 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep
tionState) | 708 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep
tionState) |
| 703 { | 709 { |
| 704 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); | 710 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
| 705 if (qName == QualifiedName::null()) | 711 if (qName == QualifiedName::null()) |
| 706 return nullptr; | 712 return nullptr; |
| 707 | 713 |
| 708 Element* element; | 714 Element* element; |
| 709 if (CustomElement::shouldCreateCustomElement(qName)) | 715 if (CustomElement::shouldCreateCustomElement(qName)) { |
| 716 CustomElementCreationScope scope(this); |
| 710 element = CustomElement::createCustomElementSync(*this, qName, exception
State); | 717 element = CustomElement::createCustomElementSync(*this, qName, exception
State); |
| 711 else if (V0CustomElement::isValidName(qName.localName()) && registrationCont
ext()) | 718 } else if (V0CustomElement::isValidName(qName.localName()) && registrationCo
ntext()) { |
| 712 element = registrationContext()->createCustomTagElement(*this, qName); | 719 element = registrationContext()->createCustomTagElement(*this, qName); |
| 713 else | 720 } else { |
| 714 element = createElement(qName, CreatedByCreateElement); | 721 element = createElement(qName, CreatedByCreateElement); |
| 715 | 722 } |
| 716 if (!typeExtension.isEmpty()) | 723 if (!typeExtension.isEmpty()) |
| 717 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); | 724 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); |
| 718 | 725 |
| 719 return element; | 726 return element; |
| 720 } | 727 } |
| 721 | 728 |
| 722 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri
ng& name, const ElementRegistrationOptions& options, ExceptionState& exceptionSt
ate, V0CustomElement::NameSet validNames) | 729 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri
ng& name, const ElementRegistrationOptions& options, ExceptionState& exceptionSt
ate, V0CustomElement::NameSet validNames) |
| 723 { | 730 { |
| 724 HostsUsingFeatures::countMainWorldOnly(scriptState, *this, HostsUsingFeature
s::Feature::DocumentRegisterElement); | 731 HostsUsingFeatures::countMainWorldOnly(scriptState, *this, HostsUsingFeature
s::Feature::DocumentRegisterElement); |
| 725 | 732 |
| (...skipping 5314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6040 } | 6047 } |
| 6041 | 6048 |
| 6042 void showLiveDocumentInstances() | 6049 void showLiveDocumentInstances() |
| 6043 { | 6050 { |
| 6044 WeakDocumentSet& set = liveDocumentSet(); | 6051 WeakDocumentSet& set = liveDocumentSet(); |
| 6045 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6052 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6046 for (Document* document : set) | 6053 for (Document* document : set) |
| 6047 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6054 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
| 6048 } | 6055 } |
| 6049 #endif | 6056 #endif |
| OLD | NEW |