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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 return isHTMLDocument() ? name.lower() : name; | 633 return isHTMLDocument() ? name.lower() : name; |
634 } | 634 } |
635 | 635 |
636 Element* Document::createElement(const AtomicString& name, ExceptionState& excep
tionState) | 636 Element* Document::createElement(const AtomicString& name, ExceptionState& excep
tionState) |
637 { | 637 { |
638 if (!isValidName(name)) { | 638 if (!isValidName(name)) { |
639 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); | 639 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); |
640 return nullptr; | 640 return nullptr; |
641 } | 641 } |
642 | 642 |
643 if (isXHTMLDocument() || isHTMLDocument()) | 643 if (isXHTMLDocument() || isHTMLDocument()) { |
| 644 if (CustomElement::shouldCreateCustomElement(*this, name)) |
| 645 return CustomElement::createCustomElement(*this, name, CreatedByCrea
teElement, exceptionState); |
644 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *th
is, 0, CreatedByCreateElement); | 646 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *th
is, 0, CreatedByCreateElement); |
| 647 } |
645 | 648 |
646 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); | 649 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); |
647 } | 650 } |
648 | 651 |
649 Element* Document::createElement(const AtomicString& localName, const AtomicStri
ng& typeExtension, ExceptionState& exceptionState) | 652 Element* Document::createElement(const AtomicString& localName, const AtomicStri
ng& typeExtension, ExceptionState& exceptionState) |
650 { | 653 { |
651 if (!isValidName(localName)) { | 654 if (!isValidName(localName)) { |
652 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + localName + "') is not a valid name."); | 655 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + localName + "') is not a valid name."); |
653 return nullptr; | 656 return nullptr; |
654 } | 657 } |
655 | 658 |
656 Element* element; | 659 Element* element; |
657 | 660 |
658 if (CustomElement::shouldCreateCustomElement(*this, localName)) { | 661 if (CustomElement::shouldCreateCustomElement(*this, localName)) { |
659 element = CustomElement::createCustomElement(*this, localName, CreatedBy
CreateElement); | 662 element = CustomElement::createCustomElement(*this, localName, CreatedBy
CreateElement, exceptionState); |
660 } else if (V0CustomElement::isValidName(localName) && registrationContext())
{ | 663 } else if (V0CustomElement::isValidName(localName) && registrationContext())
{ |
661 element = registrationContext()->createCustomTagElement(*this, Qualified
Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); | 664 element = registrationContext()->createCustomTagElement(*this, Qualified
Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); |
662 } else { | 665 } else { |
663 element = createElement(localName, exceptionState); | 666 element = createElement(localName, exceptionState); |
664 if (exceptionState.hadException()) | 667 if (exceptionState.hadException()) |
665 return nullptr; | 668 return nullptr; |
666 } | 669 } |
667 | 670 |
668 if (!typeExtension.isEmpty()) | 671 if (!typeExtension.isEmpty()) |
669 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); | 672 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); |
(...skipping 15 matching lines...) Expand all Loading... |
685 | 688 |
686 return qName; | 689 return qName; |
687 } | 690 } |
688 | 691 |
689 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, ExceptionState& exceptionState) | 692 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, ExceptionState& exceptionState) |
690 { | 693 { |
691 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); | 694 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
692 if (qName == QualifiedName::null()) | 695 if (qName == QualifiedName::null()) |
693 return nullptr; | 696 return nullptr; |
694 | 697 |
695 return createElement(qName, CreatedByCreateElement); | 698 return createElement(qName, CreatedByCreateElement, exceptionState); |
696 } | 699 } |
697 | 700 |
698 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) |
699 { | 702 { |
700 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); | 703 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
701 if (qName == QualifiedName::null()) | 704 if (qName == QualifiedName::null()) |
702 return nullptr; | 705 return nullptr; |
703 | 706 |
704 Element* element; | 707 Element* element; |
705 if (CustomElement::shouldCreateCustomElement(*this, qName)) | 708 if (CustomElement::shouldCreateCustomElement(*this, qName)) |
706 element = CustomElement::createCustomElement(*this, qName, CreatedByCrea
teElement); | 709 element = CustomElement::createCustomElement(*this, qName, CreatedByCrea
teElement, exceptionState); |
707 else if (V0CustomElement::isValidName(qName.localName()) && registrationCont
ext()) | 710 else if (V0CustomElement::isValidName(qName.localName()) && registrationCont
ext()) |
708 element = registrationContext()->createCustomTagElement(*this, qName); | 711 element = registrationContext()->createCustomTagElement(*this, qName); |
709 else | 712 else |
710 element = createElement(qName, CreatedByCreateElement); | 713 element = createElement(qName, CreatedByCreateElement); |
711 | 714 |
712 if (!typeExtension.isEmpty()) | 715 if (!typeExtension.isEmpty()) |
713 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); | 716 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); |
714 | 717 |
715 return element; | 718 return element; |
716 } | 719 } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 e = Element::create(qName, this); | 982 e = Element::create(qName, this); |
980 | 983 |
981 if (e->prefix() != qName.prefix()) | 984 if (e->prefix() != qName.prefix()) |
982 e->setTagNameForCreateElementNS(qName); | 985 e->setTagNameForCreateElementNS(qName); |
983 | 986 |
984 DCHECK(qName == e->tagQName()); | 987 DCHECK(qName == e->tagQName()); |
985 | 988 |
986 return e; | 989 return e; |
987 } | 990 } |
988 | 991 |
| 992 Element* Document::createElement(const QualifiedName& qName, CreateElementFlags
flags, ExceptionState& exceptionState) |
| 993 { |
| 994 if (CustomElement::shouldCreateCustomElement(*this, qName)) |
| 995 return CustomElement::createCustomElement(*this, qName, flags, exception
State); |
| 996 return createElement(qName, flags); |
| 997 } |
| 998 |
989 String Document::readyState() const | 999 String Document::readyState() const |
990 { | 1000 { |
991 DEFINE_STATIC_LOCAL(const String, loading, ("loading")); | 1001 DEFINE_STATIC_LOCAL(const String, loading, ("loading")); |
992 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive")); | 1002 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive")); |
993 DEFINE_STATIC_LOCAL(const String, complete, ("complete")); | 1003 DEFINE_STATIC_LOCAL(const String, complete, ("complete")); |
994 | 1004 |
995 switch (m_readyState) { | 1005 switch (m_readyState) { |
996 case Loading: | 1006 case Loading: |
997 return loading; | 1007 return loading; |
998 case Interactive: | 1008 case Interactive: |
(...skipping 5004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6003 } | 6013 } |
6004 | 6014 |
6005 void showLiveDocumentInstances() | 6015 void showLiveDocumentInstances() |
6006 { | 6016 { |
6007 WeakDocumentSet& set = liveDocumentSet(); | 6017 WeakDocumentSet& set = liveDocumentSet(); |
6008 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6018 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6009 for (Document* document : set) | 6019 for (Document* document : set) |
6010 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6020 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
6011 } | 6021 } |
6012 #endif | 6022 #endif |
OLD | NEW |