| Index: Source/core/dom/DecodedDataDocumentParser.cpp
|
| diff --git a/Source/core/dom/DecodedDataDocumentParser.cpp b/Source/core/dom/DecodedDataDocumentParser.cpp
|
| index 4ca47018d36f42dcd00f8db27ca8d55c9ae02396..7f3c01f23d888588788284487ead384a0f4ef704 100644
|
| --- a/Source/core/dom/DecodedDataDocumentParser.cpp
|
| +++ b/Source/core/dom/DecodedDataDocumentParser.cpp
|
| @@ -28,13 +28,13 @@
|
|
|
| #include "core/dom/Document.h"
|
| #include "core/dom/DocumentEncodingData.h"
|
| -#include "core/html/parser/TextResourceDecoder.h"
|
| +#include "core/fetch/TextResourceDecoder.h"
|
|
|
| namespace WebCore {
|
|
|
| DecodedDataDocumentParser::DecodedDataDocumentParser(Document* document)
|
| : DocumentParser(document)
|
| - , m_needsDecoder(true)
|
| + , m_hasAppendedData(false)
|
| {
|
| }
|
|
|
| @@ -44,7 +44,6 @@ DecodedDataDocumentParser::~DecodedDataDocumentParser()
|
|
|
| void DecodedDataDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
|
| {
|
| - m_needsDecoder = false;
|
| m_decoder = decoder;
|
| }
|
|
|
| @@ -53,9 +52,9 @@ TextResourceDecoder* DecodedDataDocumentParser::decoder()
|
| return m_decoder.get();
|
| }
|
|
|
| -PassOwnPtr<TextResourceDecoder> DecodedDataDocumentParser::takeDecoder()
|
| +void DecodedDataDocumentParser::setHasAppendedData()
|
| {
|
| - return m_decoder.release();
|
| + m_hasAppendedData = true;
|
| }
|
|
|
| void DecodedDataDocumentParser::appendBytes(const char* data, size_t length)
|
| @@ -92,10 +91,22 @@ void DecodedDataDocumentParser::flush()
|
|
|
| void DecodedDataDocumentParser::updateDocument(String& decodedData)
|
| {
|
| - document()->setEncodingData(DocumentEncodingData(*m_decoder.get()));
|
| + DocumentEncodingData encodingData;
|
| + encodingData.encoding = m_decoder->encoding();
|
| + encodingData.wasDetectedHeuristically = m_decoder->encodingWasDetectedHeuristically();
|
| + encodingData.sawDecodingError = m_decoder->sawError();
|
| + document()->setEncodingData(encodingData);
|
|
|
| - if (!decodedData.isEmpty())
|
| - append(decodedData.releaseImpl());
|
| + if (decodedData.isEmpty())
|
| + return;
|
| +
|
| + append(decodedData.releaseImpl());
|
| + // FIXME: Should be removed as part of https://code.google.com/p/chromium/issues/detail?id=319643
|
| + if (!m_hasAppendedData) {
|
| + m_hasAppendedData = true;
|
| + if (m_decoder->encoding().usesVisualOrdering())
|
| + document()->setVisuallyOrdered();
|
| + }
|
| }
|
|
|
| };
|
|
|