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

Unified Diff: third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h

Issue 1890103002: Reland "UTF-8 detector for pages missing encoding info" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/html/parser/TextResourceDecoder.h
diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
index 82411a707fd1ef085cb910d83d2ef7371f2fdc80..bdfa0d6b32791882175023408b1ff109e3246bbf 100644
--- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
+++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
@@ -79,16 +79,18 @@ public:
private:
- // TextResourceDecoder does three kind of encoding detection:
+ // TextResourceDecoder does four kinds of encoding detection:
// 1. By BOM,
// 2. By Content if |m_contentType| is not |PlainTextContext|
- // (e.g. <meta> tag for HTML), and
- // 3. By detectTextEncoding().
+ // (e.g. <meta> tag for HTML),
+ // 3. By isUTF8Encoded() to detect if the document
+ // is of UTF-8, and
+ // 4. By detectTextEncodingUniversal().
enum EncodingDetectionOption {
- // Use 1. + 2. + 3.
+ // Use 1. + 2. + 4.
UseAllAutoDetection,
- // Use 1. + 2.
+ // Use 1. + 2. + 3.
UseContentAndBOMBasedDetection,
// Use None of them.
@@ -108,7 +110,8 @@ private:
bool checkForCSSCharset(const char*, size_t, bool& movedDataToBuffer);
bool checkForXMLCharset(const char*, size_t, bool& movedDataToBuffer);
void checkForMetaCharset(const char*, size_t);
- bool shouldAutoDetect() const;
+ void detectTextEncoding(const char*, size_t);
+ bool shouldDetectEncoding() const;
ContentType m_contentType;
WTF::TextEncoding m_encoding;
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698