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

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

Issue 74513003: Moved text decoding to the parser thread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@parserthread_step25
Patch Set: XSSAuditor fix Created 7 years, 1 month 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
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 4b6d5ba62c7651ad7abb43cfd3dfb3dca681be00..046342062ddca295186d501bbea435aff906d8ed 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1109,7 +1109,7 @@ void Document::setCharset(const String& charset)
if (!encoding.isValid())
return;
DocumentEncodingData newEncodingData = m_encodingData;
- newEncodingData.encoding = encoding;
+ newEncodingData.setEncoding(encoding);
setEncodingData(newEncodingData);
}
@@ -2109,15 +2109,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()) {
@@ -3963,18 +3954,27 @@ 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, IGNORE_EXCEPTION);
}
m_encodingData = newData;
+
+ // FIXME: Should be removed as part of https://code.google.com/p/chromium/issues/detail?id=319643
+ if (m_encodingData.encoding().usesVisualOrdering() != m_visuallyOrdered) {
+ m_visuallyOrdered = !m_visuallyOrdered;
eseidel 2013/11/25 19:57:13 This reads weird to me, but OK.
oystein (OOO til 10th of July) 2013/11/27 00:47:30 Habitual thing, I suppose; I added a new local var
+ // FIXME: How is possible to not have a renderer here?
+ if (renderView())
+ renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrder : LogicalOrder);
+ setNeedsStyleRecalc();
+ }
}
KURL Document::completeURL(const String& url, const KURL& baseURLOverride) const

Powered by Google App Engine
This is Rietveld 408576698