summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
commitcfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch)
tree24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp
parent69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff)
downloadqtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp
index 63dce28d0..aa26c0737 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp
@@ -49,13 +49,8 @@ WTF::String QWebIconImageProvider::iconURLForPageURLInContext(const WTF::String
QUrl url;
url.setScheme(QStringLiteral("image"));
url.setHost(QWebIconImageProvider::identifier());
-
- QString path;
- path.append(QLatin1Char('/'));
- path.append(QString::number(context->contextID()));
- path.append(QLatin1Char('/'));
- path.append(QString::number(WTF::StringHash::hash(iconURL)));
- url.setPath(path);
+ // Make sure that QML doesn't show cached versions of the previous icon if the icon location changed.
+ url.setPath(QLatin1Char('/') + QString::number(WTF::StringHash::hash(iconURL)));
// FIXME: Use QUrl::DecodedMode when landed in Qt
url.setFragment(QString::fromLatin1(QByteArray(QString(pageURL).toUtf8()).toBase64()));
@@ -70,21 +65,12 @@ WTF::String QWebIconImageProvider::iconURLForPageURLInContext(const WTF::String
QImage QWebIconImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize)
{
- // The string identifier has the leading image://webicon/ already stripped, so we just
- // need to truncate from the first slash to get the context id.
- QString contextIDString = id.left(id.indexOf(QLatin1Char('/')));
- bool ok = false;
- uint64_t contextId = contextIDString.toUInt(&ok);
- if (!ok)
- return QImage();
+ QString pageURL = QString::fromUtf8(QByteArray::fromBase64(id.midRef(id.indexOf('#') + 1).toLatin1()));
- QtWebContext* context = QtWebContext::contextByID(contextId);
- if (!context)
+ QtWebIconDatabaseClient* iconDatabase = QtWebContext::iconDatabase();
+ if (!iconDatabase)
return QImage();
- QString pageURL = QString::fromUtf8(QByteArray::fromBase64(id.midRef(id.indexOf('#') + 1).toLatin1()));
-
- QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
QImage icon = requestedSize.isValid() ? iconDatabase->iconImageForPageURL(pageURL, requestedSize) : iconDatabase->iconImageForPageURL(pageURL);
ASSERT(!icon.isNull());