OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved. | 3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2008 Holger Hans Peter Freyther | 7 * Copyright (C) 2008 Holger Hans Peter Freyther |
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 if (document->frame()->tree().parent()) | 111 if (document->frame()->tree().parent()) |
112 return false; // This document is not in a top frame | 112 return false; // This document is not in a top frame |
113 | 113 |
114 if (SVGImage::isInSVGImage(document)) | 114 if (SVGImage::isInSVGImage(document)) |
115 return false; | 115 return false; |
116 | 116 |
117 return true; | 117 return true; |
118 } | 118 } |
119 | 119 |
120 class PendingStartElementNSCallback FINAL : public XMLDocumentParser::PendingCal
lback { | 120 class PendingStartElementNSCallback final : public XMLDocumentParser::PendingCal
lback { |
121 public: | 121 public: |
122 PendingStartElementNSCallback(const AtomicString& localName, const AtomicStr
ing& prefix, const AtomicString& uri, | 122 PendingStartElementNSCallback(const AtomicString& localName, const AtomicStr
ing& prefix, const AtomicString& uri, |
123 int namespaceCount, const xmlChar** namespaces, int attributeCount, int
defaultedCount, const xmlChar** attributes) | 123 int namespaceCount, const xmlChar** namespaces, int attributeCount, int
defaultedCount, const xmlChar** attributes) |
124 : m_localName(localName) | 124 : m_localName(localName) |
125 , m_prefix(prefix) | 125 , m_prefix(prefix) |
126 , m_uri(uri) | 126 , m_uri(uri) |
127 , m_namespaceCount(namespaceCount) | 127 , m_namespaceCount(namespaceCount) |
128 , m_attributeCount(attributeCount) | 128 , m_attributeCount(attributeCount) |
129 , m_defaultedCount(defaultedCount) | 129 , m_defaultedCount(defaultedCount) |
130 { | 130 { |
(...skipping 16 matching lines...) Expand all Loading... |
147 { | 147 { |
148 for (int i = 0; i < m_namespaceCount * 2; ++i) | 148 for (int i = 0; i < m_namespaceCount * 2; ++i) |
149 xmlFree(m_namespaces[i]); | 149 xmlFree(m_namespaces[i]); |
150 xmlFree(m_namespaces); | 150 xmlFree(m_namespaces); |
151 for (int i = 0; i < m_attributeCount; ++i) | 151 for (int i = 0; i < m_attributeCount; ++i) |
152 for (int j = 0; j < 4; ++j) | 152 for (int j = 0; j < 4; ++j) |
153 xmlFree(m_attributes[i * 5 + j]); | 153 xmlFree(m_attributes[i * 5 + j]); |
154 xmlFree(m_attributes); | 154 xmlFree(m_attributes); |
155 } | 155 } |
156 | 156 |
157 virtual void call(XMLDocumentParser* parser) OVERRIDE | 157 virtual void call(XMLDocumentParser* parser) override |
158 { | 158 { |
159 parser->startElementNs(m_localName, m_prefix, m_uri, | 159 parser->startElementNs(m_localName, m_prefix, m_uri, |
160 m_namespaceCount, const_cast<const xmlChar**>(m_namespaces), | 160 m_namespaceCount, const_cast<const xmlChar**>(m_namespaces), |
161 m_attributeCount, m_defaultedCount, const_cast<const xmlChar**>(m_at
tributes)); | 161 m_attributeCount, m_defaultedCount, const_cast<const xmlChar**>(m_at
tributes)); |
162 } | 162 } |
163 | 163 |
164 private: | 164 private: |
165 AtomicString m_localName; | 165 AtomicString m_localName; |
166 AtomicString m_prefix; | 166 AtomicString m_prefix; |
167 AtomicString m_uri; | 167 AtomicString m_uri; |
168 int m_namespaceCount; | 168 int m_namespaceCount; |
169 xmlChar** m_namespaces; | 169 xmlChar** m_namespaces; |
170 int m_attributeCount; | 170 int m_attributeCount; |
171 int m_defaultedCount; | 171 int m_defaultedCount; |
172 xmlChar** m_attributes; | 172 xmlChar** m_attributes; |
173 }; | 173 }; |
174 | 174 |
175 class PendingEndElementNSCallback FINAL : public XMLDocumentParser::PendingCallb
ack { | 175 class PendingEndElementNSCallback final : public XMLDocumentParser::PendingCallb
ack { |
176 public: | 176 public: |
177 virtual void call(XMLDocumentParser* parser) OVERRIDE | 177 virtual void call(XMLDocumentParser* parser) override |
178 { | 178 { |
179 parser->endElementNs(); | 179 parser->endElementNs(); |
180 } | 180 } |
181 }; | 181 }; |
182 | 182 |
183 class PendingCharactersCallback FINAL : public XMLDocumentParser::PendingCallbac
k { | 183 class PendingCharactersCallback final : public XMLDocumentParser::PendingCallbac
k { |
184 public: | 184 public: |
185 PendingCharactersCallback(const xmlChar* chars, int length) | 185 PendingCharactersCallback(const xmlChar* chars, int length) |
186 : m_chars(xmlStrndup(chars, length)) | 186 : m_chars(xmlStrndup(chars, length)) |
187 , m_length(length) | 187 , m_length(length) |
188 { | 188 { |
189 } | 189 } |
190 | 190 |
191 virtual ~PendingCharactersCallback() | 191 virtual ~PendingCharactersCallback() |
192 { | 192 { |
193 xmlFree(m_chars); | 193 xmlFree(m_chars); |
194 } | 194 } |
195 | 195 |
196 virtual void call(XMLDocumentParser* parser) OVERRIDE | 196 virtual void call(XMLDocumentParser* parser) override |
197 { | 197 { |
198 parser->characters(m_chars, m_length); | 198 parser->characters(m_chars, m_length); |
199 } | 199 } |
200 | 200 |
201 private: | 201 private: |
202 xmlChar* m_chars; | 202 xmlChar* m_chars; |
203 int m_length; | 203 int m_length; |
204 }; | 204 }; |
205 | 205 |
206 class PendingProcessingInstructionCallback FINAL : public XMLDocumentParser::Pen
dingCallback { | 206 class PendingProcessingInstructionCallback final : public XMLDocumentParser::Pen
dingCallback { |
207 public: | 207 public: |
208 PendingProcessingInstructionCallback(const String& target, const String& dat
a) | 208 PendingProcessingInstructionCallback(const String& target, const String& dat
a) |
209 : m_target(target) | 209 : m_target(target) |
210 , m_data(data) | 210 , m_data(data) |
211 { | 211 { |
212 } | 212 } |
213 | 213 |
214 virtual void call(XMLDocumentParser* parser) OVERRIDE | 214 virtual void call(XMLDocumentParser* parser) override |
215 { | 215 { |
216 parser->processingInstruction(m_target, m_data); | 216 parser->processingInstruction(m_target, m_data); |
217 } | 217 } |
218 | 218 |
219 private: | 219 private: |
220 String m_target; | 220 String m_target; |
221 String m_data; | 221 String m_data; |
222 }; | 222 }; |
223 | 223 |
224 class PendingCDATABlockCallback FINAL : public XMLDocumentParser::PendingCallbac
k { | 224 class PendingCDATABlockCallback final : public XMLDocumentParser::PendingCallbac
k { |
225 public: | 225 public: |
226 explicit PendingCDATABlockCallback(const String& text) : m_text(text) { } | 226 explicit PendingCDATABlockCallback(const String& text) : m_text(text) { } |
227 | 227 |
228 virtual void call(XMLDocumentParser* parser) OVERRIDE | 228 virtual void call(XMLDocumentParser* parser) override |
229 { | 229 { |
230 parser->cdataBlock(m_text); | 230 parser->cdataBlock(m_text); |
231 } | 231 } |
232 | 232 |
233 private: | 233 private: |
234 String m_text; | 234 String m_text; |
235 }; | 235 }; |
236 | 236 |
237 class PendingCommentCallback FINAL : public XMLDocumentParser::PendingCallback { | 237 class PendingCommentCallback final : public XMLDocumentParser::PendingCallback { |
238 public: | 238 public: |
239 explicit PendingCommentCallback(const String& text) : m_text(text) { } | 239 explicit PendingCommentCallback(const String& text) : m_text(text) { } |
240 | 240 |
241 virtual void call(XMLDocumentParser* parser) OVERRIDE | 241 virtual void call(XMLDocumentParser* parser) override |
242 { | 242 { |
243 parser->comment(m_text); | 243 parser->comment(m_text); |
244 } | 244 } |
245 | 245 |
246 private: | 246 private: |
247 String m_text; | 247 String m_text; |
248 }; | 248 }; |
249 | 249 |
250 class PendingInternalSubsetCallback FINAL : public XMLDocumentParser::PendingCal
lback { | 250 class PendingInternalSubsetCallback final : public XMLDocumentParser::PendingCal
lback { |
251 public: | 251 public: |
252 PendingInternalSubsetCallback(const String& name, const String& externalID,
const String& systemID) | 252 PendingInternalSubsetCallback(const String& name, const String& externalID,
const String& systemID) |
253 : m_name(name) | 253 : m_name(name) |
254 , m_externalID(externalID) | 254 , m_externalID(externalID) |
255 , m_systemID(systemID) | 255 , m_systemID(systemID) |
256 { | 256 { |
257 } | 257 } |
258 | 258 |
259 virtual void call(XMLDocumentParser* parser) OVERRIDE | 259 virtual void call(XMLDocumentParser* parser) override |
260 { | 260 { |
261 parser->internalSubset(m_name, m_externalID, m_systemID); | 261 parser->internalSubset(m_name, m_externalID, m_systemID); |
262 } | 262 } |
263 | 263 |
264 private: | 264 private: |
265 String m_name; | 265 String m_name; |
266 String m_externalID; | 266 String m_externalID; |
267 String m_systemID; | 267 String m_systemID; |
268 }; | 268 }; |
269 | 269 |
270 class PendingErrorCallback FINAL : public XMLDocumentParser::PendingCallback { | 270 class PendingErrorCallback final : public XMLDocumentParser::PendingCallback { |
271 public: | 271 public: |
272 PendingErrorCallback(XMLErrors::ErrorType type, const xmlChar* message, Ordi
nalNumber lineNumber, OrdinalNumber columnNumber) | 272 PendingErrorCallback(XMLErrors::ErrorType type, const xmlChar* message, Ordi
nalNumber lineNumber, OrdinalNumber columnNumber) |
273 : m_type(type) | 273 : m_type(type) |
274 , m_message(xmlStrdup(message)) | 274 , m_message(xmlStrdup(message)) |
275 , m_lineNumber(lineNumber) | 275 , m_lineNumber(lineNumber) |
276 , m_columnNumber(columnNumber) | 276 , m_columnNumber(columnNumber) |
277 { | 277 { |
278 } | 278 } |
279 | 279 |
280 virtual ~PendingErrorCallback() | 280 virtual ~PendingErrorCallback() |
281 { | 281 { |
282 xmlFree(m_message); | 282 xmlFree(m_message); |
283 } | 283 } |
284 | 284 |
285 virtual void call(XMLDocumentParser* parser) OVERRIDE | 285 virtual void call(XMLDocumentParser* parser) override |
286 { | 286 { |
287 parser->handleError(m_type, reinterpret_cast<char*>(m_message), TextPosi
tion(m_lineNumber, m_columnNumber)); | 287 parser->handleError(m_type, reinterpret_cast<char*>(m_message), TextPosi
tion(m_lineNumber, m_columnNumber)); |
288 } | 288 } |
289 | 289 |
290 private: | 290 private: |
291 XMLErrors::ErrorType m_type; | 291 XMLErrors::ErrorType m_type; |
292 xmlChar* m_message; | 292 xmlChar* m_message; |
293 OrdinalNumber m_lineNumber; | 293 OrdinalNumber m_lineNumber; |
294 OrdinalNumber m_columnNumber; | 294 OrdinalNumber m_columnNumber; |
295 }; | 295 }; |
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 sax.initialized = XML_SAX2_MAGIC; | 1644 sax.initialized = XML_SAX2_MAGIC; |
1645 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); | 1645 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); |
1646 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1646 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1647 parseChunk(parser->context(), parseString); | 1647 parseChunk(parser->context(), parseString); |
1648 finishParsing(parser->context()); | 1648 finishParsing(parser->context()); |
1649 attrsOK = state.gotAttributes; | 1649 attrsOK = state.gotAttributes; |
1650 return state.attributes; | 1650 return state.attributes; |
1651 } | 1651 } |
1652 | 1652 |
1653 } // namespace blink | 1653 } // namespace blink |
OLD | NEW |