Add support for query encoding to WTFURL
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 21:32:45 +0000 (21:32 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 21:32:45 +0000 (21:32 +0000)
commit0466d97ad6f984f5d62f2315da81a52f5dc7d5ba
tree2fbae11e659b8453862e06ec64e0efb77036b039
parent0dfd2f945776a080e63dfa1fda3d0f51c7d2a94f
Add support for query encoding to WTFURL
https://bugs.webkit.org/show_bug.cgi?id=97422

Reviewed by Adam Barth.

Source/WebCore:

Add the Charset conversion on WebCore side.

* platform/KURLWTFURL.cpp:
(WebCore::KURL::KURL):
(CharsetConverter):
(WebCore::CharsetConverter::CharsetConverter):
* platform/mac/KURLMac.mm:
(WebCore::KURL::KURL):

Source/WTF:

Expose character conversion through the new abstract class URLQueryCharsetConverter.
URLQueryCharsetConverter is implemented by WebCore to expose the TextEncoding classes.

Unfortunatelly that forces us to bring over URLBuffer in the public API. We may be able
to mitigate that later when moving WTFURL to more templates.

The change fixes 2 of the URL layout tests.

* WTF.xcodeproj/project.pbxproj:
* wtf/url/api/ParsedURL.cpp:
(WTF::ParsedURL::ParsedURL):
* wtf/url/api/ParsedURL.h:
(ParsedURL):
ParsedURL was using the same constructor for ParsedURLString, and URL without a base.
That was a mistake on my part, I did not intend that, fixed it now :)

* wtf/url/api/URLBuffer.h: Renamed from Source/WTF/wtf/url/src/URLBuffer.h.
(URLBuffer):
(WTF::URLBuffer::URLBuffer):
(WTF::URLBuffer::~URLBuffer):
(WTF::URLBuffer::at):
(WTF::URLBuffer::set):
(WTF::URLBuffer::capacity):
(WTF::URLBuffer::length):
(WTF::URLBuffer::data):
(WTF::URLBuffer::setLength):
(WTF::URLBuffer::append):
(WTF::URLBuffer::grow):
* wtf/url/api/URLQueryCharsetConverter.h: Added.
(URLQueryCharsetConverter):
(WTF::URLQueryCharsetConverter::URLQueryCharsetConverter):
(WTF::URLQueryCharsetConverter::~URLQueryCharsetConverter):
* wtf/url/src/URLCanon.h:
(URLCanonicalizer):
* wtf/url/src/URLCanonFilesystemurl.cpp:
(WTF::URLCanonicalizer::canonicalizeFileSystemURL):
(WTF::URLCanonicalizer::ReplaceFileSystemURL):
* wtf/url/src/URLCanonFileurl.cpp:
(WTF::URLCanonicalizer::CanonicalizeFileURL):
(WTF::URLCanonicalizer::ReplaceFileURL):
* wtf/url/src/URLCanonInternal.h:
(URLCanonicalizer):
* wtf/url/src/URLCanonQuery.cpp:
(WTF::URLCanonicalizer::CanonicalizeQuery):
(WTF::URLCanonicalizer::ConvertUTF16ToQueryEncoding):
* wtf/url/src/URLCanonRelative.cpp:
(WTF::URLCanonicalizer::resolveRelativeURL):
* wtf/url/src/URLCanonStdURL.cpp:
(WTF::URLCanonicalizer::CanonicalizeStandardURL):
(WTF::URLCanonicalizer::ReplaceStandardURL):
* wtf/url/src/URLUtil.cpp:
(URLUtilities):
(WTF::URLUtilities::canonicalize):
(WTF::URLUtilities::resolveRelative):
(WTF::URLUtilities::ReplaceComponents):
* wtf/url/src/URLUtil.h:
(URLUtilities):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129413 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/url/api/ParsedURL.cpp
Source/WTF/wtf/url/api/ParsedURL.h
Source/WTF/wtf/url/api/URLBuffer.h [moved from Source/WTF/wtf/url/src/URLBuffer.h with 100% similarity]
Source/WTF/wtf/url/api/URLQueryCharsetConverter.h [new file with mode: 0644]
Source/WTF/wtf/url/src/URLCanon.h
Source/WTF/wtf/url/src/URLCanonFilesystemurl.cpp
Source/WTF/wtf/url/src/URLCanonFileurl.cpp
Source/WTF/wtf/url/src/URLCanonInternal.h
Source/WTF/wtf/url/src/URLCanonQuery.cpp
Source/WTF/wtf/url/src/URLCanonRelative.cpp
Source/WTF/wtf/url/src/URLCanonStdURL.cpp
Source/WTF/wtf/url/src/URLUtil.cpp
Source/WTF/wtf/url/src/URLUtil.h
Source/WebCore/ChangeLog
Source/WebCore/platform/KURLWTFURL.cpp
Source/WebCore/platform/mac/KURLMac.mm