summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-06 01:22:42 +0000
committerjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-06 01:22:42 +0000
commitdd09918ff5055fc3343000f5c672b0a853ee8c0c (patch)
treefa0b4074be2043176be8283cd8181978c88a588f /webkit
parentf7675a4414d958ed39532f7e60efc6f1a1b70c93 (diff)
downloadchromium_src-dd09918ff5055fc3343000f5c672b0a853ee8c0c.zip
chromium_src-dd09918ff5055fc3343000f5c672b0a853ee8c0c.tar.gz
chromium_src-dd09918ff5055fc3343000f5c672b0a853ee8c0c.tar.bz2
Change init() in GKURL to use the default UTF-8 converter when an encoding is one of Unicode encodings (UTF-8,7,16,32). HTML5 stipulates that it should use UTF-8 for UTF-16, which is extended in this change list to include UTF-32 and UTF-7 (Firefox made that change a long time ago).
The corresponding webkit bug is http://bugs.webkit.org/show_bug.cgi?id=21635 (the patch was landed in r38755 in the webkit trunk and picked up in r6182 in our copy of Webkit). The layout tests for this was landed in the webkit in r38988 : http://bugs.webkit.org/show_bug.cgi?id=22492 ) and will be picked up in the next webkit merge. bug=3433 TEST=pass the layout tests http/tests/misc/{url,submit-get,submit-post}-in-utf{7,32be,32le,16le,16be}.html (not yet in our tree) Review URL: http://codereview.chromium.org/13186 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6481 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/port/platform/GKURL.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/webkit/port/platform/GKURL.cpp b/webkit/port/platform/GKURL.cpp
index 9a81aff..281f513 100644
--- a/webkit/port/platform/GKURL.cpp
+++ b/webkit/port/platform/GKURL.cpp
@@ -86,10 +86,15 @@ inline void AssertProtocolIsGood(const char* protocol)
// string if the input string is NULL. This will always ensure we have a non-
// NULL character pointer since ReplaceComponents has special meaning for NULL.
inline const url_parse::UTF16Char* CharactersOrEmpty(const String& str) {
- static const url_parse::UTF16Char zero = 0;
- return str.characters() ?
- reinterpret_cast<const url_parse::UTF16Char*>(str.characters()) :
- &zero;
+ static const url_parse::UTF16Char zero = 0;
+ return str.characters() ?
+ reinterpret_cast<const url_parse::UTF16Char*>(str.characters()) :
+ &zero;
+}
+
+inline bool IsUnicodeEncoding(const TextEncoding* encoding)
+{
+ return encoding->encodingForFormSubmission() == UTF8Encoding();
}
} // namespace
@@ -254,16 +259,17 @@ void KURL::init(const KURL& base,
void KURL::init(const KURL& base, const char* rel, int rel_len,
const TextEncoding* query_encoding)
{
- // As a performance optimization, we only use the charset converter if the
- // encoding is not UTF-8. The URL canonicalizer will be more efficient with
- // no charset converter object because it can do UTF-8 internally with no
- // extra copies.
- //
+ // As a performance optimization, we do not use the charset converter if
+ // encoding is UTF-8 or other Unicode encodings. Note that this is
+ // per HTML5 2.5.3 (resolving URL). The URL canonicalizer will be
+ // more efficient with no charset converter object because it
+ // can do UTF-8 internally with no extra copies.
+
// We feel free to make the charset converter object every time since it's
// just a wrapper around a reference.
WebCoreCharsetConverter charset_converter_object(query_encoding);
WebCoreCharsetConverter* charset_converter =
- (!query_encoding || *query_encoding == UTF8Encoding()) ? 0 :
+ (!query_encoding || IsUnicodeEncoding(query_encoding)) ? 0 :
&charset_converter_object;
url_canon::RawCanonOutputT<char> output;
@@ -299,7 +305,7 @@ void KURL::init(const KURL& base, const UChar* rel, int rel_len,
{
WebCoreCharsetConverter charset_converter_object(query_encoding);
WebCoreCharsetConverter* charset_converter =
- (!query_encoding || *query_encoding == UTF8Encoding()) ? 0 :
+ (!query_encoding || IsUnicodeEncoding(query_encoding)) ? 0 :
&charset_converter_object;
url_canon::RawCanonOutputT<char> output;