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

Side by Side Diff: third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp

Issue 2804943002: Avoid duplicate functions/code in core/editing: endTag (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 19 matching lines...) Expand all
30 #include "core/XLinkNames.h" 30 #include "core/XLinkNames.h"
31 #include "core/XMLNSNames.h" 31 #include "core/XMLNSNames.h"
32 #include "core/XMLNames.h" 32 #include "core/XMLNames.h"
33 #include "core/dom/Attr.h" 33 #include "core/dom/Attr.h"
34 #include "core/dom/CDATASection.h" 34 #include "core/dom/CDATASection.h"
35 #include "core/dom/Comment.h" 35 #include "core/dom/Comment.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/dom/DocumentFragment.h" 37 #include "core/dom/DocumentFragment.h"
38 #include "core/dom/DocumentType.h" 38 #include "core/dom/DocumentType.h"
39 #include "core/dom/ProcessingInstruction.h" 39 #include "core/dom/ProcessingInstruction.h"
40 #include "core/editing/EditingUtilities.h"
40 #include "core/editing/Editor.h" 41 #include "core/editing/Editor.h"
41 #include "core/html/HTMLElement.h" 42 #include "core/html/HTMLElement.h"
42 #include "core/html/HTMLTemplateElement.h" 43 #include "core/html/HTMLTemplateElement.h"
43 #include "platform/weborigin/KURL.h" 44 #include "platform/weborigin/KURL.h"
44 #include "wtf/text/CharacterNames.h" 45 #include "wtf/text/CharacterNames.h"
45 46
46 namespace blink { 47 namespace blink {
47 48
48 MarkupAccumulator::MarkupAccumulator(EAbsoluteURLs resolveUrlsMethod, 49 MarkupAccumulator::MarkupAccumulator(EAbsoluteURLs resolveUrlsMethod,
49 SerializationType serializationType) 50 SerializationType serializationType)
(...skipping 27 matching lines...) Expand all
77 // Only XMLSerializer can pass an Attr. So, |documentIsHTML| flag is 78 // Only XMLSerializer can pass an Attr. So, |documentIsHTML| flag is
78 // false. 79 // false.
79 m_formatter.appendAttributeValue(result, toAttr(node).value(), false); 80 m_formatter.appendAttributeValue(result, toAttr(node).value(), false);
80 break; 81 break;
81 default: 82 default:
82 m_formatter.appendStartMarkup(result, node, namespaces); 83 m_formatter.appendStartMarkup(result, node, namespaces);
83 break; 84 break;
84 } 85 }
85 } 86 }
86 87
87 static bool elementCannotHaveEndTag(const Node& node) {
88 if (!node.isHTMLElement())
89 return false;
90
91 return !toHTMLElement(node).shouldSerializeEndTag();
92 }
93
94 void MarkupAccumulator::appendEndMarkup(StringBuilder& result, 88 void MarkupAccumulator::appendEndMarkup(StringBuilder& result,
95 const Element& element) { 89 const Element& element) {
96 m_formatter.appendEndMarkup(result, element); 90 m_formatter.appendEndMarkup(result, element);
97 } 91 }
98 92
99 void MarkupAccumulator::appendCustomAttributes(StringBuilder&, 93 void MarkupAccumulator::appendCustomAttributes(StringBuilder&,
100 const Element&, 94 const Element&,
101 Namespaces*) {} 95 Namespaces*) {}
102 96
103 void MarkupAccumulator::appendText(StringBuilder& result, Text& text) { 97 void MarkupAccumulator::appendText(StringBuilder& result, Text& text) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 serializeNodesWithNamespaces<Strategy>(accumulator, targetNode, childrenOnly, 200 serializeNodesWithNamespaces<Strategy>(accumulator, targetNode, childrenOnly,
207 namespaces); 201 namespaces);
208 return accumulator.toString(); 202 return accumulator.toString();
209 } 203 }
210 204
211 template String serializeNodes<EditingStrategy>(MarkupAccumulator&, 205 template String serializeNodes<EditingStrategy>(MarkupAccumulator&,
212 Node&, 206 Node&,
213 EChildrenOnly); 207 EChildrenOnly);
214 208
215 } // namespace blink 209 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698