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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 if (exceptionState.hadException()) | 762 if (exceptionState.hadException()) |
763 return 0; | 763 return 0; |
764 } | 764 } |
765 | 765 |
766 if (RuntimeEnabledFeatures::customElementsEnabled() && !typeExtension.isEmpt
y()) | 766 if (RuntimeEnabledFeatures::customElementsEnabled() && !typeExtension.isEmpt
y()) |
767 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element
.get(), typeExtension); | 767 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element
.get(), typeExtension); |
768 | 768 |
769 return element; | 769 return element; |
770 } | 770 } |
771 | 771 |
| 772 static inline QualifiedName createQualifiedName(const AtomicString& namespaceURI
, const AtomicString& qualifiedName, ExceptionState& exceptionState) |
| 773 { |
| 774 AtomicString prefix, localName; |
| 775 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, exceptio
nState)) |
| 776 return nullQName(); |
| 777 |
| 778 QualifiedName qName(prefix, localName, namespaceURI); |
| 779 if (!Document::hasValidNamespaceForElements(qName)) { |
| 780 exceptionState.throwDOMException(NamespaceError, "The namespace URI prov
ided ('" + namespaceURI + "') is not valid for the qualified name provided ('" +
qualifiedName + "')."); |
| 781 return nullQName(); |
| 782 } |
| 783 |
| 784 return qName; |
| 785 } |
| 786 |
| 787 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const AtomicString& qualifiedName, ExceptionState& exceptionState) |
| 788 { |
| 789 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
| 790 if (qName == nullQName()) |
| 791 return 0; |
| 792 |
| 793 return createElement(qName, false); |
| 794 } |
| 795 |
772 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const AtomicString& qualifiedName, const AtomicString& typeExtension, ExceptionS
tate& exceptionState) | 796 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const AtomicString& qualifiedName, const AtomicString& typeExtension, ExceptionS
tate& exceptionState) |
773 { | 797 { |
774 AtomicString prefix, localName; | 798 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
775 if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState)) | 799 if (qName == nullQName()) |
776 return 0; | 800 return 0; |
777 | 801 |
778 QualifiedName qName(prefix, localName, namespaceURI); | |
779 if (!hasValidNamespaceForElements(qName)) { | |
780 exceptionState.throwDOMException(NamespaceError, "The namespace URI prov
ided ('" + namespaceURI + "') is not valid for the qualified name provided ('" +
qualifiedName + "')."); | |
781 return 0; | |
782 } | |
783 | |
784 RefPtr<Element> element; | 802 RefPtr<Element> element; |
785 if (CustomElement::isValidName(qName.localName()) && registrationContext())
{ | 803 if (CustomElement::isValidName(qName.localName()) && registrationContext()) |
786 element = registrationContext()->createCustomTagElement(*this, qName); | 804 element = registrationContext()->createCustomTagElement(*this, qName); |
787 } else { | 805 else |
788 element = createElementNS(namespaceURI, qualifiedName, exceptionState); | 806 element = createElement(qName, false); |
789 if (exceptionState.hadException()) | |
790 return 0; | |
791 } | |
792 | 807 |
793 if (!typeExtension.isEmpty()) | 808 if (!typeExtension.isEmpty()) |
794 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element
.get(), typeExtension); | 809 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element
.get(), typeExtension); |
795 | 810 |
796 return element; | 811 return element; |
797 } | 812 } |
798 | 813 |
799 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, ExceptionState& exceptionState) | 814 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, ExceptionState& exceptionState) |
800 { | 815 { |
801 return registerElement(state, name, Dictionary(), exceptionState); | 816 return registerElement(state, name, Dictionary(), exceptionState); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } | 1093 } |
1079 | 1094 |
1080 NamedFlowCollection* Document::namedFlows() | 1095 NamedFlowCollection* Document::namedFlows() |
1081 { | 1096 { |
1082 if (!m_namedFlows) | 1097 if (!m_namedFlows) |
1083 m_namedFlows = NamedFlowCollection::create(this); | 1098 m_namedFlows = NamedFlowCollection::create(this); |
1084 | 1099 |
1085 return m_namedFlows.get(); | 1100 return m_namedFlows.get(); |
1086 } | 1101 } |
1087 | 1102 |
1088 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const AtomicString& qualifiedName, ExceptionState& exceptionState) | |
1089 { | |
1090 AtomicString prefix, localName; | |
1091 if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState)) | |
1092 return 0; | |
1093 | |
1094 QualifiedName qName(prefix, localName, namespaceURI); | |
1095 if (!hasValidNamespaceForElements(qName)) { | |
1096 exceptionState.throwDOMException(NamespaceError, "The namespace URI prov
ided ('" + namespaceURI + "') is not valid for the qualified name provided ('" +
qualifiedName + "')."); | |
1097 return 0; | |
1098 } | |
1099 | |
1100 return createElement(qName, false); | |
1101 } | |
1102 | |
1103 String Document::readyState() const | 1103 String Document::readyState() const |
1104 { | 1104 { |
1105 DEFINE_STATIC_LOCAL(const String, loading, ("loading")); | 1105 DEFINE_STATIC_LOCAL(const String, loading, ("loading")); |
1106 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive")); | 1106 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive")); |
1107 DEFINE_STATIC_LOCAL(const String, complete, ("complete")); | 1107 DEFINE_STATIC_LOCAL(const String, complete, ("complete")); |
1108 | 1108 |
1109 switch (m_readyState) { | 1109 switch (m_readyState) { |
1110 case Loading: | 1110 case Loading: |
1111 return loading; | 1111 return loading; |
1112 case Interactive: | 1112 case Interactive: |
(...skipping 4313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5426 void Document::defaultEventHandler(Event* event) | 5426 void Document::defaultEventHandler(Event* event) |
5427 { | 5427 { |
5428 if (frame() && frame()->remotePlatformLayer()) { | 5428 if (frame() && frame()->remotePlatformLayer()) { |
5429 frame()->chromeClient().forwardInputEvent(this, event); | 5429 frame()->chromeClient().forwardInputEvent(this, event); |
5430 return; | 5430 return; |
5431 } | 5431 } |
5432 Node::defaultEventHandler(event); | 5432 Node::defaultEventHandler(event); |
5433 } | 5433 } |
5434 | 5434 |
5435 } // namespace WebCore | 5435 } // namespace WebCore |
OLD | NEW |