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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 EntityMaskInHTMLAttributeValue = EntityAmp | EntityQuot | EntityNbsp, | 57 EntityMaskInHTMLAttributeValue = EntityAmp | EntityQuot | EntityNbsp, |
58 }; | 58 }; |
59 | 59 |
60 class MarkupAccumulator { | 60 class MarkupAccumulator { |
61 WTF_MAKE_NONCOPYABLE(MarkupAccumulator); | 61 WTF_MAKE_NONCOPYABLE(MarkupAccumulator); |
62 | 62 |
63 public: | 63 public: |
64 MarkupAccumulator(Vector<Node*>*, EAbsoluteURLs, const Range* = 0); | 64 MarkupAccumulator(Vector<Node*>*, EAbsoluteURLs, const Range* = 0); |
65 virtual ~MarkupAccumulator(); | 65 virtual ~MarkupAccumulator(); |
66 | 66 |
67 String serializeNodes(Node* targetNode, EChildrenOnly, Vector<QualifiedName>
* tagNamesToSkip = 0); | 67 String serializeNodes(Node& targetNode, EChildrenOnly, Vector<QualifiedName>
* tagNamesToSkip = 0); |
68 | 68 |
69 static void appendComment(StringBuilder&, const String&); | 69 static void appendComment(StringBuilder&, const String&); |
70 | 70 |
71 static void appendCharactersReplacingEntities(StringBuilder&, const String&,
unsigned, unsigned, EntityMask); | 71 static void appendCharactersReplacingEntities(StringBuilder&, const String&,
unsigned, unsigned, EntityMask); |
72 | 72 |
73 protected: | 73 protected: |
74 void appendString(const String&); | 74 void appendString(const String&); |
75 void appendStartTag(Node*, Namespaces* = 0); | 75 void appendStartTag(Node&, Namespaces* = 0); |
76 virtual void appendEndTag(Node*); | 76 virtual void appendEndTag(const Node&); |
77 static size_t totalLength(const Vector<String>&); | 77 static size_t totalLength(const Vector<String>&); |
78 size_t length() const { return m_markup.length(); } | 78 size_t length() const { return m_markup.length(); } |
79 void concatenateMarkup(StringBuilder&); | 79 void concatenateMarkup(StringBuilder&); |
80 void appendAttributeValue(StringBuilder&, const String&, bool); | 80 void appendAttributeValue(StringBuilder&, const String&, bool); |
81 virtual void appendCustomAttributes(StringBuilder&, Element*, Namespaces*); | 81 virtual void appendCustomAttributes(StringBuilder&, const Element&, Namespac
es*); |
82 bool shouldAddNamespaceElement(const Element*); | 82 bool shouldAddNamespaceElement(const Element&); |
83 bool shouldAddNamespaceAttribute(const Attribute&, Namespaces&); | 83 bool shouldAddNamespaceAttribute(const Attribute&, Namespaces&); |
84 void appendNamespace(StringBuilder&, const AtomicString& prefix, const Atomi
cString& namespaceURI, Namespaces&); | 84 void appendNamespace(StringBuilder&, const AtomicString& prefix, const Atomi
cString& namespaceURI, Namespaces&); |
85 EntityMask entityMaskForText(Text*) const; | 85 EntityMask entityMaskForText(const Text&) const; |
86 virtual void appendText(StringBuilder&, Text*); | 86 virtual void appendText(StringBuilder&, Text&); |
87 void appendXMLDeclaration(StringBuilder&, const Document*); | 87 void appendXMLDeclaration(StringBuilder&, const Document&); |
88 void appendDocumentType(StringBuilder&, const DocumentType*); | 88 void appendDocumentType(StringBuilder&, const DocumentType&); |
89 void appendProcessingInstruction(StringBuilder&, const String& target, const
String& data); | 89 void appendProcessingInstruction(StringBuilder&, const String& target, const
String& data); |
90 virtual void appendElement(StringBuilder&, Element*, Namespaces*); | 90 virtual void appendElement(StringBuilder&, Element&, Namespaces*); |
91 void appendOpenTag(StringBuilder&, Element*, Namespaces*); | 91 void appendOpenTag(StringBuilder&, const Element&, Namespaces*); |
92 void appendCloseTag(StringBuilder&, Element*); | 92 void appendCloseTag(StringBuilder&, const Element&); |
93 void appendAttribute(StringBuilder&, Element*, const Attribute&, Namespaces*
); | 93 void appendAttribute(StringBuilder&, const Element&, const Attribute&, Names
paces*); |
94 void appendCDATASection(StringBuilder&, const String&); | 94 void appendCDATASection(StringBuilder&, const String&); |
95 void appendStartMarkup(StringBuilder&, const Node*, Namespaces*); | 95 void appendStartMarkup(StringBuilder&, Node&, Namespaces*); |
96 bool shouldSelfClose(const Node*); | 96 bool shouldSelfClose(const Node&); |
97 bool elementCannotHaveEndTag(const Node*); | 97 bool elementCannotHaveEndTag(const Node&); |
98 void appendEndMarkup(StringBuilder&, const Node*); | 98 void appendEndMarkup(StringBuilder&, const Node&); |
99 | 99 |
100 Vector<Node*>* const m_nodes; | 100 Vector<Node*>* const m_nodes; |
101 const Range* const m_range; | 101 const Range* const m_range; |
102 | 102 |
103 private: | 103 private: |
104 String resolveURLIfNeeded(const Element*, const String&) const; | 104 String resolveURLIfNeeded(const Element&, const String&) const; |
105 void appendQuotedURLAttributeValue(StringBuilder&, const Element*, const Att
ribute&); | 105 void appendQuotedURLAttributeValue(StringBuilder&, const Element&, const Att
ribute&); |
106 void serializeNodesWithNamespaces(Node* targetNode, EChildrenOnly, const Nam
espaces*, Vector<QualifiedName>* tagNamesToSkip); | 106 void serializeNodesWithNamespaces(Node& targetNode, EChildrenOnly, const Nam
espaces*, Vector<QualifiedName>* tagNamesToSkip); |
107 | 107 |
108 StringBuilder m_markup; | 108 StringBuilder m_markup; |
109 const EAbsoluteURLs m_resolveURLsMethod; | 109 const EAbsoluteURLs m_resolveURLsMethod; |
110 }; | 110 }; |
111 | 111 |
112 } | 112 } |
113 | 113 |
114 #endif | 114 #endif |
OLD | NEW |