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

Side by Side Diff: Source/core/editing/MarkupAccumulator.cpp

Issue 183663033: Pre-bind the 'xml' prefix for serialization of XML fragments (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/XMLSerializer-prebound-xml-prefix.html ('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) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 , m_resolveURLsMethod(resolveUrlsMethod) 102 , m_resolveURLsMethod(resolveUrlsMethod)
103 { 103 {
104 } 104 }
105 105
106 MarkupAccumulator::~MarkupAccumulator() 106 MarkupAccumulator::~MarkupAccumulator()
107 { 107 {
108 } 108 }
109 109
110 String MarkupAccumulator::serializeNodes(Node& targetNode, EChildrenOnly childre nOnly, Vector<QualifiedName>* tagNamesToSkip) 110 String MarkupAccumulator::serializeNodes(Node& targetNode, EChildrenOnly childre nOnly, Vector<QualifiedName>* tagNamesToSkip)
111 { 111 {
112 serializeNodesWithNamespaces(targetNode, childrenOnly, 0, tagNamesToSkip); 112 Namespaces* namespaces = 0;
113 Namespaces namespaceHash;
114 if (!targetNode.document().isHTMLDocument()) {
115 // Add pre-bound namespaces for XML fragments.
116 namespaceHash.set(xmlAtom.impl(), XMLNames::xmlNamespaceURI.impl());
117 namespaces = &namespaceHash;
118 }
119
120 serializeNodesWithNamespaces(targetNode, childrenOnly, namespaces, tagNamesT oSkip);
113 return m_markup.toString(); 121 return m_markup.toString();
114 } 122 }
115 123
116 void MarkupAccumulator::serializeNodesWithNamespaces(Node& targetNode, EChildren Only childrenOnly, const Namespaces* namespaces, Vector<QualifiedName>* tagNames ToSkip) 124 void MarkupAccumulator::serializeNodesWithNamespaces(Node& targetNode, EChildren Only childrenOnly, const Namespaces* namespaces, Vector<QualifiedName>* tagNames ToSkip)
117 { 125 {
118 if (tagNamesToSkip) { 126 if (tagNamesToSkip) {
119 for (size_t i = 0; i < tagNamesToSkip->size(); ++i) { 127 for (size_t i = 0; i < tagNamesToSkip->size(); ++i) {
120 if (targetNode.hasTagName(tagNamesToSkip->at(i))) 128 if (targetNode.hasTagName(tagNamesToSkip->at(i)))
121 return; 129 return;
122 } 130 }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 { 537 {
530 if (!node.isElementNode() || shouldSelfClose(node) || (!node.hasChildren() & & elementCannotHaveEndTag(node))) 538 if (!node.isElementNode() || shouldSelfClose(node) || (!node.hasChildren() & & elementCannotHaveEndTag(node)))
531 return; 539 return;
532 540
533 result.appendLiteral("</"); 541 result.appendLiteral("</");
534 result.append(nodeNamePreservingCase(toElement(node))); 542 result.append(nodeNamePreservingCase(toElement(node)));
535 result.append('>'); 543 result.append('>');
536 } 544 }
537 545
538 } 546 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/XMLSerializer-prebound-xml-prefix.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698