| 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::createCustomElementSync(*this, name, exception
State); |
| 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::createCustomElementSync(*this, localName, excep
tionState); |
| 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 |
| 698 if (CustomElement::shouldCreateCustomElement(*this, qName)) |
| 699 return CustomElement::createCustomElementSync(*this, qName, exceptionSta
te); |
| 695 return createElement(qName, CreatedByCreateElement); | 700 return createElement(qName, CreatedByCreateElement); |
| 696 } | 701 } |
| 697 | 702 |
| 698 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep
tionState) | 703 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep
tionState) |
| 699 { | 704 { |
| 700 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); | 705 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti
onState)); |
| 701 if (qName == QualifiedName::null()) | 706 if (qName == QualifiedName::null()) |
| 702 return nullptr; | 707 return nullptr; |
| 703 | 708 |
| 704 Element* element; | 709 Element* element; |
| 705 if (CustomElement::shouldCreateCustomElement(*this, qName)) | 710 if (CustomElement::shouldCreateCustomElement(*this, qName)) |
| 706 element = CustomElement::createCustomElement(*this, qName, CreatedByCrea
teElement); | 711 element = CustomElement::createCustomElementSync(*this, qName, exception
State); |
| 707 else if (V0CustomElement::isValidName(qName.localName()) && registrationCont
ext()) | 712 else if (V0CustomElement::isValidName(qName.localName()) && registrationCont
ext()) |
| 708 element = registrationContext()->createCustomTagElement(*this, qName); | 713 element = registrationContext()->createCustomTagElement(*this, qName); |
| 709 else | 714 else |
| 710 element = createElement(qName, CreatedByCreateElement); | 715 element = createElement(qName, CreatedByCreateElement); |
| 711 | 716 |
| 712 if (!typeExtension.isEmpty()) | 717 if (!typeExtension.isEmpty()) |
| 713 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); | 718 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme
nt, typeExtension); |
| 714 | 719 |
| 715 return element; | 720 return element; |
| 716 } | 721 } |
| (...skipping 5291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6008 } | 6013 } |
| 6009 | 6014 |
| 6010 void showLiveDocumentInstances() | 6015 void showLiveDocumentInstances() |
| 6011 { | 6016 { |
| 6012 WeakDocumentSet& set = liveDocumentSet(); | 6017 WeakDocumentSet& set = liveDocumentSet(); |
| 6013 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6018 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6014 for (Document* document : set) | 6019 for (Document* document : set) |
| 6015 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()); |
| 6016 } | 6021 } |
| 6017 #endif | 6022 #endif |
| OLD | NEW |