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

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

Issue 1157363007: Refactoring: Use enum class for SerializationType (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « no previous file | Source/core/editing/MarkupAccumulator.cpp » ('j') | 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 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // Non-breaking space needs to be escaped in innerHTML for compatibility rea son. See http://trac.webkit.org/changeset/32879 51 // Non-breaking space needs to be escaped in innerHTML for compatibility rea son. See http://trac.webkit.org/changeset/32879
52 // However, we cannot do this in a XML document because it does not have the entity reference defined (See the bug 19215). 52 // However, we cannot do this in a XML document because it does not have the entity reference defined (See the bug 19215).
53 EntityMaskInCDATA = 0, 53 EntityMaskInCDATA = 0,
54 EntityMaskInPCDATA = EntityAmp | EntityLt | EntityGt, 54 EntityMaskInPCDATA = EntityAmp | EntityLt | EntityGt,
55 EntityMaskInHTMLPCDATA = EntityMaskInPCDATA | EntityNbsp, 55 EntityMaskInHTMLPCDATA = EntityMaskInPCDATA | EntityNbsp,
56 EntityMaskInAttributeValue = EntityAmp | EntityQuot | EntityLt | EntityGt, 56 EntityMaskInAttributeValue = EntityAmp | EntityQuot | EntityLt | EntityGt,
57 EntityMaskInHTMLAttributeValue = EntityAmp | EntityQuot | EntityNbsp, 57 EntityMaskInHTMLAttributeValue = EntityAmp | EntityQuot | EntityNbsp,
58 }; 58 };
59 59
60 enum SerializationType { 60 enum class SerializationType {
61 AsOwnerDocument, 61 AsOwnerDocument,
62 ForcedXML 62 ForcedXML
63 }; 63 };
64 64
65 class MarkupAccumulator { 65 class MarkupAccumulator {
66 WTF_MAKE_NONCOPYABLE(MarkupAccumulator); 66 WTF_MAKE_NONCOPYABLE(MarkupAccumulator);
67 STACK_ALLOCATED(); 67 STACK_ALLOCATED();
68 public: 68 public:
69 static void appendComment(StringBuilder&, const String&); 69 static void appendComment(StringBuilder&, const String&);
70 static void appendCharactersReplacingEntities(StringBuilder&, const String&, unsigned, unsigned, EntityMask); 70 static void appendCharactersReplacingEntities(StringBuilder&, const String&, unsigned, unsigned, EntityMask);
71 static size_t totalLength(const Vector<String>&); 71 static size_t totalLength(const Vector<String>&);
72 72
73 MarkupAccumulator(EAbsoluteURLs, SerializationType = AsOwnerDocument); 73 MarkupAccumulator(EAbsoluteURLs, SerializationType = SerializationType::AsOw nerDocument);
74 virtual ~MarkupAccumulator(); 74 virtual ~MarkupAccumulator();
75 75
76 void appendString(const String&); 76 void appendString(const String&);
77 virtual void appendStartTag(Node&, Namespaces* = nullptr); 77 virtual void appendStartTag(Node&, Namespaces* = nullptr);
78 virtual void appendEndTag(const Element&); 78 virtual void appendEndTag(const Element&);
79 void appendStartMarkup(StringBuilder&, Node&, Namespaces*); 79 void appendStartMarkup(StringBuilder&, Node&, Namespaces*);
80 void appendEndMarkup(StringBuilder&, const Element&); 80 void appendEndMarkup(StringBuilder&, const Element&);
81 81
82 size_t length() const { return m_markup.length(); } 82 size_t length() const { return m_markup.length(); }
83 void concatenateMarkup(StringBuilder&) const; 83 void concatenateMarkup(StringBuilder&) const;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 }; 115 };
116 116
117 template<typename Strategy> 117 template<typename Strategy>
118 String serializeNodes(MarkupAccumulator&, Node&, EChildrenOnly); 118 String serializeNodes(MarkupAccumulator&, Node&, EChildrenOnly);
119 119
120 extern template String serializeNodes<EditingStrategy>(MarkupAccumulator&, Node& , EChildrenOnly); 120 extern template String serializeNodes<EditingStrategy>(MarkupAccumulator&, Node& , EChildrenOnly);
121 121
122 } 122 }
123 123
124 #endif 124 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/MarkupAccumulator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698