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

Unified Diff: third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp

Issue 2655203002: Merge "Pass more hints to encoding detector." to M57 branch (Closed)
Patch Set: Created 3 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
Index: third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
diff --git a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
index 9d3c5de1b0bce672613430fb3c281c770ea0064b..e4b84334b3246d66ebe79a1f89ac7c8442313951 100644
--- a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
+++ b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
@@ -101,13 +101,15 @@ TextResourceDecoderBuilder::createDecoderInstance(Document* document) {
getEncodingFromDomain(document->url());
if (LocalFrame* frame = document->frame()) {
if (Settings* settings = frame->settings()) {
+ const WTF::TextEncoding hintEncoding =
+ encodingFromDomain.isValid() ? encodingFromDomain
+ : settings->getDefaultTextEncodingName();
// Disable autodetection for XML to honor the default encoding (UTF-8) for
// unlabelled documents.
- return TextResourceDecoder::create(
- m_mimeType,
- encodingFromDomain.isValid() ? encodingFromDomain
- : settings->getDefaultTextEncodingName(),
- !DOMImplementation::isXMLMIMEType(m_mimeType));
+ if (DOMImplementation::isXMLMIMEType(m_mimeType))
+ return TextResourceDecoder::create(m_mimeType, hintEncoding);
+ return TextResourceDecoder::createWithAutoDetection(
+ m_mimeType, hintEncoding, document->url());
}
}

Powered by Google App Engine
This is Rietveld 408576698