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

Side by Side Diff: third_party/WebKit/WebCore/platform/text/TextEncoding.cpp

Issue 174528: japanese encoding webkit fixes for 3.0 branch (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/WebKit/WebCore/platform/text/TextEncoding.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> 3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 bool TextEncoding::usesVisualOrdering() const 137 bool TextEncoding::usesVisualOrdering() const
138 { 138 {
139 if (noExtendedTextEncodingNameUsed()) 139 if (noExtendedTextEncodingNameUsed())
140 return false; 140 return false;
141 141
142 static const char* const a = atomicCanonicalTextEncodingName("ISO-8859-8"); 142 static const char* const a = atomicCanonicalTextEncodingName("ISO-8859-8");
143 return m_name == a; 143 return m_name == a;
144 } 144 }
145 145
146 #if !PLATFORM(CHROMIUM)
146 bool TextEncoding::isJapanese() const 147 bool TextEncoding::isJapanese() const
147 { 148 {
148 if (noExtendedTextEncodingNameUsed()) 149 if (noExtendedTextEncodingNameUsed())
149 return false; 150 return false;
150 151
151 DEFINE_STATIC_LOCAL(HashSet<const char*>, set, ()); 152 DEFINE_STATIC_LOCAL(HashSet<const char*>, set, ());
152 if (set.isEmpty()) { 153 if (set.isEmpty()) {
153 addEncodingName(set, "x-mac-japanese"); 154 addEncodingName(set, "x-mac-japanese");
154 addEncodingName(set, "cp932"); 155 addEncodingName(set, "cp932");
155 addEncodingName(set, "JIS_X0201"); 156 addEncodingName(set, "JIS_X0201");
156 addEncodingName(set, "JIS_X0208-1983"); 157 addEncodingName(set, "JIS_X0208-1983");
157 addEncodingName(set, "JIS_X0208-1990"); 158 addEncodingName(set, "JIS_X0208-1990");
158 addEncodingName(set, "JIS_X0212-1990"); 159 addEncodingName(set, "JIS_X0212-1990");
159 addEncodingName(set, "JIS_C6226-1978"); 160 addEncodingName(set, "JIS_C6226-1978");
160 addEncodingName(set, "Shift_JIS_X0213-2000"); 161 addEncodingName(set, "Shift_JIS_X0213-2000");
161 addEncodingName(set, "ISO-2022-JP"); 162 addEncodingName(set, "ISO-2022-JP");
162 addEncodingName(set, "ISO-2022-JP-2"); 163 addEncodingName(set, "ISO-2022-JP-2");
163 addEncodingName(set, "ISO-2022-JP-1"); 164 addEncodingName(set, "ISO-2022-JP-1");
164 addEncodingName(set, "ISO-2022-JP-3"); 165 addEncodingName(set, "ISO-2022-JP-3");
165 addEncodingName(set, "EUC-JP"); 166 addEncodingName(set, "EUC-JP");
166 addEncodingName(set, "Shift_JIS"); 167 addEncodingName(set, "Shift_JIS");
167 } 168 }
168 return m_name && set.contains(m_name); 169 return m_name && set.contains(m_name);
169 } 170 }
171 #endif
170 172
171 UChar TextEncoding::backslashAsCurrencySymbol() const 173 UChar TextEncoding::backslashAsCurrencySymbol() const
172 { 174 {
175 #if PLATFORM(CHROMIUM)
176 // Chromium does not want this. The blog article cited is not
177 // a justification for replacing U+005C with U+00A5.
178 return '\\';
179 #else
173 if (noExtendedTextEncodingNameUsed()) 180 if (noExtendedTextEncodingNameUsed())
174 return '\\'; 181 return '\\';
175 182
176 // The text encodings below treat backslash as a currency symbol. 183 // The text encodings below treat backslash as a currency symbol.
177 // See http://blogs.msdn.com/michkap/archive/2005/09/17/469941.aspx for more information. 184 // See http://blogs.msdn.com/michkap/archive/2005/09/17/469941.aspx for more information.
178 static const char* const a = atomicCanonicalTextEncodingName("Shift_JIS_X021 3-2000"); 185 static const char* const a = atomicCanonicalTextEncodingName("Shift_JIS_X021 3-2000");
179 static const char* const b = atomicCanonicalTextEncodingName("EUC-JP"); 186 static const char* const b = atomicCanonicalTextEncodingName("EUC-JP");
180 return (m_name == a || m_name == b) ? 0x00A5 : '\\'; 187 return (m_name == a || m_name == b) ? 0x00A5 : '\\';
188 #endif
181 } 189 }
182 190
183 bool TextEncoding::isNonByteBasedEncoding() const 191 bool TextEncoding::isNonByteBasedEncoding() const
184 { 192 {
185 if (noExtendedTextEncodingNameUsed()) { 193 if (noExtendedTextEncodingNameUsed()) {
186 return *this == UTF16LittleEndianEncoding() 194 return *this == UTF16LittleEndianEncoding()
187 || *this == UTF16BigEndianEncoding(); 195 || *this == UTF16BigEndianEncoding();
188 } 196 }
189 197
190 return *this == UTF16LittleEndianEncoding() 198 return *this == UTF16LittleEndianEncoding()
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return globalUTF8Encoding; 270 return globalUTF8Encoding;
263 } 271 }
264 272
265 const TextEncoding& WindowsLatin1Encoding() 273 const TextEncoding& WindowsLatin1Encoding()
266 { 274 {
267 static TextEncoding globalWindowsLatin1Encoding("WinLatin-1"); 275 static TextEncoding globalWindowsLatin1Encoding("WinLatin-1");
268 return globalWindowsLatin1Encoding; 276 return globalWindowsLatin1Encoding;
269 } 277 }
270 278
271 } // namespace WebCore 279 } // namespace WebCore
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/platform/text/TextEncoding.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698