Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: Source/core/dom/Document.cpp

Issue 129123002: Revert of "Revert of Moved text decoding to the parser thread" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentEncodingData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index ea83cd88ef51657735d3d0877e99d9ebd2f03cd5..3cc7f52701ba06caae8f682afbda9c1b13eeae1f 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -109,7 +109,6 @@
#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"
@@ -141,6 +140,7 @@
#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"
@@ -1111,7 +1111,7 @@ void Document::setCharset(const String& charset)
if (!encoding.isValid())
return;
DocumentEncodingData newEncodingData = m_encodingData;
- newEncodingData.encoding = encoding;
+ newEncodingData.setEncoding(encoding);
setEncodingData(newEncodingData);
}
@@ -2102,15 +2102,6 @@ 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()) {
@@ -4008,18 +3999,28 @@ 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentEncodingData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698