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

Unified Diff: third_party/WebKit/Source/wtf/text/TextEncoding.cpp

Issue 1424303002: Remove unused support for NFC normalization during text encoding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nfc-remove
Patch Set: Created 5 years, 2 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 | « third_party/WebKit/Source/wtf/text/TextEncoding.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/text/TextEncoding.cpp
diff --git a/third_party/WebKit/Source/wtf/text/TextEncoding.cpp b/third_party/WebKit/Source/wtf/text/TextEncoding.cpp
index fca629cc923b117d65e5e539ff9dc362b6562a8c..3b0563887861bc7145b7422c056fe2fc2fca2e15 100644
--- a/third_party/WebKit/Source/wtf/text/TextEncoding.cpp
+++ b/third_party/WebKit/Source/wtf/text/TextEncoding.cpp
@@ -34,7 +34,6 @@
#include "wtf/text/CString.h"
#include "wtf/text/TextEncodingRegistry.h"
#include "wtf/text/WTFString.h"
-#include <unicode/unorm.h>
namespace WTF {
@@ -85,45 +84,6 @@ CString TextEncoding::encode(const String& string, UnencodableHandling handling)
return encodedString;
}
-CString TextEncoding::normalizeAndEncode(const String& string, UnencodableHandling handling) const
-{
- if (!m_name)
- return CString();
-
- if (string.isEmpty())
- return "";
-
- // Text exclusively containing Latin-1 characters (U+0000..U+00FF) is left
- // unaffected by NFC. This is effectively the same as saying that all
- // Latin-1 text is already normalized to NFC.
- // Source: http://unicode.org/reports/tr15/
- if (string.is8Bit())
- return newTextCodec(*this)->encode(string.characters8(), string.length(), handling);
-
- const UChar* source = string.characters16();
- size_t length = string.length();
-
- Vector<UChar> normalizedCharacters;
-
- UErrorCode err = U_ZERO_ERROR;
- if (unorm_quickCheck(source, length, UNORM_NFC, &err) != UNORM_YES) {
- // First try using the length of the original string, since normalization to NFC rarely increases length.
- normalizedCharacters.grow(length);
- int32_t normalizedLength = unorm_normalize(source, length, UNORM_NFC, 0, normalizedCharacters.data(), length, &err);
- if (err == U_BUFFER_OVERFLOW_ERROR) {
- err = U_ZERO_ERROR;
- normalizedCharacters.resize(normalizedLength);
- normalizedLength = unorm_normalize(source, length, UNORM_NFC, 0, normalizedCharacters.data(), normalizedLength, &err);
- }
- ASSERT(U_SUCCESS(err));
-
- source = normalizedCharacters.data();
- length = normalizedLength;
- }
-
- return newTextCodec(*this)->encode(source, length, handling);
-}
-
bool TextEncoding::usesVisualOrdering() const
{
if (noExtendedTextEncodingNameUsed())
« no previous file with comments | « third_party/WebKit/Source/wtf/text/TextEncoding.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698