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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 ExceptionState& exceptionState) { | 662 ExceptionState& exceptionState) { |
663 if (!isValidName(name)) { | 663 if (!isValidName(name)) { |
664 exceptionState.throwDOMException( | 664 exceptionState.throwDOMException( |
665 InvalidCharacterError, | 665 InvalidCharacterError, |
666 "The tag name provided ('" + name + "') is not a valid name."); | 666 "The tag name provided ('" + name + "') is not a valid name."); |
667 return nullptr; | 667 return nullptr; |
668 } | 668 } |
669 | 669 |
670 if (isXHTMLDocument() || isHTMLDocument()) { | 670 if (isXHTMLDocument() || isHTMLDocument()) { |
671 if (CustomElement::shouldCreateCustomElement(name)) | 671 if (CustomElement::shouldCreateCustomElement(name)) |
672 return CustomElement::createCustomElementSync(*this, name, | 672 return CustomElement::createCustomElementSync(*this, name); |
673 exceptionState); | |
674 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *this, | 673 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *this, |
675 0, CreatedByCreateElement); | 674 0, CreatedByCreateElement); |
676 } | 675 } |
677 | 676 |
678 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); | 677 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); |
679 } | 678 } |
680 | 679 |
681 Element* Document::createElement(const AtomicString& localName, | 680 Element* Document::createElement(const AtomicString& localName, |
682 const AtomicString& typeExtension, | 681 const AtomicString& typeExtension, |
683 ExceptionState& exceptionState) { | 682 ExceptionState& exceptionState) { |
684 if (!isValidName(localName)) { | 683 if (!isValidName(localName)) { |
685 exceptionState.throwDOMException( | 684 exceptionState.throwDOMException( |
686 InvalidCharacterError, | 685 InvalidCharacterError, |
687 "The tag name provided ('" + localName + "') is not a valid name."); | 686 "The tag name provided ('" + localName + "') is not a valid name."); |
688 return nullptr; | 687 return nullptr; |
689 } | 688 } |
690 | 689 |
691 Element* element; | 690 Element* element; |
692 | 691 |
693 if (CustomElement::shouldCreateCustomElement(localName)) { | 692 if (CustomElement::shouldCreateCustomElement(localName)) { |
694 element = CustomElement::createCustomElementSync(*this, localName, | 693 element = CustomElement::createCustomElementSync(*this, localName); |
695 exceptionState); | |
696 } else if (V0CustomElement::isValidName(localName) && registrationContext()) { | 694 } else if (V0CustomElement::isValidName(localName) && registrationContext()) { |
697 element = registrationContext()->createCustomTagElement( | 695 element = registrationContext()->createCustomTagElement( |
698 *this, QualifiedName(nullAtom, convertLocalName(localName), | 696 *this, QualifiedName(nullAtom, convertLocalName(localName), |
699 xhtmlNamespaceURI)); | 697 xhtmlNamespaceURI)); |
700 } else { | 698 } else { |
701 element = createElement(localName, exceptionState); | 699 element = createElement(localName, exceptionState); |
702 if (exceptionState.hadException()) | 700 if (exceptionState.hadException()) |
703 return nullptr; | 701 return nullptr; |
704 } | 702 } |
705 | 703 |
(...skipping 28 matching lines...) Expand all Loading... |
734 | 732 |
735 Element* Document::createElementNS(const AtomicString& namespaceURI, | 733 Element* Document::createElementNS(const AtomicString& namespaceURI, |
736 const AtomicString& qualifiedName, | 734 const AtomicString& qualifiedName, |
737 ExceptionState& exceptionState) { | 735 ExceptionState& exceptionState) { |
738 QualifiedName qName( | 736 QualifiedName qName( |
739 createQualifiedName(namespaceURI, qualifiedName, exceptionState)); | 737 createQualifiedName(namespaceURI, qualifiedName, exceptionState)); |
740 if (qName == QualifiedName::null()) | 738 if (qName == QualifiedName::null()) |
741 return nullptr; | 739 return nullptr; |
742 | 740 |
743 if (CustomElement::shouldCreateCustomElement(qName)) | 741 if (CustomElement::shouldCreateCustomElement(qName)) |
744 return CustomElement::createCustomElementSync(*this, qName, exceptionState); | 742 return CustomElement::createCustomElementSync(*this, qName); |
745 return createElement(qName, CreatedByCreateElement); | 743 return createElement(qName, CreatedByCreateElement); |
746 } | 744 } |
747 | 745 |
748 Element* Document::createElementNS(const AtomicString& namespaceURI, | 746 Element* Document::createElementNS(const AtomicString& namespaceURI, |
749 const AtomicString& qualifiedName, | 747 const AtomicString& qualifiedName, |
750 const AtomicString& typeExtension, | 748 const AtomicString& typeExtension, |
751 ExceptionState& exceptionState) { | 749 ExceptionState& exceptionState) { |
752 QualifiedName qName( | 750 QualifiedName qName( |
753 createQualifiedName(namespaceURI, qualifiedName, exceptionState)); | 751 createQualifiedName(namespaceURI, qualifiedName, exceptionState)); |
754 if (qName == QualifiedName::null()) | 752 if (qName == QualifiedName::null()) |
755 return nullptr; | 753 return nullptr; |
756 | 754 |
757 Element* element; | 755 Element* element; |
758 if (CustomElement::shouldCreateCustomElement(qName)) | 756 if (CustomElement::shouldCreateCustomElement(qName)) |
759 element = | 757 element = CustomElement::createCustomElementSync(*this, qName); |
760 CustomElement::createCustomElementSync(*this, qName, exceptionState); | |
761 else if (V0CustomElement::isValidName(qName.localName()) && | 758 else if (V0CustomElement::isValidName(qName.localName()) && |
762 registrationContext()) | 759 registrationContext()) |
763 element = registrationContext()->createCustomTagElement(*this, qName); | 760 element = registrationContext()->createCustomTagElement(*this, qName); |
764 else | 761 else |
765 element = createElement(qName, CreatedByCreateElement); | 762 element = createElement(qName, CreatedByCreateElement); |
766 | 763 |
767 if (!typeExtension.isEmpty()) | 764 if (!typeExtension.isEmpty()) |
768 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension( | 765 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension( |
769 element, typeExtension); | 766 element, typeExtension); |
770 | 767 |
(...skipping 5640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6411 } | 6408 } |
6412 | 6409 |
6413 void showLiveDocumentInstances() { | 6410 void showLiveDocumentInstances() { |
6414 WeakDocumentSet& set = liveDocumentSet(); | 6411 WeakDocumentSet& set = liveDocumentSet(); |
6415 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6412 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6416 for (Document* document : set) | 6413 for (Document* document : set) |
6417 fprintf(stderr, "- Document %p URL: %s\n", document, | 6414 fprintf(stderr, "- Document %p URL: %s\n", document, |
6418 document->url().getString().utf8().data()); | 6415 document->url().getString().utf8().data()); |
6419 } | 6416 } |
6420 #endif | 6417 #endif |
OLD | NEW |