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

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

Issue 167653002: Make importNode work when the XML document contains a CDATA section (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add testcase Created 6 years, 10 months 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/importNode-cdata-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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 { 889 {
890 if (!importedNode) { 890 if (!importedNode) {
891 exceptionState.throwDOMException(NotSupportedError, "The node provided i s invalid."); 891 exceptionState.throwDOMException(NotSupportedError, "The node provided i s invalid.");
892 return 0; 892 return 0;
893 } 893 }
894 894
895 switch (importedNode->nodeType()) { 895 switch (importedNode->nodeType()) {
896 case TEXT_NODE: 896 case TEXT_NODE:
897 return createTextNode(importedNode->nodeValue()); 897 return createTextNode(importedNode->nodeValue());
898 case CDATA_SECTION_NODE: 898 case CDATA_SECTION_NODE:
899 return createCDATASection(importedNode->nodeValue(), exceptionState); 899 return importedNode->cloneNode(deep);
adamk 2014/02/19 17:04:59 cloneNode alone can't be used to implement importN
900 case PROCESSING_INSTRUCTION_NODE: 900 case PROCESSING_INSTRUCTION_NODE:
901 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), exceptionState); 901 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), exceptionState);
902 case COMMENT_NODE: 902 case COMMENT_NODE:
903 return createComment(importedNode->nodeValue()); 903 return createComment(importedNode->nodeValue());
904 case DOCUMENT_TYPE_NODE: { 904 case DOCUMENT_TYPE_NODE: {
905 DocumentType* doctype = toDocumentType(importedNode); 905 DocumentType* doctype = toDocumentType(importedNode);
906 return DocumentType::create(this, doctype->name(), doctype->publicId(), doctype->systemId()); 906 return DocumentType::create(this, doctype->name(), doctype->publicId(), doctype->systemId());
907 } 907 }
908 case ELEMENT_NODE: { 908 case ELEMENT_NODE: {
909 Element* oldElement = toElement(importedNode); 909 Element* oldElement = toElement(importedNode);
(...skipping 4551 matching lines...) Expand 10 before | Expand all | Expand 10 after
5461 void Document::defaultEventHandler(Event* event) 5461 void Document::defaultEventHandler(Event* event)
5462 { 5462 {
5463 if (frame() && frame()->remotePlatformLayer()) { 5463 if (frame() && frame()->remotePlatformLayer()) {
5464 frame()->chromeClient().forwardInputEvent(this, event); 5464 frame()->chromeClient().forwardInputEvent(this, event);
5465 return; 5465 return;
5466 } 5466 }
5467 Node::defaultEventHandler(event); 5467 Node::defaultEventHandler(event);
5468 } 5468 }
5469 5469
5470 } // namespace WebCore 5470 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/importNode-cdata-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698