Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reviewed by Eric Seidel.
        Fix the data content of an image with a base64.

        * platform/network/curl/ResourceHandleManager.cpp:
        (WebCore::parseDataUrl): Remove the String and use only the data
        Vector because the data.latin1().data() convert the data content and
        the image test ( https://bugs.webkit.org/attachment.cgi?id=21726 ) is
        not drawn correctly.


Canonical link: https://commits.webkit.org/28357@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Aug 28, 2008
1 parent 5a17ae0 commit be1f555
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 12 additions & 0 deletions WebCore/ChangeLog
@@ -1,3 +1,15 @@
2008-08-27 Mario Bensi <mbensi@pleyo.com>

Reviewed by Eric Seidel.

Fix the data content of an image with a base64.

* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::parseDataUrl): Remove the String and use only the data
Vector because the data.latin1().data() convert the data content and
the image test ( https://bugs.webkit.org/attachment.cgi?id=21726 ) is
not drawn correctly.

2008-08-27 Antti Koivisto <antti@apple.com>

Reviewed by Eric Seidel.
Expand Down
9 changes: 3 additions & 6 deletions WebCore/platform/network/curl/ResourceHandleManager.cpp
Expand Up @@ -460,17 +460,14 @@ static void parseDataUrl(ResourceHandle* handle)

size_t outLength = 0;
char* outData = 0;
Vector<char> out;
if (base64 && !data.isEmpty()) {
// Use the GLib Base64 if available, since WebCore's decoder isn't
// general-purpose and fails on Acid3 test 97 (whitespace).
#ifdef USE_GLIB_BASE64
outData = reinterpret_cast<char*>(g_base64_decode(data.utf8().data(), &outLength));
#else
Vector<char> out;
if (base64Decode(data.latin1().data(), data.length(), out))
data = String(out.data(), out.size());
else
data = String();
base64Decode(data.latin1().data(), data.length(), out);
#endif
}

Expand All @@ -494,7 +491,7 @@ static void parseDataUrl(ResourceHandle* handle)
if (outData)
client->didReceiveData(handle, outData, outLength, 0);
else
client->didReceiveData(handle, data.latin1().data(), data.length(), 0);
client->didReceiveData(handle, out.data(), out.size(), 0);

#ifdef USE_GLIB_BASE64
g_free(outData);
Expand Down

0 comments on commit be1f555

Please sign in to comment.