OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010. Adam Barth. All rights reserved. | 2 * Copyright (C) 2010. Adam Barth. All rights reserved. |
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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 13 matching lines...) Loading... |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "core/loader/DocumentWriter.h" | 30 #include "core/loader/DocumentWriter.h" |
31 | 31 |
32 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
33 #include "core/dom/ScriptableDocumentParser.h" | 33 #include "core/dom/ScriptableDocumentParser.h" |
34 #include "core/fetch/TextResourceDecoder.h" | 34 #include "core/html/parser/TextResourceDecoder.h" |
35 #include "core/loader/FrameLoader.h" | 35 #include "core/loader/FrameLoader.h" |
36 #include "core/loader/FrameLoaderStateMachine.h" | 36 #include "core/loader/FrameLoaderStateMachine.h" |
37 #include "core/frame/DOMWindow.h" | 37 #include "core/frame/DOMWindow.h" |
38 #include "core/frame/Frame.h" | 38 #include "core/frame/Frame.h" |
39 #include "core/frame/FrameView.h" | 39 #include "core/frame/FrameView.h" |
40 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
41 #include "platform/weborigin/KURL.h" | 41 #include "platform/weborigin/KURL.h" |
42 #include "platform/weborigin/SecurityOrigin.h" | 42 #include "platform/weborigin/SecurityOrigin.h" |
43 #include "wtf/PassOwnPtr.h" | 43 #include "wtf/PassOwnPtr.h" |
44 | 44 |
(...skipping 26 matching lines...) Loading... |
71 { | 71 { |
72 m_document->setCompatibilityMode(Document::NoQuirksMode); | 72 m_document->setCompatibilityMode(Document::NoQuirksMode); |
73 | 73 |
74 // FIXME: This should call DocumentParser::appendBytes instead of append | 74 // FIXME: This should call DocumentParser::appendBytes instead of append |
75 // to support RawDataDocumentParsers. | 75 // to support RawDataDocumentParsers. |
76 if (DocumentParser* parser = m_document->parser()) { | 76 if (DocumentParser* parser = m_document->parser()) { |
77 parser->pinToMainThread(); | 77 parser->pinToMainThread(); |
78 // Because we're pinned to the main thread we don't need to worry about | 78 // Because we're pinned to the main thread we don't need to worry about |
79 // passing ownership of the source string. | 79 // passing ownership of the source string. |
80 parser->append(source.impl()); | 80 parser->append(source.impl()); |
81 parser->setHasAppendedData(); | |
82 } | 81 } |
83 } | 82 } |
84 | 83 |
85 void DocumentWriter::addData(const char* bytes, size_t length) | 84 void DocumentWriter::addData(const char* bytes, size_t length) |
86 { | 85 { |
87 ASSERT(m_parser); | 86 ASSERT(m_parser); |
88 if (m_parser->needsDecoder() && 0 < length) { | 87 if (m_parser->needsDecoder() && 0 < length) { |
89 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume
nt); | 88 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume
nt); |
90 m_parser->setDecoder(decoder.release()); | 89 m_parser->setDecoder(decoder.release()); |
91 } | 90 } |
(...skipping 37 matching lines...) Loading... |
129 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); | 128 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); |
130 } | 129 } |
131 | 130 |
132 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() | 131 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() |
133 { | 132 { |
134 ASSERT(m_parser && !m_parser->isStopped()); | 133 ASSERT(m_parser && !m_parser->isStopped()); |
135 m_parser->setDocumentWasLoadedAsPartOfNavigation(); | 134 m_parser->setDocumentWasLoadedAsPartOfNavigation(); |
136 } | 135 } |
137 | 136 |
138 } // namespace WebCore | 137 } // namespace WebCore |
OLD | NEW |