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

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: addressed review issues 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
« no previous file with comments | « LayoutTests/fast/dom/DocumentType/clone-node-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 830
831 switch (importedNode->nodeType()) { 831 switch (importedNode->nodeType()) {
832 case TEXT_NODE: 832 case TEXT_NODE:
833 return createTextNode(importedNode->nodeValue()); 833 return createTextNode(importedNode->nodeValue());
834 case CDATA_SECTION_NODE: 834 case CDATA_SECTION_NODE:
835 return createCDATASection(importedNode->nodeValue(), exceptionState); 835 return createCDATASection(importedNode->nodeValue(), exceptionState);
836 case PROCESSING_INSTRUCTION_NODE: 836 case PROCESSING_INSTRUCTION_NODE:
837 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), exceptionState); 837 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), exceptionState);
838 case COMMENT_NODE: 838 case COMMENT_NODE:
839 return createComment(importedNode->nodeValue()); 839 return createComment(importedNode->nodeValue());
840 case DOCUMENT_TYPE_NODE: {
841 DocumentType* doctype = toDocumentType(importedNode);
842 return DocumentType::create(this, doctype->name(), doctype->publicId(), doctype->systemId());
843 }
840 case ELEMENT_NODE: { 844 case ELEMENT_NODE: {
841 Element* oldElement = toElement(importedNode); 845 Element* oldElement = toElement(importedNode);
842 // FIXME: The following check might be unnecessary. Is it possible that 846 // FIXME: The following check might be unnecessary. Is it possible that
843 // oldElement has mismatched prefix/namespace? 847 // oldElement has mismatched prefix/namespace?
844 if (!hasValidNamespaceForElements(oldElement->tagQName())) { 848 if (!hasValidNamespaceForElements(oldElement->tagQName())) {
845 exceptionState.throwUninformativeAndGenericDOMException(NamespaceErr or); 849 exceptionState.throwUninformativeAndGenericDOMException(NamespaceErr or);
846 return 0; 850 return 0;
847 } 851 }
848 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false ); 852 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false );
849 853
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 } 887 }
884 } 888 }
885 889
886 return newFragment.release(); 890 return newFragment.release();
887 } 891 }
888 case ENTITY_NODE: 892 case ENTITY_NODE:
889 case NOTATION_NODE: 893 case NOTATION_NODE:
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. 894 // 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.
891 // Ability to add these imported nodes to a DocumentType will be conside red for addition to a future release of the DOM. 895 // Ability to add these imported nodes to a DocumentType will be conside red for addition to a future release of the DOM.
892 case DOCUMENT_NODE: 896 case DOCUMENT_NODE:
893 case DOCUMENT_TYPE_NODE:
894 case XPATH_NAMESPACE_NODE: 897 case XPATH_NAMESPACE_NODE:
895 break; 898 break;
896 } 899 }
897 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); 900 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
898 return 0; 901 return 0;
899 } 902 }
900 903
901 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex ceptionState) 904 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex ceptionState)
902 { 905 {
903 if (!source) { 906 if (!source) {
(...skipping 4310 matching lines...) Expand 10 before | Expand all | Expand 10 after
5214 } 5217 }
5215 5218
5216 FastTextAutosizer* Document::fastTextAutosizer() 5219 FastTextAutosizer* Document::fastTextAutosizer()
5217 { 5220 {
5218 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5221 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5219 m_fastTextAutosizer = FastTextAutosizer::create(this); 5222 m_fastTextAutosizer = FastTextAutosizer::create(this);
5220 return m_fastTextAutosizer.get(); 5223 return m_fastTextAutosizer.get();
5221 } 5224 }
5222 5225
5223 } // namespace WebCore 5226 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/DocumentType/clone-node-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698