OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |