summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-01 10:36:58 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-01 10:36:58 +0200
commitb1e9e47fa11f608ae16bc07f97a2acf95bf80272 (patch)
treec88c45e80c9c44506e7cdf9a3bb39ebf82a8cd5b /Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
parentbe01689f43cf6882cf670d33df49ead1f570c53a (diff)
downloadqtwebkit-b1e9e47fa11f608ae16bc07f97a2acf95bf80272.tar.gz
Imported WebKit commit 499c84c99aa98e9870fa7eaa57db476c6d160d46 (http://svn.webkit.org/repository/webkit/trunk@119200)
Weekly update :). Particularly relevant changes for Qt are the use of the WebCore image decoders and direct usage of libpng/libjpeg if available in the system.
Diffstat (limited to 'Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp')
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp51
1 files changed, 20 insertions, 31 deletions
diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
index c769c8b03..5132c7939 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
@@ -62,13 +62,29 @@ QtWebIconDatabaseClient::~QtWebIconDatabaseClient()
WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), 0);
}
-void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo)
+void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo)
{
- QUrl qUrl = WKURLCopyQUrl(pageURL);
- toQtWebIconDatabaseClient(clientInfo)->requestIconForPageURL(qUrl);
+ emit toQtWebIconDatabaseClient(clientInfo)->iconChangedForPageURL(toImpl(pageURL)->string());
}
-QImage QtWebIconDatabaseClient::iconImageForPageURL(const String& pageURL, const QSize& iconSize)
+WTF::String QtWebIconDatabaseClient::iconForPageURL(const WTF::String& pageURL)
+{
+ String iconURL;
+ m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL);
+
+ if (iconURL.isEmpty())
+ return String();
+
+ // Verify that the image data is actually available before reporting back
+ // a url, since clients assume that the url can be used directly.
+ WebCore::Image* iconImage = m_iconDatabase->imageForPageURL(pageURL);
+ if (!iconImage || iconImage->isNull())
+ return String();
+
+ return iconURL;
+}
+
+QImage QtWebIconDatabaseClient::iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize)
{
MutexLocker locker(m_imageLock);
@@ -84,33 +100,6 @@ QImage QtWebIconDatabaseClient::iconImageForPageURL(const String& pageURL, const
return nativeImage->toImage();
}
-unsigned QtWebIconDatabaseClient::iconURLHashForPageURL(const String& pageURL)
-{
- String iconURL;
- m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL);
- return StringHash::hash(iconURL);
-}
-
-void QtWebIconDatabaseClient::requestIconForPageURL(const QUrl& pageURL)
-{
- String pageURLString = WebCore::KURL(pageURL).string();
- if (iconImageForPageURL(pageURLString).isNull())
- return;
-
- unsigned iconID = iconURLHashForPageURL(pageURLString);
- QUrl url;
- url.setScheme(QStringLiteral("image"));
- url.setHost(QStringLiteral("webicon"));
- QString path;
- path.append(QLatin1Char('/'));
- path.append(QString::number(m_contextId));
- path.append(QLatin1Char('/'));
- path.append(QString::number(iconID));
- url.setPath(path);
- url.setEncodedFragment(pageURL.toEncoded());
- emit iconChangedForPageURL(pageURL, url);
-}
-
void QtWebIconDatabaseClient::retainIconForPageURL(const String& pageURL)
{
m_iconDatabase->retainIconForPageURL(pageURL);