| 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. |
| 11 * | 11 * |
| 12 * This library is free software; you can redistribute it and/or | 12 * This library is free software; you can redistribute it and/or |
| 13 * modify it under the terms of the GNU Library General Public | 13 * modify it under the terms of the GNU Library General Public |
| 14 * License as published by the Free Software Foundation; either | 14 * License as published by the Free Software Foundation; either |
| 15 * version 2 of the License, or (at your option) any later version. | 15 * version 2 of the License, or (at your option) any later version. |
| 16 * | 16 * |
| 17 * This library is distributed in the hope that it will be useful, | 17 * This library is distributed in the hope that it will be useful, |
| 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 20 * Library General Public License for more details. | 20 * Library General Public License for more details. |
| 21 * | 21 * |
| 22 * You should have received a copy of the GNU Library General Public License | 22 * You should have received a copy of the GNU Library General Public License |
| 23 * along with this library; see the file COPYING.LIB. If not, write to | 23 * along with this library; see the file COPYING.LIB. If not, write to |
| 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "core/dom/Document.h" | 28 #include "core/dom/Document.h" |
| 29 | 29 |
| 30 #include "bindings/core/v8/CustomElementConstructorBuilder.h" | |
| 31 #include "bindings/core/v8/DOMDataStore.h" | 30 #include "bindings/core/v8/DOMDataStore.h" |
| 32 #include "bindings/core/v8/ExceptionMessages.h" | 31 #include "bindings/core/v8/ExceptionMessages.h" |
| 33 #include "bindings/core/v8/ExceptionState.h" | 32 #include "bindings/core/v8/ExceptionState.h" |
| 34 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 33 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 35 #include "bindings/core/v8/Microtask.h" | 34 #include "bindings/core/v8/Microtask.h" |
| 36 #include "bindings/core/v8/ScriptCallStack.h" | 35 #include "bindings/core/v8/ScriptCallStack.h" |
| 37 #include "bindings/core/v8/ScriptController.h" | 36 #include "bindings/core/v8/ScriptController.h" |
| 38 #include "bindings/core/v8/UnionTypesCore.h" | 37 #include "bindings/core/v8/UnionTypesCore.h" |
| 38 #include "bindings/core/v8/V0CustomElementConstructorBuilder.h" |
| 39 #include "bindings/core/v8/V8DOMWrapper.h" | 39 #include "bindings/core/v8/V8DOMWrapper.h" |
| 40 #include "bindings/core/v8/V8PerIsolateData.h" | 40 #include "bindings/core/v8/V8PerIsolateData.h" |
| 41 #include "bindings/core/v8/WindowProxy.h" | 41 #include "bindings/core/v8/WindowProxy.h" |
| 42 #include "core/HTMLElementFactory.h" | 42 #include "core/HTMLElementFactory.h" |
| 43 #include "core/HTMLNames.h" | 43 #include "core/HTMLNames.h" |
| 44 #include "core/SVGElementFactory.h" | 44 #include "core/SVGElementFactory.h" |
| 45 #include "core/SVGNames.h" | 45 #include "core/SVGNames.h" |
| 46 #include "core/XMLNSNames.h" | 46 #include "core/XMLNSNames.h" |
| 47 #include "core/XMLNames.h" | 47 #include "core/XMLNames.h" |
| 48 #include "core/animation/AnimationTimeline.h" | 48 #include "core/animation/AnimationTimeline.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 #include "core/dom/ScriptedIdleTaskController.h" | 98 #include "core/dom/ScriptedIdleTaskController.h" |
| 99 #include "core/dom/SelectorQuery.h" | 99 #include "core/dom/SelectorQuery.h" |
| 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/TouchList.h" | 103 #include "core/dom/TouchList.h" |
| 104 #include "core/dom/TransformSource.h" | 104 #include "core/dom/TransformSource.h" |
| 105 #include "core/dom/TreeWalker.h" | 105 #include "core/dom/TreeWalker.h" |
| 106 #include "core/dom/VisitedLinkState.h" | 106 #include "core/dom/VisitedLinkState.h" |
| 107 #include "core/dom/XMLDocument.h" | 107 #include "core/dom/XMLDocument.h" |
| 108 #include "core/dom/custom/CustomElementMicrotaskRunQueue.h" | 108 #include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h" |
| 109 #include "core/dom/custom/CustomElementRegistrationContext.h" | 109 #include "core/dom/custom/V0CustomElementRegistrationContext.h" |
| 110 #include "core/dom/shadow/ElementShadow.h" | 110 #include "core/dom/shadow/ElementShadow.h" |
| 111 #include "core/dom/shadow/FlatTreeTraversal.h" | 111 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 112 #include "core/dom/shadow/ShadowRoot.h" | 112 #include "core/dom/shadow/ShadowRoot.h" |
| 113 #include "core/editing/DragCaretController.h" | 113 #include "core/editing/DragCaretController.h" |
| 114 #include "core/editing/Editor.h" | 114 #include "core/editing/Editor.h" |
| 115 #include "core/editing/FrameSelection.h" | 115 #include "core/editing/FrameSelection.h" |
| 116 #include "core/editing/InputMethodController.h" | 116 #include "core/editing/InputMethodController.h" |
| 117 #include "core/editing/markers/DocumentMarkerController.h" | 117 #include "core/editing/markers/DocumentMarkerController.h" |
| 118 #include "core/editing/serializers/Serialization.h" | 118 #include "core/editing/serializers/Serialization.h" |
| 119 #include "core/editing/spellcheck/SpellChecker.h" | 119 #include "core/editing/spellcheck/SpellChecker.h" |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 | 638 |
| 639 Element* Document::createElement(const AtomicString& localName, const AtomicStri
ng& typeExtension, ExceptionState& exceptionState) | 639 Element* Document::createElement(const AtomicString& localName, const AtomicStri
ng& typeExtension, ExceptionState& exceptionState) |
| 640 { | 640 { |
| 641 if (!isValidName(localName)) { | 641 if (!isValidName(localName)) { |
| 642 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + localName + "') is not a valid name."); | 642 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + localName + "') is not a valid name."); |
| 643 return nullptr; | 643 return nullptr; |
| 644 } | 644 } |
| 645 | 645 |
| 646 Element* element; | 646 Element* element; |
| 647 | 647 |
| 648 if (CustomElement::isValidName(localName) && registrationContext()) { | 648 if (V0CustomElement::isValidName(localName) && registrationContext()) { |
| 649 element = registrationContext()->createCustomTagElement(*this, Qualified
Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); | 649 element = registrationContext()->createCustomTagElement(*this, Qualified
Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); |
| 650 } else { | 650 } else { |
| 651 element = createElement(localName, exceptionState); | 651 element = createElement(localName, exceptionState); |
| 652 if (exceptionState.hadException()) | 652 if (exceptionState.hadException()) |
| 653 return nullptr; | 653 return nullptr; |
| 654 } | 654 } |
| 655 | 655 |
| 656 if (!typeExtension.isEmpty()) | 656 if (!typeExtension.isEmpty()) |
| 657 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element
, typeExtension); | 657 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); |
| 658 | 658 |
| 659 return element; | 659 return element; |
| 660 } | 660 } |
| 661 | 661 |
| 662 static inline QualifiedName createQualifiedName(const AtomicString& namespaceURI
, const AtomicString& qualifiedName, ExceptionState& exceptionState) | 662 static inline QualifiedName createQualifiedName(const AtomicString& namespaceURI
, const AtomicString& qualifiedName, ExceptionState& exceptionState) |
| 663 { | 663 { |
| 664 AtomicString prefix, localName; | 664 AtomicString prefix, localName; |
| 665 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, exceptio
nState)) | 665 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, exceptio
nState)) |
| 666 return QualifiedName::null(); | 666 return QualifiedName::null(); |
| 667 | 667 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 683 return createElement(qName, false); | 683 return createElement(qName, false); |
| 684 } | 684 } |
| 685 | 685 |
| 686 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep
tionState) | 686 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep
tionState) |
| 687 { | 687 { |
| 688 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); | 688 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
| 689 if (qName == QualifiedName::null()) | 689 if (qName == QualifiedName::null()) |
| 690 return nullptr; | 690 return nullptr; |
| 691 | 691 |
| 692 Element* element; | 692 Element* element; |
| 693 if (CustomElement::isValidName(qName.localName()) && registrationContext()) | 693 if (V0CustomElement::isValidName(qName.localName()) && registrationContext()
) |
| 694 element = registrationContext()->createCustomTagElement(*this, qName); | 694 element = registrationContext()->createCustomTagElement(*this, qName); |
| 695 else | 695 else |
| 696 element = createElement(qName, false); | 696 element = createElement(qName, false); |
| 697 | 697 |
| 698 if (!typeExtension.isEmpty()) | 698 if (!typeExtension.isEmpty()) |
| 699 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element
, typeExtension); | 699 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); |
| 700 | 700 |
| 701 return element; | 701 return element; |
| 702 } | 702 } |
| 703 | 703 |
| 704 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri
ng& name, const ElementRegistrationOptions& options, ExceptionState& exceptionSt
ate, CustomElement::NameSet validNames) | 704 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri
ng& name, const ElementRegistrationOptions& options, ExceptionState& exceptionSt
ate, V0CustomElement::NameSet validNames) |
| 705 { | 705 { |
| 706 OriginsUsingFeatures::countMainWorldOnly(scriptState, *this, OriginsUsingFea
tures::Feature::DocumentRegisterElement); | 706 OriginsUsingFeatures::countMainWorldOnly(scriptState, *this, OriginsUsingFea
tures::Feature::DocumentRegisterElement); |
| 707 | 707 |
| 708 if (!registrationContext()) { | 708 if (!registrationContext()) { |
| 709 exceptionState.throwDOMException(NotSupportedError, "No element registra
tion context is available."); | 709 exceptionState.throwDOMException(NotSupportedError, "No element registra
tion context is available."); |
| 710 return ScriptValue(); | 710 return ScriptValue(); |
| 711 } | 711 } |
| 712 | 712 |
| 713 CustomElementConstructorBuilder constructorBuilder(scriptState, options); | 713 V0CustomElementConstructorBuilder constructorBuilder(scriptState, options); |
| 714 registrationContext()->registerElement(this, &constructorBuilder, name, vali
dNames, exceptionState); | 714 registrationContext()->registerElement(this, &constructorBuilder, name, vali
dNames, exceptionState); |
| 715 return constructorBuilder.bindingsReturnValue(); | 715 return constructorBuilder.bindingsReturnValue(); |
| 716 } | 716 } |
| 717 | 717 |
| 718 CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue() | 718 V0CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue() |
| 719 { | 719 { |
| 720 if (!m_customElementMicrotaskRunQueue) | 720 if (!m_customElementMicrotaskRunQueue) |
| 721 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat
e(); | 721 m_customElementMicrotaskRunQueue = V0CustomElementMicrotaskRunQueue::cre
ate(); |
| 722 return m_customElementMicrotaskRunQueue.get(); | 722 return m_customElementMicrotaskRunQueue.get(); |
| 723 } | 723 } |
| 724 | 724 |
| 725 void Document::setImportsController(HTMLImportsController* controller) | 725 void Document::setImportsController(HTMLImportsController* controller) |
| 726 { | 726 { |
| 727 DCHECK(!m_importsController || !controller); | 727 DCHECK(!m_importsController || !controller); |
| 728 m_importsController = controller; | 728 m_importsController = controller; |
| 729 if (!m_importsController && !loader()) | 729 if (!m_importsController && !loader()) |
| 730 m_fetcher->clearContext(); | 730 m_fetcher->clearContext(); |
| 731 } | 731 } |
| (...skipping 5174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5906 #ifndef NDEBUG | 5906 #ifndef NDEBUG |
| 5907 using namespace blink; | 5907 using namespace blink; |
| 5908 void showLiveDocumentInstances() | 5908 void showLiveDocumentInstances() |
| 5909 { | 5909 { |
| 5910 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5910 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5911 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5911 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5912 for (Document* document : set) | 5912 for (Document* document : set) |
| 5913 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 5913 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
| 5914 } | 5914 } |
| 5915 #endif | 5915 #endif |
| OLD | NEW |