- Revision
- 145512
- Author
- jocelyn.turco...@digia.com
- Date
- 2013-03-12 04:11:14 -0700 (Tue, 12 Mar 2013)
Log Message
[Qt][WK2] Favor QUrl and QString over WTF::String in the Qt API layer
https://bugs.webkit.org/show_bug.cgi?id=109468
Reviewed by Allan Sandfeld Jensen.
Signed off for WebKit2 by Benjamin Poulain.
In preparation for patches using the C API types in some areas, remove the
usage of WTF::String on the affected line.
Use a QUrl for icon URL to avoid unnecessary conversion.
Use a QString for the page URL to keep it compatible with WebPageProxy and
WebIconDatabase and avoid QUrl parsing.
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::_q_onIconChangedForPageURL):
(QQuickWebViewPrivate::updateIcon):
(QQuickWebView::emitUrlChangeIfNeeded):
(QQuickWebView::icon):
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate):
* UIProcess/API/qt/qwebiconimageprovider.cpp:
(QWebIconImageProvider::iconURLForPageURLInContext):
* UIProcess/API/qt/qwebiconimageprovider_p.h:
* UIProcess/qt/QtWebIconDatabaseClient.cpp:
(WebKit::QtWebIconDatabaseClient::iconForPageURL):
(WebKit::QtWebIconDatabaseClient::iconImageForPageURL):
(WebKit::QtWebIconDatabaseClient::retainIconForPageURL):
(WebKit::QtWebIconDatabaseClient::releaseIconForPageURL):
* UIProcess/qt/QtWebIconDatabaseClient.h:
(QtWebIconDatabaseClient):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (145511 => 145512)
--- trunk/Source/WebKit2/ChangeLog 2013-03-12 10:47:11 UTC (rev 145511)
+++ trunk/Source/WebKit2/ChangeLog 2013-03-12 11:11:14 UTC (rev 145512)
@@ -1,3 +1,36 @@
+2013-02-14 Jocelyn Turcotte <jocelyn.turco...@digia.com>
+
+ [Qt][WK2] Favor QUrl and QString over WTF::String in the Qt API layer
+ https://bugs.webkit.org/show_bug.cgi?id=109468
+
+ Reviewed by Allan Sandfeld Jensen.
+ Signed off for WebKit2 by Benjamin Poulain.
+
+ In preparation for patches using the C API types in some areas, remove the
+ usage of WTF::String on the affected line.
+
+ Use a QUrl for icon URL to avoid unnecessary conversion.
+ Use a QString for the page URL to keep it compatible with WebPageProxy and
+ WebIconDatabase and avoid QUrl parsing.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::_q_onIconChangedForPageURL):
+ (QQuickWebViewPrivate::updateIcon):
+ (QQuickWebView::emitUrlChangeIfNeeded):
+ (QQuickWebView::icon):
+ * UIProcess/API/qt/qquickwebview_p_p.h:
+ (QQuickWebViewPrivate):
+ * UIProcess/API/qt/qwebiconimageprovider.cpp:
+ (QWebIconImageProvider::iconURLForPageURLInContext):
+ * UIProcess/API/qt/qwebiconimageprovider_p.h:
+ * UIProcess/qt/QtWebIconDatabaseClient.cpp:
+ (WebKit::QtWebIconDatabaseClient::iconForPageURL):
+ (WebKit::QtWebIconDatabaseClient::iconImageForPageURL):
+ (WebKit::QtWebIconDatabaseClient::retainIconForPageURL):
+ (WebKit::QtWebIconDatabaseClient::releaseIconForPageURL):
+ * UIProcess/qt/QtWebIconDatabaseClient.h:
+ (QtWebIconDatabaseClient):
+
2013-03-12 Manuel Rego Casasnovas <r...@igalia.com>
[GTK][WK2] REGRESSION(r145081): Unit tests not working if locale is not English
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (145511 => 145512)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2013-03-12 10:47:11 UTC (rev 145511)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2013-03-12 11:11:14 UTC (rev 145512)
@@ -627,7 +627,7 @@
void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QString& pageUrl)
{
- if (pageUrl != QString(m_currentUrl))
+ if (pageUrl != m_currentUrl)
return;
updateIcon();
@@ -647,7 +647,7 @@
if (!provider)
return;
- WTF::String iconUrl = provider->iconURLForPageURLInContext(m_currentUrl, context.get());
+ QUrl iconUrl = provider->iconURLForPageURLInContext(m_currentUrl, context.get());
if (iconUrl == m_iconUrl)
return;
@@ -1700,7 +1700,7 @@
{
Q_D(QQuickWebView);
- WTF::String activeUrl = d->webPageProxy->activeURL();
+ QString activeUrl = d->webPageProxy->activeURL();
if (activeUrl != d->m_currentUrl) {
d->m_currentUrl = activeUrl;
emit urlChanged();
@@ -1728,7 +1728,7 @@
QUrl QQuickWebView::icon() const
{
Q_D(const QQuickWebView);
- return QUrl(d->m_iconUrl);
+ return d->m_iconUrl;
}
/*!
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (145511 => 145512)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h 2013-03-12 10:47:11 UTC (rev 145511)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h 2013-03-12 11:11:14 UTC (rev 145512)
@@ -202,9 +202,9 @@
bool m_navigatorQtObjectEnabled;
bool m_renderToOffscreenBuffer;
bool m_allowAnyHTTPSCertificateForLocalHost;
- WTF::String m_iconUrl;
+ QUrl m_iconUrl;
int m_loadProgress;
- WTF::String m_currentUrl;
+ QString m_currentUrl;
};
class QQuickWebViewLegacyPrivate : public QQuickWebViewPrivate {
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp (145511 => 145512)
--- trunk/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp 2013-03-12 10:47:11 UTC (rev 145511)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp 2013-03-12 11:11:14 UTC (rev 145512)
@@ -38,29 +38,29 @@
{
}
-WTF::String QWebIconImageProvider::iconURLForPageURLInContext(const WTF::String &pageURL, QtWebContext* context)
+QUrl QWebIconImageProvider::iconURLForPageURLInContext(const QString &pageURL, QtWebContext* context)
{
QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
- WTF::String iconURL = iconDatabase->iconForPageURL(pageURL);
+ QUrl iconURL = iconDatabase->iconForPageURL(pageURL);
if (iconURL.isEmpty())
- return String();
+ return QUrl();
QUrl url;
url.setScheme(QStringLiteral("image"));
url.setHost(QWebIconImageProvider::identifier());
// 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)));
+ url.setPath(QLatin1Char('/') + QString::number(WTF::StringHash::hash(iconURL.toString())));
// FIXME: Use QUrl::DecodedMode when landed in Qt
- url.setFragment(QString::fromLatin1(QByteArray(QString(pageURL).toUtf8()).toBase64()));
+ url.setFragment(QString::fromLatin1(pageURL.toUtf8().toBase64()));
// FIXME: We can't know when the icon url is no longer in use,
// so we never release these icons. At some point we might want
// to introduce expiry of icons to elevate this issue.
iconDatabase->retainIconForPageURL(pageURL);
- return url.toString(QUrl::FullyEncoded);
+ return url;
}
QImage QWebIconImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize)
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h (145511 => 145512)
--- trunk/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h 2013-03-12 10:47:11 UTC (rev 145511)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h 2013-03-12 11:11:14 UTC (rev 145512)
@@ -36,7 +36,7 @@
static QString identifier() { return QStringLiteral("webicon"); }
- WTF::String iconURLForPageURLInContext(const WTF::String& pageURL, WebKit::QtWebContext* context);
+ QUrl iconURLForPageURLInContext(const QString& pageURL, WebKit::QtWebContext* context);
virtual QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize);
};
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp (145511 => 145512)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp 2013-03-12 10:47:11 UTC (rev 145511)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp 2013-03-12 11:11:14 UTC (rev 145512)
@@ -65,24 +65,24 @@
emit toQtWebIconDatabaseClient(clientInfo)->iconChangedForPageURL(toImpl(pageURL)->string());
}
-WTF::String QtWebIconDatabaseClient::iconForPageURL(const WTF::String& pageURL)
+QUrl QtWebIconDatabaseClient::iconForPageURL(const QString& pageURL)
{
String iconURL;
m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL);
if (iconURL.isEmpty())
- return String();
+ return QUrl();
// 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 QUrl();
- return iconURL;
+ return QUrl(iconURL);
}
-QImage QtWebIconDatabaseClient::iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize)
+QImage QtWebIconDatabaseClient::iconImageForPageURL(const QString& pageURL, const QSize& iconSize)
{
MutexLocker locker(m_imageLock);
@@ -95,12 +95,12 @@
return nativeImage->toImage();
}
-void QtWebIconDatabaseClient::retainIconForPageURL(const String& pageURL)
+void QtWebIconDatabaseClient::retainIconForPageURL(const QString& pageURL)
{
m_iconDatabase->retainIconForPageURL(pageURL);
}
-void QtWebIconDatabaseClient::releaseIconForPageURL(const String& pageURL)
+void QtWebIconDatabaseClient::releaseIconForPageURL(const QString& pageURL)
{
m_iconDatabase->releaseIconForPageURL(pageURL);
}
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h (145511 => 145512)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h 2013-03-12 10:47:11 UTC (rev 145511)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h 2013-03-12 11:11:14 UTC (rev 145512)
@@ -33,10 +33,6 @@
class QUrl;
QT_END_NAMESPACE
-namespace WTF {
-class String;
-}
-
namespace WebKit {
class WebContext;
@@ -49,11 +45,11 @@
QtWebIconDatabaseClient(WebContext*);
~QtWebIconDatabaseClient();
- WTF::String iconForPageURL(const WTF::String& pageURL);
- QImage iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize = QSize(32, 32));
+ QUrl iconForPageURL(const QString& pageURL);
+ QImage iconImageForPageURL(const QString& pageURL, const QSize& iconSize = QSize(32, 32));
- void retainIconForPageURL(const WTF::String&);
- void releaseIconForPageURL(const WTF::String&);
+ void retainIconForPageURL(const QString&);
+ void releaseIconForPageURL(const QString&);
public:
Q_SIGNAL void iconChangedForPageURL(const QString& pageURL);