| Index: Source/core/dom/Document.cpp
 | 
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
 | 
| index c707ba453eb701be02c352b19da2ee3cce0ab4e6..f7c72f860d0e28c7d2acea91ca922f1c39e97454 100644
 | 
| --- a/Source/core/dom/Document.cpp
 | 
| +++ b/Source/core/dom/Document.cpp
 | 
| @@ -109,6 +109,7 @@
 | 
|  #include "core/events/ScopedEventQueue.h"
 | 
|  #include "core/events/ThreadLocalEventNames.h"
 | 
|  #include "core/fetch/ResourceFetcher.h"
 | 
| +#include "core/fetch/TextResourceDecoder.h"
 | 
|  #include "core/frame/ContentSecurityPolicy.h"
 | 
|  #include "core/frame/DOMSecurityPolicy.h"
 | 
|  #include "core/frame/DOMWindow.h"
 | 
| @@ -140,7 +141,6 @@
 | 
|  #include "core/html/parser/HTMLDocumentParser.h"
 | 
|  #include "core/html/parser/HTMLParserIdioms.h"
 | 
|  #include "core/html/parser/NestingLevelIncrementer.h"
 | 
| -#include "core/html/parser/TextResourceDecoder.h"
 | 
|  #include "core/inspector/InspectorCounters.h"
 | 
|  #include "core/inspector/InspectorInstrumentation.h"
 | 
|  #include "core/inspector/ScriptCallStack.h"
 | 
| @@ -1105,7 +1105,7 @@ void Document::setCharset(const String& charset)
 | 
|      if (!encoding.isValid())
 | 
|          return;
 | 
|      DocumentEncodingData newEncodingData = m_encodingData;
 | 
| -    newEncodingData.setEncoding(encoding);
 | 
| +    newEncodingData.encoding = encoding;
 | 
|      setEncodingData(newEncodingData);
 | 
|  }
 | 
|  
 | 
| @@ -2096,6 +2096,15 @@ AXObjectCache* Document::axObjectCache() const
 | 
|      return topDocument->m_axObjectCache.get();
 | 
|  }
 | 
|  
 | 
| +void Document::setVisuallyOrdered()
 | 
| +{
 | 
| +    m_visuallyOrdered = true;
 | 
| +    // FIXME: How is possible to not have a renderer here?
 | 
| +    if (renderView())
 | 
| +        renderView()->style()->setRTLOrdering(VisualOrder);
 | 
| +    setNeedsStyleRecalc();
 | 
| +}
 | 
| +
 | 
|  PassRefPtr<DocumentParser> Document::createParser()
 | 
|  {
 | 
|      if (isHTMLDocument()) {
 | 
| @@ -3984,28 +3993,18 @@ void Document::setEncodingData(const DocumentEncodingData& newData)
 | 
|      // document's title so that the user doesn't see an incorrectly decoded title
 | 
|      // in the title bar.
 | 
|      if (m_titleElement
 | 
| -        && encoding() != newData.encoding()
 | 
| +        && encoding() != newData.encoding
 | 
|          && !m_titleElement->firstElementChild()
 | 
|          && encoding() == Latin1Encoding()
 | 
|          && m_titleElement->textContent().containsOnlyLatin1()) {
 | 
|  
 | 
|          CString originalBytes = m_titleElement->textContent().latin1();
 | 
| -        OwnPtr<TextCodec> codec = newTextCodec(newData.encoding());
 | 
| +        OwnPtr<TextCodec> codec = newTextCodec(newData.encoding);
 | 
|          String correctlyDecodedTitle = codec->decode(originalBytes.data(), originalBytes.length(), true);
 | 
|          m_titleElement->setTextContent(correctlyDecodedTitle);
 | 
|      }
 | 
|  
 | 
|      m_encodingData = newData;
 | 
| -
 | 
| -    // FIXME: Should be removed as part of https://code.google.com/p/chromium/issues/detail?id=319643
 | 
| -    bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering();
 | 
| -    if (shouldUseVisualOrdering != m_visuallyOrdered) {
 | 
| -        m_visuallyOrdered = shouldUseVisualOrdering;
 | 
| -        // FIXME: How is possible to not have a renderer here?
 | 
| -        if (renderView())
 | 
| -            renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrder : LogicalOrder);
 | 
| -        setNeedsStyleRecalc();
 | 
| -    }
 | 
|  }
 | 
|  
 | 
|  KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOverride) const
 | 
| 
 |