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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 InvalidCharacterError, | 651 InvalidCharacterError, |
652 "The tag name provided ('" + name + "') is not a valid name."); | 652 "The tag name provided ('" + name + "') is not a valid name."); |
653 return nullptr; | 653 return nullptr; |
654 } | 654 } |
655 | 655 |
656 if (isXHTMLDocument() || isHTMLDocument()) { | 656 if (isXHTMLDocument() || isHTMLDocument()) { |
657 // 2. If the context object is an HTML document, let localName be | 657 // 2. If the context object is an HTML document, let localName be |
658 // converted to ASCII lowercase. | 658 // converted to ASCII lowercase. |
659 AtomicString localName = convertLocalName(name); | 659 AtomicString localName = convertLocalName(name); |
660 if (CustomElement::shouldCreateCustomElement(localName)) | 660 if (CustomElement::shouldCreateCustomElement(localName)) |
661 return CustomElement::createCustomElementSync(*this, localName, | 661 return CustomElement::createCustomElementSync(*this, localName); |
662 exceptionState); | |
663 return HTMLElementFactory::createHTMLElement(localName, *this, 0, | 662 return HTMLElementFactory::createHTMLElement(localName, *this, 0, |
664 CreatedByCreateElement); | 663 CreatedByCreateElement); |
665 } | 664 } |
666 | 665 |
667 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); | 666 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); |
668 } | 667 } |
669 | 668 |
670 Element* Document::createElement(const AtomicString& localName, | 669 Element* Document::createElement(const AtomicString& localName, |
671 const AtomicString& typeExtension, | 670 const AtomicString& typeExtension, |
672 ExceptionState& exceptionState) { | 671 ExceptionState& exceptionState) { |
673 if (!isValidName(localName)) { | 672 if (!isValidName(localName)) { |
674 exceptionState.throwDOMException( | 673 exceptionState.throwDOMException( |
675 InvalidCharacterError, | 674 InvalidCharacterError, |
676 "The tag name provided ('" + localName + "') is not a valid name."); | 675 "The tag name provided ('" + localName + "') is not a valid name."); |
677 return nullptr; | 676 return nullptr; |
678 } | 677 } |
679 | 678 |
680 Element* element; | 679 Element* element; |
681 | 680 |
682 if (CustomElement::shouldCreateCustomElement(convertLocalName(localName))) { | 681 if (CustomElement::shouldCreateCustomElement(convertLocalName(localName))) { |
683 element = CustomElement::createCustomElementSync( | 682 element = CustomElement::createCustomElementSync( |
684 *this, convertLocalName(localName), exceptionState); | 683 *this, convertLocalName(localName)); |
685 } else if (V0CustomElement::isValidName(localName) && registrationContext()) { | 684 } else if (V0CustomElement::isValidName(localName) && registrationContext()) { |
686 element = registrationContext()->createCustomTagElement( | 685 element = registrationContext()->createCustomTagElement( |
687 *this, QualifiedName(nullAtom, convertLocalName(localName), | 686 *this, QualifiedName(nullAtom, convertLocalName(localName), |
688 xhtmlNamespaceURI)); | 687 xhtmlNamespaceURI)); |
689 } else { | 688 } else { |
690 element = createElement(localName, exceptionState); | 689 element = createElement(localName, exceptionState); |
691 if (exceptionState.hadException()) | 690 if (exceptionState.hadException()) |
692 return nullptr; | 691 return nullptr; |
693 } | 692 } |
694 | 693 |
(...skipping 28 matching lines...) Expand all Loading... |
723 | 722 |
724 Element* Document::createElementNS(const AtomicString& namespaceURI, | 723 Element* Document::createElementNS(const AtomicString& namespaceURI, |
725 const AtomicString& qualifiedName, | 724 const AtomicString& qualifiedName, |
726 ExceptionState& exceptionState) { | 725 ExceptionState& exceptionState) { |
727 QualifiedName qName( | 726 QualifiedName qName( |
728 createQualifiedName(namespaceURI, qualifiedName, exceptionState)); | 727 createQualifiedName(namespaceURI, qualifiedName, exceptionState)); |
729 if (qName == QualifiedName::null()) | 728 if (qName == QualifiedName::null()) |
730 return nullptr; | 729 return nullptr; |
731 | 730 |
732 if (CustomElement::shouldCreateCustomElement(qName)) | 731 if (CustomElement::shouldCreateCustomElement(qName)) |
733 return CustomElement::createCustomElementSync(*this, qName, exceptionState); | 732 return CustomElement::createCustomElementSync(*this, qName); |
734 return createElement(qName, CreatedByCreateElement); | 733 return createElement(qName, CreatedByCreateElement); |
735 } | 734 } |
736 | 735 |
737 Element* Document::createElementNS(const AtomicString& namespaceURI, | 736 Element* Document::createElementNS(const AtomicString& namespaceURI, |
738 const AtomicString& qualifiedName, | 737 const AtomicString& qualifiedName, |
739 const AtomicString& typeExtension, | 738 const AtomicString& typeExtension, |
740 ExceptionState& exceptionState) { | 739 ExceptionState& exceptionState) { |
741 QualifiedName qName( | 740 QualifiedName qName( |
742 createQualifiedName(namespaceURI, qualifiedName, exceptionState)); | 741 createQualifiedName(namespaceURI, qualifiedName, exceptionState)); |
743 if (qName == QualifiedName::null()) | 742 if (qName == QualifiedName::null()) |
744 return nullptr; | 743 return nullptr; |
745 | 744 |
746 Element* element; | 745 Element* element; |
747 if (CustomElement::shouldCreateCustomElement(qName)) | 746 if (CustomElement::shouldCreateCustomElement(qName)) |
748 element = | 747 element = CustomElement::createCustomElementSync(*this, qName); |
749 CustomElement::createCustomElementSync(*this, qName, exceptionState); | |
750 else if (V0CustomElement::isValidName(qName.localName()) && | 748 else if (V0CustomElement::isValidName(qName.localName()) && |
751 registrationContext()) | 749 registrationContext()) |
752 element = registrationContext()->createCustomTagElement(*this, qName); | 750 element = registrationContext()->createCustomTagElement(*this, qName); |
753 else | 751 else |
754 element = createElement(qName, CreatedByCreateElement); | 752 element = createElement(qName, CreatedByCreateElement); |
755 | 753 |
756 if (!typeExtension.isEmpty()) | 754 if (!typeExtension.isEmpty()) |
757 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension( | 755 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension( |
758 element, typeExtension); | 756 element, typeExtension); |
759 | 757 |
(...skipping 5637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6397 } | 6395 } |
6398 | 6396 |
6399 void showLiveDocumentInstances() { | 6397 void showLiveDocumentInstances() { |
6400 WeakDocumentSet& set = liveDocumentSet(); | 6398 WeakDocumentSet& set = liveDocumentSet(); |
6401 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6399 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6402 for (Document* document : set) | 6400 for (Document* document : set) |
6403 fprintf(stderr, "- Document %p URL: %s\n", document, | 6401 fprintf(stderr, "- Document %p URL: %s\n", document, |
6404 document->url().getString().utf8().data()); | 6402 document->url().getString().utf8().data()); |
6405 } | 6403 } |
6406 #endif | 6404 #endif |
OLD | NEW |