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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 } | 632 } |
633 | 633 |
634 Element* Document::createElement(const AtomicString& name, ExceptionState& excep
tionState) | 634 Element* Document::createElement(const AtomicString& name, ExceptionState& excep
tionState) |
635 { | 635 { |
636 if (!isValidName(name)) { | 636 if (!isValidName(name)) { |
637 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); | 637 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); |
638 return nullptr; | 638 return nullptr; |
639 } | 639 } |
640 | 640 |
641 if (isXHTMLDocument() || isHTMLDocument()) { | 641 if (isXHTMLDocument() || isHTMLDocument()) { |
642 if (CustomElement::shouldCreateCustomElement(*this, name)) | 642 if (CustomElement::shouldCreateCustomElement(name)) |
643 return CustomElement::createCustomElementSync(*this, name, exception
State); | 643 return CustomElement::createCustomElementSync(*this, name, exception
State); |
644 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *th
is, 0, CreatedByCreateElement); | 644 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *th
is, 0, CreatedByCreateElement); |
645 } | 645 } |
646 | 646 |
647 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); | 647 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); |
648 } | 648 } |
649 | 649 |
650 Element* Document::createElement(const AtomicString& localName, const AtomicStri
ng& typeExtension, ExceptionState& exceptionState) | 650 Element* Document::createElement(const AtomicString& localName, const AtomicStri
ng& typeExtension, ExceptionState& exceptionState) |
651 { | 651 { |
652 if (!isValidName(localName)) { | 652 if (!isValidName(localName)) { |
653 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + localName + "') is not a valid name."); | 653 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + localName + "') is not a valid name."); |
654 return nullptr; | 654 return nullptr; |
655 } | 655 } |
656 | 656 |
657 Element* element; | 657 Element* element; |
658 | 658 |
659 if (CustomElement::shouldCreateCustomElement(*this, localName)) { | 659 if (CustomElement::shouldCreateCustomElement(localName)) { |
660 element = CustomElement::createCustomElementSync(*this, localName, excep
tionState); | 660 element = CustomElement::createCustomElementSync(*this, localName, excep
tionState); |
661 } else if (V0CustomElement::isValidName(localName) && registrationContext())
{ | 661 } else if (V0CustomElement::isValidName(localName) && registrationContext())
{ |
662 element = registrationContext()->createCustomTagElement(*this, Qualified
Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); | 662 element = registrationContext()->createCustomTagElement(*this, Qualified
Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); |
663 } else { | 663 } else { |
664 element = createElement(localName, exceptionState); | 664 element = createElement(localName, exceptionState); |
665 if (exceptionState.hadException()) | 665 if (exceptionState.hadException()) |
666 return nullptr; | 666 return nullptr; |
667 } | 667 } |
668 | 668 |
669 if (!typeExtension.isEmpty()) | 669 if (!typeExtension.isEmpty()) |
(...skipping 16 matching lines...) Expand all Loading... |
686 | 686 |
687 return qName; | 687 return qName; |
688 } | 688 } |
689 | 689 |
690 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, ExceptionState& exceptionState) | 690 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, ExceptionState& exceptionState) |
691 { | 691 { |
692 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); | 692 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
693 if (qName == QualifiedName::null()) | 693 if (qName == QualifiedName::null()) |
694 return nullptr; | 694 return nullptr; |
695 | 695 |
696 if (CustomElement::shouldCreateCustomElement(*this, qName)) | 696 if (CustomElement::shouldCreateCustomElement(qName)) |
697 return CustomElement::createCustomElementSync(*this, qName, exceptionSta
te); | 697 return CustomElement::createCustomElementSync(*this, qName, exceptionSta
te); |
698 return createElement(qName, CreatedByCreateElement); | 698 return createElement(qName, CreatedByCreateElement); |
699 } | 699 } |
700 | 700 |
701 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep
tionState) | 701 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep
tionState) |
702 { | 702 { |
703 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); | 703 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
704 if (qName == QualifiedName::null()) | 704 if (qName == QualifiedName::null()) |
705 return nullptr; | 705 return nullptr; |
706 | 706 |
707 Element* element; | 707 Element* element; |
708 if (CustomElement::shouldCreateCustomElement(*this, qName)) | 708 if (CustomElement::shouldCreateCustomElement(qName)) |
709 element = CustomElement::createCustomElementSync(*this, qName, exception
State); | 709 element = CustomElement::createCustomElementSync(*this, qName, exception
State); |
710 else if (V0CustomElement::isValidName(qName.localName()) && registrationCont
ext()) | 710 else if (V0CustomElement::isValidName(qName.localName()) && registrationCont
ext()) |
711 element = registrationContext()->createCustomTagElement(*this, qName); | 711 element = registrationContext()->createCustomTagElement(*this, qName); |
712 else | 712 else |
713 element = createElement(qName, CreatedByCreateElement); | 713 element = createElement(qName, CreatedByCreateElement); |
714 | 714 |
715 if (!typeExtension.isEmpty()) | 715 if (!typeExtension.isEmpty()) |
716 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); | 716 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); |
717 | 717 |
718 return element; | 718 return element; |
(...skipping 5319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6038 } | 6038 } |
6039 | 6039 |
6040 void showLiveDocumentInstances() | 6040 void showLiveDocumentInstances() |
6041 { | 6041 { |
6042 WeakDocumentSet& set = liveDocumentSet(); | 6042 WeakDocumentSet& set = liveDocumentSet(); |
6043 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6043 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6044 for (Document* document : set) | 6044 for (Document* document : set) |
6045 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6045 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
6046 } | 6046 } |
6047 #endif | 6047 #endif |
OLD | NEW |