Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: Source/core/dom/Document.cpp

Issue 102533002: Implemented DocumentType.cloneNode(bool) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r); 782 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
783 return 0; 783 return 0;
784 } 784 }
785 if (data.find("]]>") != WTF::kNotFound) { 785 if (data.find("]]>") != WTF::kNotFound) {
786 exceptionState.throwDOMException(InvalidCharacterError, "String cannot c ontain ']]>' since that is the end delimiter of a CData section."); 786 exceptionState.throwDOMException(InvalidCharacterError, "String cannot c ontain ']]>' since that is the end delimiter of a CData section.");
787 return 0; 787 return 0;
788 } 788 }
789 return CDATASection::create(*this, data); 789 return CDATASection::create(*this, data);
790 } 790 }
791 791
792 PassRefPtr<DocumentType> Document::createDocumentType(const String& qualifiedNam e, const String& publicId, const String& systemId)
793 {
794 return DocumentType::create(this, qualifiedName, publicId, systemId);
esprehn 2013/12/09 17:19:08 Remove this method, the other ones are real JS API
795 }
796
792 PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const St ring& target, const String& data, ExceptionState& exceptionState) 797 PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const St ring& target, const String& data, ExceptionState& exceptionState)
793 { 798 {
794 if (!isValidName(target)) { 799 if (!isValidName(target)) {
795 exceptionState.throwUninformativeAndGenericDOMException(InvalidCharacter Error); 800 exceptionState.throwUninformativeAndGenericDOMException(InvalidCharacter Error);
796 return 0; 801 return 0;
797 } 802 }
798 if (isHTMLDocument()) { 803 if (isHTMLDocument()) {
799 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r); 804 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
800 return 0; 805 return 0;
801 } 806 }
(...skipping 19 matching lines...) Expand all
821 826
822 switch (importedNode->nodeType()) { 827 switch (importedNode->nodeType()) {
823 case TEXT_NODE: 828 case TEXT_NODE:
824 return createTextNode(importedNode->nodeValue()); 829 return createTextNode(importedNode->nodeValue());
825 case CDATA_SECTION_NODE: 830 case CDATA_SECTION_NODE:
826 return createCDATASection(importedNode->nodeValue(), exceptionState); 831 return createCDATASection(importedNode->nodeValue(), exceptionState);
827 case PROCESSING_INSTRUCTION_NODE: 832 case PROCESSING_INSTRUCTION_NODE:
828 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), exceptionState); 833 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), exceptionState);
829 case COMMENT_NODE: 834 case COMMENT_NODE:
830 return createComment(importedNode->nodeValue()); 835 return createComment(importedNode->nodeValue());
836 case DOCUMENT_TYPE_NODE: {
837 DocumentType* doctype = static_cast<DocumentType*>(importedNode);
esprehn 2013/12/09 17:19:08 toDocumentType(importedNode), you might need to ad
838 return createDocumentType(doctype->name(), doctype->publicId(), doctype- >systemId());
esprehn 2013/12/09 17:19:08 DocumentType::create(...)
839 }
831 case ELEMENT_NODE: { 840 case ELEMENT_NODE: {
832 Element* oldElement = toElement(importedNode); 841 Element* oldElement = toElement(importedNode);
833 // FIXME: The following check might be unnecessary. Is it possible that 842 // FIXME: The following check might be unnecessary. Is it possible that
834 // oldElement has mismatched prefix/namespace? 843 // oldElement has mismatched prefix/namespace?
835 if (!hasValidNamespaceForElements(oldElement->tagQName())) { 844 if (!hasValidNamespaceForElements(oldElement->tagQName())) {
836 exceptionState.throwUninformativeAndGenericDOMException(NamespaceErr or); 845 exceptionState.throwUninformativeAndGenericDOMException(NamespaceErr or);
837 return 0; 846 return 0;
838 } 847 }
839 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false ); 848 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false );
840 849
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } 883 }
875 } 884 }
876 885
877 return newFragment.release(); 886 return newFragment.release();
878 } 887 }
879 case ENTITY_NODE: 888 case ENTITY_NODE:
880 case NOTATION_NODE: 889 case NOTATION_NODE:
881 // FIXME: It should be possible to import these node types, however in D OM3 the DocumentType is readonly, so there isn't much sense in doing that. 890 // FIXME: It should be possible to import these node types, however in D OM3 the DocumentType is readonly, so there isn't much sense in doing that.
882 // Ability to add these imported nodes to a DocumentType will be conside red for addition to a future release of the DOM. 891 // Ability to add these imported nodes to a DocumentType will be conside red for addition to a future release of the DOM.
883 case DOCUMENT_NODE: 892 case DOCUMENT_NODE:
884 case DOCUMENT_TYPE_NODE:
885 case XPATH_NAMESPACE_NODE: 893 case XPATH_NAMESPACE_NODE:
886 break; 894 break;
887 } 895 }
888 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); 896 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
889 return 0; 897 return 0;
890 } 898 }
891 899
892 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex ceptionState) 900 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex ceptionState)
893 { 901 {
894 if (!source) { 902 if (!source) {
(...skipping 4318 matching lines...) Expand 10 before | Expand all | Expand 10 after
5213 } 5221 }
5214 5222
5215 FastTextAutosizer* Document::fastTextAutosizer() 5223 FastTextAutosizer* Document::fastTextAutosizer()
5216 { 5224 {
5217 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5225 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5218 m_fastTextAutosizer = FastTextAutosizer::create(this); 5226 m_fastTextAutosizer = FastTextAutosizer::create(this);
5219 return m_fastTextAutosizer.get(); 5227 return m_fastTextAutosizer.get();
5220 } 5228 }
5221 5229
5222 } // namespace WebCore 5230 } // namespace WebCore
OLDNEW
« LayoutTests/fast/dom/DocumentType/clone-node.html ('K') | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698