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 Apple Inc. All rights reserved. | 3 * Copyright (C) 2005, 2006, 2008 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 append(source); | 125 append(source); |
126 } | 126 } |
127 | 127 |
128 void XMLDocumentParser::append(const SegmentedString& s) | 128 void XMLDocumentParser::append(const SegmentedString& s) |
129 { | 129 { |
130 String parseString = s.toString(); | 130 String parseString = s.toString(); |
131 | 131 |
132 if (m_sawXSLTransform || !m_sawFirstElement) | 132 if (m_sawXSLTransform || !m_sawFirstElement) |
133 m_originalSourceForTransform += parseString; | 133 m_originalSourceForTransform += parseString; |
134 | 134 |
135 if (isStopped() || m_sawXSLTransform) | 135 if (isDetached() || m_parserStopped || m_sawXSLTransform) |
136 return; | 136 return; |
137 | 137 |
138 if (m_parserPaused) { | 138 if (m_parserPaused) { |
139 m_pendingSrc.append(s); | 139 m_pendingSrc.append(s); |
140 return; | 140 return; |
141 } | 141 } |
142 | 142 |
143 doWrite(s.toString()); | 143 doWrite(s.toString()); |
144 | 144 |
145 // After parsing, go ahead and dispatch image beforeload events. | 145 // After parsing, go ahead and dispatch image beforeload events. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 #if !USE(QXMLSTREAM) | 183 #if !USE(QXMLSTREAM) |
184 static inline String toString(const xmlChar* str, unsigned len) | 184 static inline String toString(const xmlChar* str, unsigned len) |
185 { | 185 { |
186 return UTF8Encoding().decode(reinterpret_cast<const char*>(str), len); | 186 return UTF8Encoding().decode(reinterpret_cast<const char*>(str), len); |
187 } | 187 } |
188 #endif | 188 #endif |
189 | 189 |
190 | 190 |
191 void XMLDocumentParser::exitText() | 191 void XMLDocumentParser::exitText() |
192 { | 192 { |
193 if (isStopped()) | 193 if (m_parserStopped) |
194 return; | 194 return; |
195 | 195 |
196 if (!m_currentNode || !m_currentNode->isTextNode()) | 196 if (!m_currentNode || !m_currentNode->isTextNode()) |
197 return; | 197 return; |
198 | 198 |
199 #if !USE(QXMLSTREAM) | 199 #if !USE(QXMLSTREAM) |
200 ExceptionCode ec = 0; | 200 ExceptionCode ec = 0; |
201 static_cast<Text*>(m_currentNode)->appendData(toString(m_bufferedText.data()
, m_bufferedText.size()), ec); | 201 static_cast<Text*>(m_currentNode)->appendData(toString(m_bufferedText.data()
, m_bufferedText.size()), ec); |
202 Vector<xmlChar> empty; | 202 Vector<xmlChar> empty; |
203 m_bufferedText.swap(empty); | 203 m_bufferedText.swap(empty); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 394 |
395 RefPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fragment, conte
xtElement, scriptingPermission); | 395 RefPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fragment, conte
xtElement, scriptingPermission); |
396 bool wellFormed = parser->appendFragmentSource(chunk); | 396 bool wellFormed = parser->appendFragmentSource(chunk); |
397 // Do not call finish(). Current finish() and doEnd() implementations touch
the main Document/loader | 397 // Do not call finish(). Current finish() and doEnd() implementations touch
the main Document/loader |
398 // and can cause crashes in the fragment case. | 398 // and can cause crashes in the fragment case. |
399 parser->detach(); // Allows ~DocumentParser to assert it was detached before
destruction. | 399 parser->detach(); // Allows ~DocumentParser to assert it was detached before
destruction. |
400 return wellFormed; // appendFragmentSource()'s wellFormed is more permissive
than wellFormed(). | 400 return wellFormed; // appendFragmentSource()'s wellFormed is more permissive
than wellFormed(). |
401 } | 401 } |
402 | 402 |
403 } // namespace WebCore | 403 } // namespace WebCore |
OLD | NEW |