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

Side by Side Diff: Source/wtf/text/TextEncoding.cpp

Issue 335803002: Remove unused text encoding quirks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « Source/wtf/text/TextEncoding.h ('k') | Source/wtf/text/TextEncodingRegistry.h » ('j') | 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 * Copyright (C) 2007-2009 Torch Mobile, Inc. 4 * Copyright (C) 2007-2009 Torch Mobile, Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 27 matching lines...) Expand all
38 namespace WTF { 38 namespace WTF {
39 39
40 static const TextEncoding& UTF7Encoding() 40 static const TextEncoding& UTF7Encoding()
41 { 41 {
42 static TextEncoding globalUTF7Encoding("UTF-7"); 42 static TextEncoding globalUTF7Encoding("UTF-7");
43 return globalUTF7Encoding; 43 return globalUTF7Encoding;
44 } 44 }
45 45
46 TextEncoding::TextEncoding(const char* name) 46 TextEncoding::TextEncoding(const char* name)
47 : m_name(atomicCanonicalTextEncodingName(name)) 47 : m_name(atomicCanonicalTextEncodingName(name))
48 , m_backslashAsCurrencySymbol(backslashAsCurrencySymbol())
49 { 48 {
50 // Aliases are valid, but not "replacement" itself. 49 // Aliases are valid, but not "replacement" itself.
51 if (m_name && isReplacementEncoding(name)) 50 if (m_name && isReplacementEncoding(name))
52 m_name = 0; 51 m_name = 0;
53 } 52 }
54 53
55 TextEncoding::TextEncoding(const String& name) 54 TextEncoding::TextEncoding(const String& name)
56 : m_name(atomicCanonicalTextEncodingName(name)) 55 : m_name(atomicCanonicalTextEncodingName(name))
57 , m_backslashAsCurrencySymbol(backslashAsCurrencySymbol())
58 { 56 {
59 // Aliases are valid, but not "replacement" itself. 57 // Aliases are valid, but not "replacement" itself.
60 if (m_name && isReplacementEncoding(name)) 58 if (m_name && isReplacementEncoding(name))
61 m_name = 0; 59 m_name = 0;
62 } 60 }
63 61
64 String TextEncoding::decode(const char* data, size_t length, bool stopOnError, b ool& sawError) const 62 String TextEncoding::decode(const char* data, size_t length, bool stopOnError, b ool& sawError) const
65 { 63 {
66 if (!m_name) 64 if (!m_name)
67 return String(); 65 return String();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 125
128 bool TextEncoding::usesVisualOrdering() const 126 bool TextEncoding::usesVisualOrdering() const
129 { 127 {
130 if (noExtendedTextEncodingNameUsed()) 128 if (noExtendedTextEncodingNameUsed())
131 return false; 129 return false;
132 130
133 static const char* const a = atomicCanonicalTextEncodingName("ISO-8859-8"); 131 static const char* const a = atomicCanonicalTextEncodingName("ISO-8859-8");
134 return m_name == a; 132 return m_name == a;
135 } 133 }
136 134
137 UChar TextEncoding::backslashAsCurrencySymbol() const
138 {
139 return shouldShowBackslashAsCurrencySymbolIn(m_name) ? 0x00A5 : '\\';
140 }
141
142 bool TextEncoding::isNonByteBasedEncoding() const 135 bool TextEncoding::isNonByteBasedEncoding() const
143 { 136 {
144 if (noExtendedTextEncodingNameUsed()) { 137 if (noExtendedTextEncodingNameUsed()) {
145 return *this == UTF16LittleEndianEncoding() 138 return *this == UTF16LittleEndianEncoding()
146 || *this == UTF16BigEndianEncoding(); 139 || *this == UTF16BigEndianEncoding();
147 } 140 }
148 141
149 return *this == UTF16LittleEndianEncoding() 142 return *this == UTF16LittleEndianEncoding()
150 || *this == UTF16BigEndianEncoding() 143 || *this == UTF16BigEndianEncoding()
151 || *this == UTF32BigEndianEncoding() 144 || *this == UTF32BigEndianEncoding()
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return globalUTF8Encoding; 215 return globalUTF8Encoding;
223 } 216 }
224 217
225 const TextEncoding& WindowsLatin1Encoding() 218 const TextEncoding& WindowsLatin1Encoding()
226 { 219 {
227 static TextEncoding globalWindowsLatin1Encoding("WinLatin1"); 220 static TextEncoding globalWindowsLatin1Encoding("WinLatin1");
228 return globalWindowsLatin1Encoding; 221 return globalWindowsLatin1Encoding;
229 } 222 }
230 223
231 } // namespace WTF 224 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/wtf/text/TextEncoding.h ('k') | Source/wtf/text/TextEncodingRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698