Chromium Code Reviews| Index: Source/core/loader/DocumentWriter.cpp |
| diff --git a/Source/core/loader/DocumentWriter.cpp b/Source/core/loader/DocumentWriter.cpp |
| index 1134cc8db224889d2621c2375cd52fdc23dc8824..da1f638fa53d504284cf3762be4ff3b727136873 100644 |
| --- a/Source/core/loader/DocumentWriter.cpp |
| +++ b/Source/core/loader/DocumentWriter.cpp |
| @@ -97,8 +97,10 @@ void DocumentWriter::reportDataReceived() |
| void DocumentWriter::addData(const char* bytes, size_t length) |
| { |
| ASSERT(m_parser); |
| - if (!m_decoder && m_parser->needsDecoder() && 0 < length) |
| + if (!m_decoder && m_parser->needsDecoder() && 0 < length) { |
| m_decoder = m_decoderBuilder.buildFor(m_document); |
| + m_parser->setDecoder(m_decoder); |
| + } |
| // appendBytes() can result replacing DocumentLoader::m_writer. |
| RefPtr<DocumentWriter> protectingThis(this); |
| size_t consumedChars = m_parser->appendBytes(bytes, length); |
| @@ -118,8 +120,10 @@ void DocumentWriter::end() |
| if (!m_parser) |
| return; |
| - if (!m_decoder && m_parser->needsDecoder()) |
| + if (!m_decoder && m_parser->needsDecoder()) { |
| m_decoder = m_decoderBuilder.buildFor(m_document); |
|
abarth-chromium
2013/11/14 07:04:33
Do we need to keep the m_decoder member here? The
oystein (OOO til 10th of July)
2013/11/14 19:02:29
Nah might as well move it now :).
|
| + m_parser->setDecoder(m_decoder); |
| + } |
| // flush() can result replacing DocumentLoader::m_writer. |
| RefPtr<DocumentWriter> protectingThis(this); |
| size_t consumedChars = m_parser->flush(); |
| @@ -133,6 +137,11 @@ void DocumentWriter::end() |
| m_document = 0; |
| } |
| +void DocumentWriter::setUserChosenEncoding(const String& charset) |
| +{ |
| + m_decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); |
| +} |
| + |
| void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() |
| { |
| ASSERT(m_parser && !m_parser->isStopped()); |