summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-4.7.010
-rw-r--r--doc/src/network-programming/bearermanagement.qdoc2
-rw-r--r--doc/src/snippets/code/doc_src_containers.qdoc8
-rw-r--r--doc/src/snippets/code/doc_src_qalgorithms.qdoc2
-rw-r--r--doc/src/snippets/code/doc_src_qset.qdoc2
-rw-r--r--doc/src/snippets/code/doc_src_qt4-tulip.qdoc2
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp2
-rw-r--r--doc/src/snippets/code/src_gui_kernel_qapplication.cpp4
-rw-r--r--doc/src/snippets/code/src_network_kernel_qhostinfo.cpp2
-rw-r--r--doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp2
-rw-r--r--doc/src/snippets/droparea.cpp2
-rw-r--r--doc/src/snippets/picture/picture.cpp4
-rw-r--r--doc/src/snippets/qfontdatabase/main.cpp4
-rw-r--r--doc/src/snippets/qlistview-dnd/model.cpp4
-rw-r--r--doc/src/snippets/qstringlist/main.cpp2
-rw-r--r--doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp2
-rw-r--r--doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp4
-rw-r--r--examples/network/bearercloud/cloud.cpp5
-rw-r--r--src/3rdparty/webkit/.tag2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog14
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h1
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog64
-rw-r--r--src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog48
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp12
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp28
-rw-r--r--src/corelib/tools/qsimd.cpp82
-rw-r--r--src/corelib/tools/qsimd_p.h21
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp30
-rw-r--r--src/gui/gui.pro20
-rw-r--r--src/gui/image/image.pri1
-rw-r--r--src/gui/image/qimage.cpp10
-rw-r--r--src/gui/image/qimage_ssse3.cpp150
-rw-r--r--src/gui/kernel/qpalette.cpp10
-rw-r--r--src/gui/widgets/qlineedit.cpp3
-rw-r--r--src/network/bearer/qnetworksession.cpp12
-rw-r--r--src/opengl/qglbuffer.cpp4
-rw-r--r--src/opengl/qglbuffer.h4
-rw-r--r--src/opengl/qwindowsurface_gl.cpp7
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp21
-rw-r--r--src/script/api/qscriptengineagent.cpp3
-rw-r--r--tests/auto/qimage/tst_qimage.cpp22
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp29
-rw-r--r--tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp83
-rw-r--r--tests/benchmarks/gui/image/image.pro1
-rw-r--r--tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro10
-rw-r--r--tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp108
52 files changed, 809 insertions, 79 deletions
diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0
index 8997cff..518d362 100644
--- a/dist/changes-4.7.0
+++ b/dist/changes-4.7.0
@@ -216,6 +216,7 @@ QtNetwork
* [QTBUG-9618] [MR 2372] send secure cookies only over secure connections
* [QTBUG-7713] Fix bug related to re-sending request
* [QTBUG-7673] Fix issue with some webservers
+ * [QTBUG-11029] do not accept cookies with non-alpha-numerical domain
- Sockets
* Better support for derived QTcpServer
* [QTBUG-7054] Fix error handling with waitFor*() for socket engine
@@ -223,6 +224,10 @@ QtNetwork
- SSL
* [QTBUG-2515] Do not make OpenSSL prompt for a password
* [QTBUG-6504, QTBUG-8924, QTBUG-5645] Fix memleak
+ * [QTBUG-9973] QSslCertificate: support large serial numbers
+ * [QTBUG-8833] make QSslSocket::systemCaCertificates() use system certs
+ * [QT-3567] QSslSocket: improve error handling (fixes Secunia Advisory SA40389)
+ * [QBTUG-4455, MR 731] Fix handling of SSL certificates with wildcard domain names
QtScript
--------
@@ -245,6 +250,7 @@ QtXmlPatterns
- [QTBUG-8920] fixed crash with anonymous types in XsdSchemaChecker
- [QTBUG-8394] include/import/redefine schemas only once
- QXmlSchema: fix crash with referencing elements
+ - [QBTUG-6485] QXmlSchema: allow usage of xsd:all
Qt Plugins
----------
@@ -471,6 +477,4 @@ QtCore:
QtNetwork:
- Qt does no longer provide its own CA bundle, but uses system APIs for
- retrieving the default system certificates. On Symbian,
- QSslSocket::systemCaCertificates() provides an empty list of
- certificates.
+ retrieving the default system certificates.
diff --git a/doc/src/network-programming/bearermanagement.qdoc b/doc/src/network-programming/bearermanagement.qdoc
index 67c13f2..bc016df 100644
--- a/doc/src/network-programming/bearermanagement.qdoc
+++ b/doc/src/network-programming/bearermanagement.qdoc
@@ -191,7 +191,7 @@ closed via \l{QNetworkSession::close()}, respectively. If the session
is \l{QNetworkSession::Disconnected}{disconnected} at the time of the
\l{QNetworkSession::open()}{open()} call the underlying interface is started;
otherwise only the reference counter against the global session is
-incremeted. The opposite behavior can be observed when using
+incremented. The opposite behavior can be observed when using
\l{QNetworkSession::close()}{close()}.
In some use cases it may be necessary to turn the interface off despite of
diff --git a/doc/src/snippets/code/doc_src_containers.qdoc b/doc/src/snippets/code/doc_src_containers.qdoc
index 5cf2aab..1f86f60 100644
--- a/doc/src/snippets/code/doc_src_containers.qdoc
+++ b/doc/src/snippets/code/doc_src_containers.qdoc
@@ -216,7 +216,7 @@ while (i.hasNext())
//! [17]
QLinkedList<QString> list;
...
-foreach (QString str, list)
+foreach (const QString &str, list)
qDebug() << str;
//! [17]
@@ -224,7 +224,7 @@ foreach (QString str, list)
//! [18]
QLinkedList<QString> list;
...
-foreach (QString str, list) {
+foreach (const QString &str, list) {
if (str.isEmpty())
break;
qDebug() << str;
@@ -235,7 +235,7 @@ foreach (QString str, list) {
//! [19]
QMap<QString, int> map;
...
-foreach (QString str, map.keys())
+foreach (const QString &str, map.keys())
qDebug() << str << ":" << map.value(str);
//! [19]
@@ -243,7 +243,7 @@ foreach (QString str, map.keys())
//! [20]
QMultiMap<QString, int> map;
...
-foreach (QString str, map.uniqueKeys()) {
+foreach (const QString &str, map.uniqueKeys()) {
foreach (int i, map.values(str))
qDebug() << str << ":" << i;
}
diff --git a/doc/src/snippets/code/doc_src_qalgorithms.qdoc b/doc/src/snippets/code/doc_src_qalgorithms.qdoc
index 78634a2..f5a73c6 100644
--- a/doc/src/snippets/code/doc_src_qalgorithms.qdoc
+++ b/doc/src/snippets/code/doc_src_qalgorithms.qdoc
@@ -217,7 +217,7 @@ QStringList list;
list << "AlPha" << "beTA" << "gamma" << "DELTA";
QMap<QString, QString> map;
-foreach (QString str, list)
+foreach (const QString &str, list)
map.insert(str.toLower(), str);
list = map.values();
diff --git a/doc/src/snippets/code/doc_src_qset.qdoc b/doc/src/snippets/code/doc_src_qset.qdoc
index ac48edb..c6e1933 100644
--- a/doc/src/snippets/code/doc_src_qset.qdoc
+++ b/doc/src/snippets/code/doc_src_qset.qdoc
@@ -80,7 +80,7 @@ while (i != set.constEnd()) {
//! [6]
QSet<QString> set;
...
-foreach (QString value, set)
+foreach (const QString &value, set)
qDebug() << value;
//! [6]
diff --git a/doc/src/snippets/code/doc_src_qt4-tulip.qdoc b/doc/src/snippets/code/doc_src_qt4-tulip.qdoc
index 3d88a0d..f29d3ba 100644
--- a/doc/src/snippets/code/doc_src_qt4-tulip.qdoc
+++ b/doc/src/snippets/code/doc_src_qt4-tulip.qdoc
@@ -47,7 +47,7 @@ foreach (variable, container)
//! [1]
QList<QString> list;
...
-foreach (QString str, list)
+foreach (const QString &str, list)
cout << str.ascii() << endl;
//! [1]
diff --git a/doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp b/doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp
index 2e64505..fb62347 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp
@@ -51,7 +51,7 @@ connect(quitButton, SIGNAL(clicked()), &app, SLOT(quit()));
//! [2]
-foreach (QString path, app.libraryPaths())
+foreach (const QString &path, app.libraryPaths())
do_something(path);
//! [2]
diff --git a/doc/src/snippets/code/src_gui_kernel_qapplication.cpp b/doc/src/snippets/code/src_gui_kernel_qapplication.cpp
index c93a25c..766b249 100644
--- a/doc/src/snippets/code/src_gui_kernel_qapplication.cpp
+++ b/doc/src/snippets/code/src_gui_kernel_qapplication.cpp
@@ -158,13 +158,13 @@ appname -session id
//! [10]
-foreach (QString command, mySession.restartCommand())
+foreach (const QString &command, mySession.restartCommand())
do_something(command);
//! [10]
//! [11]
-foreach (QString command, mySession.discardCommand())
+foreach (const QString &command, mySession.discardCommand())
do_something(command);
//! [11]
diff --git a/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp b/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp
index 3871289..99deb20 100644
--- a/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp
+++ b/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp
@@ -68,7 +68,7 @@ void MyWidget::lookedUp(const QHostInfo &host)
return;
}
- foreach (QHostAddress address, host.addresses())
+ foreach (const QHostAddress &address, host.addresses())
qDebug() << "Found address:" << address.toString();
}
//! [3]
diff --git a/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp b/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp
index 5c9421f..937dbb9 100644
--- a/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp
+++ b/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp
@@ -39,7 +39,7 @@
****************************************************************************/
//! [0]
-foreach (QSslCertificate cert, QSslCertificate::fromPath("C:/ssl/certificate.*.pem", QSsl::Pem,
+foreach (const QSslCertificate &cert, QSslCertificate::fromPath("C:/ssl/certificate.*.pem", QSsl::Pem,
QRegExp::Wildcard)) {
qDebug() << cert.issuerInfo(QSslCertificate::Organization);
}
diff --git a/doc/src/snippets/droparea.cpp b/doc/src/snippets/droparea.cpp
index bbcf82d..bb49dd7 100644
--- a/doc/src/snippets/droparea.cpp
+++ b/doc/src/snippets/droparea.cpp
@@ -130,7 +130,7 @@ QPixmap DropArea::extractPixmap(const QByteArray &data, const QString &format)
QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
QPixmap pixmap;
- foreach (QByteArray imageFormat, imageFormats) {
+ foreach (const QByteArray &imageFormat, imageFormats) {
if (format.mid(6) == QString(imageFormat)) {
pixmap.loadFromData(data, imageFormat);
break;
diff --git a/doc/src/snippets/picture/picture.cpp b/doc/src/snippets/picture/picture.cpp
index 0c5712a..5283978 100644
--- a/doc/src/snippets/picture/picture.cpp
+++ b/doc/src/snippets/picture/picture.cpp
@@ -76,7 +76,7 @@ int main()
// FORMATS
//! [2]
QStringList list = QPicture::inputFormatList();
- foreach (QString string, list)
+ foreach (const QString &string, list)
myProcessing(string);
//! [2]
}
@@ -85,7 +85,7 @@ int main()
// OUTPUT
//! [3]
QStringList list = QPicture::outputFormatList();
- foreach (QString string, list)
+ foreach (const QString &string, list)
myProcessing(string);
//! [3]
}
diff --git a/doc/src/snippets/qfontdatabase/main.cpp b/doc/src/snippets/qfontdatabase/main.cpp
index 7f939de..1b8ff42 100644
--- a/doc/src/snippets/qfontdatabase/main.cpp
+++ b/doc/src/snippets/qfontdatabase/main.cpp
@@ -50,11 +50,11 @@ int main(int argc, char **argv)
fontTree.setColumnCount(2);
fontTree.setHeaderLabels(QStringList() << "Font" << "Smooth Sizes");
- foreach (QString family, database.families()) {
+ foreach (const QString &family, database.families()) {
QTreeWidgetItem *familyItem = new QTreeWidgetItem(&fontTree);
familyItem->setText(0, family);
- foreach (QString style, database.styles(family)) {
+ foreach (const QString &style, database.styles(family)) {
QTreeWidgetItem *styleItem = new QTreeWidgetItem(familyItem);
styleItem->setText(0, style);
diff --git a/doc/src/snippets/qlistview-dnd/model.cpp b/doc/src/snippets/qlistview-dnd/model.cpp
index d310c03..bca71ee 100644
--- a/doc/src/snippets/qlistview-dnd/model.cpp
+++ b/doc/src/snippets/qlistview-dnd/model.cpp
@@ -109,7 +109,7 @@ bool DragDropListModel::dropMimeData(const QMimeData *data,
//! [6]
insertRows(beginRow, rows, QModelIndex());
- foreach (QString text, newItems) {
+ foreach (const QString &text, newItems) {
QModelIndex idx = index(beginRow, 0, QModelIndex());
setData(idx, text);
beginRow++;
@@ -139,7 +139,7 @@ QMimeData *DragDropListModel::mimeData(const QModelIndexList &indexes) const
QDataStream stream(&encodedData, QIODevice::WriteOnly);
- foreach (QModelIndex index, indexes) {
+ foreach (const QModelIndex &index, indexes) {
if (index.isValid()) {
QString text = data(index, Qt::DisplayRole).toString();
stream << text;
diff --git a/doc/src/snippets/qstringlist/main.cpp b/doc/src/snippets/qstringlist/main.cpp
index 76785f1..9ada319 100644
--- a/doc/src/snippets/qstringlist/main.cpp
+++ b/doc/src/snippets/qstringlist/main.cpp
@@ -118,7 +118,7 @@ Widget::Widget(QWidget *parent)
result.clear();
//! [12]
- foreach (QString str, list) {
+ foreach (const QString &str, list) {
if (str.contains("Bill"))
result += str;
}
diff --git a/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp b/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp
index 2d01240..620a716 100644
--- a/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp
+++ b/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp
@@ -123,7 +123,7 @@ QMimeData *DragDropModel::mimeData(const QModelIndexList &indexes) const
QDataStream stream(&encodedData, QIODevice::WriteOnly);
- foreach (QModelIndex index, indexes) {
+ foreach (const QModelIndex &index, indexes) {
if (index.isValid()) {
QString text = data(index, Qt::DisplayRole).toString();
stream << index.internalId() << index.row() << index.column() << text;
diff --git a/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp b/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp
index 6a49be8..35d2fa7 100644
--- a/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp
+++ b/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp
@@ -72,9 +72,9 @@ int main(int argc, char *argv[])
<< (QStringList() << "David Bradley" << "42")
<< (QStringList() << "Knut Walters" << "25")
<< (QStringList() << "Andrea Jones" << "34");
- foreach (QStringList row, rows) {
+ foreach (const QStringList &row, rows) {
QList<QStandardItem *> items;
- foreach (QString text, row)
+ foreach (const QString &text, row)
items.append(new QStandardItem(text));
model.appendRow(items);
}
diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp
index 2856c71..980efbf 100644
--- a/examples/network/bearercloud/cloud.cpp
+++ b/examples/network/bearercloud/cloud.cpp
@@ -245,6 +245,8 @@ void Cloud::stateChanged(QNetworkSession::State state)
else
finalOpacity = 1.0;
+#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) && \
+ !defined(Q_OS_SYMBIAN) && !defined(Q_OS_WINCE)
QString tooltip;
if (configuration.name().isEmpty())
@@ -302,6 +304,9 @@ void Cloud::stateChanged(QNetworkSession::State state)
tooltip += tr("<br>Sent data: %1 bytes").arg(session->bytesWritten());
setToolTip(tooltip);
+#else
+ Q_UNUSED(state);
+#endif
}
//! [2]
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag
index 79165f6..3cb818d 100644
--- a/src/3rdparty/webkit/.tag
+++ b/src/3rdparty/webkit/.tag
@@ -1 +1 @@
-669858f9bbd4913fd16c642090375c81acbfdb04
+0be9ff9f2b1ec2b748885ac15299bc1c65aca590
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index 8fa3a72..ea680ac 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-10-30 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml()
+
+ This ensures that long-running JavaScript (for example due to a modal alert() dialog),
+ will not trigger a deferred load after only 500ms (the default tokenizer delay) while
+ still giving a reasonable timeout (10 seconds) to prevent deadlock.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29381
+
+ * runtime/TimeoutChecker.h: Add getter for the timeout interval
+
2010-05-18 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h
index 7bfa6d0..5925641 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h
@@ -40,6 +40,7 @@ namespace JSC {
TimeoutChecker();
void setTimeoutInterval(unsigned timeoutInterval) { m_timeoutInterval = timeoutInterval; }
+ unsigned timeoutInterval() const { return m_timeoutInterval; }
unsigned ticksUntilNextCheck() { return m_ticksUntilNextCheck; }
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index e492154..f12f6b5 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from
and has the sha1 checksum
- 669858f9bbd4913fd16c642090375c81acbfdb04
+ 0be9ff9f2b1ec2b748885ac15299bc1c65aca590
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 1f7ca09..f7f2803 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,67 @@
+2010-07-01 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Clamp color stops passed to QGradient to 1.0
+ [https://bugs.webkit.org/show_bug.cgi?id=41484
+
+ Fixes an issue where color stops would be silently dropped from radial gradients.
+
+ * platform/graphics/qt/GradientQt.cpp:
+ (WebCore::Gradient::platformGradient):
+
+2010-07-07 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Prevent assertion/duplicate loads for non-deferred subtitute-data loads
+
+ https://bugs.webkit.org/show_bug.cgi?id=30879
+
+ MainResourceLoader uses the member m_initialRequest to store requests for future
+ deferred loads. When doing the actual load in handleDataLoadNow(), we therefore
+ have to clear this request so that subsequent entries into the loader will not
+ start yet another load.
+
+ This can happen as a result of a PageGroupLoadDeferrer going out of scope when
+ returning from Chrome::runJavaScriptAlert(), which calls setDeferredLoading(false),
+ but only in the case of using both substitute-data and non-deferred main resource
+ load together. That's why two new DRT functions were added:
+
+ * queueLoadHTMLString()
+ * setDeferMainResourceLoad()
+
+ The change adds DRT hooks for Mac, Win and Qt for these two functions. For Mac
+ and Win the hook uses new SPI in WebDataSource. For Qt a new static member was
+ added to the FrameLoaderClientQt and accessed though DumpRenderTreeSupportQt.
+
+ Test: fast/loader/non-deferred-substitute-load.html
+
+ * loader/MainResourceLoader.cpp:
+ (WebCore::MainResourceLoader::handleDataLoadNow):
+
+2010-07-16 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Simon Fraser.
+
+ Spatial navigation: do not consider outline for focusable element boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=42474
+
+ Test: fast/events/spatial-navigation/snav-zero-margin-content.html
+
+ Currently in WebCore::renderRectRelativeToRootDocument function, we are calling
+ RenderObject::absoluteClippedOverflowRect to obtain the rect boundary of a given
+ renderer/element. This method deals with outline, which is out of elements boundary.
+ It makes spatial navigation to fail on common sites like google.gom: "Web, Images, Map, etc"
+ are inaccessible.
+
+ Patch replaces RenderObject::absoluteClippedOverflowRect by Node::getRect,
+ which returns only the absolute bounding box rect of the Element.
+
+ * page/SpatialNavigation.cpp:
+ (WebCore::renderRectRelativeToRootDocument):
+ (WebCore::checkNegativeCoordsForNode):
+
2010-07-21 Kristian Amlie <kristian.amlie@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp b/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp
index 28587e2..54c5c34 100644
--- a/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp
@@ -464,6 +464,10 @@ void MainResourceLoader::handleDataLoadNow(MainResourceLoaderTimer*)
KURL url = m_substituteData.responseURL();
if (url.isEmpty())
url = m_initialRequest.url();
+
+ // Clear the initial request here so that subsequent entries into the
+ // loader will not think there's still a deferred load left to do.
+ m_initialRequest = ResourceRequest();
ResourceResponse response(url, m_substituteData.mimeType(), m_substituteData.content()->size(), m_substituteData.textEncoding(), "");
didReceiveResponse(response);
diff --git a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp
index a80626f..fdacebb 100644
--- a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp
+++ b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp
@@ -102,14 +102,9 @@ void distanceDataForNode(FocusDirection direction, Node* start, FocusCandidate&
// FIXME: This function does not behave correctly with transformed frames.
static IntRect renderRectRelativeToRootDocument(RenderObject* render)
{
- ASSERT(render);
+ ASSERT(render && render->node());
- IntRect rect(render->absoluteClippedOverflowRect());
-
- if (rect.isEmpty()) {
- Element* e = static_cast<Element*>(render->node());
- rect = e->getRect();
- }
+ IntRect rect = render->node()->getRect();
// In cases when the |render|'s associated node is in a scrollable inner
// document, we only consider its scrollOffset if it is not offscreen.
@@ -516,7 +511,7 @@ static bool checkNegativeCoordsForNode(Node* node, const IntRect& curRect)
{
ASSERT(node || node->renderer());
- if (curRect.x() > 0 && curRect.y() > 0)
+ if (curRect.x() >= 0 && curRect.y() >= 0)
return true;
bool canBeScrolled = false;
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp
index 8b9e2d7..1ec3203 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp
@@ -65,7 +65,7 @@ QGradient* Gradient::platformGradient()
lastStop = stopIterator->stop;
if (m_radial && m_r0)
lastStop = m_r0 / m_r1 + lastStop * (1.0f - m_r0 / m_r1);
- m_gradient->setColorAt(lastStop, stopColor);
+ m_gradient->setColorAt(qMin(lastStop, qreal(1.0f)), stopColor);
// Keep the lastStop as orginal value, since the following stopColor depend it
lastStop = stopIterator->stop;
++stopIterator;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
index cc7b11c..4fe784f 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
@@ -959,6 +959,10 @@ void QWebFrame::load(const QNetworkRequest &req,
The \a html is loaded immediately; external objects are loaded asynchronously.
+ If a script in the \a html runs longer than the default script timeout (currently 10 seconds),
+ for example due to being blocked by a modal JavaScript alert dialog, this method will return
+ as soon as possible after the timeout and any subsequent \a html will be loaded asynchronously.
+
When using this method WebKit assumes that external resources such as JavaScript programs or style
sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external
script can be specified through the charset attribute of the HTML script tag. It is also possible
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 1075b24..b2bff0c 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,51 @@
+2009-10-30 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml()
+
+ This ensures that long-running JavaScript (for example due to a modal alert() dialog),
+ will not trigger a deferred load after only 500ms (the default tokenizer delay) while
+ still giving a reasonable timeout (10 seconds) to prevent deadlock.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29381
+
+ * Api/qwebframe.cpp: Document the behaviour
+ * WebCoreSupport/FrameLoaderClientQt.cpp: set the custom tokenizer delay for substitute loads
+ * tests/qwebframe/tst_qwebframe.cpp: Add test
+
+2010-07-07 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Prevent assertion/duplicate loads for non-deferred subtitute-data loads
+
+ https://bugs.webkit.org/show_bug.cgi?id=30879
+
+ MainResourceLoader uses the member m_initialRequest to store requests for future
+ deferred loads. When doing the actual load in handleDataLoadNow(), we therefore
+ have to clear this request so that subsequent entries into the loader will not
+ start yet another load.
+
+ This can happen as a result of a PageGroupLoadDeferrer going out of scope when
+ returning from Chrome::runJavaScriptAlert(), which calls setDeferredLoading(false),
+ but only in the case of using both substitute-data and non-deferred main resource
+ load together. That's why two new DRT functions were added:
+
+ * queueLoadHTMLString()
+ * setDeferMainResourceLoad()
+
+ The change adds DRT hooks for Mac, Win and Qt for these two functions. For Mac
+ and Win the hook uses new SPI in WebDataSource. For Qt a new static member was
+ added to the FrameLoaderClientQt and accessed though DumpRenderTreeSupportQt.
+
+ * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+ (DumpRenderTreeSupportQt::setDeferMainResourceDataLoad):
+ * WebCoreSupport/DumpRenderTreeSupportQt.h:
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::createDocumentLoader):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
2010-07-23 David Boddie <dboddie@trolltech.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 686bfcc..713fa39 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -38,6 +38,7 @@
#include "FrameTree.h"
#include "FrameView.h"
#include "DocumentLoader.h"
+#include "JSDOMWindowBase.h"
#include "MIMETypeRegistry.h"
#include "ResourceResponse.h"
#include "Page.h"
@@ -141,6 +142,8 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceRespon
namespace WebCore
{
+bool FrameLoaderClientQt::deferMainResourceDataLoad = true;
+
FrameLoaderClientQt::FrameLoaderClientQt()
: m_frame(0)
, m_webFrame(0)
@@ -812,8 +815,15 @@ bool FrameLoaderClientQt::shouldFallBack(const WebCore::ResourceError&)
WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientQt::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData)
{
RefPtr<DocumentLoader> loader = DocumentLoader::create(request, substituteData);
- if (substituteData.isValid())
+ if (!deferMainResourceDataLoad || substituteData.isValid()) {
loader->setDeferMainResourceDataLoad(false);
+ // Use the default timeout interval for JS as the HTML tokenizer delay. This ensures
+ // that long-running JavaScript will still allow setHtml() to be synchronous, while
+ // still giving a reasonable timeout to prevent deadlock.
+ double delay = JSDOMWindowBase::commonJSGlobalData()->timeoutChecker.timeoutInterval() / 1000.0f;
+ m_frame->page()->setCustomHTMLTokenizerTimeDelay(delay);
+ } else
+ m_frame->page()->setCustomHTMLTokenizerTimeDelay(-1);
return loader.release();
}
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index adeb31c..515cf9a 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -211,6 +211,8 @@ namespace WebCore {
QString chooseFile(const QString& oldFile);
+ static bool deferMainResourceDataLoad;
+
private:
Frame *m_frame;
QWebFrame *m_webFrame;
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 76fdba3..e584f97 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -598,6 +598,7 @@ private slots:
void setHtml();
void setHtmlWithResource();
void setHtmlWithBaseURL();
+ void setHtmlWithJSAlert();
void ipv6HostEncoding();
void metaData();
#if !defined(Q_WS_MAEMO_5)
@@ -2485,6 +2486,33 @@ void tst_QWebFrame::setHtmlWithBaseURL()
QCOMPARE(m_view->page()->history()->count(), 0);
}
+class MyPage : public QWebPage
+{
+public:
+ MyPage() : QWebPage(), alerts(0) {}
+ int alerts;
+
+protected:
+ virtual void javaScriptAlert(QWebFrame*, const QString& msg)
+ {
+ alerts++;
+ QCOMPARE(msg, QString("foo"));
+ // Should not be enough to trigger deferred loading, since we've upped the HTML
+ // tokenizer delay in the Qt frameloader. See HTMLTokenizer::continueProcessing()
+ QTest::qWait(1000);
+ }
+};
+
+void tst_QWebFrame::setHtmlWithJSAlert()
+{
+ QString html("<html><head></head><body><script>alert('foo');</script><p>hello world</p></body></html>");
+ MyPage page;
+ m_view->setPage(&page);
+ page.mainFrame()->setHtml(html);
+ QCOMPARE(page.alerts, 1);
+ QCOMPARE(m_view->page()->mainFrame()->toHtml(), html);
+}
+
class TestNetworkManager : public QNetworkAccessManager
{
public:
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index aa2ee47..5aa7217 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -91,6 +91,7 @@ uint qDetectCPUFeatures()
features = MMX|SSE|SSE2;
#elif defined(__i386__) || defined(_M_IX86)
unsigned int extended_result = 0;
+ unsigned int feature_result = 0;
uint result = 0;
/* see p. 118 of amd64 instruction set manual Vol3 */
#if defined(Q_CC_GNU)
@@ -112,7 +113,8 @@ uint qDetectCPUFeatures()
"1:\n"
"pop %%ebx\n"
"mov %%edx, %0\n"
- : "=r" (result)
+ "mov %%ecx, %1\n"
+ : "=r" (result), "=r" (feature_result)
:
: "%eax", "%ecx", "%edx"
);
@@ -164,6 +166,7 @@ uint qDetectCPUFeatures()
mov eax, 1
cpuid
mov result, edx
+ mov feature_result, ecx
skip:
pop edx
pop ecx
@@ -218,19 +221,86 @@ uint qDetectCPUFeatures()
features |= SSE;
if (result & (1u << 26))
features |= SSE2;
- if (extended_result & (1u))
+ if (feature_result & (1u))
features |= SSE3;
- if (extended_result & (1u << 9))
+ if (feature_result & (1u << 9))
features |= SSSE3;
- if (extended_result & (1u << 19))
+ if (feature_result & (1u << 19))
features |= SSE4_1;
- if (extended_result & (1u << 20))
+ if (feature_result & (1u << 20))
features |= SSE4_2;
- if (extended_result & (1u << 28))
+ if (feature_result & (1u << 28))
features |= AVX;
#endif // i386
+#if defined(__x86_64__) || defined(Q_OS_WIN64)
+ uint feature_result = 0;
+
+#if defined(Q_CC_GNU)
+ asm ("push %%rbx\n"
+ "pushf\n"
+ "pop %%rax\n"
+ "mov %%eax, %%ebx\n"
+ "xor $0x00200000, %%eax\n"
+ "push %%rax\n"
+ "popf\n"
+ "pushf\n"
+ "pop %%rax\n"
+ "xor %%edx, %%edx\n"
+ "xor %%ebx, %%eax\n"
+ "jz 1f\n"
+
+ "mov $0x00000001, %%eax\n"
+ "cpuid\n"
+ "1:\n"
+ "pop %%rbx\n"
+ "mov %%ecx, %0\n"
+ : "=r" (feature_result)
+ :
+ : "%eax", "%ecx", "%edx"
+ );
+#elif defined (Q_OS_WIN64)
+ _asm {
+ push rax
+ push rbx
+ push rcx
+ push rdx
+ pushfd
+ pop rax
+ mov ebx, eax
+ xor eax, 00200000h
+ push rax
+ popfd
+ pushfd
+ pop rax
+ mov edx, 0
+ xor eax, ebx
+ jz skip
+
+ mov eax, 1
+ cpuid
+ mov feature_result, ecx
+ skip:
+ pop rdx
+ pop rcx
+ pop rbx
+ pop rax
+ }
+#endif
+
+ if (feature_result & (1u))
+ features |= SSE3;
+ if (feature_result & (1u << 9))
+ features |= SSSE3;
+ if (feature_result & (1u << 19))
+ features |= SSE4_1;
+ if (feature_result & (1u << 20))
+ features |= SSE4_2;
+ if (feature_result & (1u << 28))
+ features |= AVX;
+#endif // x86_64
+
#if defined(QT_HAVE_MMX)
if (qgetenv("QT_NO_MMX").toInt())
features ^= MMX;
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 18394853..5ff0f97 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -72,6 +72,27 @@ QT_BEGIN_HEADER
# include <emmintrin.h>
#endif
+// SSE3 intrinsics
+#if defined(QT_HAVE_SSE3) && (defined(__SSE3__) || defined(Q_CC_MSVC))
+#include <pmmintrin.h>
+#endif
+
+// SSSE3 intrinsics
+#if defined(QT_HAVE_SSSE3) && (defined(__SSSE3__) || defined(Q_CC_MSVC))
+#include <tmmintrin.h>
+#endif
+
+// SSE4.1 and SSE4.2 intrinsics
+#if (defined(QT_HAVE_SSE4_1) || defined(QT_HAVE_SSE4_2)) && (defined(__SSE4_1__) || defined(Q_CC_MSVC))
+#include <smmintrin.h>
+#endif
+
+// AVX intrinsics
+#if defined(QT_HAVE_AVX) && (defined(__AVX__) || defined(Q_CC_MSVC))
+#include <immintrin.h>
+#endif
+
+
#if !defined(QT_BOOTSTRAPPED) && (!defined(Q_CC_MSVC) || (defined(_M_X64) || _M_IX86_FP == 2))
#define QT_ALWAYS_HAVE_SSE2
#endif
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 008d054..1837366 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -485,24 +485,22 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId,
if (object && context) {
+ QDeclarativeProperty property(object, propertyName, context);
if (isLiteralValue) {
- QDeclarativeProperty literalProperty(object, propertyName, context);
- literalProperty.write(expression);
+ property.write(expression);
+ } else if (hasValidSignal(object, propertyName)) {
+ QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString());
+ QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression);
+ } else if (property.isProperty()) {
+ QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context);
+ binding->setTarget(property);
+ binding->setNotifyOnValueChanged(true);
+ QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, binding);
+ if (oldBinding)
+ oldBinding->destroy();
+ binding->update();
} else {
- if (hasValidSignal(object, propertyName)) {
- QDeclarativeProperty property(object, propertyName);
- QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString());
- QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression);
- } else {
- QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context);
- QDeclarativeProperty property(object, propertyName, context);
- binding->setTarget(property);
- binding->setNotifyOnValueChanged(true);
- QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, binding);
- if (oldBinding)
- oldBinding->destroy();
- binding->update();
- }
+ qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object;
}
}
}
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 3aee078..1b43ef2 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -187,6 +187,25 @@ contains(QMAKE_MAC_XARCH, no) {
silent:sse2_compiler.commands = @echo compiling[sse2] ${QMAKE_FILE_IN} && $$sse2_compiler.commands
QMAKE_EXTRA_COMPILERS += sse2_compiler
}
+ ssse3 {
+ ssse3_compiler.commands = $$QMAKE_CXX -c -Winline
+
+ mac {
+ ssse3_compiler.commands += -Xarch_i386 -mssse3
+ ssse3_compiler.commands += -Xarch_x86_64 -mssse3
+ } else {
+ ssse3_compiler.commands += -mssse3
+ }
+
+ ssse3_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
+ ssse3_compiler.dependency_type = TYPE_C
+ ssse3_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
+ ssse3_compiler.input = SSSE3_SOURCES
+ ssse3_compiler.variable_out = OBJECTS
+ ssse3_compiler.name = compiling[ssse3] ${QMAKE_FILE_IN}
+ silent:ssse3_compiler.commands = @echo compiling[ssse3] ${QMAKE_FILE_IN} && $$ssse3_compiler.commands
+ QMAKE_EXTRA_COMPILERS += ssse3_compiler
+ }
iwmmxt {
iwmmxt_compiler.commands = $$QMAKE_CXX -c -Winline
iwmmxt_compiler.commands += -mcpu=iwmmxt
@@ -205,6 +224,7 @@ contains(QMAKE_MAC_XARCH, no) {
3dnow:sse: SOURCES += $$SSE3DNOW_SOURCES
sse: SOURCES += $$SSE_SOURCES
sse2: SOURCES += $$SSE2_SOURCES
+ ssse3: SOURCES += $$SSSE3_SOURCES
iwmmxt: SOURCES += $$IWMMXT_SOURCES
}
}
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 3a02d56..b20a04f 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -95,3 +95,4 @@ contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri)
# SIMD
SSE2_SOURCES += image/qimage_sse2.cpp
+SSSE3_SOURCES += image/qimage_ssse3.cpp
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 713e765..30cf758 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -3354,7 +3354,7 @@ CONVERT_DECL(qargb4444, quint32)
// first index source, second dest
-static const Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormats] =
+static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormats] =
{
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
@@ -3761,6 +3761,14 @@ void qInitImageConversions()
inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_sse2;
}
#endif
+#ifdef QT_HAVE_SSSE3
+ if (features & SSSE3) {
+ extern void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
+ converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_ssse3;
+ converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_ssse3;
+ converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_ssse3;
+ }
+#endif
}
/*!
diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp
new file mode 100644
index 0000000..1c664f2
--- /dev/null
+++ b/src/gui/image/qimage_ssse3.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qimage.h>
+#include <private/qimage_p.h>
+#include <private/qsimd_p.h>
+
+#ifdef QT_HAVE_SSSE3
+
+#include <stdio.h>
+QT_BEGIN_NAMESPACE
+
+// Convert a scanline of RGB888 (src) to RGB32 (dst)
+// src must be at least len * 3 bytes
+// dst must be at least len * 4 bytes
+inline void convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len)
+{
+ quint32 *const end = dst + len;
+
+ // Prologue, align dst to 16 bytes. The alignement is done on dst because it has 4 store()
+ // for each 3 load() of src.
+ const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
+ const int prologLength = qMin(len, offsetToAlignOn16Bytes);
+
+ for (int i = 0; i < prologLength; ++i) {
+ *dst++ = qRgb(src[0], src[1], src[2]);
+ src += 3;
+ }
+
+ // Mask the 4 first colors of the RGB888 vector
+ const __m128i shuffleMask = _mm_set_epi8(0xff, 9, 10, 11, 0xff, 6, 7, 8, 0xff, 3, 4, 5, 0xff, 0, 1, 2);
+
+ // Mask the 4 last colors of a RGB888 vector with an offset of 1 (so the last 3 bytes are RGB)
+ const __m128i shuffleMaskEnd = _mm_set_epi8(0xff, 13, 14, 15, 0xff, 10, 11, 12, 0xff, 7, 8, 9, 0xff, 4, 5, 6);
+
+ // Mask to have alpha = 0xff
+ const __m128i alphaMask = _mm_set1_epi32(0xff000000);
+
+ __m128i *inVectorPtr = (__m128i *)src;
+ __m128i *dstVectorPtr = (__m128i *)dst;
+
+ const int simdRoundCount = (len - prologLength) / 16; // one iteration in the loop converts 16 pixels
+ for (int i = 0; i < simdRoundCount; ++i) {
+ /*
+ RGB888 has 5 pixels per vector, + 1 byte from the next pixel. The idea here is
+ to load vectors of RGB888 and use palignr to select a vector out of two vectors.
+
+ After 3 loads of RGB888 and 3 stores of RGB32, we have 4 pixels left in the last
+ vector of RGB888, we can mask it directly to get a last store or RGB32. After that,
+ the first next byte is a R, and we can loop for the next 16 pixels.
+
+ The conversion itself is done with a byte permutation (pshufb).
+ */
+ __m128i firstSrcVector = _mm_lddqu_si128(inVectorPtr);
+ __m128i outputVector = _mm_shuffle_epi8(firstSrcVector, shuffleMask);
+ _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
+ ++inVectorPtr;
+ ++dstVectorPtr;
+
+ // There are 4 unused bytes left in srcVector, we need to load the next 16 bytes
+ // and load the next input with palignr
+ __m128i secondSrcVector = _mm_lddqu_si128(inVectorPtr);
+ __m128i srcVector = _mm_alignr_epi8(secondSrcVector, firstSrcVector, 12);
+ outputVector = _mm_shuffle_epi8(srcVector, shuffleMask);
+ _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
+ ++inVectorPtr;
+ ++dstVectorPtr;
+ firstSrcVector = secondSrcVector;
+
+ // We now have 8 unused bytes left in firstSrcVector
+ secondSrcVector = _mm_lddqu_si128(inVectorPtr);
+ srcVector = _mm_alignr_epi8(secondSrcVector, firstSrcVector, 8);
+ outputVector = _mm_shuffle_epi8(srcVector, shuffleMask);
+ _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
+ ++inVectorPtr;
+ ++dstVectorPtr;
+
+ // There are now 12 unused bytes in firstSrcVector.
+ // We can mask them directly, almost there.
+ outputVector = _mm_shuffle_epi8(secondSrcVector, shuffleMaskEnd);
+ _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
+ ++dstVectorPtr;
+ }
+ src = (uchar *)inVectorPtr;
+ dst = (quint32 *)dstVectorPtr;
+
+ while (dst != end) {
+ *dst++ = qRgb(src[0], src[1], src[2]);
+ src += 3;
+ }
+}
+
+void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(src->format == QImage::Format_RGB888);
+ Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied);
+ Q_ASSERT(src->width == dest->width);
+ Q_ASSERT(src->height == dest->height);
+
+ const uchar *src_data = (uchar *) src->data;
+ quint32 *dest_data = (quint32 *) dest->data;
+
+ for (int i = 0; i < src->height; ++i) {
+ convert_rgb888_to_rgb32_ssse3(dest_data, src_data, src->width);
+ src_data += src->bytes_per_line;
+ dest_data = (quint32 *)((uchar*)dest_data + dest->bytes_per_line);
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_HAVE_SSSE3
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 98e8f66..38ec806 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -868,11 +868,21 @@ void QPalette::detach()
Returns true (slowly) if this palette is different from \a p;
otherwise returns false (usually quickly).
+
+ \note The current ColorGroup is not taken into account when
+ comparing palettes
+
+ \sa operator==
*/
/*!
Returns true (usually quickly) if this palette is equal to \a p;
otherwise returns false (slowly).
+
+ \note The current ColorGroup is not taken into account when
+ comparing palettes
+
+ \sa operator!=
*/
bool QPalette::operator==(const QPalette &p) const
{
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index d7311ef..981e934 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1949,7 +1949,8 @@ void QLineEdit::paintEvent(QPaintEvent *)
if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())){
flags |= QLineControl::DrawSelections;
// Palette only used for selections/mask and may not be in sync
- if(d->control->palette() != pal)
+ if (d->control->palette() != pal
+ || d->control->palette().currentColorGroup() != pal.currentColorGroup())
d->control->setPalette(pal);
}
diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp
index 1ed6cbb..65de539 100644
--- a/src/network/bearer/qnetworksession.cpp
+++ b/src/network/bearer/qnetworksession.cpp
@@ -629,8 +629,10 @@ void QNetworkSession::reject()
If the session is based on a service network configuration the number of
sent bytes across all active member configurations are returned.
- This function may not always be supported on all platforms and returns
- 0. The platform capability can be detected via QNetworkConfigurationManager::DataStatistics.
+ This function may not always be supported on all platforms and returns 0.
+ The platform capability can be detected via QNetworkConfigurationManager::DataStatistics.
+
+ \note On some platforms this function may run the main event loop.
*/
quint64 QNetworkSession::bytesWritten() const
{
@@ -646,8 +648,10 @@ quint64 QNetworkSession::bytesWritten() const
If the session is based on a service network configuration the number of
sent bytes across all active member configurations are returned.
- This function may not always be supported on all platforms and returns
- 0. The platform capability can be detected via QNetworkConfigurationManager::DataStatistics.
+ This function may not always be supported on all platforms and returns 0.
+ The platform capability can be detected via QNetworkConfigurationManager::DataStatistics.
+
+ \note On some platforms this function may run the main event loop.
*/
quint64 QNetworkSession::bytesReceived() const
{
diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp
index d6e0109..5f0aed4 100644
--- a/src/opengl/qglbuffer.cpp
+++ b/src/opengl/qglbuffer.cpp
@@ -416,7 +416,7 @@ void QGLBuffer::allocate(const void *data, int count)
\sa release(), create()
*/
-bool QGLBuffer::bind() const
+bool QGLBuffer::bind()
{
#ifndef QT_NO_DEBUG
if (!isCreated())
@@ -448,7 +448,7 @@ bool QGLBuffer::bind() const
\sa bind()
*/
-void QGLBuffer::release() const
+void QGLBuffer::release()
{
#ifndef QT_NO_DEBUG
if (!isCreated())
diff --git a/src/opengl/qglbuffer.h b/src/opengl/qglbuffer.h
index a1b45ff..9867f31 100644
--- a/src/opengl/qglbuffer.h
+++ b/src/opengl/qglbuffer.h
@@ -101,8 +101,8 @@ public:
void destroy();
- bool bind() const;
- void release() const;
+ bool bind();
+ void release();
static void release(QGLBuffer::Type type);
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index e9da452..6b82ed3 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -494,10 +494,9 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
}
}
#endif
- if (d_ptr->paintedRegion.boundingRect() != geometry()) {
- // Emits warning if not supported. Should never happen unless
- // setPartialUpdateSupport(true) has been called.
- context()->d_func()->swapRegion(&d_ptr->paintedRegion);
+ if (d_ptr->paintedRegion.boundingRect() != geometry() &&
+ hasPartialUpdateSupport()) {
+ context()->d_func()->swapRegion(&d_ptr->paintedRegion);
} else
context()->swapBuffers();
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index f89ed0a..d6b4975 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -1044,6 +1044,11 @@ void QNetworkSessionPrivateImpl::RunL()
TInt error = KErrNone;
QNetworkConfiguration newActiveConfig = activeConfiguration();
if (!newActiveConfig.isValid()) {
+ // RConnection startup was successfull but no configuration
+ // was found. That indicates that user has chosen to create a
+ // new WLAN configuration (from scan results), but that new
+ // configuration does not have access to Internet (Internet
+ // Connectivity Test, ICT, failed).
error = KErrGeneral;
} else {
// Use name of the IAP to open global 'Open C' RConnection
@@ -1053,16 +1058,24 @@ void QNetworkSessionPrivateImpl::RunL()
strcpy(ifr.ifr_name, nameAsByteArray.constData());
error = setdefaultif(&ifr);
}
-
if (error != KErrNone) {
isOpen = false;
isOpening = false;
iError = QNetworkSession::UnknownSessionError;
QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
- Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
+ if (!newActiveConfig.isValid()) {
+ // No valid configuration, bail out.
+ // Status updates from QNCM won't be received correctly
+ // because there is no configuration to associate them with so transit here.
+ iConnection.Close();
+ newState(QNetworkSession::Closing);
+ newState(QNetworkSession::Disconnected);
+ } else {
+ Cancel();
+ }
QT_TRYCATCH_LEAVING(syncStateWithInterface());
return;
}
@@ -1117,7 +1130,9 @@ void QNetworkSessionPrivateImpl::RunL()
isOpening = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
- if (publicConfig.state() == QNetworkConfiguration::Undefined ||
+ if (statusCode == KErrCancel) {
+ iError = QNetworkSession::SessionAbortedError;
+ } else if (publicConfig.state() == QNetworkConfiguration::Undefined ||
publicConfig.state() == QNetworkConfiguration::Defined) {
iError = QNetworkSession::InvalidConfigurationError;
} else {
diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp
index 28905e8..0b5828a 100644
--- a/src/script/api/qscriptengineagent.cpp
+++ b/src/script/api/qscriptengineagent.cpp
@@ -134,9 +134,12 @@ void QScriptEngineAgentPrivate::returnEvent(const JSC::DebuggerCallFrame& frame,
void QScriptEngineAgentPrivate::exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler)
{
JSC::CallFrame *oldFrame = engine->currentFrame;
+ int oldAgentLineNumber = engine->agentLineNumber;
engine->currentFrame = frame.callFrame();
QScriptValue value(engine->scriptValueFromJSCValue(frame.exception()));
+ engine->agentLineNumber = value.property(QLatin1String("lineNumber")).toInt32();
q_ptr->exceptionThrow(sourceID, value, hasHandler);
+ engine->agentLineNumber = oldAgentLineNumber;
engine->currentFrame = oldFrame;
engine->setCurrentException(value);
};
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index 5052114..1330d96 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -83,6 +83,8 @@ private slots:
void convertToFormat_data();
void convertToFormat();
+ void convertToFormatRgb888ToRGB32();
+
void createAlphaMask_data();
void createAlphaMask();
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
@@ -799,6 +801,26 @@ void tst_QImage::convertToFormat()
QFile::remove(QLatin1String("expected2.xpm"));
}
+void tst_QImage::convertToFormatRgb888ToRGB32()
+{
+ // 545 so width % 4 != 0. This ensure there is padding at the end of the scanlines
+ const int height = 545;
+ const int width = 545;
+ QImage source(width, height, QImage::Format_RGB888);
+ for (int y = 0; y < height; ++y) {
+ uchar *srcPixels = source.scanLine(y);
+ for (int x = 0; x < width * 3; ++x)
+ srcPixels[x] = x;
+ }
+
+ QImage rgb32Image = source.convertToFormat(QImage::Format_RGB888);
+ QCOMPARE(rgb32Image.format(), QImage::Format_RGB888);
+ for (int x = 0; x < width; ++x) {
+ for (int y = 0; y < height; ++y)
+ QCOMPARE(rgb32Image.pixel(x, y), source.pixel(x, y));
+ }
+}
+
void tst_QImage::createAlphaMask_data()
{
QTest::addColumn<int>("x");
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index b34e559..717b32d 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -66,7 +66,6 @@
#include <qspinbox.h>
#include <qdebug.h>
-
//TESTED_CLASS=
//TESTED_FILES=
@@ -275,6 +274,7 @@ private slots:
void taskQTBUG_7902_contextMenuCrash();
#endif
void taskQTBUG_7395_readOnlyShortcut();
+ void QTBUG697_paletteCurrentColorGroup();
#ifdef QT3_SUPPORT
void validateAndSet_data();
@@ -3714,5 +3714,32 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
QCOMPARE(spy.count(), 1);
}
+void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup()
+{
+#ifndef Q_WS_X11
+ QSKIP("Only tested on X11", SkipAll);
+#endif
+ QLineEdit le;
+ le.setText(" ");
+ QPalette p = le.palette();
+ p.setBrush(QPalette::Active, QPalette::Highlight, Qt::green);
+ p.setBrush(QPalette::Inactive, QPalette::Highlight, Qt::red);
+ le.setPalette(p);
+
+ le.show();
+ QApplication::setActiveWindow(&le);
+ QTest::qWaitForWindowShown(&le);
+ le.setFocus();
+ QTRY_VERIFY(le.hasFocus());
+ le.selectAll();
+
+ QImage img(le.size(),QImage::Format_ARGB32 );
+ le.render(&img);
+ QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::green).rgb());
+ QApplication::setActiveWindow(0);
+ le.render(&img);
+ QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::red).rgb());
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"
diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
index a0f10dd..ed00b96 100644
--- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
+++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
@@ -116,6 +116,8 @@ private slots:
void evaluateProgram_SyntaxError();
void evaluateNullProgram();
void QTBUG6108();
+ void backtraces_data();
+ void backtraces();
private:
double m_testProperty;
@@ -2379,5 +2381,86 @@ void tst_QScriptEngineAgent::QTBUG6108()
QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId);
}
+class BacktraceSpy : public QScriptEngineAgent
+{
+public:
+ BacktraceSpy(QScriptEngine *engine, const QStringList &expectedbacktrace, int breakpoint)
+ : QScriptEngineAgent(engine), expectedbacktrace(expectedbacktrace), breakpoint(breakpoint), ok(false) {}
+
+ QStringList expectedbacktrace;
+ int breakpoint;
+ bool ok;
+
+protected:
+
+ void exceptionThrow(qint64 , const QScriptValue &, bool)
+ { check(); }
+
+ void positionChange(qint64 , int lineNumber, int )
+ {
+ if (lineNumber == breakpoint)
+ check();
+ }
+
+private:
+ void check()
+ {
+ QCOMPARE(engine()->currentContext()->backtrace(), expectedbacktrace);
+ ok = true;
+ }
+};
+
+
+void tst_QScriptEngineAgent::backtraces_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::addColumn<int>("breakpoint");
+ QTest::addColumn<QStringList>("expectedbacktrace");
+
+ {
+ QString source(
+ "function foo() {\n"
+ " var a = 5\n"
+ "}\n"
+ "foo('hello', { })\n"
+ "var r = 0;");
+
+ QStringList expected;
+ expected
+ << "foo('hello', [object Object]) at filename.js:2"
+ << "<global>() at filename.js:4";
+ QTest::newRow("simple breakpoint") << source << 2 << expected;
+ }
+
+ {
+ QString source(
+ "function foo() {\n"
+ " error = err\n" //this must throw
+ "}\n"
+ "foo('hello', { })\n"
+ "var r = 0;");
+
+ QStringList expected;
+ expected
+ << "foo('hello', [object Object]) at filename.js:2"
+ << "<global>() at filename.js:4";
+ QTest::newRow("throw because of error") << source << -100 << expected;
+ }
+}
+
+void tst_QScriptEngineAgent::backtraces()
+{
+ QFETCH(QString, code);
+ QFETCH(int, breakpoint);
+ QFETCH(QStringList, expectedbacktrace);
+
+ QScriptEngine eng;
+ BacktraceSpy *spy = new BacktraceSpy(&eng, expectedbacktrace, breakpoint);
+ eng.setAgent(spy);
+ QLatin1String filename("filename.js");
+ eng.evaluate(code, filename);
+ QVERIFY(spy->ok);
+}
+
QTEST_MAIN(tst_QScriptEngineAgent)
#include "tst_qscriptengineagent.moc"
diff --git a/tests/benchmarks/gui/image/image.pro b/tests/benchmarks/gui/image/image.pro
index 3094e72..a8c6732 100644
--- a/tests/benchmarks/gui/image/image.pro
+++ b/tests/benchmarks/gui/image/image.pro
@@ -1,6 +1,7 @@
TEMPLATE = subdirs
SUBDIRS = \
blendbench \
+ qimageconversion \
qimagereader \
qpixmap \
qpixmapcache
diff --git a/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro b/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro
new file mode 100644
index 0000000..ec50d98
--- /dev/null
+++ b/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro
@@ -0,0 +1,10 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_bench_imageConversion
+
+SOURCES += tst_qimageconversion.cpp
+
+!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
+!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
+!contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG
+!contains(QT_CONFIG, no-tiff):DEFINES += QTEST_HAVE_TIFF
diff --git a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
new file mode 100644
index 0000000..1c76d46
--- /dev/null
+++ b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QImage>
+
+Q_DECLARE_METATYPE(QImage)
+
+class tst_QImageConversion : public QObject
+{
+ Q_OBJECT
+private slots:
+ void convertRgb888ToRGB32_data();
+ void convertRgb888ToRGB32();
+
+private:
+ QImage generateImageRgb888(int width, int height);
+};
+
+void tst_QImageConversion::convertRgb888ToRGB32_data()
+{
+ QTest::addColumn<QImage>("inputImage");
+ // height = 5000 to get interesting timing.
+
+ // 3 pixels wide -> smaller than regular vector of 128bits
+ QTest::newRow("width: 3px; height: 5000px;") << generateImageRgb888(3, 5000);
+
+ // 8 pixels wide -> potential for 2 vectors
+ QTest::newRow("width: 8px; height: 5000px;") << generateImageRgb888(3, 5000);
+
+ // 16 pixels, minimum for the SSSE3 implementation
+ QTest::newRow("width: 16px; height: 5000px;") << generateImageRgb888(16, 5000);
+
+ // 50 pixels, more realistic use case
+ QTest::newRow("width: 50px; height: 5000px;") << generateImageRgb888(50, 5000);
+
+ // 2000 pixels -> typical values for pictures
+ QTest::newRow("width: 2000px; height: 5000px;") << generateImageRgb888(2000, 5000);
+}
+
+void tst_QImageConversion::convertRgb888ToRGB32()
+{
+ QFETCH(QImage, inputImage);
+
+ QBENCHMARK {
+ volatile QImage output = inputImage.convertToFormat(QImage::Format_RGB32);
+ // we need the volatile and the following to make sure the compiler does not do
+ // anything stupid :)
+ (void)output;
+ }
+}
+
+/*
+ Fill a RGB888 image with "random" pixel values.
+ */
+QImage tst_QImageConversion::generateImageRgb888(int width, int height)
+{
+ QImage image(width, height, QImage::Format_RGB888);
+ const int byteWidth = width * 3;
+
+ for (int y = 0; y < image.height(); ++y) {
+ uchar *scanline = image.scanLine(y);
+ for (int x = 0; x < byteWidth; ++x)
+ scanline[x] = x ^ y;
+ }
+ return image;
+}
+
+QTEST_MAIN(tst_QImageConversion)
+#include "tst_qimageconversion.moc"