| 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 | 768 |
| 769 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const
AtomicString& typeExtension, ExceptionCode& ec) | 769 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const
AtomicString& typeExtension, ExceptionCode& ec) |
| 770 { | 770 { |
| 771 if (!isValidName(localName)) { | 771 if (!isValidName(localName)) { |
| 772 ec = INVALID_CHARACTER_ERR; | 772 ec = INVALID_CHARACTER_ERR; |
| 773 return 0; | 773 return 0; |
| 774 } | 774 } |
| 775 | 775 |
| 776 RefPtr<Element> element; | 776 RefPtr<Element> element; |
| 777 | 777 |
| 778 if (m_registry) | 778 if (CustomElementRegistry::isCustomTagName(localName)) |
| 779 element = m_registry->tryToCreateCustomTagElement(QualifiedName(nullAtom
, localName, xhtmlNamespaceURI)); | 779 element = ensureCustomElementRegistry()->createCustomTagElement(Qualifie
dName(nullAtom, localName, xhtmlNamespaceURI)); |
| 780 | 780 else |
| 781 if (!element) | |
| 782 element = createElement(localName, ec); | 781 element = createElement(localName, ec); |
| 783 | 782 |
| 784 if (!typeExtension.isNull()) { | 783 if (!typeExtension.isNull()) { |
| 785 setTypeExtension(element.get(), typeExtension); | 784 setTypeExtension(element.get(), typeExtension); |
| 786 if (m_registry) | 785 ensureCustomElementRegistry()->didGiveTypeExtension(element.get()); |
| 787 m_registry->didGiveTypeExtension(element.get()); | |
| 788 } | 786 } |
| 789 | 787 |
| 790 return element; | 788 return element; |
| 791 } | 789 } |
| 792 | 790 |
| 793 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const String& qualifiedName, const AtomicString& typeExtension, ExceptionCode& e
c) | 791 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const String& qualifiedName, const AtomicString& typeExtension, ExceptionCode& e
c) |
| 794 { | 792 { |
| 795 String prefix, localName; | 793 String prefix, localName; |
| 796 if (!parseQualifiedName(qualifiedName, prefix, localName, ec)) | 794 if (!parseQualifiedName(qualifiedName, prefix, localName, ec)) |
| 797 return 0; | 795 return 0; |
| 798 | 796 |
| 799 QualifiedName qName(prefix, localName, namespaceURI); | 797 QualifiedName qName(prefix, localName, namespaceURI); |
| 800 if (!hasValidNamespaceForElements(qName)) { | 798 if (!hasValidNamespaceForElements(qName)) { |
| 801 ec = NAMESPACE_ERR; | 799 ec = NAMESPACE_ERR; |
| 802 return 0; | 800 return 0; |
| 803 } | 801 } |
| 804 | 802 |
| 805 RefPtr<Element> element; | 803 RefPtr<Element> element; |
| 806 | 804 if (CustomElementRegistry::isCustomTagName(qName.localName())) |
| 807 if (m_registry) | 805 element = ensureCustomElementRegistry()->createCustomTagElement(qName); |
| 808 element = m_registry->tryToCreateCustomTagElement(qName); | 806 else |
| 809 | |
| 810 if (!element) | |
| 811 element = createElementNS(namespaceURI, qualifiedName, ec); | 807 element = createElementNS(namespaceURI, qualifiedName, ec); |
| 812 | 808 |
| 813 if (!typeExtension.isNull()) { | 809 if (!typeExtension.isNull()) { |
| 814 setTypeExtension(element.get(), typeExtension); | 810 setTypeExtension(element.get(), typeExtension); |
| 815 if (m_registry) | 811 ensureCustomElementRegistry()->didGiveTypeExtension(element.get()); |
| 816 m_registry->didGiveTypeExtension(element.get()); | |
| 817 } | 812 } |
| 818 | 813 |
| 819 return element; | 814 return element; |
| 820 } | 815 } |
| 821 | 816 |
| 822 PassRefPtr<CustomElementConstructor> Document::registerElement(WebCore::ScriptSt
ate* state, const AtomicString& name, ExceptionCode& ec) | 817 PassRefPtr<CustomElementConstructor> Document::registerElement(WebCore::ScriptSt
ate* state, const AtomicString& name, ExceptionCode& ec) |
| 823 { | 818 { |
| 824 return registerElement(state, name, Dictionary(), ec); | 819 return registerElement(state, name, Dictionary(), ec); |
| 825 } | 820 } |
| 826 | 821 |
| 827 PassRefPtr<CustomElementConstructor> Document::registerElement(WebCore::ScriptSt
ate* state, const AtomicString& name, const Dictionary& options, ExceptionCode&
ec) | 822 PassRefPtr<CustomElementConstructor> Document::registerElement(WebCore::ScriptSt
ate* state, const AtomicString& name, const Dictionary& options, ExceptionCode&
ec) |
| 828 { | 823 { |
| 829 if (!isHTMLDocument() && !isXHTMLDocument()) { | 824 if (!isHTMLDocument() && !isXHTMLDocument()) { |
| 830 ec = NOT_SUPPORTED_ERR; | 825 ec = NOT_SUPPORTED_ERR; |
| 831 return 0; | 826 return 0; |
| 832 } | 827 } |
| 833 | 828 |
| 834 if (!m_registry) | 829 return ensureCustomElementRegistry()->registerElement(state, name, options,
ec); |
| 830 } |
| 831 |
| 832 CustomElementRegistry* Document::ensureCustomElementRegistry() |
| 833 { |
| 834 if (!m_registry) { |
| 835 ASSERT(isHTMLDocument() || isXHTMLDocument()); |
| 835 m_registry = adoptRef(new CustomElementRegistry(this)); | 836 m_registry = adoptRef(new CustomElementRegistry(this)); |
| 836 return m_registry->registerElement(state, name, options, ec); | 837 } |
| 838 return m_registry.get(); |
| 837 } | 839 } |
| 838 | 840 |
| 839 PassRefPtr<DocumentFragment> Document::createDocumentFragment() | 841 PassRefPtr<DocumentFragment> Document::createDocumentFragment() |
| 840 { | 842 { |
| 841 return DocumentFragment::create(document()); | 843 return DocumentFragment::create(document()); |
| 842 } | 844 } |
| 843 | 845 |
| 844 PassRefPtr<Text> Document::createTextNode(const String& data) | 846 PassRefPtr<Text> Document::createTextNode(const String& data) |
| 845 { | 847 { |
| 846 return Text::create(this, data); | 848 return Text::create(this, data); |
| (...skipping 4814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5661 return; | 5663 return; |
| 5662 | 5664 |
| 5663 Vector<RefPtr<Element> > associatedFormControls; | 5665 Vector<RefPtr<Element> > associatedFormControls; |
| 5664 copyToVector(m_associatedFormControls, associatedFormControls); | 5666 copyToVector(m_associatedFormControls, associatedFormControls); |
| 5665 | 5667 |
| 5666 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm
Controls); | 5668 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm
Controls); |
| 5667 m_associatedFormControls.clear(); | 5669 m_associatedFormControls.clear(); |
| 5668 } | 5670 } |
| 5669 | 5671 |
| 5670 } // namespace WebCore | 5672 } // namespace WebCore |
| OLD | NEW |