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

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

Issue 1161463008: Refactoring: Have StyledMarkupAccumulator use MarkupFormatter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 6 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
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (!element.document().url().isLocalFile()) 125 if (!element.document().url().isLocalFile())
126 return element.document().completeURL(urlString).string(); 126 return element.document().completeURL(urlString).string();
127 break; 127 break;
128 128
129 case DoNotResolveURLs: 129 case DoNotResolveURLs:
130 break; 130 break;
131 } 131 }
132 return urlString; 132 return urlString;
133 } 133 }
134 134
135 void MarkupFormatter::appendStartMarkup(StringBuilder& result, const Node& node, Namespaces* namespaces)
136 {
137 switch (node.nodeType()) {
138 case Node::TEXT_NODE:
139 ASSERT_NOT_REACHED();
140 break;
141 case Node::COMMENT_NODE:
142 appendComment(result, toComment(node).data());
143 break;
144 case Node::DOCUMENT_NODE:
145 appendXMLDeclaration(result, toDocument(node));
146 break;
147 case Node::DOCUMENT_FRAGMENT_NODE:
148 break;
149 case Node::DOCUMENT_TYPE_NODE:
150 appendDocumentType(result, toDocumentType(node));
151 break;
152 case Node::PROCESSING_INSTRUCTION_NODE:
153 appendProcessingInstruction(result, toProcessingInstruction(node).target (), toProcessingInstruction(node).data());
154 break;
155 case Node::ELEMENT_NODE:
156 ASSERT_NOT_REACHED();
157 break;
158 case Node::CDATA_SECTION_NODE:
159 appendCDATASection(result, toCDATASection(node).data());
160 break;
161 case Node::ATTRIBUTE_NODE:
162 ASSERT_NOT_REACHED();
163 break;
164 }
165 }
166
135 static bool elementCannotHaveEndTag(const Node& node) 167 static bool elementCannotHaveEndTag(const Node& node)
136 { 168 {
137 if (!node.isHTMLElement()) 169 if (!node.isHTMLElement())
138 return false; 170 return false;
139 171
140 // FIXME: ieForbidsInsertHTML may not be the right function to call here 172 // FIXME: ieForbidsInsertHTML may not be the right function to call here
141 // ieForbidsInsertHTML is used to disallow setting innerHTML/outerHTML 173 // ieForbidsInsertHTML is used to disallow setting innerHTML/outerHTML
142 // or createContextualFragment. It does not necessarily align with 174 // or createContextualFragment. It does not necessarily align with
143 // which elements should be serialized w/o end tags. 175 // which elements should be serialized w/o end tags.
144 return toHTMLElement(node).ieForbidsInsertHTML(); 176 return toHTMLElement(node).ieForbidsInsertHTML();
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } 468 }
437 469
438 bool MarkupFormatter::serializeAsHTMLDocument(const Node& node) const 470 bool MarkupFormatter::serializeAsHTMLDocument(const Node& node) const
439 { 471 {
440 if (m_serializationType == SerializationType::ForcedXML) 472 if (m_serializationType == SerializationType::ForcedXML)
441 return false; 473 return false;
442 return node.document().isHTMLDocument(); 474 return node.document().isHTMLDocument();
443 } 475 }
444 476
445 } 477 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698