From f74dd380f30306bb2cf93ef61bb35dc8db045a11 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 22 Sep 2009 11:45:22 +0200 Subject: fix tst_QMenu::task242454_sizeHint for Windows mobile QMenu actually doesn't use QFontMetrics::width to calculate its bounding rect but QFontMetrics::boundingRect. That's why this test failed on Windows CE. Reviewed-by: thierry --- tests/auto/qmenu/tst_qmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 174d1d7..abf8246 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -658,7 +658,7 @@ void tst_QMenu::task242454_sizeHint() QMenu menu; QString s = QLatin1String("foo\nfoo\nfoo\nfoo"); menu.addAction(s); - QVERIFY(menu.sizeHint().width() > menu.fontMetrics().width(s)); + QVERIFY(menu.sizeHint().width() > menu.fontMetrics().boundingRect(QRect(), Qt::TextSingleLine, s).width()); } -- cgit v0.12 From 1053d8564ca33e18a813e0f0fa1ec1f381e4a937 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 22 Sep 2009 12:38:56 +0200 Subject: Fix broken drop-down arrows on Windows 7 This issue affects both tool buttons and buttosn with menus. The problem is that the Windows metric we were using to calculate the size changed on Windows 7. It seems not to be the correct metric so it seems more reliable to use the dpi-scaled constant 12 as we were doing in common style already. This should make appearance consistent between the windows versions. Task-number: QTBUG-4241 Reviewed-by: denis --- src/gui/styles/qwindowsxpstyle.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index ed2ee8a..1a9f4f2 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -3276,17 +3276,6 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con } break; - case PM_MenuButtonIndicator: - { - XPThemeData theme(widget, 0, QLatin1String("TOOLBAR"), TP_SPLITBUTTONDROPDOWN); - if (theme.isValid()) { - SIZE size; - pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size); - res = size.cx; - } - } - break; - case PM_TitleBarHeight: { #ifdef QT3_SUPPORT -- cgit v0.12 From e410d2711ae2aba15b9da7b07a4f8e40a50ab9c5 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 22 Sep 2009 14:38:09 +0200 Subject: Ensure that QStandardItem::clone() is used when a prototype is set This fixes a regression introduced in Qt 4.5.0, when dragging an item within a QTreeView it would not call clone() when it was dropped even if a prototype was set on the QStandardItemModel. Reviewed-by: Marius Bugge Monsen --- src/gui/itemviews/qstandarditemmodel.cpp | 9 +++++---- src/gui/itemviews/qstandarditemmodel_p.h | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp index bc25edd..8c9a2fd 100644 --- a/src/gui/itemviews/qstandarditemmodel.cpp +++ b/src/gui/itemviews/qstandarditemmodel.cpp @@ -2965,7 +2965,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const Used by QStandardItemModel::dropMimeData stream out an item and his children */ -static void decodeDataRecursive(QDataStream &stream, QStandardItem *item) +void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStandardItem *item) { int colCount, childCount; stream >> *item; @@ -2976,7 +2976,7 @@ static void decodeDataRecursive(QDataStream &stream, QStandardItem *item) while(childPos > 0) { childPos--; - QStandardItem *child = new QStandardItem; + QStandardItem *child = createItem(); decodeDataRecursive(stream, child); item->setChild( childPos / colCount, childPos % colCount, child); } @@ -2989,6 +2989,7 @@ static void decodeDataRecursive(QDataStream &stream, QStandardItem *item) bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) { + Q_D(QStandardItemModel); // check if the action is supported if (!data || !(action == Qt::CopyAction || action == Qt::MoveAction)) return false; @@ -3020,9 +3021,9 @@ bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti while (!stream.atEnd()) { int r, c; - QStandardItem *item = new QStandardItem; + QStandardItem *item = d->createItem(); stream >> r >> c; - decodeDataRecursive(stream, item); + d->decodeDataRecursive(stream, item); rows.append(r); columns.append(c); diff --git a/src/gui/itemviews/qstandarditemmodel_p.h b/src/gui/itemviews/qstandarditemmodel_p.h index 3d842f3..430fcb6 100644 --- a/src/gui/itemviews/qstandarditemmodel_p.h +++ b/src/gui/itemviews/qstandarditemmodel_p.h @@ -175,6 +175,8 @@ public: void _q_emitItemChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void decodeDataRecursive(QDataStream &stream, QStandardItem *item); + QVector columnHeaderItems; QVector rowHeaderItems; QStandardItem *root; -- cgit v0.12 From 3a00b2bc8590e0ac43313681ba690629efdcbeab Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 23 Sep 2009 10:42:12 +0300 Subject: Removed symbian specific cache location from qabstractnetworkcache test. This has been just workaround for misbehaving QDesktopServices implementation, and now QDesktopServices::CacheLocation has been fixed for Symbian. Reviewed-by: Aleksandar Sasha Babic --- tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index 2377c18..5ef95cd 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -83,12 +83,8 @@ public: : QNetworkDiskCache(parent) , gotData(false) { -#ifdef Q_OS_SYMBIAN - QString location = QLatin1String("./cache/"); -#else QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation) + QLatin1String("/qnetworkdiskcache/"); -#endif setCacheDirectory(location); clear(); } -- cgit v0.12 From 6d3764ee563db117d03b9c759e491b70a3c1df7d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 23 Sep 2009 10:12:24 +0200 Subject: Make sure fontextractor example is found by qtdemo Qt Demo seems to assume the executable name is the same as the directory name, so change the name to all lower case to avoid getting the message that the example has not been built even when it has. Found by Black Team. --- examples/webkit/formextractor/formextractor.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/webkit/formextractor/formextractor.pro b/examples/webkit/formextractor/formextractor.pro index d2cb240..e748c74 100644 --- a/examples/webkit/formextractor/formextractor.pro +++ b/examples/webkit/formextractor/formextractor.pro @@ -1,5 +1,5 @@ QT += webkit -TARGET = formExtractor +TARGET = formextractor TEMPLATE = app SOURCES += main.cpp \ formextractor.cpp \ -- cgit v0.12 From 33d104723a02297ffef53020d42b789284699534 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 23 Sep 2009 10:22:49 +0200 Subject: Paint arrow on top of node, not underneath it It looked strange that the node and its drop shadow was painted on top of the arrow. Flip the z-axis around to make sure the arrow is painted on top. Task-number: QTBUG-4544 Reviewed-by: Gunnar --- examples/graphicsview/elasticnodes/node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/graphicsview/elasticnodes/node.cpp b/examples/graphicsview/elasticnodes/node.cpp index 3a218e7..b878011 100644 --- a/examples/graphicsview/elasticnodes/node.cpp +++ b/examples/graphicsview/elasticnodes/node.cpp @@ -53,7 +53,7 @@ Node::Node(GraphWidget *graphWidget) { setFlag(ItemIsMovable); setCacheMode(DeviceCoordinateCache); - setZValue(1); + setZValue(-1); } void Node::addEdge(Edge *edge) -- cgit v0.12 From 9262ee16906fd8e030cd5d2a81d22fe9b791b9f6 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 23 Sep 2009 12:42:58 +0200 Subject: Calling raise() on a hidden windows makes it visible on Cocoa. [NSWindow orderFront:] on a hidden window will make it visible. So raise_sys() will now check if window is visible before this method is called. Task-number: 255428 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 987d2ae..ef71194 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3613,7 +3613,7 @@ void QWidgetPrivate::raise_sys() QMacCocoaAutoReleasePool pool; if (isRealWindow()) { // Calling orderFront shows the window on Cocoa too. - if (!q->testAttribute(Qt::WA_DontShowOnScreen)) { + if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) { [qt_mac_window_for(q) orderFront:qt_mac_window_for(q)]; } if (qt_mac_raise_process) { //we get to be the active process now -- cgit v0.12 From 0cb5038a3e5d3a6b0c33d081b89c6fe47cfc0b1b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 23 Sep 2009 14:35:06 +0200 Subject: Try to support Qt 4.4-style Phonon includes in Qt. This introduces an undocumented "phonon_compat" subdir and also adds it to the INCLUDEPATH when QT += phonon is specified. With this, these styles of #includes should be supported: #include #include #include #include #include #include Still need to check if the headers get installed during "make install". I couldn't find where in our code that is done. BT: yes Reviewed-By: Trust Me --- bin/syncqt | 10 ++++++++-- mkspecs/features/qt.prf | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/syncqt b/bin/syncqt index 01c519e..5cb5d86 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -843,9 +843,15 @@ foreach (@modules_to_sync) { $master_contents .= "#endif\n"; unless($showonly) { - unless ($lib eq "phonon") { + my @master_includes; + if ($lib eq "phonon") { + push @master_includes, "$out_basedir/include/phonon_compat/phonon/phonon"; + push @master_includes, "$out_basedir/include/phonon/Phonon/Phonon"; + } else { + push @master_includes, "$out_basedir/include/$lib/$lib"; + } + foreach my $master_include (@master_includes) { #generate the "master" include file - my $master_include = "$out_basedir/include/$lib/$lib"; $pri_install_files .= fixPaths($master_include, "$modules{$lib}") . " "; #get the master file installed too if($master_include && -e "$master_include") { open MASTERINCLUDE, "<$master_include"; diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index b3d6a5f..2b2a42c 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -158,8 +158,12 @@ for(QTLIB, $$list($$lower($$unique(QT)))) { else:isEqual(QTLIB, scripttools):qlib = QtScriptTools else:isEqual(QTLIB, testlib):qlib = QtTest else:isEqual(QTLIB, dbus):qlib = QtDBus - else:isEqual(QTLIB, phonon):qlib = phonon - else:isEqual(QTLIB, webkit):qlib = QtWebKit + else:isEqual(QTLIB, phonon) { + qlib = phonon + INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon_compat/phonon + INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon_compat + INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon/Phonon + } else:isEqual(QTLIB, webkit):qlib = QtWebKit else:isEqual(QTLIB, multimedia):qlib = QtMultimedia else:message("Unknown QT: $$QTLIB"):qlib = !isEmpty(qlib) { -- cgit v0.12 From 94ffd7e298a4ffa0440fd18a30b1823a71c6bb77 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 23 Sep 2009 14:35:06 +0200 Subject: Try to support Qt 4.4-style Phonon includes in Qt. This introduces an undocumented "phonon_compat" subdir and also adds it to the INCLUDEPATH when QT += phonon is specified. With this, these styles of #includes should be supported: #include #include #include #include #include #include Still need to check if the headers get installed during "make install". I couldn't find where in our code that is done. BT: yes Reviewed-By: Trust Me (cherry picked from commit 0cb5038a3e5d3a6b0c33d081b89c6fe47cfc0b1b) --- bin/syncqt | 10 ++++++++-- mkspecs/features/qt.prf | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/syncqt b/bin/syncqt index a3addd8..edabeca 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -840,9 +840,15 @@ foreach (@modules_to_sync) { $master_contents .= "#endif\n"; unless($showonly) { - unless ($lib eq "phonon") { + my @master_includes; + if ($lib eq "phonon") { + push @master_includes, "$out_basedir/include/phonon_compat/phonon/phonon"; + push @master_includes, "$out_basedir/include/phonon/Phonon/Phonon"; + } else { + push @master_includes, "$out_basedir/include/$lib/$lib"; + } + foreach my $master_include (@master_includes) { #generate the "master" include file - my $master_include = "$out_basedir/include/$lib/$lib"; $pri_install_files .= fixPaths($master_include, "$modules{$lib}") . " "; #get the master file installed too if($master_include && -e "$master_include") { open MASTERINCLUDE, "<$master_include"; diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 0c6e09a..dc833e7 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -149,8 +149,13 @@ for(QTLIB, $$list($$lower($$unique(QT)))) { else:isEqual(QTLIB, scripttools):qlib = QtScriptTools else:isEqual(QTLIB, testlib):qlib = QtTest else:isEqual(QTLIB, dbus):qlib = QtDBus - else:isEqual(QTLIB, phonon):qlib = phonon else:isEqual(QTLIB, webkit):qlib = QtWebKit + else:isEqual(QTLIB, phonon) { + qlib = phonon + INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon_compat/phonon + INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon_compat + INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon/Phonon + } else:isEqual(QTLIB, webkit):qlib = QtWebKit else:message("Unknown QT: $$QTLIB"):qlib = !isEmpty(qlib) { target_qt:isEqual(TARGET, qlib) { -- cgit v0.12 From df47e0d40290f5e40054a9612f75177d9ef8537a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 23 Sep 2009 14:51:23 +0200 Subject: Autotest: This test does requires internal builds (with autotests). Reviewed-By: TrustMe --- tests/auto/qkeysequence/qkeysequence.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qkeysequence/qkeysequence.pro b/tests/auto/qkeysequence/qkeysequence.pro index bd85402..d4779af 100644 --- a/tests/auto/qkeysequence/qkeysequence.pro +++ b/tests/auto/qkeysequence/qkeysequence.pro @@ -1,4 +1,5 @@ load(qttest_p4) +requires(contains(QT_CONFIG,private_tests)) SOURCES += tst_qkeysequence.cpp RESOURCES += qkeysequence.qrc \ No newline at end of file -- cgit v0.12 From a33c1ca39ef8cb2485dbde3c0454873f58c0b733 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 23 Sep 2009 15:01:44 +0200 Subject: Try to stabilize this test --- tests/auto/qcopchannel/tst_qcopchannel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qcopchannel/tst_qcopchannel.cpp b/tests/auto/qcopchannel/tst_qcopchannel.cpp index 93d037e..9a3be6c 100644 --- a/tests/auto/qcopchannel/tst_qcopchannel.cpp +++ b/tests/auto/qcopchannel/tst_qcopchannel.cpp @@ -49,6 +49,7 @@ #include #include +#include "../../shared/util.h" class tst_QCopChannel : public QObject { @@ -110,7 +111,7 @@ void tst_QCopChannel::sendreceivemp() testSend(channelName, "msg", "data"); QApplication::processEvents(); - QCOMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 1); QList args = spy.takeFirst(); QCOMPARE(args.at(0).toString(), QString("msg")); @@ -134,7 +135,7 @@ void tst_QCopChannel::sendreceivesp() QCOMPARE(spy.count(), 0); QCopChannel::send(channelName, "msg", "data"); QApplication::processEvents(); - QCOMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 1); QList args = spy.takeFirst(); QCOMPARE(args.at(0).toString(), QString("msg")); -- cgit v0.12 From 7dedc5699842d2651859e36b0ca843ec4d173056 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 23 Sep 2009 14:55:25 +0200 Subject: Fixed parsing of html header in the qtextcodec. The QTextCodec::codecForHtml used to expect http-equiv attribute before the charset attribute in the meta header, which is not always the case. Reviewed-by: Simon Hausmann --- src/corelib/codecs/qtextcodec.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 3ef9f7e..4f0e13c 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -1536,12 +1536,14 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba, QTextCodec *defaultCo if (!c) { QByteArray header = ba.left(512).toLower(); if ((pos = header.indexOf("http-equiv=")) != -1) { - pos = header.indexOf("charset=", pos) + int(strlen("charset=")); - if (pos != -1) { - int pos2 = header.indexOf('\"', pos+1); - QByteArray cs = header.mid(pos, pos2-pos); - // qDebug("found charset: %s", cs.data()); - c = QTextCodec::codecForName(cs); + if ((pos = header.lastIndexOf("meta ", pos)) != -1) { + pos = header.indexOf("charset=", pos) + int(strlen("charset=")); + if (pos != -1) { + int pos2 = header.indexOf('\"', pos+1); + QByteArray cs = header.mid(pos, pos2-pos); + // qDebug("found charset: %s", cs.data()); + c = QTextCodec::codecForName(cs); + } } } } -- cgit v0.12 From 2e27c5a11488d5b7aa6831ba30a8c11bf71fb07a Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 23 Sep 2009 09:11:56 +0200 Subject: Fix a warning about an unused variable. Reviewed-by: TrustMe --- src/corelib/kernel/qcoreapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index c575509..9a93685 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -345,7 +345,7 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver) } #elif defined(Q_OS_SYMBIAN) && defined (QT_NO_DEBUG) // no implementation in release builds, but keep the symbol present -void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver) +void QCoreApplicationPrivate::checkReceiverThread(QObject * /* receiver */) { } #endif -- cgit v0.12 From 5e11ae8dc8594f648105f8a62baf1b82c909fd2a Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 11 Aug 2009 08:39:12 +0200 Subject: Implement Qt::WA_AcceptTouchEvents on S60 Turning this attribute ends up calling RWindow::EnabledAdvancedPointers(), which tells Symbian to send us multiple pointer events with extended info. Reviewed-by: Jason Barron --- src/gui/kernel/qwidget.cpp | 2 +- src/gui/kernel/qwidget_p.h | 1 + src/gui/kernel/qwidget_s60.cpp | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 6f5781c..53ef682 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -10397,7 +10397,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; case Qt::WA_AcceptTouchEvents: -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) +#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_S60) if (on) d->registerTouchWindow(); #endif diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 5a9c48c..296c5b1 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -693,6 +693,7 @@ public: static QWidget *keyboardGrabber; void s60UpdateIsOpaque(); void reparentChildren(); + void registerTouchWindow(); #endif }; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 4fef020..2e6139b 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -299,6 +299,9 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de destroyw->ControlEnv()->AppUi()->RemoveFromStack(destroyw); CBase::Delete(destroyw); } + + if (q->testAttribute(Qt::WA_AcceptTouchEvents)) + registerTouchWindow(); } @@ -800,6 +803,15 @@ void QWidgetPrivate::setMask_sys(const QRegion& /* region */) } +void QWidgetPrivate::registerTouchWindow() +{ + Q_Q(QWidget); + if (q->testAttribute(Qt::WA_WState_Created) && q->windowType() != Qt::Desktop) { + RWindow *rwindow = static_cast(q->effectiveWinId()->DrawableWindow()); + rwindow->EnableAdvancedPointers(); + } +} + int QWidget::metric(PaintDeviceMetric m) const { Q_D(const QWidget); -- cgit v0.12 From 48d0f84958fdc2dcffab75f33842a9dbc3d4d7b1 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 11 Aug 2009 09:39:26 +0200 Subject: Implement advanced pointer handling on S60 Since we only get one pointer event at a time, we need to keep a list of all known touch points in QApplicationPrivate (otherwise the QTouchEvent won't contain enough points). The QApplication machinery can handle having inactive touch-points in the list, so at the moment we don't clear the list. We treat PointerNumber zero as the primary touch point, and only send regular mouse events for that pointer, never for the others. Reviewed-by: Jason Barron --- src/gui/kernel/qapplication_p.h | 5 +++ src/gui/kernel/qapplication_s60.cpp | 76 ++++++++++++++++++++++++++++++++++++- src/gui/kernel/qt_s60_p.h | 1 + 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 707caaa..aec21fd 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -576,6 +576,11 @@ public: void _q_readRX71MultiTouchEvents(); #endif +#if defined(Q_WS_S60) + int maxTouchPressure; + QList appAllTouchPoints; +#endif + private: #ifdef Q_WS_QWS QMap maxWindowRects; diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a5d07fd..58aca83 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -368,8 +368,77 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons m_previousEventLongTap = true; } +void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event) +{ + QApplicationPrivate *d = QApplicationPrivate::instance(); + + QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget); + + while (d->appAllTouchPoints.count() <= event->PointerNumber()) + d->appAllTouchPoints.append(QTouchEvent::TouchPoint(d->appAllTouchPoints.count())); + + Qt::TouchPointStates allStates = 0; + for (int i = 0; i < d->appAllTouchPoints.count(); ++i) { + QTouchEvent::TouchPoint &touchPoint = d->appAllTouchPoints[i]; + + if (touchPoint.id() == event->PointerNumber()) { + Qt::TouchPointStates state; + switch (event->iType) { + case TPointerEvent::EButton1Down: + case TPointerEvent::EEnterHighPressure: + state = Qt::TouchPointPressed; + break; + case TPointerEvent::EButton1Up: + case TPointerEvent::EExitCloseProximity: + state = Qt::TouchPointReleased; + break; + case TPointerEvent::EDrag: + state = Qt::TouchPointMoved; + break; + default: + // how likely is this to happen? + state = Qt::TouchPointStationary; + break; + } + if (event->PointerNumber() == 0) + state |= Qt::TouchPointPrimary; + touchPoint.setState(state); + + QPointF screenPos = QPointF(event->iPosition.iX, event->iPosition.iY); + touchPoint.setScreenPos(screenPos); + touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(), + screenPos.y() / screenGeometry.height())); + + touchPoint.setPressure(event->Pressure() / qreal(d->maxTouchPressure)); + } else if (touchPoint.state() != Qt::TouchPointReleased) { + // all other active touch points should be marked as stationary + touchPoint.setState(Qt::TouchPointStationary); + } + + allStates |= touchPoint.state(); + } + + if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased) { + // all touch points released + d->appAllTouchPoints.clear(); + } + + QApplicationPrivate::translateRawTouchEvent(qwidget, + QTouchEvent::TouchScreen, + d->appAllTouchPoints); +} + void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) { + if (pEvent.IsAdvancedPointerEvent()) { + const TAdvancedPointerEvent *advancedPointerEvent = pEvent.AdvancedPointerEvent(); + translateAdvancedPointerEvent(advancedPointerEvent); + if (advancedPointerEvent->PointerNumber() != 0) { + // only send mouse events for the first touch point + return; + } + } + m_longTapDetector->PointerEventL(pEvent); QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent)); } @@ -1441,9 +1510,12 @@ TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym) } } - void QApplicationPrivate::initializeMultitouch_sys() -{ } +{ + if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone) + maxTouchPressure = KMaxTInt; +} + void QApplicationPrivate::cleanupMultitouch_sys() { } diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index aa39f9d..9939f2c 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -167,6 +167,7 @@ private: TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent); bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent); void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ); + void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event); private: QWidget *qwidget; -- cgit v0.12 From 7dcf984f85a3a75ce4c078cc931bd9d2304bc235 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 23 Sep 2009 08:31:23 +0200 Subject: Modify functions for native pixmap data conversion on Symbian. We need a way to support converion to and from multiple native pixmap types from multiple pixmap backends. Instead of adding more virtual functions to QPixmapData, make the existing one more generic but pass an opaque pointer and a type and do some internal casting. Currently this function is Symbian only, but could easily be extended to work on other platforms. Reviewed-by: Aleksandar Babic Reviewed-by: Jani Hautakangas --- src/gui/image/qpixmap.h | 6 +- src/gui/image/qpixmap_s60.cpp | 410 +++++++++++++++++++++--------------------- src/gui/image/qpixmap_s60_p.h | 21 ++- src/gui/image/qpixmapdata.cpp | 5 +- src/gui/image/qpixmapdata_p.h | 15 +- src/openvg/qpixmapdata_vg.cpp | 266 ++++++++++++++------------- src/openvg/qpixmapdata_vg_p.h | 4 +- 7 files changed, 376 insertions(+), 351 deletions(-) diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 2ed65ea..a891637 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -161,10 +161,8 @@ public: #endif #if defined(Q_OS_SYMBIAN) - enum ConversionMode { CopyData, DuplicateHandle }; - - CFbsBitmap *toSymbianCFbsBitmap(ConversionMode mode = DuplicateHandle) const; - static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode = DuplicateHandle); + CFbsBitmap *toSymbianCFbsBitmap() const; + static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap); RSgImage* toSymbianRSgImage() const; static QPixmap fromSymbianRSgImage(RSgImage *sgImage); #endif diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 303e923..cab6116 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -297,231 +297,55 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h) } /*! - \enum QPixmap::ConversionMode - - \bold{Symbian only:} This enum defines how the conversion between \c - CFbsBitmap and QPixmap is performed. - - \warning This enum is only available on Symbian. - - \value CopyData Copied CFbsBitmap data. - - \value DuplicateHandle Duplicates CFbsBitmap handle. This also means - that pixmap data will be explicitly shared. - - \sa fromSymbianCFbsBitmap(), toSymbianCFbsBitmap() -*/ - - -/*! - \fn CFbsBitmap *QPixmap::toSymbianCFbsBitmap(ConversionMode mode) + \fn CFbsBitmap *QPixmap::toSymbianCFbsBitmap() \since 4.6 - Creates \c CFbsBitmap that is equivalent to the QPixmap, based on - the given \a mode. If the creation then this function returns 0. + Creates a \c CFbsBitmap that is equivalent to the QPixmap. Internally this + function will try to duplicate the handle instead of copying the data, + however in scenarios where this is not possible the data will be copied. + If the creation fails or the pixmap is null, then this function returns 0. It is the caller's responsibility to release the \c CFbsBitmap data after use either by deleting the bitmap or calling \c Reset(). - \warning On S60 3.1 and S60 3.2 conversion mode will always be CopyData - if QPixmap pixels have alpha values. + \warning On S60 3.1 and S60 3.2, semi-transparent pixmaps are always copied + and not duplicated. \warning This function is only available on Symbian OS. \sa fromSymbianCFbsBitmap() */ -CFbsBitmap *QPixmap::toSymbianCFbsBitmap(ConversionMode mode) const +CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const { - QS60PixmapData *s60data = static_cast(data.data()); - - if (isNull() || !s60data->cfbsBitmap) + QPixmapData *data = pixmapData(); + if (data->isNull()) return 0; - bool convertToArgb32 = false; - - QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion(); - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) { - // Convert argb32_premultiplied to argb32 since Symbian 9.2 and Symbian 9.3 do - // not support premultipied format. - - if (s60data->image.format() == QImage::Format_ARGB32_Premultiplied) { - mode = CopyData; - convertToArgb32 = true; - } - } - - CFbsBitmap *bitmap = 0; - - TDisplayMode displayMode = s60data->cfbsBitmap->DisplayMode(); - - if(displayMode == EGray2) { - //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid - //So invert mono bitmaps so that masks work correctly. - s60data->image.invertPixels(); - mode = CopyData; - } - - if (mode == CopyData) { - QImage source; - - if (convertToArgb32) { - source = s60data->image.convertToFormat(QImage::Format_ARGB32); - displayMode = EColor16MA; - } else { - source = s60data->image; - } - - CFbsBitmap *newBitmap = createSymbianCFbsBitmap(TSize(source.width(), source.height()), displayMode); - const uchar *sptr = source.bits(); - s60data->symbianBitmapDataAccess->beginDataAccess(newBitmap); - - uchar *dptr = (uchar*)newBitmap->DataAddress(); - Mem::Copy(dptr, sptr, source.numBytes()); - - s60data->symbianBitmapDataAccess->endDataAccess(newBitmap); - - bitmap = newBitmap; - } else { - - QT_TRAP_THROWING(bitmap = new (ELeave) CFbsBitmap); - - TInt err = bitmap->Duplicate(s60data->cfbsBitmap->Handle()); - if (err != KErrNone) { - qWarning("Could not duplicate CFbsBitmap"); - delete bitmap; - bitmap = 0; - } - } - - if(displayMode == EGray2) { - // restore pixels - s60data->image.invertPixels(); - } - - return bitmap; + return reinterpret_cast(data->toNativeType(QPixmapData::FbsBitmap)); } /*! - \fn QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode) + \fn QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) \since 4.6 - Creates a QPixmap from native \c CFbsBitmap \a bitmap. The conversion - is based on the specified \a mode. Conversion mode is always QPixmap::CopyData - if given \a bitmap does not have display mode of TDisplayMode::EGray2, - \c TDisplayMode::EColor16MU or \c TDisplayMode::EColor16MAP. - + Creates a QPixmap from a \c CFbsBitmap \a bitmap. Internally this function + will try to duplicate the bitmap handle instead of copying the data, however + in scenarios where this is not possible the data will be copied. + To be sure that QPixmap does not modify your original instance, you should + make a copy of your \c CFbsBitmap before calling this function. If the CFbsBitmap is not valid this function will return a null QPixmap. \warning This function is only available on Symbian OS. \sa toSymbianCFbsBitmap(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} */ -QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode) +QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) { - if (bitmap) { - - bool deleteSourceBitmap = false; - -#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE - - // Rasterize extended bitmaps - - TUid extendedBitmapType = bitmap->ExtendedBitmapType(); - if (extendedBitmapType != KNullUid) { - CFbsBitmap *rasterBitmap = createSymbianCFbsBitmap(bitmap->SizeInPixels(), EColor16MA); - - CFbsBitmapDevice *rasterBitmapDev = 0; - QT_TRAP_THROWING(rasterBitmapDev = CFbsBitmapDevice::NewL(rasterBitmap)); - - CFbsBitGc *rasterBitmapGc = 0; - TInt err = rasterBitmapDev->CreateContext(rasterBitmapGc); - if (err != KErrNone) { - delete rasterBitmap; - delete rasterBitmapDev; - rasterBitmapDev = 0; - return QPixmap(); - } - - rasterBitmapGc->BitBlt(TPoint( 0, 0), bitmap); - - bitmap = rasterBitmap; - - delete rasterBitmapDev; - delete rasterBitmapGc; - - rasterBitmapDev = 0; - rasterBitmapGc = 0; - - deleteSourceBitmap = true; - } -#endif - - - deleteSourceBitmap = bitmap->IsCompressedInRAM(); - CFbsBitmap *sourceBitmap = uncompress(bitmap); - - TDisplayMode displayMode = sourceBitmap->DisplayMode(); - QImage::Format format = qt_TDisplayMode2Format(displayMode); - - QImage::Format opaqueFormat = QNativeImage::systemFormat(); - QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied; - - if (format != opaqueFormat && format != alphaFormat && format != QImage::Format_MonoLSB) - mode = CopyData; - - - QPixmapData::PixelType type = (format!=QImage::Format_MonoLSB) - ? QPixmapData::PixmapType - : QPixmapData::BitmapType; - - QS60PixmapData *pixmapData = 0; - - if (mode == CopyData) { - - TSize size = sourceBitmap->SizeInPixels(); - - QSymbianBitmapDataAccess da; - da.beginDataAccess(sourceBitmap); - uchar *bytes = (uchar*)sourceBitmap->DataAddress(); - QImage img = QImage(bytes, size.iWidth, size.iHeight, format); - da.endDataAccess(sourceBitmap); - - pixmapData = new QS60PixmapData(type); - pixmapData->fromImage(img, Qt::AutoColor); - - if(deleteSourceBitmap) - delete sourceBitmap; - - if(displayMode == EGray2) { - //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid - //So invert mono bitmaps so that masks work correctly. - pixmapData->image.invertPixels(); - } - } else { - CFbsBitmap* duplicate = 0; - QT_TRAP_THROWING(duplicate = new (ELeave) CFbsBitmap); - - TInt err = duplicate->Duplicate(sourceBitmap->Handle()); - if (err != KErrNone) { - qWarning("Could not duplicate CFbsBitmap"); - - if(deleteSourceBitmap) - delete sourceBitmap; - - delete duplicate; - return QPixmap(); - } - - pixmapData = new QS60PixmapData(type); - pixmapData->fromSymbianBitmap(duplicate); - - if(deleteSourceBitmap) - delete sourceBitmap; - } - - return QPixmap(pixmapData); - } + if (!bitmap) + return QPixmap(); - return QPixmap(); + QPixmap pixmap; + pixmap.pixmapData()->fromNativeType(reinterpret_cast(bitmap), QPixmapData::FbsBitmap); + return pixmap; } QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), @@ -921,7 +745,7 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) return QPixmap(); QPixmap pixmap; - pixmap.pixmapData()->fromRSgImage(sgImage); + pixmap.pixmapData()->fromNativeType(reinterpret_cast(sgImage), QPixmapData::SgImage); return pixmap; } @@ -949,9 +773,193 @@ RSgImage *QPixmap::toSymbianRSgImage() const if (isNull()) return 0; - RSgImage *sgImage = pixmapData()->toRSgImage(); + RSgImage *sgImage = reinterpret_cast(pixmapData()->toNativeType(QPixmapData::SgImage)); return sgImage; } +void* QS60PixmapData::toNativeType(NativeType type) +{ + if (type == QPixmapData::SgImage) { + return 0; + } else if (type == QPixmapData::FbsBitmap) { + + if (isNull() || !cfbsBitmap) + return 0; + + bool convertToArgb32 = false; + bool needsCopy = false; + + QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion(); + if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) { + // Convert argb32_premultiplied to argb32 since Symbian 9.2 and Symbian 9.3 do + // not support premultipied format. + + if (image.format() == QImage::Format_ARGB32_Premultiplied) { + needsCopy = true; + convertToArgb32 = true; + } + } + + CFbsBitmap *bitmap = 0; + + TDisplayMode displayMode = cfbsBitmap->DisplayMode(); + + if(displayMode == EGray2) { + //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid + //So invert mono bitmaps so that masks work correctly. + image.invertPixels(); + needsCopy = true; + } + + if (needsCopy) { + QImage source; + + if (convertToArgb32) { + source = image.convertToFormat(QImage::Format_ARGB32); + displayMode = EColor16MA; + } else { + source = image; + } + + CFbsBitmap *newBitmap = createSymbianCFbsBitmap(TSize(source.width(), source.height()), displayMode); + const uchar *sptr = source.bits(); + symbianBitmapDataAccess->beginDataAccess(newBitmap); + + uchar *dptr = (uchar*)newBitmap->DataAddress(); + Mem::Copy(dptr, sptr, source.numBytes()); + + symbianBitmapDataAccess->endDataAccess(newBitmap); + + bitmap = newBitmap; + } else { + + QT_TRAP_THROWING(bitmap = new (ELeave) CFbsBitmap); + + TInt err = bitmap->Duplicate(cfbsBitmap->Handle()); + if (err != KErrNone) { + qWarning("Could not duplicate CFbsBitmap"); + delete bitmap; + bitmap = 0; + } + } + + if(displayMode == EGray2) { + // restore pixels + image.invertPixels(); + } + + return reinterpret_cast(bitmap); + + } + + return 0; +} + +void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) +{ + if (nativeType == QPixmapData::SgImage) { + return; + } else if (nativeType == QPixmapData::FbsBitmap && pixmap) { + + CFbsBitmap *bitmap = reinterpret_cast(pixmap); + + bool deleteSourceBitmap = false; + bool needsCopy = false; + +#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE + + // Rasterize extended bitmaps + + TUid extendedBitmapType = bitmap->ExtendedBitmapType(); + if (extendedBitmapType != KNullUid) { + CFbsBitmap *rasterBitmap = createSymbianCFbsBitmap(bitmap->SizeInPixels(), EColor16MA); + + CFbsBitmapDevice *rasterBitmapDev = 0; + QT_TRAP_THROWING(rasterBitmapDev = CFbsBitmapDevice::NewL(rasterBitmap)); + + CFbsBitGc *rasterBitmapGc = 0; + TInt err = rasterBitmapDev->CreateContext(rasterBitmapGc); + if (err != KErrNone) { + delete rasterBitmap; + delete rasterBitmapDev; + rasterBitmapDev = 0; + return; + } + + rasterBitmapGc->BitBlt(TPoint( 0, 0), bitmap); + + bitmap = rasterBitmap; + + delete rasterBitmapDev; + delete rasterBitmapGc; + + rasterBitmapDev = 0; + rasterBitmapGc = 0; + + deleteSourceBitmap = true; + } +#endif + + + deleteSourceBitmap = bitmap->IsCompressedInRAM(); + CFbsBitmap *sourceBitmap = uncompress(bitmap); + + TDisplayMode displayMode = sourceBitmap->DisplayMode(); + QImage::Format format = qt_TDisplayMode2Format(displayMode); + + QImage::Format opaqueFormat = QNativeImage::systemFormat(); + QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied; + + if (format != opaqueFormat && format != alphaFormat && format != QImage::Format_MonoLSB) + needsCopy = true; + + + type = (format != QImage::Format_MonoLSB) + ? QPixmapData::PixmapType + : QPixmapData::BitmapType; + + if (needsCopy) { + + TSize size = sourceBitmap->SizeInPixels(); + + QSymbianBitmapDataAccess da; + da.beginDataAccess(sourceBitmap); + uchar *bytes = (uchar*)sourceBitmap->DataAddress(); + QImage img = QImage(bytes, size.iWidth, size.iHeight, format); + da.endDataAccess(sourceBitmap); + + fromImage(img, Qt::AutoColor); + + if(deleteSourceBitmap) + delete sourceBitmap; + + if(displayMode == EGray2) { + //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid + //So invert mono bitmaps so that masks work correctly. + image.invertPixels(); + } + } else { + CFbsBitmap* duplicate = 0; + QT_TRAP_THROWING(duplicate = new (ELeave) CFbsBitmap); + + TInt err = duplicate->Duplicate(sourceBitmap->Handle()); + if (err != KErrNone) { + qWarning("Could not duplicate CFbsBitmap"); + + if(deleteSourceBitmap) + delete sourceBitmap; + + delete duplicate; + return; + } + + fromSymbianBitmap(duplicate); + + if(deleteSourceBitmap) + delete sourceBitmap; + } + } +} + QT_END_NAMESPACE diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index 21f1bb3..4498c05 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -66,17 +66,17 @@ class QSymbianBitmapDataAccess; class QSymbianFbsHeapLock { public: - + enum LockAction { Unlock }; - + explicit QSymbianFbsHeapLock(LockAction a); ~QSymbianFbsHeapLock(); - void relock(); - + void relock(); + private: - + LockAction action; bool wasLocked; }; @@ -102,13 +102,16 @@ public: void beginDataAccess(); void endDataAccess(bool readOnly=false) const; + void* toNativeType(NativeType type); + void fromNativeType(void* pixmap, NativeType type); + private: - void release(); - void fromSymbianBitmap(CFbsBitmap* bitmap); - bool initSymbianBitmapContext(); + void release(); + void fromSymbianBitmap(CFbsBitmap* bitmap); + bool initSymbianBitmapContext(); QSymbianBitmapDataAccess *symbianBitmapDataAccess; - + CFbsBitmap *cfbsBitmap; CFbsBitmapDevice *bitmapDevice; CBitmapContext *bitmapContext; diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 65899a4..93fc2eb 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -224,14 +224,15 @@ QImage* QPixmapData::buffer() } #if defined(Q_OS_SYMBIAN) -RSgImage* QPixmapData::toRSgImage() +void* QPixmapData::toNativeType(NativeType /* type */) { return 0; } -void QPixmapData::fromRSgImage(RSgImage* rsgImage) +void QPixmapData::fromNativeType(void* /* pixmap */, NativeType /* typre */) { return; } #endif + QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 5920a06..3e85236 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -56,10 +56,6 @@ #include #include -#if defined(Q_OS_SYMBIAN) -class RSgImage; -#endif - QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QPixmapData @@ -70,6 +66,12 @@ public: // Must match QPixmap::Type PixmapType, BitmapType }; +#if defined(Q_OS_SYMBIAN) + enum NativeType { + FbsBitmap, + SgImage + }; +#endif enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass, OpenGLClass, OpenVGClass, CustomClass = 1024 }; @@ -114,8 +116,8 @@ public: inline bool isNull() const { return is_null; } #if defined(Q_OS_SYMBIAN) - virtual RSgImage* toRSgImage(); - virtual void fromRSgImage(RSgImage* rsgImage); + virtual void* toNativeType(NativeType type); + virtual void fromNativeType(void* pixmap, NativeType type); #endif protected: @@ -129,6 +131,7 @@ private: friend class QPixmap; friend class QGLContextPrivate; friend class QX11PixmapData; + friend class QS60PixmapData; friend class QGLTextureCache; //Needs to check the reference count friend class QExplicitlySharedDataPointer; diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 53975d7..38a89e6 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -381,167 +381,179 @@ void QVGPixmapData::cleanup() source = QImage(); } -void QVGPixmapData::fromRSgImage(RSgImage* sgImage) +void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) { - Q_UNUSED(sgImage); #if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL) - // when "0" used as argument then - // default display, context are used - if (!context) - context = qt_vg_create_context(0); + if (type == QPixmapData::SgImage && pixmap) { + RSgImage *sgImage = reinterpret_cast(pixmap); + // when "0" used as argument then + // default display, context are used + if (!context) + context = qt_vg_create_context(0); - if (vgImage != VG_INVALID_HANDLE) { - vgDestroyImage(vgImage); - vgImage = VG_INVALID_HANDLE; - } - if (vgImageOpacity != VG_INVALID_HANDLE) { - vgDestroyImage(vgImageOpacity); - vgImageOpacity = VG_INVALID_HANDLE; - } + if (vgImage != VG_INVALID_HANDLE) { + vgDestroyImage(vgImage); + vgImage = VG_INVALID_HANDLE; + } + if (vgImageOpacity != VG_INVALID_HANDLE) { + vgDestroyImage(vgImageOpacity); + vgImageOpacity = VG_INVALID_HANDLE; + } - TInt err = 0; + TInt err = 0; - err = SgDriver::Open(); - if(err != KErrNone) { - cleanup(); - return; - } + err = SgDriver::Open(); + if(err != KErrNone) { + cleanup(); + return; + } - if(sgImage->IsNull()) { - cleanup(); - SgDriver::Close(); - return; - } + if(sgImage->IsNull()) { + cleanup(); + SgDriver::Close(); + return; + } - TSgImageInfo sgImageInfo; - err = sgImage->GetInfo(sgImageInfo); - if(err != KErrNone) { - cleanup(); - SgDriver::Close(); - return; - } + TSgImageInfo sgImageInfo; + err = sgImage->GetInfo(sgImageInfo); + if(err != KErrNone) { + cleanup(); + SgDriver::Close(); + return; + } - pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR"); - pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); - pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); + pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR"); + pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); + pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); - if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { - cleanup(); - SgDriver::Close(); - return; - } + if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { + cleanup(); + SgDriver::Close(); + return; + } - const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; - EGLImageKHR eglImage = eglCreateImageKHR(context->display(), - EGL_NO_CONTEXT, - EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer)sgImage, - (EGLint*)KEglImageAttribs); + const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; + EGLImageKHR eglImage = eglCreateImageKHR(context->display(), + EGL_NO_CONTEXT, + EGL_NATIVE_PIXMAP_KHR, + (EGLClientBuffer)sgImage, + (EGLint*)KEglImageAttribs); + + if(eglGetError() != EGL_SUCCESS) { + cleanup(); + SgDriver::Close(); + return; + } - if(eglGetError() != EGL_SUCCESS) { - cleanup(); - SgDriver::Close(); - return; - } + vgImage = vgCreateEGLImageTargetKHR(eglImage); + if(vgGetError() != VG_NO_ERROR) { + cleanup(); + eglDestroyImageKHR(context->display(), eglImage); + SgDriver::Close(); + return; + } - vgImage = vgCreateEGLImageTargetKHR(eglImage); - if(vgGetError() != VG_NO_ERROR) { - cleanup(); + w = sgImageInfo.iSizeInPixels.iWidth; + h = sgImageInfo.iSizeInPixels.iHeight; + d = 32; // We always use ARGB_Premultiplied for VG pixmaps. + is_null = (w <= 0 || h <= 0); + source = QImage(); + recreate = false; + setSerialNumber(++qt_vg_pixmap_serial); + // release stuff eglDestroyImageKHR(context->display(), eglImage); SgDriver::Close(); - return; - } + } else if (type == QPixmapData::FbsBitmap) { - w = sgImageInfo.iSizeInPixels.iWidth; - h = sgImageInfo.iSizeInPixels.iHeight; - d = 32; // We always use ARGB_Premultiplied for VG pixmaps. - is_null = (w <= 0 || h <= 0); - source = QImage(); - recreate = false; - setSerialNumber(++qt_vg_pixmap_serial); - // release stuff - eglDestroyImageKHR(context->display(), eglImage); - SgDriver::Close(); + } #else + Q_UNUSED(pixmap); + Q_UNUSED(type); #endif } -RSgImage* QVGPixmapData::toRSgImage() +void* QVGPixmapData::toNativeType(NativeType type) { #if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL) - toVGImage(); - - if(!isValid() || vgImage == VG_INVALID_HANDLE) - return 0; - - TInt err = 0; + if (type == QPixmapData::SgImage) { + toVGImage(); + + if(!isValid() || vgImage == VG_INVALID_HANDLE) + return 0; + + TInt err = 0; + + err = SgDriver::Open(); + if(err != KErrNone) + return 0; + + TSgImageInfo sgInfo; + sgInfo.iPixelFormat = EUidPixelFormatARGB_8888_PRE; + sgInfo.iSizeInPixels.SetSize(w, h); + sgInfo.iUsage = ESgUsageOpenVgImage | ESgUsageOpenVgTarget; + sgInfo.iShareable = ETrue; + sgInfo.iCpuAccess = ESgCpuAccessNone; + sgInfo.iScreenId = KSgScreenIdMain; //KSgScreenIdAny; + sgInfo.iUserAttributes = NULL; + sgInfo.iUserAttributeCount = 0; + + RSgImage *sgImage = q_check_ptr(new RSgImage()); + err = sgImage->Create(sgInfo, NULL, NULL); + if(err != KErrNone) { + SgDriver::Close(); + return 0; + } - err = SgDriver::Open(); - if(err != KErrNone) - return 0; + pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR"); + pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); + pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); - TSgImageInfo sgInfo; - sgInfo.iPixelFormat = EUidPixelFormatARGB_8888_PRE; - sgInfo.iSizeInPixels.SetSize(w, h); - sgInfo.iUsage = ESgUsageOpenVgImage | ESgUsageOpenVgTarget; - sgInfo.iShareable = ETrue; - sgInfo.iCpuAccess = ESgCpuAccessNone; - sgInfo.iScreenId = KSgScreenIdMain; //KSgScreenIdAny; - sgInfo.iUserAttributes = NULL; - sgInfo.iUserAttributeCount = 0; - - RSgImage *sgImage = q_check_ptr(new RSgImage()); - err = sgImage->Create(sgInfo, NULL, NULL); - if(err != KErrNone) { - SgDriver::Close(); - return 0; - } + if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { + SgDriver::Close(); + return 0; + } - pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR"); - pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); - pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); + const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; + EGLImageKHR eglImage = eglCreateImageKHR(context->display(), + EGL_NO_CONTEXT, + EGL_NATIVE_PIXMAP_KHR, + (EGLClientBuffer)sgImage, + (EGLint*)KEglImageAttribs); + if(eglGetError() != EGL_SUCCESS) { + sgImage->Close(); + SgDriver::Close(); + return 0; + } - if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { - SgDriver::Close(); - return 0; - } + VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage); + if(vgGetError() != VG_NO_ERROR) { + eglDestroyImageKHR(context->display(), eglImage); + sgImage->Close(); + SgDriver::Close(); + return 0; + } - const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; - EGLImageKHR eglImage = eglCreateImageKHR(context->display(), - EGL_NO_CONTEXT, - EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer)sgImage, - (EGLint*)KEglImageAttribs); - if(eglGetError() != EGL_SUCCESS) { - sgImage->Close(); - SgDriver::Close(); - return 0; - } + vgCopyImage(dstVgImage, 0, 0, + vgImage, 0, 0, + w, h, VG_FALSE); - VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage); - if(vgGetError() != VG_NO_ERROR) { + if(vgGetError() != VG_NO_ERROR) { + sgImage->Close(); + sgImage = 0; + } + // release stuff + vgDestroyImage(dstVgImage); eglDestroyImageKHR(context->display(), eglImage); - sgImage->Close(); SgDriver::Close(); + return reinterpret_cast(sgImage); + } else if (type == QPixmapData::FbsBitmap) { return 0; } - - vgCopyImage(dstVgImage, 0, 0, - vgImage, 0, 0, - w, h, VG_FALSE); - - if(vgGetError() != VG_NO_ERROR) { - sgImage->Close(); - sgImage = 0; - } - // release stuff - vgDestroyImage(dstVgImage); - eglDestroyImageKHR(context->display(), eglImage); - SgDriver::Close(); - return sgImage; #else + Q_UNUSED(type); return 0; #endif } #endif //Q_OS_SYMBIAN + QT_END_NAMESPACE diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h index 122f596..99115df 100644 --- a/src/openvg/qpixmapdata_vg_p.h +++ b/src/openvg/qpixmapdata_vg_p.h @@ -95,8 +95,8 @@ public: QSize size() const { return QSize(w, h); } #if defined(Q_OS_SYMBIAN) - RSgImage* toRSgImage(); - void fromRSgImage(RSgImage* sgImage); + void* toNativeType(NativeType type); + void fromNativeType(void* pixmap, NativeType type); #endif protected: -- cgit v0.12 From 2966b2a95b0d7d161a6dc1a6edab3d6aa6edf004 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 22 Sep 2009 14:26:21 +0200 Subject: When using style sheets, the focus flag was not propagated to the children of complex widgets. Reviewed-by: Olivier --- src/gui/styles/qstylesheetstyle.cpp | 2 +- .../auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 55 ++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index e33b255..def82ae 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -1759,7 +1759,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QWidget *w, const QStyleOption *o QStyle::SubControl subControl = knownPseudoElements[pseudoElement].subControl; if (!(complex->activeSubControls & subControl)) - state = QStyle::State(state & (QStyle::State_Enabled | QStyle::State_Horizontal)); + state &= (QStyle::State_Enabled | QStyle::State_Horizontal | QStyle::State_HasFocus); } switch (pseudoElement) { diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index e7d804a..e8fbd86 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -95,6 +95,7 @@ private slots: void embeddedFonts(); void opaquePaintEvent_data(); void opaquePaintEvent(); + void complexWidgetFocus(); void task188195_baseBackground(); void task232085_spinBoxLineEditBg(); @@ -1447,6 +1448,60 @@ void tst_QStyleSheetStyle::opaquePaintEvent() QCOMPARE(cl.autoFillBackground(), !styled ); } +void tst_QStyleSheetStyle::complexWidgetFocus() +{ + // This test is a simplified version of the focusColors() test above. + + // Tests if colors can be changed by altering the focus of the widget. + // To avoid messy pixel-by-pixel comparison, we assume that the goal + // is reached if at least ten pixels of the right color can be found in + // the image. + // For this reason, we use unusual and extremely ugly colors! :-) + + QDialog frame; + // We only want to test the buttons colors. + frame.setStyleSheet("*:focus { background: black; color: black } " + "QSpinBox::up-button:focus, QSpinBox::down-button:focus { width: 15px; height: 15px; background: #e8ff66; color: #ff0084 } " + "QSpinBox::up-arrow:focus, QSpinBox::down-arrow:focus { width: 7px; height: 7px; background: #ff0084 } " + "QComboBox::drop-down:focus { background: #e8ff66; color: #ff0084 } " + "QComboBox::down-arrow:focus { width: 7px; height: 7px; background: #ff0084; color: #e8ff66 }"); + + QList widgets; + widgets << new QSpinBox; + widgets << new QComboBox; + + QLayout* layout = new QGridLayout; + layout->addWidget(new QLineEdit); // Avoids initial focus. + foreach (QWidget *widget, widgets) + layout->addWidget(widget); + frame.setLayout(layout); + + frame.show(); + QTest::qWaitForWindowShown(&frame); + QApplication::setActiveWindow(&frame); + foreach (QWidget *widget, widgets) { + widget->setFocus(); + QApplication::processEvents(); + + QImage image(frame.width(), frame.height(), QImage::Format_ARGB32); + frame.render(&image); + if (image.depth() < 24) { + QSKIP("Test doesn't support color depth < 24", SkipAll); + } + + QVERIFY2(testForColors(image, QColor(0xe8, 0xff, 0x66)), + (QString::fromLatin1(widget->metaObject()->className()) + + " did not contain background color #e8ff66, using style " + + QString::fromLatin1(qApp->style()->metaObject()->className())) + .toLocal8Bit().constData()); + QVERIFY2(testForColors(image, QColor(0xff, 0x00, 0x84)), + (QString::fromLatin1(widget->metaObject()->className()) + + " did not contain text color #ff0084, using style " + + QString::fromLatin1(qApp->style()->metaObject()->className())) + .toLocal8Bit().constData()); + } +} + void tst_QStyleSheetStyle::task188195_baseBackground() { QTreeView tree; -- cgit v0.12 From e97b99f249ed65c6cedfc23f751a9834641271cb Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 23 Sep 2009 14:52:08 +0200 Subject: Added QSlider to tst_QStyleSheetStyle::complexWidgetFocus. When using style sheets, QSlider::handle couldn't be customized if QSlider::groove wasn't. QComboBox::down-arrow:focus wasn't properly drawn. Reviewed-by: Olivier --- src/gui/styles/qstylesheetstyle.cpp | 20 +++++++++++++------- src/gui/styles/qwindowsstyle.cpp | 2 ++ tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 12 +++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index def82ae..0f3a88b 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3136,19 +3136,25 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC if (const QStyleOptionSlider *slider = qstyleoption_cast(opt)) { rule.drawRule(p, opt->rect); - QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove); - if (!subRule.hasDrawable()) { - baseStyle()->drawComplexControl(cc, slider, p, w); - return; + QRenderRule grooveSubRule = renderRule(w, opt, PseudoElement_SliderGroove); + QRenderRule handleSubRule = renderRule(w, opt, PseudoElement_SliderHandle); + if (!grooveSubRule.hasDrawable()) { + QStyleOptionSlider slOpt(*slider); + bool handleHasRule = handleSubRule.hasDrawable(); + // If the style specifies a different handler rule, draw the groove without the handler. + if (handleHasRule) + slOpt.subControls &= ~SC_SliderHandle; + baseStyle()->drawComplexControl(cc, &slOpt, p, w); + if (!handleHasRule) + return; } QRect gr = subControlRect(cc, opt, SC_SliderGroove, w); if (slider->subControls & SC_SliderGroove) { - subRule.drawRule(p, gr); + grooveSubRule.drawRule(p, gr); } if (slider->subControls & SC_SliderHandle) { - QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderHandle); QRect hr = subControlRect(cc, opt, SC_SliderHandle, w); QRenderRule subRule1 = renderRule(w, opt, PseudoElement_SliderSubPage); @@ -3169,7 +3175,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC subRule2.drawRule(p, r); } - subRule.drawRule(p, subRule.boxRect(hr, Margin)); + handleSubRule.drawRule(p, grooveSubRule.boxRect(hr, Margin)); } if (slider->subControls & SC_SliderTickmarks) { diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 2ed9303..0f72440 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -3030,6 +3030,8 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp ar.adjust(2, 2, -2, -2); if (opt->state & State_Enabled) flags |= State_Enabled; + if (opt->state & State_HasFocus) + flags |= State_HasFocus; if (sunkenArrow) flags |= State_Sunken; diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index e8fbd86..50bb846 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -1459,16 +1459,15 @@ void tst_QStyleSheetStyle::complexWidgetFocus() // For this reason, we use unusual and extremely ugly colors! :-) QDialog frame; - // We only want to test the buttons colors. frame.setStyleSheet("*:focus { background: black; color: black } " - "QSpinBox::up-button:focus, QSpinBox::down-button:focus { width: 15px; height: 15px; background: #e8ff66; color: #ff0084 } " "QSpinBox::up-arrow:focus, QSpinBox::down-arrow:focus { width: 7px; height: 7px; background: #ff0084 } " - "QComboBox::drop-down:focus { background: #e8ff66; color: #ff0084 } " - "QComboBox::down-arrow:focus { width: 7px; height: 7px; background: #ff0084; color: #e8ff66 }"); + "QComboBox::down-arrow:focus { width: 7px; height: 7px; background: #ff0084 }" + "QSlider::handle:horizontal:focus { width: 7px; height: 7px; background: #ff0084 } "); QList widgets; widgets << new QSpinBox; widgets << new QComboBox; + widgets << new QSlider(Qt::Horizontal); QLayout* layout = new QGridLayout; layout->addWidget(new QLineEdit); // Avoids initial focus. @@ -1489,11 +1488,6 @@ void tst_QStyleSheetStyle::complexWidgetFocus() QSKIP("Test doesn't support color depth < 24", SkipAll); } - QVERIFY2(testForColors(image, QColor(0xe8, 0xff, 0x66)), - (QString::fromLatin1(widget->metaObject()->className()) - + " did not contain background color #e8ff66, using style " - + QString::fromLatin1(qApp->style()->metaObject()->className())) - .toLocal8Bit().constData()); QVERIFY2(testForColors(image, QColor(0xff, 0x00, 0x84)), (QString::fromLatin1(widget->metaObject()->className()) + " did not contain text color #ff0084, using style " -- cgit v0.12 From 465ae8e6180c812eb91279ee4ccf047a4de2932d Mon Sep 17 00:00:00 2001 From: Marius Bugge Monsen Date: Wed, 23 Sep 2009 15:30:00 +0200 Subject: Fix QGraphicsLinearLayout::layoutDirection test failure on cocoa. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The style influences the layout results. To get consistent results across platforms, we have to specify the style when testing. Reviewed-by: Jan-Arve Sæther --- tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 4a664a4..a5d79de 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -46,6 +46,8 @@ #include #include #include +#include +#include class tst_QGraphicsLinearLayout : public QObject { Q_OBJECT @@ -141,6 +143,9 @@ public: // It is only called once. void tst_QGraphicsLinearLayout::initTestCase() { + // since the style will influence the results, we have to ensure + // that the tests are run using the same style on all platforms + QApplication::setStyle(new QPlastiqueStyle); } // This will be called after the last test function is executed. -- cgit v0.12 From bfdee5f1658b1bac4a0d1b93c5a45dbc6709f9e3 Mon Sep 17 00:00:00 2001 From: mae Date: Wed, 23 Sep 2009 15:28:24 +0200 Subject: QTextCursor selection extension when inserting characters The change makes QTextCursor not extend the selection when inserting characters at the end of the selection, provided that the cursor position is at the end. Reviewed-by: Simon Hausmann Reviewed-by: Roberto Raggi --- src/gui/text/qtextcursor.cpp | 8 ++- tests/auto/qtextcursor/tst_qtextcursor.cpp | 94 ++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 8b85d2d..ce62834 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -92,8 +92,12 @@ QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int position { QTextCursorPrivate::AdjustResult result = QTextCursorPrivate::CursorMoved; // not(!) <= , so that inserting text adjusts the cursor correctly - if (position < positionOfChange || - (position == positionOfChange && op == QTextUndoCommand::KeepCursor)) { + if (position < positionOfChange + || (position == positionOfChange + && (op == QTextUndoCommand::KeepCursor + || anchor < position) + ) + ) { result = CursorUnchanged; } else { if (charsAddedOrRemoved < 0 && position < positionOfChange - charsAddedOrRemoved) diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp index 88ecc73..d910c8d 100644 --- a/tests/auto/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp @@ -147,6 +147,8 @@ private slots: void task244408_wordUnderCursor_data(); void task244408_wordUnderCursor(); + void adjustCursorsOnInsert(); + private: int blockCount(); @@ -1658,5 +1660,97 @@ void tst_QTextCursor::task244408_wordUnderCursor() QCOMPARE(cursor.selectedText(), expected); } +void tst_QTextCursor::adjustCursorsOnInsert() +{ + cursor.insertText("Some text before "); + int posBefore = cursor.position(); + cursor.insertText("selected text"); + int posAfter = cursor.position(); + cursor.insertText(" some text afterwards"); + + QTextCursor selection = cursor; + selection.setPosition(posBefore); + selection.setPosition(posAfter, QTextCursor::KeepAnchor); + + cursor.setPosition(posBefore-1); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.anchor(), posBefore+1); + QCOMPARE(selection.position(), posAfter+1); + doc->undo(); + + cursor.setPosition(posBefore); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.anchor(), posBefore+1); + QCOMPARE(selection.position(), posAfter+1); + doc->undo(); + + cursor.setPosition(posBefore+1); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.anchor(), posBefore); + QCOMPARE(selection.position(), posAfter+1); + doc->undo(); + + cursor.setPosition(posAfter-1); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.anchor(), posBefore); + QCOMPARE(selection.position(), posAfter+1); + doc->undo(); + + cursor.setPosition(posAfter); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.anchor(), posBefore); + QCOMPARE(selection.position(), posAfter); + doc->undo(); + + cursor.setPosition(posAfter+1); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.anchor(), posBefore); + QCOMPARE(selection.position(), posAfter); + doc->undo(); + + selection.setPosition(posAfter); + selection.setPosition(posBefore, QTextCursor::KeepAnchor); + + cursor.setPosition(posBefore-1); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.position(), posBefore+1); + QCOMPARE(selection.anchor(), posAfter+1); + doc->undo(); + + cursor.setPosition(posBefore); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.position(), posBefore+1); + QCOMPARE(selection.anchor(), posAfter+1); + doc->undo(); + + cursor.setPosition(posBefore+1); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.position(), posBefore); + QCOMPARE(selection.anchor(), posAfter+1); + doc->undo(); + + cursor.setPosition(posAfter-1); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.position(), posBefore); + QCOMPARE(selection.anchor(), posAfter+1); + doc->undo(); + + cursor.setPosition(posAfter); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.position(), posBefore); + QCOMPARE(selection.anchor(), posAfter+1); + doc->undo(); + + cursor.setPosition(posAfter+1); + cursor.insertText(QLatin1String("x")); + QCOMPARE(selection.position(), posBefore); + QCOMPARE(selection.anchor(), posAfter); + doc->undo(); + + + + +} + QTEST_MAIN(tst_QTextCursor) #include "tst_qtextcursor.moc" -- cgit v0.12 From 061f4976c7a3f9ac86ccd289ee93fc64182de27d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Sep 2009 15:18:06 +0200 Subject: missing & in foreach --- tools/linguist/lupdate/cpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index be86c93..6c56a56 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1969,7 +1969,7 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat CppFiles::setResults(filename, parser.getResults()); } - foreach (const QString filename, filenames) + foreach (const QString &filename, filenames) if (!CppFiles::isBlacklisted(filename)) if (Translator *tor = CppFiles::getResults(filename)->tor) foreach (const TranslatorMessage &msg, tor->messages()) -- cgit v0.12 From f64753362edf6c22879b1f39e83de1f69b8dda77 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Sep 2009 10:55:40 +0200 Subject: simplify --- tools/linguist/lupdate/cpp.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 6c56a56..9b7fdc8 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1056,10 +1056,7 @@ QSet &CppFiles::blacklistedFiles() const ParseResults *CppFiles::getResults(const QString &cleanFile) { - ParseResultHash::ConstIterator it = parsedFiles().find(cleanFile); - if (it == parsedFiles().constEnd()) - return 0; - return *it; + return parsedFiles().value(cleanFile); } void CppFiles::setResults(const QString &cleanFile, const ParseResults *results) -- cgit v0.12 From 5fc344431354c00340d9727f64dbb3c29972f93d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Aug 2009 17:31:05 +0200 Subject: optimize directory scanning qdiroperator uses qregexp for filtering, which is sloooow. so use a hash lookup on extensions instead. --- tools/linguist/lupdate/main.cpp | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 3cba90d..e8cf121 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -62,23 +62,14 @@ static void printOut(const QString & out) } static void recursiveFileInfoList(const QDir &dir, - const QStringList &nameFilters, QDir::Filters filter, bool recursive, + const QSet &nameFilters, QDir::Filters filter, QFileInfoList *fileinfolist) { - if (recursive) - filter |= QDir::AllDirs; - QFileInfoList entries = dir.entryInfoList(nameFilters, filter); - - QFileInfoList::iterator it; - for (it = entries.begin(); it != entries.end(); ++it) { - QString fname = it->fileName(); - if (fname != QLatin1String(".") && fname != QLatin1String("..")) { - if (it->isDir()) - recursiveFileInfoList(QDir(it->absoluteFilePath()), nameFilters, filter, recursive, fileinfolist); - else - fileinfolist->append(*it); - } - } + foreach (const QFileInfo &fi, dir.entryInfoList(filter)) + if (fi.isDir()) + recursiveFileInfoList(QDir(fi.absoluteFilePath()), nameFilters, filter, fileinfolist); + else if (nameFilters.contains(fi.suffix())) + fileinfolist->append(fi); } static void printUsage() @@ -243,7 +234,7 @@ int main(int argc, char **argv) bool recursiveScan = true; QString extensions = m_defaultExtensions; - QStringList extensionsNameFilters; + QSet extensionsNameFilters; for (int i = 1; i < argc; ++i) { if (args.at(i) == QLatin1String("-ts")) @@ -418,15 +409,15 @@ int main(int argc, char **argv) foreach (QString ext, extensions.split(QLatin1Char(','))) { ext = ext.trimmed(); if (ext.startsWith(QLatin1Char('.'))) - ext.remove(0,1); - ext.insert(0, QLatin1String("*.")); - extensionsNameFilters << ext; + ext.remove(0, 1); + extensionsNameFilters.insert(ext); } } QDir::Filters filters = QDir::Files | QDir::NoSymLinks; + if (recursiveScan) + filters |= QDir::AllDirs | QDir::NoDotAndDotDot; QFileInfoList fileinfolist; - recursiveFileInfoList(dir, extensionsNameFilters, filters, - recursiveScan, &fileinfolist); + recursiveFileInfoList(dir, extensionsNameFilters, filters, &fileinfolist); int scanRootLen = dir.absolutePath().length(); foreach (const QFileInfo &fi, fileinfolist) { QString fn = QDir::cleanPath(fi.absoluteFilePath()); -- cgit v0.12 From 5bd5154ae0095a3e166e8be9347c613b2194e0be Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Aug 2009 19:14:21 +0200 Subject: cut down use of qstring::simplified() --- tools/linguist/lupdate/cpp.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 9b7fdc8..e72f1c9 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE /* qmake ignore Q_OBJECT */ -static const char MagicComment[] = "TRANSLATOR "; +static QString MagicComment(QLatin1String("TRANSLATOR")); #define STRING(s) static QString str##s(QLatin1String(#s)) @@ -1811,9 +1811,15 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } sourcetext.resize(ptr - (ushort *)sourcetext.data()); } else { - comment = yyWord.simplified(); - if (comment.startsWith(QLatin1String(MagicComment))) { - comment.remove(0, sizeof(MagicComment) - 1); + const ushort *uc = (const ushort *)yyWord.unicode(); // Is zero-terminated + int idx = 0; + ushort c; + while ((c = uc[idx]) == ' ' || c == '\t' || c == '\n') + ++idx; + if (!memcmp(uc + idx, MagicComment.unicode(), MagicComment.length() * 2)) { + idx += MagicComment.length(); + comment = QString::fromRawData(yyWord.unicode() + idx, + yyWord.length() - idx).simplified(); int k = comment.indexOf(QLatin1Char(' ')); if (k == -1) { context = comment; @@ -1826,8 +1832,6 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) results->tor->setExtras(extra); extra.clear(); } - } else { - comment.detach(); } } yyTok = getToken(); -- cgit v0.12 From 2bc1550b3dfe05353c2cb72f9d980c67e68aceaf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Aug 2009 19:23:09 +0200 Subject: avoid isalpha() & isalnum() they are surprisingly expensive --- tools/linguist/lupdate/cpp.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index e72f1c9..c224e2f 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -561,12 +561,13 @@ uint CppParser::getToken() } } while (yyCh != '\n' && yyCh != EOF); yyCh = getChar(); - } else if (isalpha(yyCh) || yyCh == '_') { + } else if ((yyCh >= 'A' && yyCh <= 'Z') || (yyCh >= 'a' && yyCh <= 'z') || yyCh == '_') { ushort *ptr = (ushort *)yyWord.unicode(); do { *ptr++ = yyCh; yyCh = getChar(); - } while (isalnum(yyCh) || yyCh == '_'); + } while ((yyCh >= 'A' && yyCh <= 'Z') || (yyCh >= 'a' && yyCh <= 'z') + || (yyCh >= '0' && yyCh <= '9') || yyCh == '_'); yyWord.resize(ptr - (ushort *)yyWord.unicode()); //qDebug() << "IDENT: " << yyWord; -- cgit v0.12 From b17a8c5c1bc7d8c26f2bf35116de71d7b582751f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Aug 2009 19:59:28 +0200 Subject: when matching strings, skip also leading comments --- tools/linguist/lupdate/cpp.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index c224e2f..b8f8451 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1174,16 +1174,18 @@ bool CppParser::match(uint t) bool CppParser::matchString(QString *s) { - bool matches = (yyTok == Tok_String); + bool matches = false; s->clear(); - while (yyTok == Tok_String) { + forever { + while (yyTok == Tok_Comment) + yyTok = getToken(); + if (yyTok != Tok_String) + return matches; + matches = true; *s += yyWord; s->detach(); - do { - yyTok = getToken(); - } while (yyTok == Tok_Comment); + yyTok = getToken(); } - return matches; } bool CppParser::matchEncoding(bool *utf8) -- cgit v0.12 From d5d169a79fe199ad210d5625b20344bdc2814e60 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Aug 2009 20:01:15 +0200 Subject: no need to actually compute number values. only 0 is special --- tools/linguist/lupdate/cpp.cpp | 55 ++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 37 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index b8f8451..8de403e 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -167,7 +167,6 @@ private: bool match(uint t); bool matchString(QString *s); bool matchEncoding(bool *utf8); - bool matchInteger(qlonglong *number); bool matchStringOrNull(QString *s); bool matchExpression(); @@ -202,7 +201,7 @@ private: Tok_Ident, Tok_Comment, Tok_String, Tok_Arrow, Tok_Colon, Tok_ColonColon, Tok_Equals, Tok_LeftBrace = 30, Tok_RightBrace, Tok_LeftParen, Tok_RightParen, Tok_Comma, Tok_Semicolon, - Tok_Integer = 40, + Tok_Null = 40, Tok_Integer, Tok_QuotedInclude = 50, Tok_AngledInclude, Tok_Other = 99 }; @@ -796,6 +795,17 @@ uint CppParser::getToken() yyCh = getChar(); return Tok_Semicolon; case '0': + yyCh = getChar(); + if (yyCh == 'x') { + do { + yyCh = getChar(); + } while ((yyCh >= '0' && yyCh <= '9') + || (yyCh >= 'a' && yyCh <= 'f') || (yyCh >= 'A' && yyCh <= 'F')); + return Tok_Integer; + } + if (yyCh < '0' || yyCh > '9') + return Tok_Null; + // Fallthrough case '1': case '2': case '3': @@ -805,25 +815,10 @@ uint CppParser::getToken() case '7': case '8': case '9': - { - QByteArray ba; - ba += yyCh; + do { yyCh = getChar(); - bool hex = yyCh == 'x'; - if (hex) { - ba += yyCh; - yyCh = getChar(); - } - while (hex ? isxdigit(yyCh) : isdigit(yyCh)) { - ba += yyCh; - yyCh = getChar(); - } - bool ok; - yyInteger = ba.toLongLong(&ok); - if (ok) - return Tok_Integer; - break; - } + } while (yyCh >= '0' && yyCh <= '9'); + return Tok_Integer; default: yyCh = getChar(); break; @@ -1211,28 +1206,14 @@ bool CppParser::matchEncoding(bool *utf8) if (yyWord == strDefaultCodec || yyWord == strCodecForTr) { *utf8 = false; yyTok = getToken(); - return true; + return true; } return false; } -bool CppParser::matchInteger(qlonglong *number) -{ - bool matches = (yyTok == Tok_Integer); - if (matches) { - yyTok = getToken(); - *number = yyInteger; - } - return matches; -} - bool CppParser::matchStringOrNull(QString *s) { - bool matches = matchString(s); - qlonglong num = 0; - if (!matches) - matches = matchInteger(&num); - return matches && num == 0; + return matchString(s) || match(Tok_Null); } /* @@ -1251,7 +1232,7 @@ bool CppParser::matchStringOrNull(QString *s) */ bool CppParser::matchExpression() { - if (match(Tok_Integer)) + if (match(Tok_Null) || match(Tok_Integer)) return true; int parenlevel = 0; -- cgit v0.12 From e4e45bc5bb3a4b38f8f726b26f863c1fdb5575f1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Aug 2009 20:09:47 +0200 Subject: take advantage of knowing that qstrings are zero-terminated internally --- tools/linguist/lupdate/cpp.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 8de403e..3999b84 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -307,13 +307,12 @@ void CppParser::setInput(QTextStream &ts, const QString &fileName) uint CppParser::getChar() { - int len = yyInStr.size(); const ushort *uc = (const ushort *)yyInStr.unicode(); forever { - if (yyInPos >= len) - return EOF; uint c = uc[yyInPos++]; - if (c == '\\' && yyInPos < len) { + if (!c) + return EOF; + if (c == '\\') { if (uc[yyInPos] == '\n') { ++yyCurLineNo; ++yyInPos; @@ -322,13 +321,13 @@ uint CppParser::getChar() if (uc[yyInPos] == '\r') { ++yyCurLineNo; ++yyInPos; - if (yyInPos < len && uc[yyInPos] == '\n') + if (uc[yyInPos] == '\n') ++yyInPos; continue; } } if (c == '\r') { - if (yyInPos < len && uc[yyInPos] == '\n') + if (uc[yyInPos] == '\n') ++yyInPos; c = '\n'; ++yyCurLineNo; -- cgit v0.12 From 830fd43c53a9cd53d626b8f6fe3682d92df0cc59 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Aug 2009 20:19:25 +0200 Subject: use a source char pointer instead of a string + index --- tools/linguist/lupdate/cpp.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 3999b84..8e9933d 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -226,7 +226,7 @@ private: QTextCodec *yySourceCodec; bool yySourceIsUnicode; QString yyInStr; - int yyInPos; + const ushort *yyInPtr; // Parser state uint yyTok; @@ -254,7 +254,6 @@ CppParser::CppParser(ParseResults *_results) results = new ParseResults; directInclude = false; } - yyInPos = 0; yyBraceDepth = 0; yyParenDepth = 0; yyCurLineNo = 1; @@ -307,28 +306,32 @@ void CppParser::setInput(QTextStream &ts, const QString &fileName) uint CppParser::getChar() { - const ushort *uc = (const ushort *)yyInStr.unicode(); + const ushort *uc = yyInPtr; forever { - uint c = uc[yyInPos++]; - if (!c) + ushort c = *uc; + if (!c) { + yyInPtr = uc; return EOF; + } + ++uc; if (c == '\\') { - if (uc[yyInPos] == '\n') { + ushort cc = *uc; + if (cc == '\n') { ++yyCurLineNo; - ++yyInPos; + ++uc; continue; } - if (uc[yyInPos] == '\r') { + if (cc == '\r') { ++yyCurLineNo; - ++yyInPos; - if (uc[yyInPos] == '\n') - ++yyInPos; + ++uc; + if (*uc == '\n') + ++uc; continue; } } if (c == '\r') { - if (uc[yyInPos] == '\n') - ++yyInPos; + if (*uc == '\n') + ++uc; c = '\n'; ++yyCurLineNo; yyAtNewline = true; @@ -338,6 +341,7 @@ uint CppParser::getChar() } else if (c != ' ' && c != '\t' && c != '#') { yyAtNewline = false; } + yyInPtr = uc; return c; } } @@ -1355,6 +1359,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) bool yyTokColonSeen = false; // Start of c'tor's initializer list yyWord.reserve(yyInStr.size()); // Rather insane. That's because we do no length checking. + yyInPtr = (const ushort *)yyInStr.unicode(); yyCh = getChar(); yyTok = getToken(); while (yyTok != Tok_Eof) { -- cgit v0.12 From 13fa5aa35e6cbf6bf7710952f541810fee7bba27 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Aug 2009 20:33:57 +0200 Subject: move static objects out of function scope cuts away a few thousand instructions. need to revisit this in case of making the parser a dynamic library. --- tools/linguist/lupdate/cpp.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 8e9933d..f6ebfb1 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1186,14 +1186,14 @@ bool CppParser::matchString(QString *s) } } +STRING(QApplication); +STRING(QCoreApplication); +STRING(UnicodeUTF8); +STRING(DefaultCodec); +STRING(CodecForTr); + bool CppParser::matchEncoding(bool *utf8) { - STRING(QApplication); - STRING(QCoreApplication); - STRING(UnicodeUTF8); - STRING(DefaultCodec); - STRING(CodecForTr); - if (yyTok != Tok_Ident) return false; if (yyWord == strQApplication || yyWord == strQCoreApplication) { -- cgit v0.12 From 313c49628ac74f647df0f3b1e2a660ebd1f4436c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Sep 2009 12:35:12 +0200 Subject: remove dead code needsTrFunctions was never set any more --- tools/linguist/lupdate/cpp.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index f6ebfb1..c6f38a0 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -76,7 +76,7 @@ struct Namespace { Namespace() : isClass(false), - hasTrFunctions(false), needsTrFunctions(false), complained(false) + hasTrFunctions(false), complained(false) {} QString name; @@ -89,7 +89,6 @@ struct Namespace { bool isClass; bool hasTrFunctions; - bool needsTrFunctions; bool complained; // ... that tr functions are missing. }; @@ -875,7 +874,6 @@ Namespace *ParseResults::include(Namespace *that, const Namespace *other) // (though not necessary) if they are shared thisSub->isClass |= otherSub->isClass; thisSub->hasTrFunctions |= otherSub->hasTrFunctions; - thisSub->needsTrFunctions |= otherSub->needsTrFunctions; thisSub->complained |= otherSub->complained; if (Namespace *newSub = include(thisSub, otherSub)) { @@ -1843,17 +1841,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) #endif break; case Tok_RightBrace: - if (yyBraceDepth + 1 == namespaceDepths.count()) { - // class or namespace - Namespace *ns = namespaces.last(); - if (ns->needsTrFunctions && !ns->hasTrFunctions && !ns->complained) { - qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", - qPrintable(yyFileName), yyLineNo, - qPrintable(stringifyNamespace(namespaces))); - ns->complained = true; - } + if (yyBraceDepth + 1 == namespaceDepths.count()) // class or namespace truncateNamespaces(&namespaces, namespaceDepths.pop()); - } if (yyBraceDepth == namespaceDepths.count()) { // function, class or namespace if (!yyBraceDepth && !directInclude) { -- cgit v0.12 From dd499bac5ce01abe730d47a84c7ad3e29bc3cf4d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 17 Sep 2009 19:21:15 +0200 Subject: remove more dead code no need for parameter "unresolved" --- tools/linguist/lupdate/cpp.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index c6f38a0..fce53af 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1521,8 +1521,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) yyTok = getToken(); } NamespaceList nsl; - QStringList unresolved; - if (fullyQualify(namespaces, fullName, false, &nsl, &unresolved)) { + if (fullyQualify(namespaces, fullName, false, &nsl, 0)) { modifyNamespace(&namespaces); namespaces.last()->usings.insert(stringListifyNamespace(nsl)); } -- cgit v0.12 From b647762117f49a3e8d20ceba84c47d4fb2941722 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Sep 2009 16:10:13 +0200 Subject: do not record class forward declarations they don't create useful namespaces and don't hold flags, so it is pointless to clutter the namespace maps with them. --- tools/linguist/lupdate/cpp.cpp | 55 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index fce53af..5dbb8e2 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1394,8 +1394,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } case Tok_friend: yyTok = getToken(); - // Ensure that these don't end up being interpreted as forward declarations - // (they are forwards, but with different namespacing). + // These are forward declarations, so ignore them. if (yyTok == Tok_class) yyTok = getToken(); break; @@ -1406,7 +1405,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) */ yyTok = getToken(); if (yyBraceDepth == namespaceDepths.count() && yyParenDepth == 0) { - QStringList fct; + QStringList quali; + QString fct; do { /* This code should execute only once, but we play @@ -1414,52 +1414,51 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) 'class Q_EXPORT QMessageBox', in which case 'QMessageBox' is the class name, not 'Q_EXPORT'. */ - text = yyWord; - text.detach(); - fct = QStringList(text); + fct = yyWord; + fct.detach(); yyTok = getToken(); } while (yyTok == Tok_Ident); while (yyTok == Tok_ColonColon) { yyTok = getToken(); if (yyTok != Tok_Ident) break; // Oops ... - text = yyWord; - text.detach(); - fct += text; + quali << fct; + fct = yyWord; + fct.detach(); yyTok = getToken(); } - if (fct.count() > 1) { - // Forward-declared class definitions can be namespaced - NamespaceList nsl; - if (!fullyQualify(namespaces, fct, true, &nsl, 0)) { - qWarning("%s:%d: Ignoring definition of undeclared qualified class\n", - qPrintable(yyFileName), yyLineNo); - break; - } - namespaceDepths.push(namespaces.count()); - namespaces = nsl; - } else { - namespaceDepths.push(namespaces.count()); - enterNamespace(&namespaces, fct.first()); - } - namespaces.last()->isClass = true; - while (yyTok == Tok_Comment) yyTok = getToken(); if (yyTok == Tok_Colon) { - // Skip any token until '{' since lupdate might do things wrong if it finds + // Skip any token until '{' since we might do things wrong if we find // a '::' token here. do { yyTok = getToken(); } while (yyTok != Tok_LeftBrace && yyTok != Tok_Eof); } else { if (yyTok != Tok_LeftBrace) { - // Obviously a forward decl - truncateNamespaces(&namespaces, namespaceDepths.pop()); + // Obviously a forward declaration. We skip those, as they + // don't create actually usable namespaces. break; } } + if (!quali.isEmpty()) { + // Forward-declared class definitions can be namespaced. + NamespaceList nsl; + if (!fullyQualify(namespaces, quali, true, &nsl, 0)) { + qWarning("%s:%d: Ignoring definition of undeclared qualified class\n", + qPrintable(yyFileName), yyLineNo); + break; + } + namespaceDepths.push(namespaces.count()); + namespaces = nsl; + } else { + namespaceDepths.push(namespaces.count()); + } + enterNamespace(&namespaces, fct); + namespaces.last()->isClass = true; + functionContext = namespaces; functionContextUnresolved.clear(); // Pointless prospectiveContext.clear(); -- cgit v0.12 From 57df91e20b8e669f4833e1f11dc2474d8118e0c9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Sep 2009 17:52:10 +0200 Subject: optimize/clarify function context stringification --- tools/linguist/lupdate/cpp.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 5dbb8e2..d5d2e10 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1590,14 +1590,14 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } while (!functionContext.at(idx - 1)->hasTrFunctions) { if (idx == 1 || !functionContext.at(idx - 2)->isClass) { - idx = functionContext.length(); + context = stringifyNamespace(functionContext); if (!functionContext.last()->complained) { qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", qPrintable(yyFileName), yyLineNo, - qPrintable(stringifyNamespace(functionContext))); + qPrintable(context)); functionContext.last()->complained = true; } - break; + goto gotctx; } --idx; } @@ -1626,19 +1626,20 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) NamespaceList nsl; QStringList unresolved; if (fullyQualify(functionContext, prefix.split(strColons), false, &nsl, &unresolved)) { + context = stringifyNamespace(nsl); if (!nsl.last()->hasTrFunctions && !nsl.last()->complained) { qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", qPrintable(yyFileName), yyLineNo, - qPrintable(stringifyNamespace(nsl))); + qPrintable(context)); nsl.last()->complained = true; } - context = stringifyNamespace(nsl); } else { context = (stringListifyNamespace(nsl) + unresolved).join(strColons); } prefix.clear(); } + gotctx: recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural); } extracomment.clear(); -- cgit v0.12 From 1c4dc6be0c5b6a730e5ae910afa8c4da986e37ee Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Sep 2009 12:47:45 +0200 Subject: drastically improve lupdate's scalability do not import all data from included files into the current file (which turned out to be extremely expensive for 3rdparty/webkit), but do hierarchical lookups on demand. this makes the lookups as such much slower, of course, but it still pays off. --- tools/linguist/lupdate/cpp.cpp | 477 ++++++++++++++++++++++++----------------- 1 file changed, 280 insertions(+), 197 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index d5d2e10..c9b25f3 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -43,6 +43,7 @@ #include +#include #include #include #include @@ -62,53 +63,110 @@ static QString MagicComment(QLatin1String("TRANSLATOR")); //#define DIAGNOSE_RETRANSLATABILITY // FIXME: should make a runtime option of this -uint qHash(const QStringList &qsl) +class HashString { +public: + HashString() : m_hashed(false) {} + explicit HashString(const QString &str) : m_str(str), m_hashed(false) {} + void setValue(const QString &str) { m_str = str; m_hashed = false; } + const QString &value() const { return m_str; } + bool operator==(const HashString &other) const { return m_str == other.m_str; } +private: + QString m_str; + mutable uint m_hash; + mutable bool m_hashed; + friend uint qHash(const HashString &str); +}; + +uint qHash(const HashString &str) +{ + if (!str.m_hashed) { + str.m_hashed = true; + str.m_hash = qHash(str.m_str); + } + return str.m_hash; +} + +class HashStringList { +public: + explicit HashStringList(const QList &list) : m_list(list), m_hashed(false) {} + const QList &value() const { return m_list; } + bool operator==(const HashStringList &other) const { return m_list == other.m_list; } +private: + QList m_list; + mutable uint m_hash; + mutable bool m_hashed; + friend uint qHash(const HashStringList &list); +}; + +uint qHash(const HashStringList &list) { - uint hash = 0; - foreach (const QString &qs, qsl) { - hash ^= qHash(qs) ^ 0xa09df22f; - hash = (hash << 13) | (hash >> 19); + if (!list.m_hashed) { + list.m_hashed = true; + uint hash = 0; + foreach (const HashString &qs, list.m_list) { + hash ^= qHash(qs) ^ 0xa09df22f; + hash = (hash << 13) | (hash >> 19); + } + list.m_hash = hash; } - return hash; + return list.m_hash; } +typedef QList NamespaceList; + struct Namespace { Namespace() : - isClass(false), + classDef(0), hasTrFunctions(false), complained(false) {} - QString name; - QMap children; - QMap aliases; - QSet usings; - - int fileId; + QHash children; + QHash aliases; + QList usings; - bool isClass; + // Class declarations set no flags and create no namespaces, so they are ignored. + // Class definitions may appear multiple times - but only because we are trying to + // "compile" all sources irrespective of build configuration. + // Nested classes may be forward-declared inside a definition, and defined in another file. + // The latter will detach the class' child list, so clones need a backlink to the original + // definition (either one in case of multiple definitions). + Namespace *classDef; bool hasTrFunctions; bool complained; // ... that tr functions are missing. }; -typedef QList NamespaceList; +static int nextFileId; + +class VisitRecorder { +public: + VisitRecorder() + { + m_ba.resize(nextFileId); + } + bool tryVisit(int fileId) + { + if (m_ba.at(fileId)) + return false; + m_ba[fileId] = true; + return true; + } +private: + QBitArray m_ba; +}; struct ParseResults { ParseResults() { - static int nextFileId; - rootNamespace.fileId = nextFileId++; tor = 0; } - bool detachNamespace(Namespace **that); - Namespace *include(Namespace *that, const Namespace *other); - void unite(const ParseResults *other); + int fileId; Namespace rootNamespace; Translator *tor; - QSet allIncludes; + QSet includes; }; typedef QHash ParseResultHash; @@ -117,7 +175,7 @@ class CppFiles { public: static const ParseResults *getResults(const QString &cleanFile); - static void setResults(const QString &cleanFile, const ParseResults *results); + static void setResults(const QString &cleanFile, ParseResults *results); static bool isBlacklisted(const QString &cleanFile); static void setBlacklisted(const QString &cleanFile); @@ -135,13 +193,13 @@ public: void setTranslator(Translator *tor) { results->tor = tor; } void parse(const QString &initialContext, ConversionData &cd, QSet &inclusions); void parseInternal(ConversionData &cd, QSet &inclusions); - const ParseResults *getResults() const { return results; } + ParseResults *getResults() const { return results; } void deleteResults() { delete results; } struct SavedState { - QStringList namespaces; + NamespaceList namespaces; QStack namespaceDepths; - QStringList functionContext; + NamespaceList functionContext; QString functionContextUnresolved; QString pendingContext; }; @@ -183,15 +241,28 @@ private: static QString stringifyNamespace(const NamespaceList &namespaces); static QStringList stringListifyNamespace(const NamespaceList &namespaces); - void modifyNamespace(NamespaceList *namespaces); - NamespaceList resolveNamespaces(const QStringList &segments); - bool qualifyOne(const NamespaceList &namespaces, int nsIdx, const QString &segment, - NamespaceList *resolved); - bool fullyQualify(const NamespaceList &namespaces, const QStringList &segments, + typedef bool (CppParser::*VisitNamespaceCallback)(const Namespace *ns, void *context) const; + bool visitNamespace(const NamespaceList &namespaces, int nsCount, + VisitNamespaceCallback callback, void *context, + VisitRecorder &vr, const ParseResults *rslt) const; + bool visitNamespace(const NamespaceList &namespaces, int nsCount, + VisitNamespaceCallback callback, void *context) const; + static QStringList stringListifySegments(const QList &namespaces); + bool qualifyOneCallbackOwn(const Namespace *ns, void *context) const; + bool qualifyOneCallbackUsing(const Namespace *ns, void *context) const; + bool qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, + NamespaceList *resolved) const; + bool fullyQualify(const NamespaceList &namespaces, const QList &segments, bool isDeclaration, - NamespaceList *resolved, QStringList *unresolved); - void enterNamespace(NamespaceList *namespaces, const QString &name); + NamespaceList *resolved, QStringList *unresolved) const; + bool fullyQualify(const NamespaceList &namespaces, const QString &segments, + bool isDeclaration, + NamespaceList *resolved, QStringList *unresolved) const; + bool findNamespaceCallback(const Namespace *ns, void *context) const; + const Namespace *findNamespace(const NamespaceList &namespaces, int nsCount = -1) const; + void enterNamespace(NamespaceList *namespaces, const HashString &name, bool isClass); void truncateNamespaces(NamespaceList *namespaces, int lenght); + Namespace *modifyNamespace(NamespaceList *namespaces, bool tryOrigin = true); enum { Tok_Eof, Tok_class, Tok_friend, Tok_namespace, Tok_using, Tok_return, @@ -837,85 +908,40 @@ uint CppParser::getToken() void CppParser::saveState(SavedState *state) { - state->namespaces = stringListifyNamespace(namespaces); + state->namespaces = namespaces; state->namespaceDepths = namespaceDepths; - state->functionContext = stringListifyNamespace(functionContext); + state->functionContext = functionContext; state->functionContextUnresolved = functionContextUnresolved; state->pendingContext = pendingContext; } void CppParser::loadState(const SavedState *state) { - namespaces = resolveNamespaces(state->namespaces); + namespaces = state->namespaces; namespaceDepths = state->namespaceDepths; - functionContext = resolveNamespaces(state->functionContext); + functionContext = state->functionContext; functionContextUnresolved = state->functionContextUnresolved; pendingContext = state->pendingContext; } -bool ParseResults::detachNamespace(Namespace **that) -{ - if ((*that)->fileId != rootNamespace.fileId) { - Namespace *newThat = new Namespace; - *newThat = **that; - newThat->fileId = rootNamespace.fileId; - *that = newThat; - return true; - } - return false; -} - -Namespace *ParseResults::include(Namespace *that, const Namespace *other) +Namespace *CppParser::modifyNamespace(NamespaceList *namespaces, bool tryOrigin) { - Namespace *origThat = that; - foreach (Namespace *otherSub, other->children) { - if (Namespace *thisSub = that->children.value(otherSub->name)) { - // Don't make these cause a detach - it's best - // (though not necessary) if they are shared - thisSub->isClass |= otherSub->isClass; - thisSub->hasTrFunctions |= otherSub->hasTrFunctions; - thisSub->complained |= otherSub->complained; - - if (Namespace *newSub = include(thisSub, otherSub)) { - thisSub = newSub; - detachNamespace(&that); - that->children[thisSub->name] = thisSub; - } - } else { - detachNamespace(&that); - that->children[otherSub->name] = otherSub; - } - } - if ((that->aliases != other->aliases && !other->aliases.isEmpty()) - || (that->usings != other->usings && !other->usings.isEmpty())) { - detachNamespace(&that); - that->aliases.unite(other->aliases); - that->usings.unite(other->usings); - } - return (that != origThat) ? that : 0; -} - -void ParseResults::unite(const ParseResults *other) -{ - allIncludes.unite(other->allIncludes); - include(&rootNamespace, &other->rootNamespace); -} - -void CppParser::modifyNamespace(NamespaceList *namespaces) -{ - Namespace *pns = 0; - int i = namespaces->count(); - forever { - --i; - Namespace *ns = namespaces->at(i); - bool detached = results->detachNamespace(&ns); - if (pns) - ns->children[pns->name] = pns; - if (!detached) // Known to be true for root namespace - return; + Namespace *pns, *ns = &results->rootNamespace; + for (int i = 1; i < namespaces->count(); ++i) { pns = ns; - namespaces->replace(i, ns); + if (!(ns = pns->children.value(namespaces->at(i)))) { + do { + ns = new Namespace; + if (tryOrigin) + if (const Namespace *ons = findNamespace(*namespaces, i + 1)) + ns->classDef = ons->classDef; + pns->children.insert(namespaces->at(i), ns); + pns = ns; + } while (++i < namespaces->count()); + break; + } } + return ns; } QString CppParser::stringifyNamespace(const NamespaceList &namespaces) @@ -924,7 +950,7 @@ QString CppParser::stringifyNamespace(const NamespaceList &namespaces) for (int i = 1; i < namespaces.count(); ++i) { if (i > 1) ret += QLatin1String("::"); - ret += namespaces.at(i)->name; + ret += namespaces.at(i).value(); } return ret; } @@ -933,58 +959,102 @@ QStringList CppParser::stringListifyNamespace(const NamespaceList &namespaces) { QStringList ret; for (int i = 1; i < namespaces.count(); ++i) - ret << namespaces.at(i)->name; + ret << namespaces.at(i).value(); return ret; } -// This function is called only with known-existing namespaces -NamespaceList CppParser::resolveNamespaces(const QStringList &segments) +bool CppParser::visitNamespace(const NamespaceList &namespaces, int nsCount, + VisitNamespaceCallback callback, void *context, + VisitRecorder &vr, const ParseResults *rslt) const { - NamespaceList ret; - Namespace *ns = &results->rootNamespace; - ret << ns; - foreach (const QString &seg, segments) { - ns = ns->children.value(seg); - ret << ns; - } + const Namespace *ns = &rslt->rootNamespace; + for (int i = 1; i < nsCount; ++i) + if (!(ns = ns->children.value(namespaces.at(i)))) + goto supers; + if ((this->*callback)(ns, context)) + return true; +supers: + foreach (const ParseResults *sup, rslt->includes) + if (vr.tryVisit(sup->fileId) + && visitNamespace(namespaces, nsCount, callback, context, vr, sup)) + return true; + return false; +} + +bool CppParser::visitNamespace(const NamespaceList &namespaces, int nsCount, + VisitNamespaceCallback callback, void *context) const +{ + VisitRecorder vr; + return visitNamespace(namespaces, nsCount, callback, context, vr, results); +} + +QStringList CppParser::stringListifySegments(const QList &segments) +{ + QStringList ret; + for (int i = 0; i < segments.count(); ++i) + ret << segments.at(i).value(); return ret; } -bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsIdx, const QString &segment, - NamespaceList *resolved) +struct QualifyOneData { + const NamespaceList &namespaces; + int nsCount; + const HashString &segment; + NamespaceList *resolved; + QSet visitedUsings; +}; + +bool CppParser::qualifyOneCallbackOwn(const Namespace *ns, void *context) const { - const Namespace *ns = namespaces.at(nsIdx); - QMap::ConstIterator cnsi = ns->children.constFind(segment); - if (cnsi != ns->children.constEnd()) { - *resolved = namespaces.mid(0, nsIdx + 1); - *resolved << *cnsi; + QualifyOneData *data = (QualifyOneData *)context; + if (ns->children.contains(data->segment)) { + *data->resolved = data->namespaces.mid(0, data->nsCount); + *data->resolved << data->segment; return true; } - QMap::ConstIterator nsai = ns->aliases.constFind(segment); + QHash::ConstIterator nsai = ns->aliases.constFind(data->segment); if (nsai != ns->aliases.constEnd()) { - *resolved = resolveNamespaces(*nsai); + *data->resolved = *nsai; return true; } - foreach (const QStringList &use, ns->usings) { - NamespaceList usedNs = resolveNamespaces(use); - if (qualifyOne(usedNs, usedNs.count() - 1, segment, resolved)) - return true; - } return false; } -bool CppParser::fullyQualify(const NamespaceList &namespaces, const QStringList &segments, +bool CppParser::qualifyOneCallbackUsing(const Namespace *ns, void *context) const +{ + QualifyOneData *data = (QualifyOneData *)context; + foreach (const HashStringList &use, ns->usings) + if (!data->visitedUsings.contains(use)) { + data->visitedUsings.insert(use); + if (qualifyOne(use.value(), use.value().count(), data->segment, data->resolved)) + return true; + } + return false; +} + +bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, + NamespaceList *resolved) const +{ + QualifyOneData data = { namespaces, nsCnt, segment, resolved, QSet() }; + + if (visitNamespace(namespaces, nsCnt, &CppParser::qualifyOneCallbackOwn, &data)) + return true; + + return visitNamespace(namespaces, nsCnt, &CppParser::qualifyOneCallbackUsing, &data); +} + +bool CppParser::fullyQualify(const NamespaceList &namespaces, const QList &segments, bool isDeclaration, - NamespaceList *resolved, QStringList *unresolved) + NamespaceList *resolved, QStringList *unresolved) const { int nsIdx; int initSegIdx; - if (segments.first().isEmpty()) { + if (segments.first().value().isEmpty()) { // fully qualified if (segments.count() == 1) { resolved->clear(); - *resolved << &results->rootNamespace; + *resolved << HashString(QString()); return true; } initSegIdx = 1; @@ -995,12 +1065,12 @@ bool CppParser::fullyQualify(const NamespaceList &namespaces, const QStringList } do { - if (qualifyOne(namespaces, nsIdx, segments[initSegIdx], resolved)) { + if (qualifyOne(namespaces, nsIdx + 1, segments[initSegIdx], resolved)) { int segIdx = initSegIdx; while (++segIdx < segments.count()) { - if (!qualifyOne(*resolved, resolved->count() - 1, segments[segIdx], resolved)) { + if (!qualifyOne(*resolved, resolved->count(), segments[segIdx], resolved)) { if (unresolved) - *unresolved = segments.mid(segIdx); + *unresolved = stringListifySegments(segments.mid(segIdx)); return false; } } @@ -1008,23 +1078,47 @@ bool CppParser::fullyQualify(const NamespaceList &namespaces, const QStringList } } while (!isDeclaration && --nsIdx >= 0); resolved->clear(); - *resolved << &results->rootNamespace; + *resolved << HashString(QString()); if (unresolved) - *unresolved = segments.mid(initSegIdx); + *unresolved = stringListifySegments(segments.mid(initSegIdx)); return false; } -void CppParser::enterNamespace(NamespaceList *namespaces, const QString &name) +bool CppParser::fullyQualify(const NamespaceList &namespaces, const QString &quali, + bool isDeclaration, + NamespaceList *resolved, QStringList *unresolved) const +{ + static QString strColons(QLatin1String("::")); + + QList segments; + foreach (const QString &str, quali.split(strColons)) // XXX slow, but needs to be fast(?) + segments << HashString(str); + return fullyQualify(namespaces, segments, isDeclaration, resolved, unresolved); +} + +bool CppParser::findNamespaceCallback(const Namespace *ns, void *context) const { - Namespace *ns = namespaces->last()->children.value(name); - if (!ns) { - ns = new Namespace; - ns->fileId = results->rootNamespace.fileId; - ns->name = name; - modifyNamespace(namespaces); - namespaces->last()->children[name] = ns; + *((const Namespace **)context) = ns; + return true; +} + +const Namespace *CppParser::findNamespace(const NamespaceList &namespaces, int nsCount) const +{ + const Namespace *ns = 0; + if (nsCount == -1) + nsCount = namespaces.count(); + visitNamespace(namespaces, nsCount, &CppParser::findNamespaceCallback, &ns); + return ns; +} + +void CppParser::enterNamespace(NamespaceList *namespaces, const HashString &name, bool isClass) +{ + *namespaces << name; + if (!findNamespace(*namespaces)) { + Namespace *ns = modifyNamespace(namespaces, false); + if (isClass) + ns->classDef = ns; } - *namespaces << ns; } void CppParser::truncateNamespaces(NamespaceList *namespaces, int length) @@ -1056,8 +1150,9 @@ const ParseResults *CppFiles::getResults(const QString &cleanFile) return parsedFiles().value(cleanFile); } -void CppFiles::setResults(const QString &cleanFile, const ParseResults *results) +void CppFiles::setResults(const QString &cleanFile, ParseResults *results) { + results->fileId = nextFileId++; parsedFiles().insert(cleanFile, results); } @@ -1093,12 +1188,8 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, QString fileExt = QFileInfo(cleanFile).suffix(); if (fileExt.isEmpty() || fileExt.startsWith(QLatin1Char('h'), Qt::CaseInsensitive)) { - if (results->allIncludes.contains(cleanFile)) - return; - results->allIncludes.insert(cleanFile); - if (const ParseResults *res = CppFiles::getResults(cleanFile)) { - results->unite(res); + results->includes.insert(res); return; } @@ -1128,8 +1219,8 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, } parser.setInput(ts, cleanFile); parser.parse(cd.m_defaultContext, cd, inclusions); - CppFiles::setResults(cleanFile, parser.getResults()); - results->unite(parser.results); + CppFiles::setResults(cleanFile, parser.results); + results->includes.insert(parser.results); } else { CppParser parser(results); parser.namespaces = namespaces; @@ -1138,12 +1229,6 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, parser.pendingContext = pendingContext; parser.setInput(ts, cleanFile); parser.parseInternal(cd, inclusions); - // Don't wreak havoc if not enough braces were found. - truncateNamespaces(&parser.namespaces, namespaces.count()); - truncateNamespaces(&parser.functionContext, functionContext.count()); - // Copy them back - the pointers might have changed. - namespaces = parser.namespaces; - functionContext = parser.functionContext; // Avoid that messages obtained by direct scanning are used CppFiles::setBlacklisted(cleanFile); } @@ -1330,7 +1415,7 @@ void CppParser::parse(const QString &initialContext, ConversionData &cd, if (results->tor) yyCodecIsUtf8 = (results->tor->codecName() == "UTF-8"); - namespaces << &results->rootNamespace; + namespaces << HashString(); functionContext = namespaces; functionContextUnresolved = initialContext; @@ -1405,8 +1490,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) */ yyTok = getToken(); if (yyBraceDepth == namespaceDepths.count() && yyParenDepth == 0) { - QStringList quali; - QString fct; + QList quali; + HashString fct; do { /* This code should execute only once, but we play @@ -1414,8 +1499,9 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) 'class Q_EXPORT QMessageBox', in which case 'QMessageBox' is the class name, not 'Q_EXPORT'. */ - fct = yyWord; - fct.detach(); + text = yyWord; + text.detach(); + fct.setValue(text); yyTok = getToken(); } while (yyTok == Tok_Ident); while (yyTok == Tok_ColonColon) { @@ -1423,8 +1509,9 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) if (yyTok != Tok_Ident) break; // Oops ... quali << fct; - fct = yyWord; - fct.detach(); + text = yyWord; + text.detach(); + fct.setValue(text); yyTok = getToken(); } while (yyTok == Tok_Comment) @@ -1456,8 +1543,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } else { namespaceDepths.push(namespaces.count()); } - enterNamespace(&namespaces, fct); - namespaces.last()->isClass = true; + enterNamespace(&namespaces, fct, true); functionContext = namespaces; functionContextUnresolved.clear(); // Pointless @@ -1469,34 +1555,33 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) yyTokColonSeen = false; yyTok = getToken(); if (yyTok == Tok_Ident) { - QString ns = yyWord; - ns.detach(); + text = yyWord; + text.detach(); + HashString ns = HashString(text); yyTok = getToken(); if (yyTok == Tok_LeftBrace) { namespaceDepths.push(namespaces.count()); - enterNamespace(&namespaces, ns); + enterNamespace(&namespaces, ns, false); yyTok = getToken(); } else if (yyTok == Tok_Equals) { // e.g. namespace Is = OuterSpace::InnerSpace; - QStringList fullName; + QList fullName; yyTok = getToken(); if (yyTok == Tok_ColonColon) - fullName.append(QString()); + fullName.append(HashString(QString())); while (yyTok == Tok_ColonColon || yyTok == Tok_Ident) { if (yyTok == Tok_Ident) { text = yyWord; text.detach(); - fullName.append(text); + fullName.append(HashString(text)); } yyTok = getToken(); } if (fullName.isEmpty()) break; NamespaceList nsl; - if (fullyQualify(namespaces, fullName, false, &nsl, 0)) { - modifyNamespace(&namespaces); - namespaces.last()->aliases.insert(ns, stringListifyNamespace(nsl)); - } + if (fullyQualify(namespaces, fullName, false, &nsl, 0)) + modifyNamespace(&namespaces, false)->aliases[ns] = nsl; } } else if (yyTok == Tok_LeftBrace) { // Anonymous namespace @@ -1506,43 +1591,40 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) break; case Tok_using: yyTok = getToken(); + // XXX this should affect only the current scope, not the entire current namespace if (yyTok == Tok_namespace) { - QStringList fullName; + QList fullName; yyTok = getToken(); if (yyTok == Tok_ColonColon) - fullName.append(QString()); + fullName.append(HashString(QString())); while (yyTok == Tok_ColonColon || yyTok == Tok_Ident) { if (yyTok == Tok_Ident) { text = yyWord; text.detach(); - fullName.append(text); + fullName.append(HashString(text)); } yyTok = getToken(); } NamespaceList nsl; - if (fullyQualify(namespaces, fullName, false, &nsl, 0)) { - modifyNamespace(&namespaces); - namespaces.last()->usings.insert(stringListifyNamespace(nsl)); - } + if (fullyQualify(namespaces, fullName, false, &nsl, 0)) + modifyNamespace(&namespaces, false)->usings << HashStringList(nsl); } else { - QStringList fullName; + QList fullName; if (yyTok == Tok_ColonColon) - fullName.append(QString()); + fullName.append(HashString(QString())); while (yyTok == Tok_ColonColon || yyTok == Tok_Ident) { if (yyTok == Tok_Ident) { text = yyWord; text.detach(); - fullName.append(text); + fullName.append(HashString(text)); } yyTok = getToken(); } if (fullName.isEmpty()) break; NamespaceList nsl; - if (fullyQualify(namespaces, fullName, false, &nsl, 0)) { - modifyNamespace(&namespaces); - namespaces.last()->aliases.insert(nsl.last()->name, stringListifyNamespace(nsl)); - } + if (fullyQualify(namespaces, fullName, false, &nsl, 0)) + modifyNamespace(&namespaces, true)->aliases[nsl.last()] = nsl; } break; case Tok_tr: @@ -1570,8 +1652,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } if (!pendingContext.isEmpty()) { QStringList unresolved; - if (!fullyQualify(namespaces, pendingContext.split(strColons), true, - &functionContext, &unresolved)) { + if (!fullyQualify(namespaces, pendingContext, true, &functionContext, &unresolved)) { functionContextUnresolved = unresolved.join(strColons); qWarning("%s:%d: Qualifying with unknown namespace/class %s::%s\n", qPrintable(yyFileName), yyLineNo, @@ -1588,14 +1669,15 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) qPrintable(yyFileName), yyLineNo); break; } - while (!functionContext.at(idx - 1)->hasTrFunctions) { - if (idx == 1 || !functionContext.at(idx - 2)->isClass) { + while (!findNamespace(functionContext, idx)->classDef->hasTrFunctions) { + if (idx == 1 || !findNamespace(functionContext, idx - 1)->classDef) { context = stringifyNamespace(functionContext); - if (!functionContext.last()->complained) { + Namespace *fctx = findNamespace(functionContext)->classDef; + if (!fctx->complained) { qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", qPrintable(yyFileName), yyLineNo, qPrintable(context)); - functionContext.last()->complained = true; + fctx->complained = true; } goto gotctx; } @@ -1603,7 +1685,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } context.clear(); for (int i = 1;;) { - context += functionContext.at(i)->name; + context += functionContext.at(i).value(); if (++i == idx) break; context += strColons; @@ -1625,13 +1707,14 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) prefix.chop(2); NamespaceList nsl; QStringList unresolved; - if (fullyQualify(functionContext, prefix.split(strColons), false, &nsl, &unresolved)) { + if (fullyQualify(functionContext, prefix, false, &nsl, &unresolved)) { context = stringifyNamespace(nsl); - if (!nsl.last()->hasTrFunctions && !nsl.last()->complained) { + Namespace *fctx = findNamespace(nsl)->classDef; + if (!fctx->hasTrFunctions && !fctx->complained) { qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", qPrintable(yyFileName), yyLineNo, qPrintable(context)); - nsl.last()->complained = true; + fctx->complained = true; } } else { context = (stringListifyNamespace(nsl) + unresolved).join(strColons); @@ -1727,7 +1810,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) break; case Tok_Q_DECLARE_TR_FUNCTIONS: case Tok_Q_OBJECT: - namespaces.last()->hasTrFunctions = true; + modifyNamespace(&namespaces, true)->hasTrFunctions = true; yyTok = getToken(); break; case Tok_Ident: -- cgit v0.12 From 158a48e06134845a72dcab14452390641747d211 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 22 Sep 2009 20:26:24 +0200 Subject: namespaces *can* have tr() functions, after all ... by virtue of the Q_DECLARE_TR_FUNCTIONS macro. so remove the artificial limitation to classes (which was mostly an optimization anyway). --- tools/linguist/lupdate/cpp.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index c9b25f3..81623ab 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -117,7 +117,7 @@ typedef QList NamespaceList; struct Namespace { Namespace() : - classDef(0), + classDef(this), hasTrFunctions(false), complained(false) {} @@ -260,7 +260,7 @@ private: NamespaceList *resolved, QStringList *unresolved) const; bool findNamespaceCallback(const Namespace *ns, void *context) const; const Namespace *findNamespace(const NamespaceList &namespaces, int nsCount = -1) const; - void enterNamespace(NamespaceList *namespaces, const HashString &name, bool isClass); + void enterNamespace(NamespaceList *namespaces, const HashString &name); void truncateNamespaces(NamespaceList *namespaces, int lenght); Namespace *modifyNamespace(NamespaceList *namespaces, bool tryOrigin = true); @@ -1111,14 +1111,11 @@ const Namespace *CppParser::findNamespace(const NamespaceList &namespaces, int n return ns; } -void CppParser::enterNamespace(NamespaceList *namespaces, const HashString &name, bool isClass) +void CppParser::enterNamespace(NamespaceList *namespaces, const HashString &name) { *namespaces << name; - if (!findNamespace(*namespaces)) { - Namespace *ns = modifyNamespace(namespaces, false); - if (isClass) - ns->classDef = ns; - } + if (!findNamespace(*namespaces)) + modifyNamespace(namespaces, false); } void CppParser::truncateNamespaces(NamespaceList *namespaces, int length) @@ -1543,7 +1540,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } else { namespaceDepths.push(namespaces.count()); } - enterNamespace(&namespaces, fct, true); + enterNamespace(&namespaces, fct); functionContext = namespaces; functionContextUnresolved.clear(); // Pointless @@ -1561,7 +1558,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) yyTok = getToken(); if (yyTok == Tok_LeftBrace) { namespaceDepths.push(namespaces.count()); - enterNamespace(&namespaces, ns, false); + enterNamespace(&namespaces, ns); yyTok = getToken(); } else if (yyTok == Tok_Equals) { // e.g. namespace Is = OuterSpace::InnerSpace; @@ -1670,7 +1667,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) break; } while (!findNamespace(functionContext, idx)->classDef->hasTrFunctions) { - if (idx == 1 || !findNamespace(functionContext, idx - 1)->classDef) { + if (idx == 1) { context = stringifyNamespace(functionContext); Namespace *fctx = findNamespace(functionContext)->classDef; if (!fctx->complained) { -- cgit v0.12 From 178945342d0d46ddde460f230c22d2acb9f930a8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 22 Sep 2009 20:27:26 +0200 Subject: actually use the argument of Q_DECLARE_TR_FUNCTIONS which means that one can set an arbitrary context. as a side effect, this caches the stringified context of Q_OBJECT-derived classes. --- .../lupdate/testdata/good/parsecontexts/main.cpp | 9 +++ .../testdata/good/parsecontexts/project.ts.result | 9 +++ tools/linguist/lupdate/cpp.cpp | 68 +++++++++++++++++++--- 3 files changed, 77 insertions(+), 9 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp index 7e81b84..25c2c0d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp @@ -262,6 +262,15 @@ QString C2::foo() } +namespace Fooish { + Q_DECLARE_TR_FUNCTIONS(Bears::And::Spiders) +} + +void Fooish::bar() +{ + return tr("whatever the context", "Bears::And::Spiders"); +} + int main(int /*argc*/, char ** /*argv*/) { return 0; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result index 9b00d53..2f21de2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result @@ -102,6 +102,15 @@ + Bears::And::Spiders + + + whatever the context + Bears::And::Spiders + + + + C1 diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 81623ab..44a8feb 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -133,6 +133,8 @@ struct Namespace { // definition (either one in case of multiple definitions). Namespace *classDef; + QString trQualification; + bool hasTrFunctions; bool complained; // ... that tr functions are missing. }; @@ -221,6 +223,7 @@ private: uint getChar(); uint getToken(); + bool getMacroArgs(); bool match(uint t); bool matchString(QString *s); bool matchEncoding(bool *utf8); @@ -416,6 +419,34 @@ uint CppParser::getChar() } } +// This ignores commas, parens and comments. +// IOW, it understands only a single, simple argument. +bool CppParser::getMacroArgs() +{ + // Failing this assertion would mean losing the preallocated buffer. + Q_ASSERT(yyWord.isDetached()); + yyWord.resize(0); + + while (isspace(yyCh)) + yyCh = getChar(); + if (yyCh != '(') + return false; + do { + yyCh = getChar(); + } while (isspace(yyCh)); + ushort *ptr = (ushort *)yyWord.unicode(); + while (yyCh != ')') { + if (yyCh == EOF) + return false; + *ptr++ = yyCh; + yyCh = getChar(); + } + yyCh = getChar(); + for (; ptr != (ushort *)yyWord.unicode() && isspace(*(ptr - 1)); --ptr) ; + yyWord.resize(ptr - (ushort *)yyWord.unicode()); + return true; +} + STRING(Q_OBJECT); STRING(Q_DECLARE_TR_FUNCTIONS); STRING(QT_TR_NOOP); @@ -1666,10 +1697,11 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) qPrintable(yyFileName), yyLineNo); break; } - while (!findNamespace(functionContext, idx)->classDef->hasTrFunctions) { + Namespace *fctx; + while (!(fctx = findNamespace(functionContext, idx)->classDef)->hasTrFunctions) { if (idx == 1) { context = stringifyNamespace(functionContext); - Namespace *fctx = findNamespace(functionContext)->classDef; + fctx = findNamespace(functionContext)->classDef; if (!fctx->complained) { qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", qPrintable(yyFileName), yyLineNo, @@ -1680,12 +1712,17 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } --idx; } - context.clear(); - for (int i = 1;;) { - context += functionContext.at(i).value(); - if (++i == idx) - break; - context += strColons; + if (fctx->trQualification.isEmpty()) { + context.clear(); + for (int i = 1;;) { + context += functionContext.at(i).value(); + if (++i == idx) + break; + context += strColons; + } + fctx->trQualification = context; + } else { + context = fctx->trQualification; } } else { context = (stringListifyNamespace(functionContext) @@ -1705,8 +1742,13 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) NamespaceList nsl; QStringList unresolved; if (fullyQualify(functionContext, prefix, false, &nsl, &unresolved)) { - context = stringifyNamespace(nsl); Namespace *fctx = findNamespace(nsl)->classDef; + if (fctx->trQualification.isEmpty()) { + context = stringifyNamespace(nsl); + fctx->trQualification = context; + } else { + context = fctx->trQualification; + } if (!fctx->hasTrFunctions && !fctx->complained) { qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n", qPrintable(yyFileName), yyLineNo, @@ -1806,6 +1848,14 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) extra.clear(); break; case Tok_Q_DECLARE_TR_FUNCTIONS: + if (getMacroArgs()) { + Namespace *ns = modifyNamespace(&namespaces, true); + ns->hasTrFunctions = true; + ns->trQualification = yyWord; + ns->trQualification.detach(); + } + yyTok = getToken(); + break; case Tok_Q_OBJECT: modifyNamespace(&namespaces, true)->hasTrFunctions = true; yyTok = getToken(); -- cgit v0.12 From 0040d5a582b7fb7e9719d7c04c8de272e2a1389d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Sep 2009 14:59:04 +0200 Subject: reduce peak memory consumption drop the parse results of files which are unlikely to be included (i.e., which are not headers). --- tools/linguist/lupdate/cpp.cpp | 100 ++++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 30 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 44a8feb..0a710e2 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -120,6 +120,10 @@ struct Namespace { classDef(this), hasTrFunctions(false), complained(false) {} + ~Namespace() + { + qDeleteAll(children); + } QHash children; QHash aliases; @@ -159,30 +163,27 @@ private: }; struct ParseResults { - - ParseResults() - { - tor = 0; - } - int fileId; Namespace rootNamespace; - Translator *tor; QSet includes; }; typedef QHash ParseResultHash; +typedef QHash TranslatorHash; class CppFiles { public: static const ParseResults *getResults(const QString &cleanFile); static void setResults(const QString &cleanFile, ParseResults *results); + static const Translator *getTranslator(const QString &cleanFile); + static void setTranslator(const QString &cleanFile, const Translator *results); static bool isBlacklisted(const QString &cleanFile); static void setBlacklisted(const QString &cleanFile); private: static ParseResultHash &parsedFiles(); + static TranslatorHash &translatedFiles(); static QSet &blacklistedFiles(); }; @@ -192,10 +193,10 @@ public: CppParser(ParseResults *results = 0); void setInput(const QString &in); void setInput(QTextStream &ts, const QString &fileName); - void setTranslator(Translator *tor) { results->tor = tor; } + void setTranslator(Translator *_tor) { tor = _tor; } void parse(const QString &initialContext, ConversionData &cd, QSet &inclusions); void parseInternal(ConversionData &cd, QSet &inclusions); - ParseResults *getResults() const { return results; } + const ParseResults *recordResults(bool isHeader); void deleteResults() { delete results; } struct SavedState { @@ -311,6 +312,7 @@ private: QString prospectiveContext; QString pendingContext; ParseResults *results; + Translator *tor; bool directInclude; SavedState savedState; @@ -320,6 +322,7 @@ private: CppParser::CppParser(ParseResults *_results) { + tor = 0; if (_results) { results = _results; directInclude = true; @@ -1166,6 +1169,13 @@ ParseResultHash &CppFiles::parsedFiles() return parsed; } +TranslatorHash &CppFiles::translatedFiles() +{ + static TranslatorHash tors; + + return tors; +} + QSet &CppFiles::blacklistedFiles() { static QSet blacklisted; @@ -1184,6 +1194,16 @@ void CppFiles::setResults(const QString &cleanFile, ParseResults *results) parsedFiles().insert(cleanFile, results); } +const Translator *CppFiles::getTranslator(const QString &cleanFile) +{ + return translatedFiles().value(cleanFile); +} + +void CppFiles::setTranslator(const QString &cleanFile, const Translator *tor) +{ + translatedFiles().insert(cleanFile, tor); +} + bool CppFiles::isBlacklisted(const QString &cleanFile) { return blacklistedFiles().contains(cleanFile); @@ -1194,6 +1214,12 @@ void CppFiles::setBlacklisted(const QString &cleanFile) blacklistedFiles().insert(cleanFile); } +static bool isHeader(const QString &name) +{ + QString fileExt = QFileInfo(name).suffix(); + return fileExt.isEmpty() || fileExt.startsWith(QLatin1Char('h'), Qt::CaseInsensitive); +} + void CppParser::processInclude(const QString &file, ConversionData &cd, QSet &inclusions) { @@ -1212,17 +1238,15 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, bool isIndirect = false; if (namespaces.count() == 1 && functionContext.count() == 1 && functionContextUnresolved.isEmpty() && pendingContext.isEmpty() - && !CppFiles::isBlacklisted(cleanFile)) { - QString fileExt = QFileInfo(cleanFile).suffix(); - if (fileExt.isEmpty() || fileExt.startsWith(QLatin1Char('h'), Qt::CaseInsensitive)) { - - if (const ParseResults *res = CppFiles::getResults(cleanFile)) { - results->includes.insert(res); - return; - } + && !CppFiles::isBlacklisted(cleanFile) + && isHeader(cleanFile)) { - isIndirect = true; + if (const ParseResults *res = CppFiles::getResults(cleanFile)) { + results->includes.insert(res); + return; } + + isIndirect = true; } QFile f(cleanFile); @@ -1247,8 +1271,7 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, } parser.setInput(ts, cleanFile); parser.parse(cd.m_defaultContext, cd, inclusions); - CppFiles::setResults(cleanFile, parser.results); - results->includes.insert(parser.results); + results->includes.insert(parser.recordResults(true)); } else { CppParser parser(results); parser.namespaces = namespaces; @@ -1434,14 +1457,14 @@ void CppParser::recordMessage( msg.setExtras(extra); if ((utf8 || yyForceUtf8) && !yyCodecIsUtf8 && msg.needs8Bit()) msg.setUtf8(true); - results->tor->append(msg); + tor->append(msg); } void CppParser::parse(const QString &initialContext, ConversionData &cd, QSet &inclusions) { - if (results->tor) - yyCodecIsUtf8 = (results->tor->codecName() == "UTF-8"); + if (tor) + yyCodecIsUtf8 = (tor->codecName() == "UTF-8"); namespaces << HashString(); functionContext = namespaces; @@ -1657,7 +1680,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) break; case Tok_tr: case Tok_trUtf8: - if (!results->tor) + if (!tor) goto case_default; if (!sourcetext.isEmpty()) qWarning("%s:%d: //%% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n", @@ -1770,7 +1793,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) break; case Tok_translateUtf8: case Tok_translate: - if (!results->tor) + if (!tor) goto case_default; if (!sourcetext.isEmpty()) qWarning("%s:%d: //%% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n", @@ -1825,7 +1848,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) extra.clear(); break; case Tok_trid: - if (!results->tor) + if (!tor) goto case_default; if (sourcetext.isEmpty()) { yyTok = getToken(); @@ -1871,7 +1894,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } break; case Tok_Comment: - if (!results->tor) + if (!tor) goto case_default; if (yyWord.startsWith(QLatin1Char(':'))) { yyWord.remove(0, 1); @@ -1944,7 +1967,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) recordMessage(yyLineNo, context, QString(), comment, extracomment, QString(), TranslatorMessage::ExtraData(), false, false); extracomment.clear(); - results->tor->setExtras(extra); + tor->setExtras(extra); extra.clear(); } } @@ -2029,6 +2052,23 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) qPrintable(yyFileName), yyParenLineNo); } +const ParseResults *CppParser::recordResults(bool isHeader) +{ + if (tor) { + if (tor->messageCount()) + CppFiles::setTranslator(yyFileName, tor); + else + delete tor; + } + if (isHeader) { + CppFiles::setResults(yyFileName, results); + return results; + } else { + delete results; + return 0; + } +} + /* Fetches tr() calls in C++ code in UI files (inside "" tag). This mechanism is obsolete. @@ -2073,12 +2113,12 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat parser.setTranslator(tor); QSet inclusions; parser.parse(cd.m_defaultContext, cd, inclusions); - CppFiles::setResults(filename, parser.getResults()); + parser.recordResults(isHeader(filename)); } foreach (const QString &filename, filenames) if (!CppFiles::isBlacklisted(filename)) - if (Translator *tor = CppFiles::getResults(filename)->tor) + if (const Translator *tor = CppFiles::getTranslator(filename)) foreach (const TranslatorMessage &msg, tor->messages()) translator.extend(msg); } -- cgit v0.12 From b9fd3e2836553dbe9c48c5d8784155b02a5699a2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Sep 2009 15:17:32 +0200 Subject: detect and eliminate forwarding headers this will save quite some hash lookups (even if in empty hashes) and make the VisitRecorder bitmap smaller. --- tools/linguist/lupdate/cpp.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 0a710e2..ed41edb 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -175,7 +175,7 @@ class CppFiles { public: static const ParseResults *getResults(const QString &cleanFile); - static void setResults(const QString &cleanFile, ParseResults *results); + static void setResults(const QString &cleanFile, const ParseResults *results); static const Translator *getTranslator(const QString &cleanFile); static void setTranslator(const QString &cleanFile, const Translator *results); static bool isBlacklisted(const QString &cleanFile); @@ -1188,9 +1188,8 @@ const ParseResults *CppFiles::getResults(const QString &cleanFile) return parsedFiles().value(cleanFile); } -void CppFiles::setResults(const QString &cleanFile, ParseResults *results) +void CppFiles::setResults(const QString &cleanFile, const ParseResults *results) { - results->fileId = nextFileId++; parsedFiles().insert(cleanFile, results); } @@ -2055,14 +2054,28 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) const ParseResults *CppParser::recordResults(bool isHeader) { if (tor) { - if (tor->messageCount()) + if (tor->messageCount()) { CppFiles::setTranslator(yyFileName, tor); - else + } else { delete tor; + tor = 0; + } } if (isHeader) { - CppFiles::setResults(yyFileName, results); - return results; + const ParseResults *pr; + if (!tor && results->includes.count() == 1 + && results->rootNamespace.children.isEmpty() + && results->rootNamespace.aliases.isEmpty() + && results->rootNamespace.usings.isEmpty()) { + // This is a forwarding header. Slash it. + pr = *results->includes.begin(); + delete results; + } else { + results->fileId = nextFileId++; + pr = results; + } + CppFiles::setResults(yyFileName, pr); + return pr; } else { delete results; return 0; -- cgit v0.12 From 9d552fbf54a25b4bab7fff8a150ab0d03d524983 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 23 Sep 2009 15:30:24 +0200 Subject: Small change in the API of animations We're not taking a parameter in updateCurrentTime any more because that parameter was the total currenttime. So it was taking into account the currenttime and the currentloop at once. This was inconsistent Reviewed-by: Leo --- examples/animation/easing/animation.h | 4 ++-- src/corelib/animation/qabstractanimation.cpp | 18 +++++++++--------- src/corelib/animation/qabstractanimation.h | 2 +- src/corelib/animation/qparallelanimationgroup.cpp | 2 +- src/corelib/animation/qparallelanimationgroup.h | 2 +- src/corelib/animation/qpauseanimation.cpp | 3 +-- src/corelib/animation/qpauseanimation.h | 2 +- src/corelib/animation/qsequentialanimationgroup.cpp | 16 ++++++---------- src/corelib/animation/qsequentialanimationgroup.h | 2 +- src/corelib/animation/qsequentialanimationgroup_p.h | 2 +- src/corelib/animation/qvariantanimation.cpp | 3 +-- src/corelib/animation/qvariantanimation.h | 2 +- .../tst_qsequentialanimationgroup.cpp | 6 +++--- tests/benchmarks/qanimation/rectanimation.cpp | 4 ++-- tests/benchmarks/qanimation/rectanimation.h | 2 +- 15 files changed, 32 insertions(+), 38 deletions(-) diff --git a/examples/animation/easing/animation.h b/examples/animation/easing/animation.h index 45a7b17..78fdc14 100644 --- a/examples/animation/easing/animation.h +++ b/examples/animation/easing/animation.h @@ -68,7 +68,7 @@ public: m_path = QPainterPath(); } - void updateCurrentTime(int msecs) + void updateCurrentTime() { if (m_pathType == CirclePath) { if (m_path.isEmpty()) { @@ -90,7 +90,7 @@ public: updateCurrentValue(pt); emit valueChanged(pt); } else { - QPropertyAnimation::updateCurrentTime(msecs); + QPropertyAnimation::updateCurrentTime(); } } diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 6306882..9027be0 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -81,12 +81,12 @@ QAbstractAnimation provides pure virtual functions used by subclasses to track the progress of the animation: duration() and updateCurrentTime(). The duration() function lets you report a - duration for the animation (as discussed above). The current time - is delivered by the animation framework through calls to - updateCurrentTime(). By reimplementing this function, you can - track the animation progress. Note that neither the interval - between calls nor the number of calls to this function are - defined; though, it will normally be 60 updates per second. + duration for the animation (as discussed above). The animation + framework calls updateCurrentTime() when current time has changed. + By reimplementing this function, you can track the animation + progress. Note that neither the interval between calls nor the + number of calls to this function are defined; though, it will + normally be 60 updates per second. By reimplementing updateState(), you can track the animation's state changes, which is particularly useful for animations that @@ -604,7 +604,7 @@ void QAbstractAnimation::setCurrentTime(int msecs) } } - updateCurrentTime(msecs); + updateCurrentTime(); if (d->currentLoop != oldLoop) emit currentLoopChanged(d->currentLoop); @@ -705,10 +705,10 @@ bool QAbstractAnimation::event(QEvent *event) } /*! - \fn virtual void QAbstractAnimation::updateCurrentTime(int msecs) = 0; + \fn virtual void QAbstractAnimation::updateCurrentTime() = 0; This pure virtual function is called every time the animation's current - time changes. The \a msecs argument is the current time. + time changes. \sa updateState() */ diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h index dc0af19..516f5e9 100644 --- a/src/corelib/animation/qabstractanimation.h +++ b/src/corelib/animation/qabstractanimation.h @@ -119,7 +119,7 @@ protected: QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = 0); bool event(QEvent *event); - virtual void updateCurrentTime(int msecs) = 0; + virtual void updateCurrentTime() = 0; virtual void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); virtual void updateDirection(QAbstractAnimation::Direction direction); diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 349090b..82d5224 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -125,7 +125,7 @@ int QParallelAnimationGroup::duration() const /*! \reimp */ -void QParallelAnimationGroup::updateCurrentTime(int) +void QParallelAnimationGroup::updateCurrentTime() { Q_D(QParallelAnimationGroup); if (d->animations.isEmpty()) diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h index f013bc7..6afe4a7 100644 --- a/src/corelib/animation/qparallelanimationgroup.h +++ b/src/corelib/animation/qparallelanimationgroup.h @@ -67,7 +67,7 @@ protected: QParallelAnimationGroup(QParallelAnimationGroupPrivate &dd, QObject *parent); bool event(QEvent *event); - void updateCurrentTime(int msecs); + void updateCurrentTime(); void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); void updateDirection(QAbstractAnimation::Direction direction); diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp index 8bfed08..c382b19 100644 --- a/src/corelib/animation/qpauseanimation.cpp +++ b/src/corelib/animation/qpauseanimation.cpp @@ -141,9 +141,8 @@ bool QPauseAnimation::event(QEvent *e) /*! \reimp */ -void QPauseAnimation::updateCurrentTime(int msecs) +void QPauseAnimation::updateCurrentTime() { - Q_UNUSED(msecs); } diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h index 05eb3b3..caac9e9 100644 --- a/src/corelib/animation/qpauseanimation.h +++ b/src/corelib/animation/qpauseanimation.h @@ -68,7 +68,7 @@ public: protected: bool event(QEvent *e); - void updateCurrentTime(int msecs); + void updateCurrentTime(); private: Q_DISABLE_COPY(QPauseAnimation) diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 53fc4f3..9ad433f 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -112,17 +112,13 @@ int QSequentialAnimationGroupPrivate::animationActualTotalDuration(int index) co return ret; } -QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivate::indexForTime(int msecs) const +QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivate::indexForCurrentTime() const { - Q_Q(const QSequentialAnimationGroup); Q_ASSERT(!animations.isEmpty()); AnimationIndex ret; int duration = 0; - // in case duration is -1, currentLoop will always be 0 - ret.timeOffset = currentLoop * q->duration(); - for (int i = 0; i < animations.size(); ++i) { duration = animationActualTotalDuration(i); @@ -131,8 +127,8 @@ QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivat // 2. it ends after msecs // 3. it is the last animation (this can happen in case there is at least 1 uncontrolled animation) // 4. it ends exactly in msecs and the direction is backwards - if (duration == -1 || msecs < (ret.timeOffset + duration) - || (msecs == (ret.timeOffset + duration) && direction == QAbstractAnimation::Backward)) { + if (duration == -1 || currentTime < (ret.timeOffset + duration) + || (currentTime == (ret.timeOffset + duration) && direction == QAbstractAnimation::Backward)) { ret.index = i; return ret; } @@ -338,13 +334,13 @@ int QSequentialAnimationGroup::duration() const /*! \reimp */ -void QSequentialAnimationGroup::updateCurrentTime(int msecs) +void QSequentialAnimationGroup::updateCurrentTime() { Q_D(QSequentialAnimationGroup); if (!d->currentAnimation) return; - const QSequentialAnimationGroupPrivate::AnimationIndex newAnimationIndex = d->indexForTime(msecs); + const QSequentialAnimationGroupPrivate::AnimationIndex newAnimationIndex = d->indexForCurrentTime(); // remove unneeded animations from actualDuration list while (newAnimationIndex.index < d->actualDuration.size()) @@ -363,7 +359,7 @@ void QSequentialAnimationGroup::updateCurrentTime(int msecs) d->setCurrentAnimation(newAnimationIndex.index); - const int newCurrentTime = msecs - newAnimationIndex.timeOffset; + const int newCurrentTime = d->currentTime - newAnimationIndex.timeOffset; if (d->currentAnimation) { d->currentAnimation->setCurrentTime(newCurrentTime); diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h index e17e103..1c9e4cc 100644 --- a/src/corelib/animation/qsequentialanimationgroup.h +++ b/src/corelib/animation/qsequentialanimationgroup.h @@ -77,7 +77,7 @@ protected: QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd, QObject *parent); bool event(QEvent *event); - void updateCurrentTime(int msecs); + void updateCurrentTime(); void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); void updateDirection(QAbstractAnimation::Direction direction); diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h index 2e65cc0..ab41d35 100644 --- a/src/corelib/animation/qsequentialanimationgroup_p.h +++ b/src/corelib/animation/qsequentialanimationgroup_p.h @@ -79,7 +79,7 @@ public: }; int animationActualTotalDuration(int index) const; - AnimationIndex indexForTime(int msecs) const; + AnimationIndex indexForCurrentTime() const; void setCurrentAnimation(int index, bool intermediate = false); void activateCurrentAnimation(bool intermediate = false); diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index c831a34..ae8bf2f 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -656,9 +656,8 @@ QVariant QVariantAnimation::interpolated(const QVariant &from, const QVariant &t /*! \reimp */ -void QVariantAnimation::updateCurrentTime(int msecs) +void QVariantAnimation::updateCurrentTime() { - Q_UNUSED(msecs); d_func()->recalculateCurrentInterval(); } diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h index c803150..98c1aec 100644 --- a/src/corelib/animation/qvariantanimation.h +++ b/src/corelib/animation/qvariantanimation.h @@ -102,7 +102,7 @@ protected: QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = 0); bool event(QEvent *event); - void updateCurrentTime(int msecs); + void updateCurrentTime(); void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); virtual void updateCurrentValue(const QVariant &value) = 0; diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index 209e68b..b14d6f8 100644 --- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -169,10 +169,10 @@ public: int duration() const { return -1; /* not time driven */ } protected: - void updateCurrentTime(int msecs) + void updateCurrentTime() { - QPropertyAnimation::updateCurrentTime(msecs); - if (msecs >= QPropertyAnimation::duration()) + QPropertyAnimation::updateCurrentTime(); + if (currentTime() >= QPropertyAnimation::duration()) stop(); } }; diff --git a/tests/benchmarks/qanimation/rectanimation.cpp b/tests/benchmarks/qanimation/rectanimation.cpp index e5f2f57..5522847 100644 --- a/tests/benchmarks/qanimation/rectanimation.cpp +++ b/tests/benchmarks/qanimation/rectanimation.cpp @@ -73,9 +73,9 @@ int RectAnimation::duration() const } -void RectAnimation::updateCurrentTime(int msecs) +void RectAnimation::updateCurrentTime() { - qreal progress = m_easing.valueForProgress( qreal(msecs) / qreal(m_dura) ); + qreal progress = m_easing.valueForProgress( currentTime() / qreal(m_dura) ); QRect now; now.setCoords(interpolateInteger(m_start.left(), m_end.left(), progress), interpolateInteger(m_start.top(), m_end.top(), progress), diff --git a/tests/benchmarks/qanimation/rectanimation.h b/tests/benchmarks/qanimation/rectanimation.h index 84ec97d..995becb 100644 --- a/tests/benchmarks/qanimation/rectanimation.h +++ b/tests/benchmarks/qanimation/rectanimation.h @@ -58,7 +58,7 @@ public: void setDuration(int d); int duration() const; - virtual void updateCurrentTime(int msecs); + virtual void updateCurrentTime(); virtual void updateState(QAbstractAnimation::State state); private: -- cgit v0.12 From aed412fd14e39a356a886c5a472ceade3da56d13 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 23 Sep 2009 15:50:49 +0200 Subject: Avoid calling ensureContext() in setGeometry. We can delay calling ensureContext() since it will happen when painting begins anyway. There is a chance that we can get to this function when a window is being hidden and if this is the first thing that happens in the application, there is no need to call ensureContext() yet. Reviewed-by: Rhys Weatherley --- src/openvg/qwindowsurface_vg.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 1997ee8..6cc2e27 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -85,7 +85,6 @@ void QVGWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoin void QVGWindowSurface::setGeometry(const QRect &rect) { QWindowSurface::setGeometry(rect); - d_ptr->ensureContext(window()); } bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy) -- cgit v0.12 From 77166549a95056a9e0ac78a1e2248c78406630a4 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 22 Sep 2009 13:48:38 +0200 Subject: Added support for using custom application objects on S60. With this patch, the application developer can use his own CEikApplication, CEikDocument and CEikAppUi classes with Qt, by deriving from QS60MainApplication, QSMainDocument and QS60MainAppUi, respectively. He can then register a factory function in the QApplication constructor to have his own objects created during the framework initialization. This patch also fixes some Qt code style issues. RevBy: Jason Barron RevBy: mread RevBy: Sami Merila RevBy: Shane Kearns --- .../snippets/code/src_corelib_global_qglobal.cpp | 3 + src/gui/kernel/qapplication.h | 14 ++ src/gui/kernel/qapplication_s60.cpp | 41 ++++- src/gui/kernel/qt_s60_p.h | 2 + src/gui/s60framework/qs60mainapplication.cpp | 81 ++++++--- src/gui/s60framework/qs60mainapplication.h | 79 +++++++++ src/gui/s60framework/qs60mainapplication_p.h | 58 +------ src/gui/s60framework/qs60mainappui.cpp | 181 ++++++++++++++------- src/gui/s60framework/qs60mainappui.h | 86 ++++++++++ src/gui/s60framework/qs60mainappui_p.h | 130 --------------- src/gui/s60framework/qs60maindocument.cpp | 99 +++++------ src/gui/s60framework/qs60maindocument.h | 80 +++++++++ src/gui/s60framework/qs60maindocument_p.h | 139 ---------------- src/gui/s60framework/s60framework.pri | 5 +- .../qs60mainapplication/qs60mainapplication.pro | 4 + .../tst_qs60mainapplication.cpp | 133 +++++++++++++++ 16 files changed, 666 insertions(+), 469 deletions(-) create mode 100644 src/gui/s60framework/qs60mainapplication.h create mode 100644 src/gui/s60framework/qs60mainappui.h delete mode 100644 src/gui/s60framework/qs60mainappui_p.h create mode 100644 src/gui/s60framework/qs60maindocument.h delete mode 100644 src/gui/s60framework/qs60maindocument_p.h create mode 100644 tests/auto/qs60mainapplication/qs60mainapplication.pro create mode 100644 tests/auto/qs60mainapplication/tst_qs60mainapplication.cpp diff --git a/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/doc/src/snippets/code/src_corelib_global_qglobal.cpp index 3c61281..16b1073 100644 --- a/doc/src/snippets/code/src_corelib_global_qglobal.cpp +++ b/doc/src/snippets/code/src_corelib_global_qglobal.cpp @@ -529,3 +529,6 @@ class MyClass : public QObject qFuzzyCompare(1 + 0.0, 1 + 1.0e-200); // This will return true //! [46] +//! [47] +CApaApplication *myApplicationFactory(); +//! [47] diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 0562251..5f21a56 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -64,6 +64,9 @@ QT_BEGIN_HEADER #if defined(Q_OS_SYMBIAN) class TWsEvent; #endif +#if defined(Q_WS_S60) +class CApaApplication; +#endif QT_BEGIN_NAMESPACE @@ -114,6 +117,11 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication public: enum Type { Tty, GuiClient, GuiServer }; + +#ifdef Q_WS_S60 + typedef CApaApplication * (*QS60MainApplicationFactory)(); +#endif + #ifndef qdoc QApplication(int &argc, char **argv, int = QT_VERSION); QApplication(int &argc, char **argv, bool GUIenabled, int = QT_VERSION); @@ -122,6 +130,9 @@ public: QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION); QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION); #endif +#if defined(Q_WS_S60) + QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION); +#endif #endif virtual ~QApplication(); @@ -357,6 +368,9 @@ public: QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0); QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); #endif +#if defined(Q_WS_S60) || defined(qdoc) + QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv); +#endif #endif private: diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a5d07fd..4ca9459 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -817,11 +817,50 @@ TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id) return CCoeControl::MopSupplyObject(id); } +/*! + \typedef QApplication::QS60MainApplicationFactory + + This is a typedef for a pointer to a function with the following + signature: + + \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 47 + + \sa QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **) +*/ + +/*! + \since 4.6 + + Creates an application using the application factory given in + \a factory, and using \a argc command line arguments in \a argv. + \a factory can be leaving, but the error will be converted to a + standard exception. + + This function is only available on S60. +*/ +QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv) + : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)) +{ + Q_D(QApplication); + S60->s60ApplicationFactory = factory; + d->construct(); +} + +QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int _internal) + : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)) +{ + Q_D(QApplication); + S60->s60ApplicationFactory = factory; + d->construct(); + QApplicationPrivate::app_compile_version = _internal; +} + void qt_init(QApplicationPrivate * /* priv */, int) { if (!CCoeEnv::Static()) { // The S60 framework has not been initalized. We need to do it. - TApaApplicationFactory factory(NewApplication); + TApaApplicationFactory factory(S60->s60ApplicationFactory ? + S60->s60ApplicationFactory : newS60Application); CApaCommandLine* commandLine = 0; TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine); // After this construction, CEikonEnv will be available from CEikonEnv::Static(). diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index aa39f9d..9734d26 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -61,6 +61,7 @@ #include "QtGui/qimage.h" #include "QtGui/qevent.h" #include "qpointer.h" +#include "qapplication.h" #include #include #include @@ -107,6 +108,7 @@ public: int mouseInteractionEnabled : 1; int virtualMouseRequired : 1; int qtOwnsS60Environment : 1; + QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type static inline void updateScreenSize(); static inline RWsSession& wsSession(); static inline RWindowGroup& windowGroup(); diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index f12ed1f..54fb3b1 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -41,53 +41,86 @@ // INCLUDE FILES #include -#include "qs60maindocument_p.h" +#include "qs60maindocument.h" #include "qs60mainapplication_p.h" +#include "qs60mainapplication.h" #include #include QT_BEGIN_NAMESPACE /** - * factory function to create the QtS60Main application class + * factory function to create the QS60Main application class */ -CApaApplication* NewApplication() +CApaApplication *newS60Application() { return new QS60MainApplication; } -// ============================ MEMBER FUNCTIONS =============================== +_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc"); +/*! + * \class QS60MainApplication + * \obsolete + * \since 4.6 + * \brief Helper class for S60 migration + * + * The QS60MainApplication provides a helper class for use in migrating from existing S60 based + * applications to Qt based applications. It is used in the exact same way as the + * \c CAknApplication class from Symbian, but internally provides extensions used by Qt. + * + * When modifying old S60 applications that rely on implementing functions in \c CAknApplication, + * the class should be modified to inherit from this class instead of \c CAknApplication. Then the + * application can choose to override only certain functions. To make Qt use the custom application + * objects, pass a factory function to + * QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **). + * + * For more information on \c CAknApplication, please see the S60 documentation. + * + * Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian + * leaves. + * + * \sa QS60MainDocument, QS60MainAppUi, QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **) + */ -_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc"); +/*! + * \brief Contructs an instance of QS60MainApplication. + */ +QS60MainApplication::QS60MainApplication() +{ +} -// ----------------------------------------------------------------------------- -// QS60MainApplication::CreateDocumentL() -// Creates CApaDocument object -// ----------------------------------------------------------------------------- -// -CApaDocument* QS60MainApplication::CreateDocumentL() +/*! + * \brief Destroys the QS60MainApplication. + */ +QS60MainApplication::~QS60MainApplication() +{ +} + +/*! + * \brief Creates an instance of QS60MainDocument. + * + * \sa QS60MainDocument + */ +CApaDocument *QS60MainApplication::CreateDocumentL() { // Create an QtS60Main document, and return a pointer to it - return (static_cast(QS60MainDocument::NewL(*this))); + return new (ELeave) QS60MainDocument(*this); } -// ----------------------------------------------------------------------------- -// QS60MainApplication::AppDllUid() -// Returns application UID -// ----------------------------------------------------------------------------- -// + +/*! + * \brief Returns the UID of the application. + */ TUid QS60MainApplication::AppDllUid() const { // Return the UID for the QtS60Main application - return ProcessUid(); + return RProcess().SecureId().operator TUid(); } -// ----------------------------------------------------------------------------- -// QS60MainApplication::ResourceFileName() -// Returns application resource filename -// ----------------------------------------------------------------------------- -// +/*! + * \brief Returns the resource file name. + */ TFileName QS60MainApplication::ResourceFileName() const { TFindFile finder(iCoeEnv->FsSession()); @@ -98,5 +131,3 @@ TFileName QS60MainApplication::ResourceFileName() const } QT_END_NAMESPACE - -// End of File diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h new file mode 100644 index 0000000..457764c --- /dev/null +++ b/src/gui/s60framework/qs60mainapplication.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper 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$ +** +****************************************************************************/ + +#ifndef QS60MAINAPPLICATION_H +#define QS60MAINAPPLICATION_H + +#include + +#ifdef Q_WS_S60 + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QS60MainApplication : public CAknApplication +{ +public: + QS60MainApplication(); + // The virtuals are for qdoc. + virtual ~QS60MainApplication(); + + virtual TUid AppDllUid() const; + + virtual TFileName ResourceFileName() const; + +protected: + + virtual CApaDocument *CreateDocumentL(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_WS_S60 + +#endif // QS60MAINAPPLICATION_H diff --git a/src/gui/s60framework/qs60mainapplication_p.h b/src/gui/s60framework/qs60mainapplication_p.h index 40562da..863d872 100644 --- a/src/gui/s60framework/qs60mainapplication_p.h +++ b/src/gui/s60framework/qs60mainapplication_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Symbian application wrapper of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -46,67 +46,21 @@ // W A R N I N G // ------------- // -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. +// This file is not part of the Qt API. It exists for the convenience +// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header +// file may change from version to version without notice, or even be removed. // // We mean it. // -// INCLUDES -#include - #include -// CLASS DECLARATION +#include QT_BEGIN_NAMESPACE -CApaApplication* NewApplication(); - -static TUid ProcessUid() -{ - RProcess me; - TSecureId securId = me.SecureId(); - me.Close(); - return securId.operator TUid(); -} - -/** -* QS60MainApplication application class. -* Provides factory to create concrete document object. -* An instance of QS60MainApplication is the application part of the -* AVKON application framework for the QtS60Main example application. -*/ -class QS60MainApplication : public CAknApplication -{ -public: // Functions from base classes - - /** - * From CApaApplication, AppDllUid. - * @return Application's UID (KUidQtS60MainApp). - */ - TUid AppDllUid() const; - - /** - * From CApaApplication, ResourceFileName - * @return Application's resource filename (KUidQtS60MainApp). - */ - TFileName ResourceFileName() const; - -protected: // Functions from base classes - - /** - * From CApaApplication, CreateDocumentL. - * Creates QS60MainDocument document object. The returned - * pointer in not owned by the QS60MainApplication object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); -}; +CApaApplication *newS60Application(); QT_END_NAMESPACE #endif // QS60MAINAPPLICATION_P_H - -// End of File diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 4f5227c..9e2333b 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -48,21 +48,42 @@ #include #include -#include "qs60mainappui_p.h" +#include "qs60mainappui.h" #include #include #include QT_BEGIN_NAMESPACE -// ============================ MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// QS60MainAppUi::ConstructL() -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// +/*! + * \class QS60MainAppUi + * \obsolete + * \since 4.6 + * \brief Helper class for S60 migration + * + * The QS60MainAppUi provides a helper class for use in migrating from existing S60 based + * applications to Qt based applications. It is used in the exact same way as the + * \c CAknAppUi class from Symbian, but internally provides extensions used by Qt. + * + * When modifying old S60 applications that rely on implementing functions in \c CAknAppUi, + * the class should be modified to inherit from this class instead of \c CAknAppUi. Then the + * application can choose to override only certain functions. + * + * For more information on \c CAknAppUi, please see the S60 documentation. + * + * Unlike other Qt classes, QS60MainAppUi behaves like an S60 class, and can throw Symbian + * leaves. + * + * \sa QS60MainDocument, QS60MainApplication + */ + +/*! + * \brief Second phase Symbian constructor. + * + * Constructs all the elements of the class that can cause a leave to happen. + * + * If you override this function, you should call the base class implementation as well. + */ void QS60MainAppUi::ConstructL() { // Cone's heap and handle checks on app destruction are not suitable for Qt apps, as many @@ -80,104 +101,142 @@ void QS60MainAppUi::ConstructL() nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); } -// ----------------------------------------------------------------------------- -// QS60MainAppUi::QS60MainAppUi() -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// +/*! + * \brief Contructs an instance of QS60MainAppUi. + */ QS60MainAppUi::QS60MainAppUi() { // No implementation required } -// ----------------------------------------------------------------------------- -// QS60MainAppUi::~QS60MainAppUi() -// Destructor. -// ----------------------------------------------------------------------------- -// +/*! + * \brief Destroys the QS60MainAppUi. + */ QS60MainAppUi::~QS60MainAppUi() { } -// ----------------------------------------------------------------------------- -// QS60MainAppUi::HandleCommandL() -// Takes care of command handling. -// ----------------------------------------------------------------------------- -// -void QS60MainAppUi::HandleCommandL(TInt aCommand) +/*! + * \brief Handles commands produced by the S60 framework. + * + * \a command holds the ID of the command to handle, and is S60 specific. + * + * If you override this function, you should call the base class implementation if you do not + * handle the command. + */ +void QS60MainAppUi::HandleCommandL(TInt command) { if (qApp) - qApp->symbianHandleCommand(aCommand); + QT_TRYCATCH_LEAVING(qApp->symbianHandleCommand(command)); } -// ----------------------------------------------------------------------------- -// QS60MainAppUi::HandleResourceChangeL() -// Takes care of event handling. -// ----------------------------------------------------------------------------- -// -void QS60MainAppUi::HandleResourceChangeL(TInt aType) +/*! + * \brief Handles a resource change in the S60 framework. + * + * Resource changes include layout switches. \a type holds the type of resource change that + * occurred. + * + * If you override this function, you should call the base class implementation if you do not + * handle the resource change. + */ +void QS60MainAppUi::HandleResourceChangeL(TInt type) { - CAknAppUi::HandleResourceChangeL(aType); + CAknAppUi::HandleResourceChangeL(type); if (qApp) - qApp->symbianResourceChange(aType); + QT_TRYCATCH_LEAVING(qApp->symbianResourceChange(type)); } -void QS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *control) +/*! + * \brief Handles raw window server events. + * + * The event type and information is passed in \a event, while the receiving control is passed in + * \a destination. + * + * If you override this function, you should call the base class implementation if you do not + * handle the event. + */ +void QS60MainAppUi::HandleWsEventL(const TWsEvent& event, CCoeControl *destination) { int result = 0; if (qApp) QT_TRYCATCH_LEAVING( - result = qApp->s60ProcessEvent(const_cast(&aEvent)) + result = qApp->s60ProcessEvent(const_cast(&event)) ); if (result <= 0) - CAknAppUi::HandleWsEventL(aEvent, control); + CAknAppUi::HandleWsEventL(event, destination); } -// ----------------------------------------------------------------------------- -// Called by the framework when the application status pane -// size is changed. Passes the new client rectangle to the -// AppView -// ----------------------------------------------------------------------------- -// +/*! + * \brief Handles changes to the status pane size. + * + * Called by the framework when the application status pane size is changed. + * + * If you override this function, you should call the base class implementation if you do not + * handle the size change. + */ void QS60MainAppUi::HandleStatusPaneSizeChange() { - HandleResourceChangeL(KInternalStatusPaneChange); + TRAP_IGNORE(HandleResourceChangeL(KInternalStatusPaneChange)); HandleStackedControlsResourceChange(KInternalStatusPaneChange); } -void QS60MainAppUi::DynInitMenuBarL(TInt, CEikMenuBar *) +/*! + * \brief Dynamically initializes a menu bar. + * + * The resource associated with the menu is given in \a resourceId, and the actual menu bar is + * passed in \a menuBar. + * + * If you override this function, you should call the base class implementation as well. + */ +void QS60MainAppUi::DynInitMenuBarL(TInt /* resourceId */, CEikMenuBar * /* menuBar */) { } -void QS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane) +/*! + * \brief Dynamically initializes a menu pane. + * + * The resource associated with the menu is given in \a resourceId, and the actual menu pane is + * passed in \a menuPane. + * + * If you override this function, you should call the base class implementation as well. + */ +void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) { - if (aResourceId == R_QT_WRAPPERAPP_MENU) { - if (aMenuPane->NumberOfItemsInPane() <= 1) - qt_symbian_show_toplevel(aMenuPane); - - } else if (aResourceId != R_AVKON_MENUPANE_FEP_DEFAULT && aResourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT && aResourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) { - qt_symbian_show_submenu(aMenuPane, aResourceId); + if (resourceId == R_QT_WRAPPERAPP_MENU) { + if (menuPane->NumberOfItemsInPane() <= 1) + QT_TRYCATCH_LEAVING(qt_symbian_show_toplevel(menuPane)); + + } else if (resourceId != R_AVKON_MENUPANE_FEP_DEFAULT + && resourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT + && resourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) { + QT_TRYCATCH_LEAVING(qt_symbian_show_submenu(menuPane, resourceId)); } } -void QS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenuType aMenuType) +/*! + * \brief Restores a menu window. + * + * The menu window to restore is given in \a menuWindow. The resource ID and type of menu is given + * in \a resourceId and \a menuType, respectively. + * + * If you override this function, you should call the base class implementation as well. + */ +void QS60MainAppUi::RestoreMenuL(CCoeControl* menuWindow, TInt resourceId, TMenuType menuType) { - if ((aMenuId == R_QT_WRAPPERAPP_MENUBAR) || (aMenuId == R_AVKON_MENUPANE_FEP_DEFAULT)) { + if ((resourceId == R_QT_WRAPPERAPP_MENUBAR) || (resourceId == R_AVKON_MENUPANE_FEP_DEFAULT)) { TResourceReader reader; - iCoeEnv->CreateResourceReaderLC(reader, aMenuId); - aMenuWindow->ConstructFromResourceL(reader); + iCoeEnv->CreateResourceReaderLC(reader, resourceId); + menuWindow->ConstructFromResourceL(reader); CleanupStack::PopAndDestroy(); } - if (aMenuType == EMenuPane) - DynInitMenuPaneL(aMenuId, (CEikMenuPane*)aMenuWindow); + if (menuType == EMenuPane) + DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow); else - DynInitMenuBarL(aMenuId, (CEikMenuBar*)aMenuWindow); + DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow); } QT_END_NAMESPACE - -// End of File diff --git a/src/gui/s60framework/qs60mainappui.h b/src/gui/s60framework/qs60mainappui.h new file mode 100644 index 0000000..c2c6ef2 --- /dev/null +++ b/src/gui/s60framework/qs60mainappui.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper 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$ +** +****************************************************************************/ + +#ifndef QS60MAINAPPUI_H +#define QS60MAINAPPUI_H + +#include + +#ifdef Q_WS_S60 + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QS60MainAppUi : public CAknAppUi +{ +public: + QS60MainAppUi(); + // The virtuals are for qdoc. + virtual ~QS60MainAppUi(); + + virtual void ConstructL(); + + virtual void RestoreMenuL(CCoeControl* menuWindow,TInt resourceId,TMenuType menuType); + virtual void DynInitMenuBarL(TInt resourceId, CEikMenuBar *menuBar); + virtual void DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane); + + virtual void HandleCommandL( TInt command ); + + virtual void HandleResourceChangeL(TInt type); + + virtual void HandleStatusPaneSizeChange(); + +protected: + virtual void HandleWsEventL(const TWsEvent& event, CCoeControl* destination); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_WS_S60 + +#endif // QS60MAINAPPUI_H diff --git a/src/gui/s60framework/qs60mainappui_p.h b/src/gui/s60framework/qs60mainappui_p.h deleted file mode 100644 index 4b10833..0000000 --- a/src/gui/s60framework/qs60mainappui_p.h +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Symbian application wrapper 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$ -** -****************************************************************************/ - -#ifndef QS60MAINAPPUI_P_H -#define QS60MAINAPPUI_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -// INCLUDES -#include - -#include - -QT_BEGIN_NAMESPACE - -// FORWARD DECLARATIONS - -// CLASS DECLARATION -/** -* QS60MainAppUi application UI class. -* Interacts with the user through the UI and request message processing -* from the handler class -*/ -class QS60MainAppUi : public CAknAppUi -{ -public: // Constructors and destructor - - /** - * ConstructL. - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * QS60MainAppUi. - * C++ default constructor. This needs to be public due to - * the way the framework constructs the AppUi - */ - QS60MainAppUi(); - - /** - * ~QS60MainAppUi. - * Virtual Destructor. - */ - virtual ~QS60MainAppUi(); - -protected: - void RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType); - void DynInitMenuBarL(TInt aResourceId, CEikMenuBar *aMenuBar); - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane); - -private: // Functions from base classes - - /** - * From CEikAppUi, HandleCommandL. - * Takes care of command handling. - * @param aCommand Command to be handled. - */ - void HandleCommandL( TInt aCommand ); - - /** - * From CAknAppUi, HandleResourceChangeL - * Handles resource change events such as layout switches in global level. - * @param aType event type. - */ - void HandleResourceChangeL(TInt aType); - - /** - * HandleStatusPaneSizeChange. - * Called by the framework when the application status pane - * size is changed. - */ - void HandleStatusPaneSizeChange(); - -protected: - void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination); -}; - -QT_END_NAMESPACE - -#endif // QS60MAINAPPUI_P_H - -// End of File diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index ba66e98..52595db 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -39,77 +39,60 @@ ** ****************************************************************************/ -// INCLUDE FILES +#include "qs60mainappui.h" +#include "qs60maindocument.h" + #include -#include "qs60mainappui_p.h" -#include "qs60maindocument_p.h" QT_BEGIN_NAMESPACE -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// QS60MainDocument::NewL() -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -QS60MainDocument* QS60MainDocument::NewL(CEikApplication& aApp) -{ - QS60MainDocument* self = NewLC(aApp); - CleanupStack::Pop(self); - return self; -} - -// ----------------------------------------------------------------------------- -// QS60MainDocument::NewLC() -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -QS60MainDocument* QS60MainDocument::NewLC(CEikApplication& aApp) -{ - QS60MainDocument* self = new(ELeave) QS60MainDocument(aApp); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -// ----------------------------------------------------------------------------- -// QS60MainDocument::ConstructL() -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void QS60MainDocument::ConstructL() -{ - // No implementation required -} +/*! + * \class QS60MainDocument + * \obsolete + * \since 4.6 + * \brief Helper class for S60 migration + * + * The QS60MainDocument provides a helper class for use in migrating from existing S60 based + * applications to Qt based applications. It is used in the exact same way as the + * \c CAknDocument class from Symbian, but internally provides extensions used by Qt. + * + * When modifying old S60 applications that rely on implementing functions in \c CAknDocument, + * the class should be modified to inherit from this class instead of \c CAknDocument. Then the + * application can choose to override only certain functions. + * + * For more information on \c CAknDocument, please see the S60 documentation. + * + * Unlike other Qt classes, QS60MainDocument behaves like an S60 class, and can throw Symbian + * leaves. + * + * \sa QS60MainApplication, QS60MainAppUi + */ -// ----------------------------------------------------------------------------- -// QS60MainDocument::QS60MainDocument() -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -QS60MainDocument::QS60MainDocument(CEikApplication& aApp) - : CAknDocument(aApp) +/*! + * \brief Constructs an instance of QS60MainDocument. + * + * \a mainApplication should contain a pointer to a QS60MainApplication instance. + */ +QS60MainDocument::QS60MainDocument(CEikApplication& mainApplication) + : CAknDocument(mainApplication) { // No implementation required } -// --------------------------------------------------------------------------- -// QS60MainDocument::~QS60MainDocument() -// Destructor. -// --------------------------------------------------------------------------- -// +/*! + * \brief Destroys the QS60MainDocument. + */ QS60MainDocument::~QS60MainDocument() { // No implementation required } -// --------------------------------------------------------------------------- -// QS60MainDocument::CreateAppUiL() -// Constructs CreateAppUi. -// --------------------------------------------------------------------------- -// -CEikAppUi* QS60MainDocument::CreateAppUiL() +/*! + * \brief Creates an instance of QS60MainAppUi. + * + * \sa QS60MainAppUi + */ +CEikAppUi *QS60MainDocument::CreateAppUiL() { // Create the application user interface, and return a pointer to it; // the framework takes ownership of this object @@ -117,5 +100,3 @@ CEikAppUi* QS60MainDocument::CreateAppUiL() } QT_END_NAMESPACE - -// End of File diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h new file mode 100644 index 0000000..366d311 --- /dev/null +++ b/src/gui/s60framework/qs60maindocument.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper 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$ +** +****************************************************************************/ + +#ifndef QS60MAINDOCUMENT_H +#define QS60MAINDOCUMENT_H + +#include + +#ifdef Q_WS_S60 + +#include + +class CEikApplication; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QS60MainAppUi; + +class Q_GUI_EXPORT QS60MainDocument : public CAknDocument +{ +public: + + QS60MainDocument(CEikApplication &mainApplication); + // The virtuals are for qdoc. + virtual ~QS60MainDocument(); + +public: + + virtual CEikAppUi *CreateAppUiL(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_WS_S60 + +#endif // QS60MAINDOCUMENT_H diff --git a/src/gui/s60framework/qs60maindocument_p.h b/src/gui/s60framework/qs60maindocument_p.h deleted file mode 100644 index d7cee13..0000000 --- a/src/gui/s60framework/qs60maindocument_p.h +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Symbian application wrapper 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$ -** -****************************************************************************/ - -#ifndef QS60MAINDOCUMENT_P_H -#define QS60MAINDOCUMENT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -// INCLUDES -#include - -#include - -class CEikApplication; - -QT_BEGIN_NAMESPACE - -// FORWARD DECLARATIONS -class QS60MainAppUi; - -// CLASS DECLARATION - -/** -* QS60MainDocument application class. -* An instance of class QS60MainDocument is the Document part of the -* AVKON application framework for the QtS60Main application. -*/ -class QS60MainDocument : public CAknDocument -{ -public: // Constructors and destructor - - /** - * NewL. - * Two-phased constructor. - * Construct a QS60MainDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of QS60MainDocument. - */ - static QS60MainDocument* NewL( CEikApplication& aApp ); - - /** - * NewLC. - * Two-phased constructor. - * Construct a QS60MainDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of QS60MainDocument. - */ - static QS60MainDocument* NewLC( CEikApplication& aApp ); - - /** - * ~QS60MainDocument - * Virtual Destructor. - */ - virtual ~QS60MainDocument(); - -public: // Functions from base classes - - /** - * CreateAppUiL - * From CEikDocument, CreateAppUiL. - * Create a QS60MainAppUi object and return a pointer to it. - * The object returned is owned by the Uikon framework. - * @return Pointer to created instance of AppUi. - */ - CEikAppUi* CreateAppUiL(); - -private: // Constructors - - /** - * ConstructL - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * QS60MainDocument. - * C++ default constructor. - * @param aApp Application creating this document. - */ - QS60MainDocument( CEikApplication& aApp ); - -}; - -QT_END_NAMESPACE - -#endif // QS60MAINDOCUMENT_P_H - -// End of File diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index f9a6d95..fea74fe 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -3,5 +3,6 @@ SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60maindocument.cpp HEADERS += s60framework/qs60mainapplication_p.h \ - s60framework/qs60mainappui_p.h \ - s60framework/qs60maindocument_p.h + s60framework/qs60mainapplication.h \ + s60framework/qs60mainappui.h \ + s60framework/qs60maindocument.h diff --git a/tests/auto/qs60mainapplication/qs60mainapplication.pro b/tests/auto/qs60mainapplication/qs60mainapplication.pro new file mode 100644 index 0000000..bbd6c30 --- /dev/null +++ b/tests/auto/qs60mainapplication/qs60mainapplication.pro @@ -0,0 +1,4 @@ +load(qttest_p4) +SOURCES += tst_qs60mainapplication.cpp + +symbian:LIBS += -lapparc -leikcore -lcone -lavkon diff --git a/tests/auto/qs60mainapplication/tst_qs60mainapplication.cpp b/tests/auto/qs60mainapplication/tst_qs60mainapplication.cpp new file mode 100644 index 0000000..78fcb86 --- /dev/null +++ b/tests/auto/qs60mainapplication/tst_qs60mainapplication.cpp @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2009 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 +#include +#include +#include + +//TESTED_CLASS= +//TESTED_FILES= + +class tst_QS60MainApplication : public QObject +{ + Q_OBJECT + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); +private slots: + void customQS60MainApplication(); +}; + +void tst_QS60MainApplication::initTestCase() +{ +} + +void tst_QS60MainApplication::cleanupTestCase() +{ +} + +void tst_QS60MainApplication::init() +{ +} + +void tst_QS60MainApplication::cleanup() +{ +} + +#ifdef Q_WS_S60 +bool appUiConstructed = false; + +class CustomMainAppUi : public QS60MainAppUi +{ +public: + CustomMainAppUi() + { + appUiConstructed = true; + } +}; + +class CustomMainDocument : public QS60MainDocument +{ +public: + CustomMainDocument(CEikApplication &eikApp) + : QS60MainDocument(eikApp) + { + } + CEikAppUi *CreateAppUiL() + { + return new (ELeave) CustomMainAppUi; + } +}; + +class CustomMainApplication : public QS60MainApplication +{ +protected: + CApaDocument *CreateDocumentL() + { + return new (ELeave) CustomMainDocument(*this); + } +}; + +CApaApplication *factory() +{ + return new (ELeave) CustomMainApplication; +} +#endif // Q_WS_S60 + +void tst_QS60MainApplication::customQS60MainApplication() +{ +#ifndef Q_WS_S60 + QSKIP("This is an S60-only test", SkipAll); +#else + int argc = 1; + char *argv = "tst_qs60mainapplication"; + QApplication app(factory, argc, &argv); + QVERIFY(appUiConstructed); +#endif +} + +QTEST_APPLESS_MAIN(tst_QS60MainApplication) +#include "tst_qs60mainapplication.moc" -- cgit v0.12 From 4184d85022e2fb3d90dfa4cb211ea5e8e968dec7 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 23 Sep 2009 10:57:28 +0200 Subject: Corrected typo. --- src/gui/kernel/qt_s60_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 9734d26..905adc2 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE // Application internal HandleResourceChangeL events, -// system evens seems to start with 0x10 +// system events seems to start with 0x10 const TInt KInternalStatusPaneChange = 0x50000000; class QS60Data -- cgit v0.12 From 40f2c3ffdbcd700ed65b72a8cad1e7ce2c009e68 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 23 Sep 2009 15:37:12 +0200 Subject: Fixed clipping of non-cosmetic dashed strokes in raster paint engine. Reviewed-by: Samuel --- src/gui/painting/qpaintengineex.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 7c49190..b563735 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -328,12 +328,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) flags |= QVectorPath::CurvedShapeHint; // ### Perspective Xforms are currently not supported... - qreal txscale = 1; - if (!(pen.isCosmetic() || (qt_scaleForTransform(state()->matrix, &txscale) && txscale != 1))) { - // We include cosmetic pens in this case to avoid having to - // change the current transform. Normal transformed, - // non-cosmetic pens will be transformed as part of fill - // later, so they are also covered here.. + if (!pen.isCosmetic()) { if (types) { while (points < lastPoint) { switch (*types) { @@ -385,8 +380,6 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) QVectorPath::WindingFill); fill(strokePath, pen.brush()); } else { - const qreal strokeWidth = d->stroker.strokeWidth(); - d->stroker.setStrokeWidth(strokeWidth * txscale); // For cosmetic pens we need a bit of trickery... We to process xform the input points if (types) { while (points < lastPoint) { @@ -440,7 +433,6 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) } d->activeStroker->end(); - d->stroker.setStrokeWidth(strokeWidth); QVectorPath strokePath(d->strokeHandler->pts.data(), d->strokeHandler->types.size(), d->strokeHandler->types.data(), -- cgit v0.12 From f4c948dde1159b3a04a507781f1e0f89bd4b3b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 23 Sep 2009 16:33:33 +0200 Subject: Add test for to see if the layout is stable if it has several solutions. Currently this fails, so we have to use QEXPECT_FAIL. --- .../tst_qgraphicsanchorlayout.cpp | 65 ++++++++++++++++++++-- 1 file changed, 59 insertions(+), 6 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 385fb3e..2c4a253 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -64,6 +64,7 @@ private slots: void example(); void setSpacing(); void hardComplexS60(); + void stability(); void delete_anchor(); void conflicts(); void sizePolicy(); @@ -986,10 +987,26 @@ void tst_QGraphicsAnchorLayout::setSpacing() } -void tst_QGraphicsAnchorLayout::hardComplexS60() +/*! + Taken from "hard" complex case, found at + https://cwiki.nokia.com/S60QTUI/AnchorLayoutComplexCases + + This layout has a special property, since it has two possible solutions for its minimum size. + + For instance, when it is in its minimum size - the layout have two possible solutions: + 1. c.width == 10, e.width == 10 and g.width == 10 + (all others have width 0) + 2. d.width == 10 and g.width == 10 + (all others have width 0) + + It also has several solutions for preferred size. +*/ +static QGraphicsAnchorLayout *createAmbiguousS60Layout() { - // Test for "hard" complex case, taken from wiki - // https://cwiki.nokia.com/S60QTUI/AnchorLayoutComplexCases + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + l->setSpacing(0); + QSizeF min(0, 10); QSizeF pref(50, 10); QSizeF max(100, 10); @@ -1002,9 +1019,6 @@ void tst_QGraphicsAnchorLayout::hardComplexS60() QGraphicsWidget *f = createItem(min, pref, max, "f"); QGraphicsWidget *g = createItem(min, pref, max, "g"); - QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; - l->setContentsMargins(0, 0, 0, 0); - // setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10); setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 10); @@ -1034,7 +1048,12 @@ void tst_QGraphicsAnchorLayout::hardComplexS60() setAnchor(l, a, Qt::AnchorBottom, d, Qt::AnchorBottom, 0); setAnchor(l, f, Qt::AnchorBottom, g, Qt::AnchorTop, 0); setAnchor(l, g, Qt::AnchorBottom, l, Qt::AnchorBottom, 0); + return l; +} +void tst_QGraphicsAnchorLayout::hardComplexS60() +{ + QGraphicsAnchorLayout *l = createAmbiguousS60Layout(); QCOMPARE(l->count(), 7); QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window); @@ -1050,6 +1069,40 @@ void tst_QGraphicsAnchorLayout::hardComplexS60() } +void tst_QGraphicsAnchorLayout::stability() +{ + QVector geometries; + geometries.resize(7); + QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window); + bool sameAsPreviousArrangement = true; + // it usually fails after 3-4 iterations + for (int pass = 0; pass < 20 && sameAsPreviousArrangement; ++pass) { + // In case we need to "scramble" the heap allocator to provoke this bug. + //static const int primes[] = {2, 3, 5, 13, 89, 233, 1597, 28657, 514229}; // fibo primes + //const int primeCount = sizeof(primes)/sizeof(int); + //int alloc = primes[pass % primeCount] + pass; + //void *mem = qMalloc(alloc); + //qFree(mem); + QGraphicsAnchorLayout *l = createAmbiguousS60Layout(); + p->setLayout(l); + QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + l->setGeometry(QRectF(QPointF(0,0), layoutMinimumSize)); + QApplication::processEvents(); + for (int i = l->count() - 1; i >=0 && sameAsPreviousArrangement; --i) { + QRectF geom = l->itemAt(i)->geometry(); + if (pass != 0) { + sameAsPreviousArrangement = (geometries[i] == geom); + } + geometries[i] = geom; + } + p->setLayout(0); // uninstalls and deletes the layout + QApplication::processEvents(); + } + delete p; + QEXPECT_FAIL("", "The layout have several solutions, but which solution it picks is not stable", Continue); + QCOMPARE(sameAsPreviousArrangement, true); +} + void tst_QGraphicsAnchorLayout::delete_anchor() { QGraphicsScene scene; -- cgit v0.12 From 74ba43ee9b82f46d07d4055af4e9ac7706701cea Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 23 Sep 2009 17:29:10 +0200 Subject: Don't disable painting with multiple screens and VNC Task-number: QTBUG-4473 Reviewed-by: Paul --- src/gui/embedded/qscreenmulti_qws.cpp | 4 ++++ src/plugins/gfxdrivers/vnc/qscreenvnc_p.h | 2 ++ src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp | 20 ++++++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/gui/embedded/qscreenmulti_qws.cpp b/src/gui/embedded/qscreenmulti_qws.cpp index beeb6aa..3a23ca2 100644 --- a/src/gui/embedded/qscreenmulti_qws.cpp +++ b/src/gui/embedded/qscreenmulti_qws.cpp @@ -46,6 +46,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -230,6 +231,9 @@ bool QMultiScreen::connect(const QString &displaySpec) QStringList specs = dSpec.split(QLatin1Char(' '), QString::SkipEmptyParts); foreach (QString spec, specs) { const int id = getDisplayId(spec); + if (spec.startsWith("vnc:", Qt::CaseInsensitive)) { + spec.append(":noDisablePainting"); + } const QPoint offset = filterDisplayOffset(spec); QScreen *s = qt_get_screen(id, spec.toLatin1().constData()); s->setOffset(offset); diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h b/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h index 9aad8f7..d7466d2 100644 --- a/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h +++ b/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h @@ -259,6 +259,8 @@ public: #endif QVNCScreen *q_ptr; + + bool noDisablePainting; }; class QRfbEncoder diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp index e177f98..f28e160 100644 --- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp +++ b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp @@ -195,8 +195,11 @@ void QVNCClientCursor::write() const QVNCScreenPrivate::QVNCScreenPrivate(QVNCScreen *parent) : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25), - vncServer(0), q_ptr(parent) + vncServer(0), q_ptr(parent), noDisablePainting(false) { +#ifdef QT_BUILD_INTERNAL + noDisablePainting = (qgetenv("QT_VNC_NO_DISABLEPAINTING").toInt() <=0); +#endif #ifndef QT_NO_QWS_SIGNALHANDLER QWSSignalHandler::instance()->addObject(this); #endif @@ -615,7 +618,7 @@ void QVNCServer::newConnection() client->write(proto, 12); state = Protocol; - if (!qvnc_screen->screen()) + if (!qvnc_screen->screen() && !qvnc_screen->d_ptr->noDisablePainting) QWSServer::instance()->enablePainting(true); } @@ -2001,7 +2004,7 @@ void QVNCServer::discardClient() delete qvnc_cursor; qvnc_cursor = 0; #endif - if (!qvnc_screen->screen()) + if (!qvnc_screen->screen() && !qvnc_screen->d_ptr->noDisablePainting) QWSServer::instance()->enablePainting(false); } @@ -2184,6 +2187,9 @@ bool QVNCScreen::connect(const QString &displaySpec) d_ptr->dpiY = (dpiY > 0 ? dpiY : dpiX); } + if (args.contains(QLatin1String("noDisablePainting"))) + d_ptr->noDisablePainting = true; + QWSServer::setDefaultMouse("None"); QWSServer::setDefaultKeyboard("None"); @@ -2273,11 +2279,9 @@ bool QVNCScreen::initDevice() if (QProxyScreen::screen()) return ok; -#ifdef QT_BUILD_INTERNAL - if (qgetenv("QT_VNC_NO_DISABLEPAINTING").toInt() <= 0) -#endif - // No need to do painting while there's no clients attached - QWSServer::instance()->enablePainting(false); + // Disable painting if there is only 1 display and nothing is attached to the VNC server + if (!d_ptr->noDisablePainting) + QWSServer::instance()->enablePainting(false); return true; } -- cgit v0.12 From f494b7a9307675f8d6f4c1a6dd0ac07697705164 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 23 Sep 2009 15:06:36 +0200 Subject: Stabilize tst_QWidget::saveRestoreGeometry We need to wait for more condition before saving, otherwise what we save is not accurate (and the test fails) --- tests/auto/qwidget/tst_qwidget.cpp | 58 ++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index b7ffd15..811213a 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -2796,10 +2796,12 @@ void tst_QWidget::raise() QTest::qWait(50); UpdateWidget *onTop = new UpdateWidget(&topLevel); + onTop->reset(); onTop->resize(topLevel.size()); onTop->setAutoFillBackground(true); onTop->show(); QTest::qWait(50); + QTRY_VERIFY(onTop->numPaintEvents > 0); onTop->reset(); // Reset all the children. @@ -3072,7 +3074,7 @@ void tst_QWidget::saveRestoreGeometry() widget.resize(size); widget.show(); QTest::qWaitForWindowShown(&widget); - QTest::qWait(10); + QApplication::processEvents(); QTRY_COMPARE(widget.pos(), position); QCOMPARE(widget.size(), size); @@ -3099,7 +3101,7 @@ void tst_QWidget::saveRestoreGeometry() QVERIFY(widget.restoreGeometry(savedGeometry)); widget.show(); QTest::qWaitForWindowShown(&widget); - QTest::qWait(10); + QApplication::processEvents(); QTRY_COMPARE(widget.pos(), position); QCOMPARE(widget.size(), size); @@ -3114,7 +3116,8 @@ void tst_QWidget::saveRestoreGeometry() widget.resize(size); widget.show(); QTest::qWaitForWindowShown(&widget); - QTest::qWait(10); + QTest::qWait(100); + QTRY_COMPARE(widget.geometry().size(), size); QRect geom; @@ -3122,56 +3125,67 @@ void tst_QWidget::saveRestoreGeometry() savedGeometry = widget.saveGeometry(); geom = widget.geometry(); widget.setWindowState(widget.windowState() | Qt::WindowFullScreen); - QTest::qWait(10); QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen)); + QTest::qWait(100); QVERIFY(widget.restoreGeometry(savedGeometry)); - QTest::qWait(10); + QTest::qWait(20); + QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen)); QTRY_COMPARE(widget.geometry(), geom); - QVERIFY(!(widget.windowState() & Qt::WindowFullScreen)); //Restore to full screen widget.setWindowState(widget.windowState() | Qt::WindowFullScreen); - QTest::qWait(10); + QTest::qWait(20); QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen)); + QTest::qWait(200); savedGeometry = widget.saveGeometry(); geom = widget.geometry(); widget.setWindowState(widget.windowState() ^ Qt::WindowFullScreen); - QTest::qWait(10); - QTRY_VERIFY(widget.restoreGeometry(savedGeometry)); - QTest::qWait(10); + QTest::qWait(20); + QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen)); + QTest::qWait(200); + QVERIFY(widget.restoreGeometry(savedGeometry)); + QTest::qWait(20); + QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen)); QTRY_COMPARE(widget.geometry(), geom); QVERIFY((widget.windowState() & Qt::WindowFullScreen)); widget.setWindowState(widget.windowState() ^ Qt::WindowFullScreen); - QTest::qWait(10); + QTest::qWait(20); + QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen)); + QTest::qWait(20); //Restore from Maximised widget.move(position); widget.resize(size); - QTest::qWait(10); + QTest::qWait(20); + QTRY_COMPARE(widget.size(), size); + QTest::qWait(100); savedGeometry = widget.saveGeometry(); geom = widget.geometry(); widget.setWindowState(widget.windowState() | Qt::WindowMaximized); - QTest::qWait(10); + QTest::qWait(20); QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized)); - QVERIFY(widget.geometry() != geom); + QTRY_VERIFY(widget.geometry() != geom); QVERIFY(widget.restoreGeometry(savedGeometry)); - QTest::qWait(10); - QCOMPARE(widget.geometry(), geom); + QTest::qWait(20); + QTRY_COMPARE(widget.geometry(), geom); QVERIFY(!(widget.windowState() & Qt::WindowMaximized)); //Restore to maximised widget.setWindowState(widget.windowState() | Qt::WindowMaximized); - QTest::qWait(10); + QTest::qWait(20); QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized)); + QTest::qWait(100); geom = widget.geometry(); savedGeometry = widget.saveGeometry(); widget.setWindowState(widget.windowState() ^ Qt::WindowMaximized); - QTest::qWait(10); - QTRY_VERIFY(widget.restoreGeometry(savedGeometry)); - QTest::qWait(10); + QTest::qWait(20); + QTRY_VERIFY(!(widget.windowState() & Qt::WindowMaximized)); + QTest::qWait(20); + QVERIFY(widget.restoreGeometry(savedGeometry)); + QTest::qWait(20); + QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized)); QTRY_COMPARE(widget.geometry(), geom); - QVERIFY((widget.windowState() & Qt::WindowMaximized)); } } @@ -7431,8 +7445,10 @@ void tst_QWidget::updateWhileMinimized() // Filter out activation change and focus events to avoid update() calls in QWidget. widget.updateOnActivationChangeAndFocusIn = false; widget.show(); + widget.reset(); QTest::qWaitForWindowShown(&widget); QApplication::processEvents(); + QTRY_VERIFY(widget.numPaintEvents > 0); // Minimize window. widget.showMinimized(); -- cgit v0.12 From 0ff0494f108bff514c4ef05a301769dc8962d66f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 23 Sep 2009 16:47:03 +0200 Subject: Skip tst_QWidget::setWindowGeometry on X11 Since WindowManager operation are all assync, and we have no way to know if the window manager has finished playing with the window geometry, this test can't be reliable. Reviewed-by: Denis --- tests/auto/qwidget/tst_qwidget.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 811213a..126d571 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -4897,6 +4897,11 @@ void tst_QWidget::setWindowGeometry_data() void tst_QWidget::setWindowGeometry() { +#ifdef Q_WS_X11 + //Since WindowManager operation are all assync, and we have no way to know if the window + // manager has finished playing with the window geometry, this test can't be reliable. + QSKIP("Window Manager behaviour are too random for this test", SkipAll); +#endif QFETCH(QList, rects); QFETCH(int, windowFlags); QRect rect = rects.takeFirst(); @@ -5044,6 +5049,11 @@ void tst_QWidget::windowMoveResize_data() void tst_QWidget::windowMoveResize() { +#ifdef Q_WS_X11 + //Since WindowManager operation are all assync, and we have no way to know if the window + // manager has finished playing with the window geometry, this test can't be reliable. + QSKIP("Window Manager behaviour are too random for this test", SkipAll); +#endif #ifdef Q_OS_IRIX QSKIP("4DWM issues on IRIX makes this test fail", SkipAll); #endif -- cgit v0.12 From d5c9bf881c97785a61d056aeee645e768c8b0474 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 23 Sep 2009 17:57:39 +0200 Subject: Added ImhEmailCharactersOnly flag. RevBy: Trust me --- src/corelib/global/qnamespace.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index c39e602..741c06f 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1430,6 +1430,7 @@ public: ImhUppercaseOnly = 0x40000, ImhLowercaseOnly = 0x80000, ImhDialableCharactersOnly = 0x100000, + ImhEmailCharactersOnly = 0x200000, ImhExclusiveInputMask = 0xffff0000 }; -- cgit v0.12 From 02641e549e836984f575c9b3cc121513c5fda7d6 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 23 Sep 2009 17:59:42 +0200 Subject: Cleaned up input method hints documentation a bit. - Added missing docs for some flags. - Rearranged the values by type. RevBy: Trust me --- src/corelib/global/qnamespace.qdoc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index fafbec5..18b4d67 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2451,23 +2451,32 @@ \enum Qt::InputMethodHint \value ImhNone No hints. + + Flags that alter the behavior: + \value ImhHiddenText Characters should be hidden, as is typically used when entering passwords. This is automatically set when setting QLineEdit::echoMode to \c Password. - \value ImhDigitsOnly Only number input is allowed. - \value ImhUppercaseOnly Only upper case letter input is allowed. - \value ImhLowercaseOnly Only lower case letter input is allowed. \value ImhNoAutoUppercase The input method should not try to automatically switch to upper case when a sentence ends. \value ImhPreferNumbers Numbers are preferred (but not required). \value ImhPreferUppercase Upper case letters are preferred (but not required). \value ImhPreferLowercase Lower case letters are preferred (but not required). \value ImhNoPredictiveText Do not use predictive text (i.e. dictionary lookup) while typing. + + Flags that restrict input (exclusive flags): + + \value ImhDigitsOnly Only digits are allowed. + \value ImhFormattedNumbersOnly Only number input is allowed. This includes decimal point and minus sign. + \value ImhUppercaseOnly Only upper case letter input is allowed. + \value ImhLowercaseOnly Only lower case letter input is allowed. \value ImhDialableCharactersOnly Only characters suitable for phone dialling are allowed. + \value ImhEmailCharactersOnly Only characters suitable for email addresses are allowed. + + Masks: - \omitvalue ImhFormattedNumbersOnly - \omitvalue ImhExclusiveInputMask + \value ImhExclusiveInputMask This mask yields nonzero if any of the exclusive flags are used. - \note If several flags ending with \c Only are ORed together, the resulting character set will + \note If several exclusive flags are ORed together, the resulting character set will consist of the union of the specified sets. For instance specifying \c ImhNumbersOnly and \c ImhUppercaseOnly would yield a set consisting of numbers and uppercase letters. -- cgit v0.12 From 1950e27370ded75506e0129858bdad9a7c1b7a93 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Sep 2009 14:38:44 +0200 Subject: tests/auto/QSvgGenerator pro file fixed Reviewed-by: TrustMe --- tests/auto/qsvggenerator/qsvggenerator.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qsvggenerator/qsvggenerator.pro b/tests/auto/qsvggenerator/qsvggenerator.pro index 450bcd3..1ccf8e9 100644 --- a/tests/auto/qsvggenerator/qsvggenerator.pro +++ b/tests/auto/qsvggenerator/qsvggenerator.pro @@ -15,6 +15,6 @@ wince*|symbian { wince* { DEFINES += SRCDIR=\\\"\\\" -} !symbian { +} else:!symbian { DEFINES += SRCDIR=\\\"$$PWD/\\\" } -- cgit v0.12 From 89261bc78f370bc54582e9fec736e6204c299ae1 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Sep 2009 17:58:33 +0200 Subject: tests/auto/qpainter pro file fixed Reviewed-by: TrustMe --- tests/auto/qpainter/qpainter.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qpainter/qpainter.pro b/tests/auto/qpainter/qpainter.pro index 1b3659d..c8446d1 100644 --- a/tests/auto/qpainter/qpainter.pro +++ b/tests/auto/qpainter/qpainter.pro @@ -9,7 +9,7 @@ wince*|symbian*: { wince* { DEFINES += SRCDIR=\\\".\\\" -} !symbian { +} else:!symbian { DEFINES += SRCDIR=\\\"$$PWD\\\" } -- cgit v0.12 From affff618d68dd7f0c6c6abd2dd59ed151e45e220 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Sep 2009 18:02:53 +0200 Subject: QLabel and QTextEdit autotest pro files fixed Reviewed-by: joerg --- tests/auto/qlabel/qlabel.pro | 2 +- tests/auto/qtextedit/qtextedit.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qlabel/qlabel.pro b/tests/auto/qlabel/qlabel.pro index c274b4a..6d55c13 100644 --- a/tests/auto/qlabel/qlabel.pro +++ b/tests/auto/qlabel/qlabel.pro @@ -3,7 +3,7 @@ SOURCES += tst_qlabel.cpp wince*:{ DEFINES += SRCDIR=\\\"\\\" -} !symbian { +} else:!symbian { DEFINES += SRCDIR=\\\"$$PWD/\\\" } diff --git a/tests/auto/qtextedit/qtextedit.pro b/tests/auto/qtextedit/qtextedit.pro index 02f5dcb..3efabad 100644 --- a/tests/auto/qtextedit/qtextedit.pro +++ b/tests/auto/qtextedit/qtextedit.pro @@ -13,7 +13,7 @@ wince*|symbian*: { wince* { DEFINES += SRCDIR=\\\"./\\\" -} !symbian { +} else:!symbian { DEFINES += SRCDIR=\\\"$$PWD/\\\" } -- cgit v0.12 From af876ae5a55526afa4aedc3d8b214d66b50032e6 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 23 Sep 2009 18:04:46 +0200 Subject: Try to stabilize stylesheet test --- tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 50bb846..15ed56b 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -974,10 +974,11 @@ void tst_QStyleSheetStyle::background() void tst_QStyleSheetStyle::tabAlignement() { QTabWidget tabWidget; - tabWidget.show(); - QTest::qWait(50); tabWidget.addTab(new QLabel("tab1"),"tab1"); tabWidget.resize(QSize(400,400)); + tabWidget.show(); + QTest::qWaitForWindowShown(&tabWidget); + QTest::qWait(50); QTabBar *bar = qFindChild(&tabWidget); QVERIFY(bar); //check the tab is on the right -- cgit v0.12 From 92b717cbfb94bffbdc1a4d22f67ad359ba81a439 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 23 Sep 2009 18:22:29 +0200 Subject: Stabilize QGraphicsEffect and QToolTip test --- tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 14 ++++++-------- tests/auto/qtooltip/tst_qtooltip.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index ba3783b..0201bc4 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -48,6 +48,8 @@ #include #include +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES= @@ -261,10 +263,8 @@ void tst_QGraphicsEffect::draw() QGraphicsView view(&scene); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QTest::qWait(100); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(item->numRepaints > 0); item->reset(); // Make sure installing the effect triggers a repaint. @@ -361,10 +361,8 @@ void tst_QGraphicsEffect::opacity() QGraphicsView view(&scene); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QTest::qWait(100); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(effect->numRepaints > 0); QCOMPARE(effect->m_opacity, qreal(0.5)); } diff --git a/tests/auto/qtooltip/tst_qtooltip.cpp b/tests/auto/qtooltip/tst_qtooltip.cpp index 2ad74a3..283effa 100644 --- a/tests/auto/qtooltip/tst_qtooltip.cpp +++ b/tests/auto/qtooltip/tst_qtooltip.cpp @@ -112,13 +112,14 @@ void tst_QToolTip::task183679() Widget_task183679 widget; widget.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&widget); -#endif + QApplication::setActiveWindow(&widget); + QTest::qWaitForWindowShown(&widget); + QTest::qWait(30); + widget.showDelayedToolTip(100); QTest::qWait(300); - QVERIFY(QToolTip::isVisible()); + QTRY_VERIFY(QToolTip::isVisible()); QTest::keyPress(&widget, key); -- cgit v0.12 From 454bedce14728e4f0575aadea6c454717c95d3fe Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 23 Sep 2009 18:43:59 +0200 Subject: Fix Q3TextBrowser It seems that the test machine has some different font configuration which makes the font weight different from the default one. Fixed the problem by resolving the font before comparing. Reviewed-by: Peter Hartmann --- tests/auto/q3textbrowser/tst_q3textbrowser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/q3textbrowser/tst_q3textbrowser.cpp b/tests/auto/q3textbrowser/tst_q3textbrowser.cpp index 9a9f55c..b4c7e0d 100644 --- a/tests/auto/q3textbrowser/tst_q3textbrowser.cpp +++ b/tests/auto/q3textbrowser/tst_q3textbrowser.cpp @@ -97,6 +97,7 @@ void tst_Q3TextBrowser::setFont() { QFont f("Courier", 6); testWidget->setFont(f); + f = f.resolve(testWidget->font()); QVERIFY(testWidget->font() == f); } -- cgit v0.12 From 0f462990247d71e598346a8f96faf6d04cd4515e Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 23 Sep 2009 19:08:16 +0200 Subject: Compile fix for platforms prior to Symbian^3. The advanced pointer events are only available on Symbian^3 and higher so we need to make sure these are protected by an #ifdef. We might have to re-factor this later into a plugin in order to get this running on older versions. Reviewed-by: axis --- src/corelib/global/qglobal.h | 1 + src/gui/kernel/qapplication_s60.cpp | 6 ++++++ src/gui/kernel/qt_s60_p.h | 2 ++ src/gui/kernel/qwidget_s60.cpp | 2 ++ 4 files changed, 11 insertions(+) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e722268..7fe67ec 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2391,6 +2391,7 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE //enabling new graphics resources #define QT_SYMBIAN_SUPPORTS_SGIMAGE +#define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER #endif diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 1c198f9..27e8602 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -368,6 +368,7 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons m_previousEventLongTap = true; } +#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event) { QApplicationPrivate *d = QApplicationPrivate::instance(); @@ -427,9 +428,11 @@ void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent QTouchEvent::TouchScreen, d->appAllTouchPoints); } +#endif void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) { +#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER if (pEvent.IsAdvancedPointerEvent()) { const TAdvancedPointerEvent *advancedPointerEvent = pEvent.AdvancedPointerEvent(); translateAdvancedPointerEvent(advancedPointerEvent); @@ -438,6 +441,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) return; } } +#endif m_longTapDetector->PointerEventL(pEvent); QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent)); @@ -1551,8 +1555,10 @@ TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym) void QApplicationPrivate::initializeMultitouch_sys() { +#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone) maxTouchPressure = KMaxTInt; +#endif } void QApplicationPrivate::cleanupMultitouch_sys() diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 3a2dd2b..0d48634 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -169,7 +169,9 @@ private: TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent); bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent); void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ); +#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event); +#endif private: QWidget *qwidget; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 2e6139b..6b5e9b7 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -805,11 +805,13 @@ void QWidgetPrivate::setMask_sys(const QRegion& /* region */) void QWidgetPrivate::registerTouchWindow() { +#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER Q_Q(QWidget); if (q->testAttribute(Qt::WA_WState_Created) && q->windowType() != Qt::Desktop) { RWindow *rwindow = static_cast(q->effectiveWinId()->DrawableWindow()); rwindow->EnableAdvancedPointers(); } +#endif } int QWidget::metric(PaintDeviceMetric m) const -- cgit v0.12 From d2180e2fc3c56d56cd073a896d8449181ca28136 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 23 Sep 2009 19:48:16 +0200 Subject: Stabilize more test --- tests/auto/qcompleter/tst_qcompleter.cpp | 4 +--- tests/auto/qfiledialog/tst_qfiledialog.cpp | 3 +++ tests/auto/qheaderview/tst_qheaderview.cpp | 3 ++- tests/auto/qmenu/tst_qmenu.cpp | 2 ++ tests/auto/qspinbox/tst_qspinbox.cpp | 2 +- tests/auto/qstyle/tst_qstyle.cpp | 2 +- tests/auto/qtableview/tst_qtableview.cpp | 2 +- tests/auto/qtextbrowser/tst_qtextbrowser.cpp | 4 +--- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 1baae90..f7b9d98 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1011,6 +1011,7 @@ void tst_QCompleter::multipleWidgets() QWidget window; window.show(); QApplication::setActiveWindow(&window); + QApplicaion::qWaitForWindowShown(&window); QTRY_VERIFY(qApp->activeWindow() == &window); QFocusEvent focusIn(QEvent::FocusIn); @@ -1022,9 +1023,6 @@ void tst_QCompleter::multipleWidgets() comboBox->setFocus(); comboBox->show(); window.activateWindow(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&window); -#endif QApplication::setActiveWindow(&window); QTest::qWait(50); QTRY_VERIFY(qApp->focusWidget() == comboBox); diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 18875e7..d6225cd 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -1039,7 +1039,10 @@ void tst_QFiledialog::focus() QNonNativeFileDialog fd; fd.setDirectory(QDir::currentPath()); fd.show(); + QApplication::setActiveWindow(&fd); + QTest::qWaitForWindowShown(&fd); QTRY_COMPARE(fd.isVisible(), true); + QTRY_COMPARE(QApplication::activeWindow(), &fd); qApp->processEvents(); // make sure the tests work with focus follows mouse diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp index 0be895b..920231d 100644 --- a/tests/auto/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/qheaderview/tst_qheaderview.cpp @@ -1434,7 +1434,8 @@ void tst_QHeaderView::focusPolicy() widget.show(); widget.setFocus(Qt::OtherFocusReason); - QTest::qWait(100); + QApplication::setActiveWindow(&widget); + QTest::qWaitForWindowShown(&widget); widget.activateWindow(); QTest::qWait(100); diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index a5bac37..d7f453e 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -440,7 +440,9 @@ void tst_QMenu::overrideMenuAction() m->addAction(aQuit); w.show(); + QApplication::setActiveWindow(&w); w.setFocus(); + QTest::qWaitForWindowShown(&w); QTRY_VERIFY(w.hasFocus()); //test of the action inside the menu diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 80f185a..69347c4 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -752,8 +752,8 @@ void tst_QSpinBox::editingFinished() testFocusWidget->show(); QApplication::setActiveWindow(testFocusWidget); + QTest::qWaitForWindowShown(testFocusWidget); box->activateWindow(); - QTest::qWait(100);//qApp->processEvents(); box->setFocus(); QTRY_COMPARE(qApp->focusWidget(), box); diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp index 8526be1..56776d7 100644 --- a/tests/auto/qstyle/tst_qstyle.cpp +++ b/tests/auto/qstyle/tst_qstyle.cpp @@ -219,7 +219,7 @@ void tst_QStyle::testStyleFactory() foreach (QString styleName , keys) { QStyle *style = QStyleFactory::create(styleName); - QVERIFY(style != 0); + QVERIFY2(style != 0, qPrintable(QString::fromLatin1("Fail to load style '%1'").arg(styleName))); delete style; } } diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index ce13d31..f5d5040 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -2908,11 +2908,11 @@ void tst_QTableView::tabFocus() QLineEdit *edit = new QLineEdit(&window); window.show(); + QApplication::setActiveWindow(&window); QTest::qWaitForWindowShown(&window); window.setFocus(); QTest::qWait(100); window.activateWindow(); - QApplication::setActiveWindow(&window); QTest::qWait(100); qApp->processEvents(); diff --git a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp index 1f06dcf..829d580 100644 --- a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp @@ -63,10 +63,8 @@ class TestBrowser : public QTextBrowser public: inline TestBrowser() : htmlLoadAttempts(0) { show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(this); -#endif QApplication::setActiveWindow(this); + QTest::qWaitForWindowShown(this); activateWindow(); setFocus(); QTest::qWait(50); -- cgit v0.12 From b3f3ab74f07cbadb568a5e8ad4363f1e042ea40c Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 23 Sep 2009 20:30:21 +0200 Subject: Fix 3.1 build - move unimplemented RFs API to the S60 plugin RFs::GetSystemDrive doesn't exist in 3.1 (even though it is in the symbian documentation). Moved it to a new function in the S60 plugins. For 3.1, it returns EDriveC, for all other versions the RFs API is used Task-number: QT-805 Reviewed-by: Iain --- src/corelib/kernel/qcore_symbian_p.h | 3 +- src/corelib/kernel/qcoreapplication.cpp | 12 +++++-- src/plugins/s60/3_1/3_1.pro | 3 +- src/plugins/s60/3_2/3_2.pro | 8 +++-- src/plugins/s60/5_0/5_0.pro | 8 +++-- src/plugins/s60/bwins/qts60pluginu.def | 2 ++ src/plugins/s60/eabi/qts60pluginu.def | 2 ++ src/plugins/s60/src/qcoreapplication_3_1.cpp | 48 ++++++++++++++++++++++++++++ src/plugins/s60/src/qcoreapplication_3_2.cpp | 48 ++++++++++++++++++++++++++++ 9 files changed, 124 insertions(+), 10 deletions(-) create mode 100644 src/plugins/s60/src/qcoreapplication_3_1.cpp create mode 100644 src/plugins/s60/src/qcoreapplication_3_2.cpp diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index 5b243dc..56097bc 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -138,7 +138,8 @@ enum S60PluginFuncOrdinals S60Plugin_GetTimeFormatSpec = 2, S60Plugin_GetLongDateFormatSpec = 3, S60Plugin_GetShortDateFormatSpec = 4, - S60Plugin_LocalizedDirectoryName = 5 + S60Plugin_LocalizedDirectoryName = 5, + S60Plugin_GetSystemDrive = 6 }; Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 9a93685..61b9ee7 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -111,6 +111,11 @@ private: QMutex *mtx; }; +#ifdef Q_OS_SYMBIAN +typedef TDriveNumber (*SystemDriveFunc)(RFs&); +static SystemDriveFunc PtrGetSystemDrive=0; +#endif + #if defined(Q_WS_WIN) || defined(Q_WS_MAC) extern QString qAppFileName(); #endif @@ -1820,8 +1825,11 @@ QString QCoreApplication::applicationDirPath() } if (err != KErrNone || (driveInfo.iDriveAtt & KDriveAttRom) || (driveInfo.iMediaAtt & KMediaAttWriteProtected)) { - driveChar = fs.GetSystemDriveChar(); - drive = fs.GetSystemDrive(); + if(!PtrGetSystemDrive) + PtrGetSystemDrive = reinterpret_cast(qt_resolveS60PluginFunc(S60Plugin_GetSystemDrive)); + Q_ASSERT(PtrGetSystemDrive); + drive = PtrGetSystemDrive(fs); + fs.DriveToChar(drive, driveChar); } qDriveChar = QChar(QLatin1Char(driveChar)).toUpper(); diff --git a/src/plugins/s60/3_1/3_1.pro b/src/plugins/s60/3_1/3_1.pro index 568a33c..58ff5ce 100644 --- a/src/plugins/s60/3_1/3_1.pro +++ b/src/plugins/s60/3_1/3_1.pro @@ -3,6 +3,7 @@ include(../s60pluginbase.pri) TARGET = qts60plugin_3_1 SOURCES += ../src/qlocale_3_1.cpp \ - ../src/qdesktopservices_3_1.cpp + ../src/qdesktopservices_3_1.cpp \ + ../src/qcoreapplication_3_1.cpp TARGET.UID3=0x2001E620 diff --git a/src/plugins/s60/3_2/3_2.pro b/src/plugins/s60/3_2/3_2.pro index 97409d3..4b28eb9 100644 --- a/src/plugins/s60/3_2/3_2.pro +++ b/src/plugins/s60/3_2/3_2.pro @@ -4,11 +4,13 @@ TARGET = qts60plugin_3_2 contains(S60_VERSION, 3.1) { SOURCES += ../src/qlocale_3_1.cpp \ - ../src/qdesktopservices_3_1.cpp + ../src/qdesktopservices_3_1.cpp \ + ../src/qcoreapplication_3_1.cpp } else { SOURCES += ../src/qlocale_3_2.cpp \ - ../src/qdesktopservices_3_2.cpp - LIBS += -ldirectorylocalizer + ../src/qdesktopservices_3_2.cpp \ + ../src/qcoreapplication_3_2.cpp + LIBS += -ldirectorylocalizer -lefsrv INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE } diff --git a/src/plugins/s60/5_0/5_0.pro b/src/plugins/s60/5_0/5_0.pro index d7c3cb2..4cdce12 100644 --- a/src/plugins/s60/5_0/5_0.pro +++ b/src/plugins/s60/5_0/5_0.pro @@ -4,11 +4,13 @@ TARGET = qts60plugin_5_0 contains(S60_VERSION, 3.1) { SOURCES += ../src/qlocale_3_1.cpp \ - ../src/qdesktopservices_3_1.cpp + ../src/qdesktopservices_3_1.cpp \ + ../src/qcoreapplication_3_1.cpp } else { SOURCES += ../src/qlocale_3_2.cpp \ - ../src/qdesktopservices_3_2.cpp - LIBS += -ldirectorylocalizer + ../src/qdesktopservices_3_2.cpp \ + ../src/qcoreapplication_3_2.cpp + LIBS += -ldirectorylocalizer -lefsrv INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE } diff --git a/src/plugins/s60/bwins/qts60pluginu.def b/src/plugins/s60/bwins/qts60pluginu.def index a082262..b4110a9 100644 --- a/src/plugins/s60/bwins/qts60pluginu.def +++ b/src/plugins/s60/bwins/qts60pluginu.def @@ -4,3 +4,5 @@ EXPORTS ?defaultGetLongDateFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 3 NONAME ; class TPtrC16 defaultGetLongDateFormatSpec(class TExtendedLocale &) ?defaultGetShortDateFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 4 NONAME ; class TPtrC16 defaultGetShortDateFormatSpec(class TExtendedLocale &) ?localizedDirectoryName@@YA?AVQString@@AAV1@@Z @ 5 NONAME ; class QString localizedDirectoryName(class QString &) + ?systemDrive@@YA?AW4TDriveNumber@@AAVRFs@@@Z @ 6 NONAME ; enum TDriveNumber systemDrive(class RFs &) + diff --git a/src/plugins/s60/eabi/qts60pluginu.def b/src/plugins/s60/eabi/qts60pluginu.def index d768436..df7895c 100644 --- a/src/plugins/s60/eabi/qts60pluginu.def +++ b/src/plugins/s60/eabi/qts60pluginu.def @@ -4,3 +4,5 @@ EXPORTS _Z28defaultGetLongDateFormatSpecR15TExtendedLocale @ 3 NONAME _Z29defaultGetShortDateFormatSpecR15TExtendedLocale @ 4 NONAME _Z22localizedDirectoryNameR7QString @ 5 NONAME + _Z11systemDriveR3RFs @ 6 NONAME + diff --git a/src/plugins/s60/src/qcoreapplication_3_1.cpp b/src/plugins/s60/src/qcoreapplication_3_1.cpp new file mode 100644 index 0000000..c7627ce --- /dev/null +++ b/src/plugins/s60/src/qcoreapplication_3_1.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 +#include + +EXPORT_C TDriveNumber systemDrive(RFs&) +{ + return EDriveC; +} diff --git a/src/plugins/s60/src/qcoreapplication_3_2.cpp b/src/plugins/s60/src/qcoreapplication_3_2.cpp new file mode 100644 index 0000000..8d2794e --- /dev/null +++ b/src/plugins/s60/src/qcoreapplication_3_2.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 +#include + +EXPORT_C TDriveNumber systemDrive(RFs& fs) +{ + return fs.GetSystemDrive(); +} -- cgit v0.12 From 5c5a6b387319095a2c2a589bb1e1d67b51854fc1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 23 Sep 2009 20:21:17 +0200 Subject: Fix tst_QWidget::activateWindow on X11 On X11 one needs to wait logner for the reply for the window mabager All the QWidget tests passes on my X11 in about 30seconds now --- tests/auto/qwidget/tst_qwidget.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 126d571..d34d3c5 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9232,9 +9232,10 @@ void tst_QWidget::activateWindow() mainwindow->setCentralWidget(label); mainwindow->setVisible(true); mainwindow->activateWindow(); + QTest::qWaitForWindowShown(&mainWindow); qApp->processEvents(); - QVERIFY(mainwindow->isActiveWindow()); + QTRY_VERIFY(mainwindow->isActiveWindow()); // Create second mainwindow and set it active QMainWindow* mainwindow2 = new QMainWindow(); @@ -9244,16 +9245,16 @@ void tst_QWidget::activateWindow() mainwindow2->activateWindow(); qApp->processEvents(); - QVERIFY(!mainwindow->isActiveWindow()); - QVERIFY(mainwindow2->isActiveWindow()); + QTRY_VERIFY(!mainwindow->isActiveWindow()); + QTRY_VERIFY(mainwindow2->isActiveWindow()); // Revert first mainwindow back to visible active mainwindow->setVisible(true); mainwindow->activateWindow(); qApp->processEvents(); - QVERIFY(mainwindow->isActiveWindow()); - QVERIFY(!mainwindow2->isActiveWindow()); + QTRY_VERIFY(mainwindow->isActiveWindow()); + QTRY_VERIFY(!mainwindow2->isActiveWindow()); } #ifdef Q_OS_SYMBIAN -- cgit v0.12 From f6b942b88ed2519b73c540120fde73390716173f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 23 Sep 2009 21:03:01 +0200 Subject: Stabilize more tests --- tests/auto/q3table/tst_q3table.cpp | 4 + tests/auto/qstackedlayout/tst_qstackedlayout.cpp | 3 +- tests/auto/qwidget/tst_qwidget.cpp | 177 ++++++++++++----------- 3 files changed, 95 insertions(+), 89 deletions(-) diff --git a/tests/auto/q3table/tst_q3table.cpp b/tests/auto/q3table/tst_q3table.cpp index ca65852..f911dd4 100644 --- a/tests/auto/q3table/tst_q3table.cpp +++ b/tests/auto/q3table/tst_q3table.cpp @@ -51,6 +51,8 @@ #include #include +#include "../../shared/util.h" + #define WAITS 1 #ifdef WAITS #endif @@ -499,6 +501,8 @@ void tst_Q3Table::pageUpDownNavigation() void tst_Q3Table::simpleKeyboardNavigation() { + QApplication::setActiveWindow(testWidget); + QTRY_COMPARE(QApplication::activeWindow(), testWidget); QWidget *w; // Test for task #24726 diff --git a/tests/auto/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/qstackedlayout/tst_qstackedlayout.cpp index cdf84811..51f6c03 100644 --- a/tests/auto/qstackedlayout/tst_qstackedlayout.cpp +++ b/tests/auto/qstackedlayout/tst_qstackedlayout.cpp @@ -353,8 +353,9 @@ void tst_QStackedLayout::keepFocusAfterSetCurrent() stackLayout->setCurrentIndex(0); testWidget->show(); - QTest::qWait(25); QApplication::setActiveWindow(testWidget); + QTest::qWaitForWindowShown(testWidget); + QApplication::processEvents(); edit1->setFocus(); edit1->activateWindow(); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index d34d3c5..2e66da2 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -2304,8 +2304,8 @@ void tst_QWidget::showMinimizedKeepsFocus() QCOMPARE(qApp->focusWidget(), static_cast(0)); window.showMinimized(); - QTest::qWait(100); - QVERIFY(window.isMinimized()); + QTest::qWait(30); + QTRY_VERIFY(window.isMinimized()); #ifdef Q_WS_QWS QEXPECT_FAIL("", "QWS does not implement showMinimized()", Continue); #endif @@ -2935,7 +2935,7 @@ void tst_QWidget::stackUnder() if (expectedPaintEvents == 1 && child->numPaintEvents == 2) QEXPECT_FAIL(0, "Mac and Windows issues double repaints for Z-Order change", Continue); #endif - QCOMPARE(child->numPaintEvents, expectedPaintEvents); + QTRY_COMPARE(child->numPaintEvents, expectedPaintEvents); QCOMPARE(child->numZOrderChangeEvents, 0); child->reset(); } @@ -3158,13 +3158,14 @@ void tst_QWidget::saveRestoreGeometry() widget.resize(size); QTest::qWait(20); QTRY_COMPARE(widget.size(), size); - QTest::qWait(100); + QTest::qWait(200); savedGeometry = widget.saveGeometry(); geom = widget.geometry(); widget.setWindowState(widget.windowState() | Qt::WindowMaximized); QTest::qWait(20); QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized)); QTRY_VERIFY(widget.geometry() != geom); + QTest::qWait(100); QVERIFY(widget.restoreGeometry(savedGeometry)); QTest::qWait(20); QTRY_COMPARE(widget.geometry(), geom); @@ -3175,13 +3176,13 @@ void tst_QWidget::saveRestoreGeometry() widget.setWindowState(widget.windowState() | Qt::WindowMaximized); QTest::qWait(20); QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized)); - QTest::qWait(100); + QTest::qWait(200); geom = widget.geometry(); savedGeometry = widget.saveGeometry(); widget.setWindowState(widget.windowState() ^ Qt::WindowMaximized); QTest::qWait(20); QTRY_VERIFY(!(widget.windowState() & Qt::WindowMaximized)); - QTest::qWait(20); + QTest::qWait(200); QVERIFY(widget.restoreGeometry(savedGeometry)); QTest::qWait(20); QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized)); @@ -3245,8 +3246,8 @@ void tst_QWidget::restoreVersion1Geometry() QTest::qWait(100); if (expectedWindowState == Qt::WindowNoState) { - QCOMPARE(widget.pos(), expectedPosition); - QCOMPARE(widget.size(), expectedSize); + QTRY_COMPARE(widget.pos(), expectedPosition); + QTRY_COMPARE(widget.size(), expectedSize); } widget.showNormal(); @@ -5277,14 +5278,19 @@ public: const QRegion r = QRegion(region); \ for (int i = 0; i < r.rects().size(); ++i) { \ const QRect rect = r.rects().at(i); \ - const QPixmap pixmap = QPixmap::grabWindow(QDesktopWidget().winId(), \ + for (int t = 0; t < 5; t++) { \ + const QPixmap pixmap = QPixmap::grabWindow(QDesktopWidget().winId(), \ rect.left(), rect.top(), \ rect.width(), rect.height()); \ - QCOMPARE(pixmap.size(), rect.size()); \ - QPixmap expectedPixmap(pixmap); /* ensure equal formats */ \ - expectedPixmap.fill(color); \ - QCOMPARE(pixmap.toImage().pixel(0,0), QColor(color).rgb()); \ - QCOMPARE(pixmap, expectedPixmap); \ + QCOMPARE(pixmap.size(), rect.size()); \ + QPixmap expectedPixmap(pixmap); /* ensure equal formats */ \ + expectedPixmap.fill(color); \ + if (pixmap.toImage().pixel(0,0) != QColor(color).rgb() && t < 4 ) \ + { QTest::qWait(200); continue; } \ + QCOMPARE(pixmap.toImage().pixel(0,0), QColor(color).rgb()); \ + QCOMPARE(pixmap, expectedPixmap); \ + break; \ + } \ } \ } @@ -5324,8 +5330,8 @@ void tst_QWidget::moveChild() #ifdef QT_MAC_USE_COCOA QEXPECT_FAIL(0, "Cocoa compositor paints the entire content view, even when opaque", Continue); #endif - QCOMPARE(parent.r, QRegion(parent.rect()) - child.geometry()); - QCOMPARE(child.r, QRegion(child.rect())); + QTRY_COMPARE(parent.r, QRegion(parent.rect()) - child.geometry()); + QTRY_COMPARE(child.r, QRegion(child.rect())); VERIFY_COLOR(child.geometry().translated(tlwOffset), child.color); VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), @@ -5340,7 +5346,7 @@ void tst_QWidget::moveChild() QPoint pos = child.pos() + offset; child.move(pos); QTest::qWait(100); - QCOMPARE(pos, child.pos()); + QTRY_COMPARE(pos, child.pos()); QCOMPARE(parent.r, QRegion(oldGeometry) - child.geometry()); #if !defined(Q_WS_MAC) @@ -7388,8 +7394,8 @@ void tst_QWidget::repaintWhenChildDeleted() #endif w.show(); QTest::qWaitForWindowShown(&w); - QTest::qWait(30); - QCOMPARE(w.r, QRegion(w.rect())); + QTest::qWait(10); + QTRY_COMPARE(w.r, QRegion(w.rect())); w.r = QRegion(); { @@ -7397,13 +7403,13 @@ void tst_QWidget::repaintWhenChildDeleted() ColorWidget child(&w, Qt::blue); child.setGeometry(10, 10, 10, 10); child.show(); - QTest::qWait(100); - QCOMPARE(child.r, QRegion(child.rect())); + QTest::qWait(10); + QTRY_COMPARE(child.r, QRegion(child.rect())); w.r = QRegion(); } - QTest::qWait(100); - QCOMPARE(w.r, QRegion(10, 10, 10, 10)); + QTest::qWait(10); + QTRY_COMPARE(w.r, QRegion(10, 10, 10, 10)); } // task 175114 @@ -8070,10 +8076,8 @@ void tst_QWidget::resizeInPaintEvent() QWidget window; UpdateWidget widget(&window); window.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&window); -#endif - QTest::qWait(100); + QTest::qWaitForWindowShown(&window); + QTRY_VERIFY(widget.numPaintEvents > 0); widget.reset(); QCOMPARE(widget.numPaintEvents, 0); @@ -8085,9 +8089,9 @@ void tst_QWidget::resizeInPaintEvent() QCOMPARE(widget.numPaintEvents, 1); widget.numPaintEvents = 0; - QTest::qWait(100); + QTest::qWait(10); // Make sure the resize triggers another update. - QCOMPARE(widget.numPaintEvents, 1); + QTRY_COMPARE(widget.numPaintEvents, 1); } #endif @@ -8597,8 +8601,7 @@ void tst_QWidget::setClearAndResizeMask() topLevel.resize(150, 150); topLevel.show(); QTest::qWaitForWindowShown(&topLevel); - QTest::qWait(40); - + QTRY_VERIFY(topLevel.numPaintEvents > 0); topLevel.reset(); // Mask top-level widget @@ -8615,20 +8618,20 @@ void tst_QWidget::setClearAndResizeMask() // Clear top-level mask topLevel.clearMask(); QCOMPARE(topLevel.mask(), QRegion()); - QTest::qWait(100); + QTest::qWait(10); QRegion outsideOldMask(topLevel.rect()); outsideOldMask -= topLevelMask; #if defined(Q_WS_WIN) || defined(Q_WS_X11) // We don't control what's happening on other platforms. // and ensure that the top-level gets an update for the area outside the old mask. QTRY_VERIFY(topLevel.numPaintEvents > 0); - QCOMPARE(topLevel.paintedRegion, outsideOldMask); + QTRY_COMPARE(topLevel.paintedRegion, outsideOldMask); #endif UpdateWidget child(&topLevel); child.setAutoFillBackground(true); // NB! Opaque child. child.resize(100, 100); child.show(); - QTest::qWait(50); + QTest::qWait(10); child.reset(); topLevel.reset(); @@ -8656,10 +8659,10 @@ void tst_QWidget::setClearAndResizeMask() // Clear child widget mask child.clearMask(); - QCOMPARE(child.mask(), QRegion()); - QTest::qWait(50); + QTRY_COMPARE(child.mask(), QRegion()); + QTest::qWait(10); // and ensure that that the child widget gets an update for the area outside the old mask. - QCOMPARE(child.numPaintEvents, 1); + QTRY_COMPARE(child.numPaintEvents, 1); outsideOldMask = child.rect(); #ifndef Q_WS_MAC // Mac always issues a full update when calling setMask, and we cannot force it to not do so. @@ -8674,10 +8677,10 @@ void tst_QWidget::setClearAndResizeMask() // Mask child widget with a mask that is bigger than the rect child.setMask(QRegion(0, 0, 1000, 1000)); - QTest::qWait(50); + QTest::qWait(10); #ifdef Q_WS_MAC // Mac always issues a full update when calling setMask, and we cannot force it to not do so. - QCOMPARE(child.numPaintEvents, 1); + QTRY_COMPARE(child.numPaintEvents, 1); #else // and ensure that we don't get any updates at all. QCOMPARE(child.numPaintEvents, 0); @@ -8686,10 +8689,10 @@ void tst_QWidget::setClearAndResizeMask() // ...and the same applies when clearing the mask. child.clearMask(); - QTest::qWait(50); + QTest::qWait(10); #ifdef Q_WS_MAC // Mac always issues a full update when calling setMask, and we cannot force it to not do so. - QVERIFY(child.numPaintEvents > 0); + QTRY_VERIFY(child.numPaintEvents > 0); #else QCOMPARE(child.numPaintEvents, 0); #endif @@ -8752,10 +8755,9 @@ void tst_QWidget::maskedUpdate() grandChild.setMask(grandChildMask); topLevel.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&topLevel); -#endif - QTest::qWait(200); + QTest::qWaitForWindowShown(&topLevel); + QTRY_VERIFY(topLevel.numPaintEvents > 0); + #define RESET_WIDGETS \ topLevel.reset(); \ @@ -8773,29 +8775,29 @@ void tst_QWidget::maskedUpdate() // TopLevel update. RESET_WIDGETS; topLevel.update(); - QTest::qWait(100); + QTest::qWait(10); - QCOMPARE(topLevel.paintedRegion, topLevelMask); - QCOMPARE(child.paintedRegion, childMask); - QCOMPARE(grandChild.paintedRegion, grandChildMask); + QTRY_COMPARE(topLevel.paintedRegion, topLevelMask); + QTRY_COMPARE(child.paintedRegion, childMask); + QTRY_COMPARE(grandChild.paintedRegion, grandChildMask); // Child update. RESET_WIDGETS; child.update(); - QTest::qWait(100); + QTest::qWait(10); - QCOMPARE(topLevel.paintedRegion, childMask.translated(child.pos())); - QCOMPARE(child.paintedRegion, childMask); - QCOMPARE(grandChild.paintedRegion, grandChildMask); + QTRY_COMPARE(topLevel.paintedRegion, childMask.translated(child.pos())); + QTRY_COMPARE(child.paintedRegion, childMask); + QTRY_COMPARE(grandChild.paintedRegion, grandChildMask); // GrandChild update. RESET_WIDGETS; grandChild.update(); - QTest::qWait(100); + QTest::qWait(10); - QCOMPARE(topLevel.paintedRegion, grandChildMask.translated(grandChild.mapTo(&topLevel, QPoint()))); - QCOMPARE(child.paintedRegion, grandChildMask.translated(grandChild.pos())); - QCOMPARE(grandChild.paintedRegion, grandChildMask); + QTRY_COMPARE(topLevel.paintedRegion, grandChildMask.translated(grandChild.mapTo(&topLevel, QPoint()))); + QTRY_COMPARE(child.paintedRegion, grandChildMask.translated(grandChild.pos())); + QTRY_COMPARE(grandChild.paintedRegion, grandChildMask); topLevel.setAttribute(Qt::WA_OpaquePaintEvent); child.setAttribute(Qt::WA_OpaquePaintEvent); @@ -8807,41 +8809,41 @@ void tst_QWidget::maskedUpdate() // TopLevel update. RESET_WIDGETS; topLevel.update(); - QTest::qWait(100); + QTest::qWait(10); QRegion expectedTopLevelUpdate = topLevelMask; expectedTopLevelUpdate -= childMask.translated(child.pos()); // Subtract opaque children. - QCOMPARE(topLevel.paintedRegion, expectedTopLevelUpdate); - QCOMPARE(child.paintedRegion, QRegion()); - QCOMPARE(grandChild.paintedRegion, QRegion()); + QTRY_COMPARE(topLevel.paintedRegion, expectedTopLevelUpdate); + QTRY_COMPARE(child.paintedRegion, QRegion()); + QTRY_COMPARE(grandChild.paintedRegion, QRegion()); // Child update. RESET_WIDGETS; child.update(); - QTest::qWait(100); + QTest::qWait(10); - QCOMPARE(topLevel.paintedRegion, QRegion()); + QTRY_COMPARE(topLevel.paintedRegion, QRegion()); QRegion expectedChildUpdate = childMask; expectedChildUpdate -= grandChildMask.translated(grandChild.pos()); // Subtract oapque children. - QCOMPARE(child.paintedRegion, expectedChildUpdate); - QCOMPARE(grandChild.paintedRegion, QRegion()); + QTRY_COMPARE(child.paintedRegion, expectedChildUpdate); + QTRY_COMPARE(grandChild.paintedRegion, QRegion()); // GrandChild update. RESET_WIDGETS; grandChild.update(); - QTest::qWait(100); + QTest::qWait(10); - QCOMPARE(topLevel.paintedRegion, QRegion()); - QCOMPARE(child.paintedRegion, QRegion()); - QCOMPARE(grandChild.paintedRegion, grandChildMask); + QTRY_COMPARE(topLevel.paintedRegion, QRegion()); + QTRY_COMPARE(child.paintedRegion, QRegion()); + QTRY_COMPARE(grandChild.paintedRegion, grandChildMask); // GrandChild update. CLEAR_MASK(grandChild); grandChild.update(); - QTest::qWait(100); + QTest::qWait(10); - QCOMPARE(topLevel.paintedRegion, QRegion()); - QCOMPARE(child.paintedRegion, QRegion()); + QTRY_COMPARE(topLevel.paintedRegion, QRegion()); + QTRY_COMPARE(child.paintedRegion, QRegion()); QRegion expectedGrandChildUpdate = grandChild.rect(); // Clip with parent's mask. expectedGrandChildUpdate &= childMask.translated(-grandChild.pos()); @@ -8850,36 +8852,36 @@ void tst_QWidget::maskedUpdate() // GrandChild update. CLEAR_MASK(child); grandChild.update(); - QTest::qWait(100); + QTest::qWait(10); - QCOMPARE(topLevel.paintedRegion, QRegion()); - QCOMPARE(child.paintedRegion, QRegion()); + QTRY_COMPARE(topLevel.paintedRegion, QRegion()); + QTRY_COMPARE(child.paintedRegion, QRegion()); expectedGrandChildUpdate = grandChild.rect(); // Clip with parent's mask. expectedGrandChildUpdate &= topLevelMask.translated(-grandChild.mapTo(&topLevel, QPoint())); - QCOMPARE(grandChild.paintedRegion, expectedGrandChildUpdate); + QTRY_COMPARE(grandChild.paintedRegion, expectedGrandChildUpdate); // Child update. RESET_WIDGETS; child.update(); - QTest::qWait(100); + QTest::qWait(10); - QCOMPARE(topLevel.paintedRegion, QRegion()); + QTRY_COMPARE(topLevel.paintedRegion, QRegion()); expectedChildUpdate = child.rect(); // Clip with parent's mask. expectedChildUpdate &= topLevelMask.translated(-child.pos()); expectedChildUpdate -= grandChild.geometry(); // Subtract opaque children. - QCOMPARE(child.paintedRegion, expectedChildUpdate); - QCOMPARE(grandChild.paintedRegion, QRegion()); + QTRY_COMPARE(child.paintedRegion, expectedChildUpdate); + QTRY_COMPARE(grandChild.paintedRegion, QRegion()); // GrandChild update. CLEAR_MASK(topLevel); grandChild.update(); - QTest::qWait(100); + QTest::qWait(10); - QCOMPARE(topLevel.paintedRegion, QRegion()); - QCOMPARE(child.paintedRegion, QRegion()); - QCOMPARE(grandChild.paintedRegion, QRegion(grandChild.rect())); // Full update. + QTRY_COMPARE(topLevel.paintedRegion, QRegion()); + QTRY_COMPARE(child.paintedRegion, QRegion()); + QTRY_COMPARE(grandChild.paintedRegion, QRegion(grandChild.rect())); // Full update. } #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) @@ -9164,16 +9166,15 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779() main.show(); QTest::qWaitForWindowShown(&main); - QTest::qWait(10); + QTest::qWait(50); QCursor::setPos(main.pos()); //get the cursor out of the picture QTest::qWait(50); - QPixmap pixmap = QPixmap::grabWindow(main.winId()); QPixmap correct(main.size()); correct.fill(Qt::green); QRect center(100, 100, 200, 200); // to avoid the decorations - QCOMPARE(pixmap.toImage().copy(center), correct.toImage().copy(center)); + QTRY_COMPARE(QPixmap::grabWindow(main.winId()).toImage().copy(center), correct.toImage().copy(center)); } void tst_QWidget::inputFocus_task257832() @@ -9232,7 +9233,7 @@ void tst_QWidget::activateWindow() mainwindow->setCentralWidget(label); mainwindow->setVisible(true); mainwindow->activateWindow(); - QTest::qWaitForWindowShown(&mainWindow); + QTest::qWaitForWindowShown(mainwindow); qApp->processEvents(); QTRY_VERIFY(mainwindow->isActiveWindow()); -- cgit v0.12 From 63299bbbc34521785408163e3fd516779f343201 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 24 Sep 2009 09:50:04 +1000 Subject: Fix cubic paths in OpenVG The multitouch/dials example was displaying rendering artifacts on the dials in the default style. This was due to incorrect VGPath construction when sizeof(qreal) == sizeof(VGfloat). It was adding two VG_CUBIC_TO_ABS elements per cubic instead of one. Task-number: QT-2035 Reviewed-by: Sarah Smith --- src/openvg/qpaintengine_vg.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 34f9cf8..3558c28 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -566,11 +566,11 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) case QPainterPath::LineToElement: segments.append(VG_LINE_TO_ABS); break; - case QPainterPath::CurveToElement: break; - - case QPainterPath::CurveToDataElement: + case QPainterPath::CurveToElement: segments.append(VG_CUBIC_TO_ABS); break; + case QPainterPath::CurveToDataElement: break; + } } if (path.hasImplicitClose()) -- cgit v0.12 From 94c7ea4ad2c12c11d1cdc33bc0455f6f0b432fc2 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 24 Sep 2009 10:04:19 +1000 Subject: Remove extraneous debug statement --- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 073afae..49e087f 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -1037,8 +1037,6 @@ void tst_QSqlTableModel::insertBeforeDelete() model.setEditStrategy(QSqlTableModel::OnManualSubmit); QVERIFY_SQL(model, select()); - qDebug() << model.rowCount(); - QSqlRecord rec = model.record(); rec.setValue(0, 4); rec.setValue(1, QString("bill")); -- cgit v0.12 From b94e0ed8fafef214c0c549ebfb4b39338bece4a1 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Thu, 24 Sep 2009 11:41:43 +1000 Subject: Mac audio; Remove signal re-decleration. Reviewed-by: Bill King --- src/multimedia/audio/qaudioinput_mac_p.h | 4 ---- src/multimedia/audio/qaudiooutput_mac_p.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_mac_p.h b/src/multimedia/audio/qaudioinput_mac_p.h index b6cc5a7..a080648 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.h +++ b/src/multimedia/audio/qaudioinput_mac_p.h @@ -145,10 +145,6 @@ public: void startTimers(); void stopTimers(); -signals: - void stateChanged(QAudio::State); - void notify(); - private slots: void deviceStopped(); diff --git a/src/multimedia/audio/qaudiooutput_mac_p.h b/src/multimedia/audio/qaudiooutput_mac_p.h index d5097dc..04b3239 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.h +++ b/src/multimedia/audio/qaudiooutput_mac_p.h @@ -145,10 +145,6 @@ public: void startTimers(); void stopTimers(); -signals: - void stateChanged(QAudio::State); - void notify(); - private slots: void deviceStopped(); void inputReady(); -- cgit v0.12 From 609dd32580b1e07213a2b2efdd4d854c34e8f6d7 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Thu, 24 Sep 2009 11:46:06 +1000 Subject: Mac audio; emit stateChanged on start, don't flush in push mode. Reviewed-by: Bill King --- src/multimedia/audio/qaudioinput_mac_p.cpp | 7 +++++++ src/multimedia/audio/qaudiooutput_mac_p.cpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index ba5801a..07fa3f4 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -376,6 +376,9 @@ public: void flush(bool all = false) { + if (m_device == 0) + return; + const int used = m_buffer->used(); const int readSize = all ? used : used - (used % m_maxPeriodSize); @@ -723,6 +726,10 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) audioThreadStart(); + stateCode = QAudio::ActiveState; + errorCode = QAudio::NoError; + emit stateChanged(stateCode); + return op; } diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp index bf9a096..4364704 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.cpp +++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp @@ -460,6 +460,8 @@ QIODevice* QAudioOutputPrivate::start(QIODevice* device) if (stateCode == QAudio::ActiveState) audioThreadStart(); + emit stateChanged(stateCode); + return op; } -- cgit v0.12 From fb50411e4c0c132631f8237933fbb0972fa4c9aa Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Thu, 24 Sep 2009 11:55:52 +1000 Subject: AudioService API changes; QString->const QString&, remove QAudioDeviceId use QAudioDeviceInfo. Reviewed-by: Bill King --- doc/src/snippets/audio/main.cpp | 3 +- .../multimedia/audio/audiodevices/audiodevices.cpp | 32 ++-- .../multimedia/audio/audiodevices/audiodevices.h | 3 +- .../multimedia/audio/audioinput/audioinput.cpp | 6 +- examples/multimedia/audio/audioinput/audioinput.h | 2 +- .../multimedia/audio/audiooutput/audiooutput.cpp | 8 +- .../multimedia/audio/audiooutput/audiooutput.h | 2 +- src/multimedia/audio/audio.pri | 7 +- src/multimedia/audio/qaudiodevicefactory.cpp | 83 +++++----- src/multimedia/audio/qaudiodevicefactory_p.h | 17 +-- src/multimedia/audio/qaudiodeviceid.cpp | 168 --------------------- src/multimedia/audio/qaudiodeviceid.h | 94 ------------ src/multimedia/audio/qaudiodeviceid_p.h | 82 ---------- src/multimedia/audio/qaudiodeviceinfo.cpp | 164 ++++++++++++++++---- src/multimedia/audio/qaudiodeviceinfo.h | 32 ++-- src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp | 38 ++--- src/multimedia/audio/qaudiodeviceinfo_alsa_p.h | 6 +- src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp | 28 ++-- src/multimedia/audio/qaudiodeviceinfo_mac_p.h | 4 +- src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 38 ++--- src/multimedia/audio/qaudiodeviceinfo_win32_p.h | 6 +- src/multimedia/audio/qaudioformat.cpp | 2 +- src/multimedia/audio/qaudioformat.h | 2 +- src/multimedia/audio/qaudioinput.cpp | 10 +- src/multimedia/audio/qaudioinput.h | 5 +- src/multimedia/audio/qaudiooutput.cpp | 8 +- src/multimedia/audio/qaudiooutput.h | 4 +- tests/auto/qaudiodeviceid/qaudiodeviceid.pro | 7 - tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp | 118 --------------- .../auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp | 8 +- tests/auto/qaudioinput/tst_qaudioinput.cpp | 2 +- tests/auto/qaudiooutput/tst_qaudiooutput.cpp | 2 +- 32 files changed, 302 insertions(+), 689 deletions(-) delete mode 100644 src/multimedia/audio/qaudiodeviceid.cpp delete mode 100644 src/multimedia/audio/qaudiodeviceid.h delete mode 100644 src/multimedia/audio/qaudiodeviceid_p.h delete mode 100644 tests/auto/qaudiodeviceid/qaudiodeviceid.pro delete mode 100644 tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp index e663115..0910865 100644 --- a/doc/src/snippets/audio/main.cpp +++ b/doc/src/snippets/audio/main.cpp @@ -98,8 +98,7 @@ private: //![2] format.setSampleType(QAudioFormat::SignedInt); - QAudioDeviceId id = QAudioDeviceInfo::defaultOutputDevice(); - QAudioDeviceInfo info(id); + QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); if (!info.isFormatSupported(format)) format = info.nearestFormat(format); diff --git a/examples/multimedia/audio/audiodevices/audiodevices.cpp b/examples/multimedia/audio/audiodevices/audiodevices.cpp index 0d305ff..4198605 100644 --- a/examples/multimedia/audio/audiodevices/audiodevices.cpp +++ b/examples/multimedia/audio/audiodevices/audiodevices.cpp @@ -80,8 +80,6 @@ AudioTest::AudioTest( QMainWindow *parent, Qt::WFlags f ) connect(sampleTypesBox,SIGNAL(activated(int)),SLOT(sampleTypeChanged(int))); connect(endianBox,SIGNAL(activated(int)),SLOT(endianChanged(int))); - device = 0; - modeBox->setCurrentIndex(0); modeChanged(0); deviceBox->setCurrentIndex(0); @@ -98,8 +96,8 @@ void AudioTest::test() logOutput->clear(); logOutput->append("NOTE: an invalid codec audio/test exists for testing, to get a fail condition."); - if(device) { - if(device->isFormatSupported(settings)) { + if (!deviceInfo.isNull()) { + if (deviceInfo.isFormatSupported(settings)) { logOutput->append("Success"); nearestFreq->setText(""); nearestChannel->setText(""); @@ -108,7 +106,7 @@ void AudioTest::test() nearestSampleType->setText(""); nearestEndian->setText(""); } else { - QAudioFormat nearest = device->nearestFormat(settings); + QAudioFormat nearest = deviceInfo.nearestFormat(settings); logOutput->append(tr("Failed")); nearestFreq->setText(QString("%1").arg(nearest.frequency())); nearestChannel->setText(QString("%1").arg(nearest.channels())); @@ -150,40 +148,34 @@ void AudioTest::modeChanged(int idx) mode=QAudio::AudioOutput; deviceBox->clear(); - QList devices = QAudioDeviceInfo::deviceList(mode); - for(int i = 0; i < devices.size(); ++i) { - deviceBox->addItem(QAudioDeviceInfo(devices.at(i)).deviceName(), qVariantFromValue(devices.at(i))); - } + foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(mode)) + deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); } void AudioTest::deviceChanged(int idx) { - delete device; - device = 0; - if (deviceBox->count() == 0) return; // device has changed - deviceHandle = deviceBox->itemData(idx).value(); - device = new QAudioDeviceInfo(deviceHandle, this); + deviceInfo = deviceBox->itemData(idx).value(); frequencyBox->clear(); - QList freqz = device->supportedFrequencies(); + QList freqz = deviceInfo.supportedFrequencies(); for(int i = 0; i < freqz.size(); ++i) frequencyBox->addItem(QString("%1").arg(freqz.at(i))); if(freqz.size()) settings.setFrequency(freqz.at(0)); channelsBox->clear(); - QList chz = device->supportedChannels(); + QList chz = deviceInfo.supportedChannels(); for(int i = 0; i < chz.size(); ++i) channelsBox->addItem(QString("%1").arg(chz.at(i))); if(chz.size()) settings.setChannels(chz.at(0)); codecsBox->clear(); - QStringList codecz = device->supportedCodecs(); + QStringList codecz = deviceInfo.supportedCodecs(); for(int i = 0; i < codecz.size(); ++i) codecsBox->addItem(QString("%1").arg(codecz.at(i))); if(codecz.size()) @@ -192,14 +184,14 @@ void AudioTest::deviceChanged(int idx) codecsBox->addItem("audio/test"); sampleSizesBox->clear(); - QList sampleSizez = device->supportedSampleSizes(); + QList sampleSizez = deviceInfo.supportedSampleSizes(); for(int i = 0; i < sampleSizez.size(); ++i) sampleSizesBox->addItem(QString("%1").arg(sampleSizez.at(i))); if(sampleSizez.size()) settings.setSampleSize(sampleSizez.at(0)); sampleTypesBox->clear(); - QList sampleTypez = device->supportedSampleTypes(); + QList sampleTypez = deviceInfo.supportedSampleTypes(); for(int i = 0; i < sampleTypez.size(); ++i) { switch(sampleTypez.at(i)) { case QAudioFormat::SignedInt: @@ -219,7 +211,7 @@ void AudioTest::deviceChanged(int idx) } endianBox->clear(); - QList endianz = device->supportedByteOrders(); + QList endianz = deviceInfo.supportedByteOrders(); for(int i = 0; i < endianz.size(); ++i) { switch(endianz.at(i)) { case QAudioFormat::LittleEndian: diff --git a/examples/multimedia/audio/audiodevices/audiodevices.h b/examples/multimedia/audio/audiodevices/audiodevices.h index acf492d..5fe5547 100644 --- a/examples/multimedia/audio/audiodevices/audiodevices.h +++ b/examples/multimedia/audio/audiodevices/audiodevices.h @@ -60,8 +60,7 @@ public: AudioTest( QMainWindow *parent = 0, Qt::WFlags f = 0 ); virtual ~AudioTest(); - QAudioDeviceId deviceHandle; - QAudioDeviceInfo* device; + QAudioDeviceInfo deviceInfo; QAudioFormat settings; QAudio::Mode mode; diff --git a/examples/multimedia/audio/audioinput/audioinput.cpp b/examples/multimedia/audio/audioinput/audioinput.cpp index a586bf3..c09e7d9 100644 --- a/examples/multimedia/audio/audioinput/audioinput.cpp +++ b/examples/multimedia/audio/audioinput/audioinput.cpp @@ -250,9 +250,9 @@ InputTest::InputTest() layout->addWidget(canvas); deviceBox = new QComboBox(this); - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); for(int i = 0; i < devices.size(); ++i) { - deviceBox->addItem(QAudioDeviceInfo(devices.at(i)).deviceName(), qVariantFromValue(devices.at(i))); + deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i))); } connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); layout->addWidget(deviceBox); @@ -367,7 +367,7 @@ void InputTest::deviceChanged(int idx) audioInput->disconnect(this); delete audioInput; - device = deviceBox->itemData(idx).value(); + device = deviceBox->itemData(idx).value(); audioInput = new QAudioInput(device, format, this); connect(audioInput,SIGNAL(notify()),SLOT(status())); connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); diff --git a/examples/multimedia/audio/audioinput/audioinput.h b/examples/multimedia/audio/audioinput/audioinput.h index c1bc602..7ba6f1f 100644 --- a/examples/multimedia/audio/audioinput/audioinput.h +++ b/examples/multimedia/audio/audioinput/audioinput.h @@ -116,7 +116,7 @@ public: InputTest(); ~InputTest(); - QAudioDeviceId device; + QAudioDeviceInfo device; QAudioFormat format; QAudioInput* audioInput; Spectrum* spec; diff --git a/examples/multimedia/audio/audiooutput/audiooutput.cpp b/examples/multimedia/audio/audiooutput/audiooutput.cpp index d239eb0..19f7a3f 100644 --- a/examples/multimedia/audio/audiooutput/audiooutput.cpp +++ b/examples/multimedia/audio/audiooutput/audiooutput.cpp @@ -142,10 +142,8 @@ AudioTest::AudioTest() QVBoxLayout* layout = new QVBoxLayout; deviceBox = new QComboBox(this); - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); - for(int i = 0; i < devices.size(); ++i) { - deviceBox->addItem(QAudioDeviceInfo(devices.at(i)).deviceName(), qVariantFromValue(devices.at(i))); - } + foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) + deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); layout->addWidget(deviceBox); @@ -200,7 +198,7 @@ void AudioTest::deviceChanged(int idx) audioOutput->disconnect(this); delete audioOutput; - device = deviceBox->itemData(idx).value(); + device = deviceBox->itemData(idx).value(); audioOutput = new QAudioOutput(device,settings,this); connect(audioOutput,SIGNAL(notify()),SLOT(status())); connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); diff --git a/examples/multimedia/audio/audiooutput/audiooutput.h b/examples/multimedia/audio/audiooutput/audiooutput.h index e2c22ee..a5c0289 100644 --- a/examples/multimedia/audio/audiooutput/audiooutput.h +++ b/examples/multimedia/audio/audiooutput/audiooutput.h @@ -87,7 +87,7 @@ public: AudioTest(); ~AudioTest(); - QAudioDeviceId device; + QAudioDeviceInfo device; Generator* gen; QAudioOutput* audioOutput; QIODevice* output; diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index c7fbbb0..c445941 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -5,9 +5,7 @@ HEADERS += $$PWD/qaudio.h \ $$PWD/qaudiodeviceinfo.h \ $$PWD/qaudioengineplugin.h \ $$PWD/qaudioengine.h \ - $$PWD/qaudiodevicefactory_p.h \ - $$PWD/qaudiodeviceid.h \ - $$PWD/qaudiodeviceid_p.h + $$PWD/qaudiodevicefactory_p.h SOURCES += $$PWD/qaudio.cpp \ @@ -17,8 +15,7 @@ SOURCES += $$PWD/qaudio.cpp \ $$PWD/qaudioinput.cpp \ $$PWD/qaudioengineplugin.cpp \ $$PWD/qaudioengine.cpp \ - $$PWD/qaudiodevicefactory.cpp \ - $$PWD/qaudiodeviceid.cpp + $$PWD/qaudiodevicefactory.cpp mac { HEADERS += $$PWD/qaudioinput_mac_p.h \ diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index 9ed1d70..8804fb6 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -44,7 +44,6 @@ #include #include #include "qaudiodevicefactory_p.h" -#include "qaudiodeviceid_p.h" #if defined(Q_OS_WIN) #include "qaudiodeviceinfo_win32_p.h" @@ -123,12 +122,12 @@ public: QAudioFormat format() const { return QAudioFormat(); } }; -QList QAudioDeviceFactory::deviceList(QAudio::Mode mode) +QList QAudioDeviceFactory::deviceList(QAudio::Mode mode) { - QList devices; + QList devices; #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - foreach (const QByteArray &handle, QAudioDeviceInfoPrivate::deviceList(mode)) - devices += createDeviceId(QLatin1String("builtin"), mode, handle); + foreach (const QByteArray &handle, QAudioDeviceInfoInternal::deviceList(mode)) + devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); #endif QFactoryLoader* l = loader(); @@ -136,7 +135,7 @@ QList QAudioDeviceFactory::deviceList(QAudio::Mode mode) QAudioEngineFactoryInterface* plugin = qobject_cast(l->instance(key)); if (plugin) { foreach (QByteArray const& handle, plugin->deviceList(mode)) - devices += createDeviceId(key, mode, handle); + devices << QAudioDeviceInfo(key, handle, mode); } delete plugin; @@ -145,50 +144,51 @@ QList QAudioDeviceFactory::deviceList(QAudio::Mode mode) return devices; } -QAudioDeviceId QAudioDeviceFactory::defaultInputDevice() +QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() { QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(QLatin1String("default"))); if (plugin) { QList list = plugin->deviceList(QAudio::AudioInput); if (list.size() > 0) - return createDeviceId(QLatin1String("default"), QAudio::AudioInput, list.at(0)); + return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput); } #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - return createDeviceId(QLatin1String("builtin"), QAudio::AudioInput, QAudioDeviceInfoPrivate::defaultInputDevice()); + return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput); #endif - return QAudioDeviceId(); + return QAudioDeviceInfo(); } -QAudioDeviceId QAudioDeviceFactory::defaultOutputDevice() +QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() { QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(QLatin1String("default"))); if (plugin) { QList list = plugin->deviceList(QAudio::AudioOutput); if (list.size() > 0) - return createDeviceId(QLatin1String("default"), QAudio::AudioOutput, list.at(0)); + return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput); } #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - return createDeviceId(QLatin1String("builtin"), QAudio::AudioOutput, QAudioDeviceInfoPrivate::defaultOutputDevice()); + return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput); #endif - return QAudioDeviceId(); + return QAudioDeviceInfo(); } -QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(QAudioDeviceId const& id) +QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode) { - if (id.isNull()) - return new QNullDeviceInfo(); + QAbstractAudioDeviceInfo *rc = 0; + #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - if (id.d->key == QLatin1String("builtin")) - return new QAudioDeviceInfoPrivate(id.d->handle, QAudio::Mode(id.d->mode)); + if (realm == QLatin1String("builtin")) + return new QAudioDeviceInfoInternal(handle, mode); #endif - QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(id.d->key)); + QAudioEngineFactoryInterface* plugin = + qobject_cast(loader()->instance(realm)); if (plugin) - return plugin->createDeviceInfo(id.d->handle, QAudio::Mode(id.d->mode)); + rc = plugin->createDeviceInfo(handle, mode); - return new QNullDeviceInfo(); + return rc == 0 ? new QNullDeviceInfo() : rc; } QAbstractAudioInput* QAudioDeviceFactory::createDefaultInputDevice(QAudioFormat const &format) @@ -201,50 +201,39 @@ QAbstractAudioOutput* QAudioDeviceFactory::createDefaultOutputDevice(QAudioForma return createOutputDevice(defaultOutputDevice(), format); } -QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceId const& id, QAudioFormat const &format) +QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format) { - if (id.isNull()) + if (deviceInfo.isNull()) return new QNullInputDevice(); #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - if (id.d->key == QLatin1String("builtin")) { - if(!defaultInputDevice().isNull()) - return new QAudioInputPrivate(id.d->handle, format); - else - return new QNullInputDevice(); - } + if (deviceInfo.realm() == QLatin1String("builtin")) + return new QAudioInputPrivate(deviceInfo.handle(), format); #endif - QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance((id.d->key))); + QAudioEngineFactoryInterface* plugin = + qobject_cast(loader()->instance(deviceInfo.realm())); if (plugin) - return plugin->createInput(id.d->handle, format); + return plugin->createInput(deviceInfo.handle(), format); return new QNullInputDevice(); } -QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceId const& id, QAudioFormat const &format) +QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format) { - if (id.isNull()) + if (deviceInfo.isNull()) return new QNullOutputDevice(); #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - if (id.d->key == QLatin1String("builtin")) { - if(!defaultOutputDevice().isNull()) - return new QAudioOutputPrivate(id.d->handle, format); - else - return new QNullOutputDevice(); - } + if (deviceInfo.realm() == QLatin1String("builtin")) + return new QAudioOutputPrivate(deviceInfo.handle(), format); #endif - QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(id.d->key)); + QAudioEngineFactoryInterface* plugin = + qobject_cast(loader()->instance(deviceInfo.realm())); if (plugin) - return plugin->createOutput(id.d->handle, format); + return plugin->createOutput(deviceInfo.handle(), format); return new QNullOutputDevice(); } -QAudioDeviceId QAudioDeviceFactory::createDeviceId(QString const& key, int mode, QByteArray const& handle) -{ - return QAudioDeviceId(new QAudioDeviceIdPrivate(key, mode, handle)); -} - QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodevicefactory_p.h b/src/multimedia/audio/qaudiodevicefactory_p.h index 8e4cf5a..008e4a8 100644 --- a/src/multimedia/audio/qaudiodevicefactory_p.h +++ b/src/multimedia/audio/qaudiodevicefactory_p.h @@ -57,7 +57,6 @@ #include #include -#include #include QT_BEGIN_HEADER @@ -68,28 +67,26 @@ QT_MODULE(Multimedia) class QAbstractAudioInput; class QAbstractAudioOutput; - +class QAbstractAudioDeviceInfo; class QAudioDeviceFactory { public: - static QList deviceList(QAudio::Mode mode); + static QList deviceList(QAudio::Mode mode); - static QAudioDeviceId defaultInputDevice(); - static QAudioDeviceId defaultOutputDevice(); + static QAudioDeviceInfo defaultInputDevice(); + static QAudioDeviceInfo defaultOutputDevice(); - static QAbstractAudioDeviceInfo* audioDeviceInfo(QAudioDeviceId const &device); + static QAbstractAudioDeviceInfo* audioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode); static QAbstractAudioInput* createDefaultInputDevice(QAudioFormat const &format); static QAbstractAudioOutput* createDefaultOutputDevice(QAudioFormat const &format); - static QAbstractAudioInput* createInputDevice(QAudioDeviceId const &device, QAudioFormat const &format); - static QAbstractAudioOutput* createOutputDevice(QAudioDeviceId const &device, QAudioFormat const &format); + static QAbstractAudioInput* createInputDevice(QAudioDeviceInfo const &device, QAudioFormat const &format); + static QAbstractAudioOutput* createOutputDevice(QAudioDeviceInfo const &device, QAudioFormat const &format); static QAbstractAudioInput* createNullInput(); static QAbstractAudioOutput* createNullOutput(); - - static QAudioDeviceId createDeviceId(QString const& key, int mode, QByteArray const& handle); }; QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceid.cpp b/src/multimedia/audio/qaudiodeviceid.cpp deleted file mode 100644 index bdbc580..0000000 --- a/src/multimedia/audio/qaudiodeviceid.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia 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 -#include -#include - -#include -#include "qaudiodeviceid_p.h" - - -QT_BEGIN_NAMESPACE - -/*! - \class QAudioDeviceId - \brief The QAudioDeviceId class provides means for identifying a unique input or output device on a system. - - \inmodule QtMultimedia - \ingroup multimedia - \since 4.6 - - \sa QAudioDeviceInfo, QAudioOutput, QAudioInput -*/ - -/*! - Construct a new null QAudioDeviceId. -*/ - -QAudioDeviceId::QAudioDeviceId() -{ -} - -/*! - Copy the QAudDeviceId referenced by \a other. -*/ - -QAudioDeviceId::QAudioDeviceId(const QAudioDeviceId &other): - d(other.d) -{ -} - -/*! - Destroy the QAudioDeviceId. -*/ - -QAudioDeviceId::~QAudioDeviceId() -{ -} - -/*! - Make a copy of the \a other QAudioDeviceId. -*/ - -QAudioDeviceId& QAudioDeviceId::operator=(const QAudioDeviceId &other) -{ - d = other.d; - return *this; -} - -/*! - Compare with the \a other QAudioDeviceId, return true if they are the same; - otherwise false. -*/ - -bool QAudioDeviceId::operator==(const QAudioDeviceId &other) const -{ - return (d.constData() == 0 && other.d.constData() == 0) || - (d.constData() != 0 && other.d.constData() != 0 && - d->key == other.d->key && d->mode == other.d->mode && d->handle == other.d->handle); -} - -/*! - Compare with the \a other QAudioDeviceId, return false if they are the same; - otherwise true. -*/ - -bool QAudioDeviceId::operator!=(const QAudioDeviceId &other) const -{ - return !(*this == other); -} - -/*! - Returns true if this is not a valid QAudioDeviceId; otherwise false. -*/ - -bool QAudioDeviceId::isNull() const -{ - return d.constData() == 0; -} - -/*! - \internal -*/ - -QAudioDeviceId::QAudioDeviceId(QAudioDeviceIdPrivate* data): - d(data) -{ -} - -/*! - \internal -*/ - -QAudioDeviceIdPrivate::QAudioDeviceIdPrivate(QString const& k, int m, QByteArray const& h): - key(k), mode(m), handle(h) -{ -} - -#ifndef QT_NO_DATASTREAM -Q_MULTIMEDIA_EXPORT QDataStream &operator<<(QDataStream &s, const QAudioDeviceId &id) -{ - s << id.d->key << id.d->mode << id.d->handle; - return s; -} - -Q_MULTIMEDIA_EXPORT QDataStream &operator>>(QDataStream &s, QAudioDeviceId &id) -{ - QString key; - int mode; - QByteArray handle; - - s >> key >> mode >> handle; - id = QAudioDeviceId(new QAudioDeviceIdPrivate(key, mode, handle)); - - return s; -} -#endif - - -QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceid.h b/src/multimedia/audio/qaudiodeviceid.h deleted file mode 100644 index 61d0d9a..0000000 --- a/src/multimedia/audio/qaudiodeviceid.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia 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$ -** -****************************************************************************/ - -#ifndef QAUDIODEVICEID_H -#define QAUDIODEVICEID_H - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Multimedia) - - -class QAudioDeviceFactory; -class QAudioDeviceIdPrivate; - -class Q_MULTIMEDIA_EXPORT QAudioDeviceId -{ - friend class QAudioDeviceFactory; - friend Q_MULTIMEDIA_EXPORT QDataStream &operator<<(QDataStream&, const QAudioDeviceId&); - friend Q_MULTIMEDIA_EXPORT QDataStream &operator>>(QDataStream&, QAudioDeviceId&); - -public: - QAudioDeviceId(); - QAudioDeviceId(const QAudioDeviceId &other); - ~QAudioDeviceId(); - - QAudioDeviceId& operator=(const QAudioDeviceId &other); - bool operator==(const QAudioDeviceId &id) const; - bool operator!=(const QAudioDeviceId &id) const; - - bool isNull() const; - -private: - QAudioDeviceId(QAudioDeviceIdPrivate *data); - - QSharedDataPointer d; -}; - -#ifndef QT_NO_DATASTREAM -Q_MULTIMEDIA_EXPORT QDataStream &operator<<(QDataStream&, const QAudioDeviceId&); -Q_MULTIMEDIA_EXPORT QDataStream &operator>>(QDataStream&, QAudioDeviceId&); -#endif - -QT_END_NAMESPACE - -QT_END_HEADER - -Q_DECLARE_METATYPE(QAudioDeviceId) - - -#endif // QAUDIODEVICEID_H diff --git a/src/multimedia/audio/qaudiodeviceid_p.h b/src/multimedia/audio/qaudiodeviceid_p.h deleted file mode 100644 index 113e1f0..0000000 --- a/src/multimedia/audio/qaudiodeviceid_p.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia 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$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QAUDIODEVICEIDPRIVATE_H -#define QAUDIODEVICEIDPRIVATE_H - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Multimedia) - - -class QAudioDeviceIdPrivate : public QSharedData -{ -public: - QAudioDeviceIdPrivate(QString const& k, int m, QByteArray const& h); - - QString key; - int mode; - QByteArray handle; -}; - - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QAUDIODEVICEIDPRIVATE_H diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index e38a91e..dce2884 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -46,12 +46,52 @@ QT_BEGIN_NAMESPACE +class QAudioDeviceInfoPrivate : public QSharedData +{ +public: + QAudioDeviceInfoPrivate():info(0) {} + QAudioDeviceInfoPrivate(const QString &r, const QByteArray &h, QAudio::Mode m): + realm(r), handle(h), mode(m) + { + info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode); + } + + QAudioDeviceInfoPrivate(const QAudioDeviceInfoPrivate &other): + QSharedData(other), + realm(other.realm), handle(other.handle), mode(other.mode) + { + info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode); + } + + QAudioDeviceInfoPrivate& operator=(const QAudioDeviceInfoPrivate &other) + { + delete info; + + realm = other.realm; + handle = other.handle; + mode = other.mode; + info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode); + return *this; + } + + ~QAudioDeviceInfoPrivate() + { + delete info; + } + + QString realm; + QByteArray handle; + QAudio::Mode mode; + QAbstractAudioDeviceInfo* info; +}; + + /*! \class QAudioDeviceInfo \brief The QAudioDeviceInfo class provides an interface to query audio devices and their functionality. - \inmodule QtMultimedia \ingroup multimedia + \since 4.6 QAudioDeviceInfo lets you query for audio devices--such as sound @@ -77,41 +117,45 @@ QT_BEGIN_NAMESPACE \dots 8 \snippet doc/src/snippets/audio/main.cpp 2 - A QAudioDeviceInfo is constructed with a QAudioDeviceId, which is - an identifier for a physical device. It is used by Qt to construct + A QAudioDeviceInfo is used by Qt to construct classes that communicate with the device--such as - QAudioDeviceInfo, QAudioInput, and QAudioOutput. The static + QAudioInput, and QAudioOutput. The static functions defaultInputDevice(), defaultOutputDevice(), and - deviceList() let you get a hold of the ids for all available - devices. You fetch ids based on whether you will use the device - for input or output; this is specified by the QAudio::Mode enum. - The QAudioDeviceId returned are only valid for the QAudio::Mode. + deviceList() let you get a list of all available + devices. Devices are fetch according to the value of mode + this is specified by the QAudio::Mode enum. + The QAudioDeviceInfo returned are only valid for the QAudio::Mode. For instance: \code - foreach(QAudioDeviceId audioId, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) { - QAudioDeviceInfo info(audioId); - qDebug() << "Device name: " << info.deviceName(); - } + foreach(const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) + qDebug() << "Device name: " << deviceInfo.deviceName(); \endcode In this code sample, we loop through all devices that are able to output sound, i.e., play an audio stream in a supported format. For each device we find, we simply print the deviceName(). - \sa QAudioOutput, QAudioInput, QAudioDeviceId + \sa QAudioOutput, QAudioInput */ /*! - Construct a new audio device info and attach it to \a parent. - Using the audio device with the specified \a id. + Constructs an empty QAudioDeviceInfo object. */ -QAudioDeviceInfo::QAudioDeviceInfo(const QAudioDeviceId &id, QObject *parent): - QObject(parent) +QAudioDeviceInfo::QAudioDeviceInfo(): + d(new QAudioDeviceInfoPrivate) +{ +} + +/*! + Constructs a copy of \a other. +*/ + +QAudioDeviceInfo::QAudioDeviceInfo(const QAudioDeviceInfo& other): + d(other.d) { - d = QAudioDeviceFactory::audioDeviceInfo(id); } /*! @@ -120,7 +164,25 @@ QAudioDeviceInfo::QAudioDeviceInfo(const QAudioDeviceId &id, QObject *parent): QAudioDeviceInfo::~QAudioDeviceInfo() { - delete d; +} + +/*! + Sets the QAudioDeviceInfo object to be equal to \a other. +*/ + +QAudioDeviceInfo& QAudioDeviceInfo::operator=(const QAudioDeviceInfo &other) +{ + d = other.d; + return *this; +} + +/*! + Returns whether this QAudioDeviceInfo object holds a device definition. +*/ + +bool QAudioDeviceInfo::isNull() const +{ + return d->info == 0; } /*! @@ -135,7 +197,7 @@ QAudioDeviceInfo::~QAudioDeviceInfo() QString QAudioDeviceInfo::deviceName() const { - return d->deviceName(); + return isNull() ? QString() : d->info->deviceName(); } /*! @@ -144,7 +206,7 @@ QString QAudioDeviceInfo::deviceName() const bool QAudioDeviceInfo::isFormatSupported(const QAudioFormat &settings) const { - return d->isFormatSupported(settings); + return isNull() ? false : d->info->isFormatSupported(settings); } /*! @@ -163,7 +225,7 @@ bool QAudioDeviceInfo::isFormatSupported(const QAudioFormat &settings) const QAudioFormat QAudioDeviceInfo::preferredFormat() const { - return d->preferredFormat(); + return isNull() ? QAudioFormat() : d->info->preferredFormat(); } /*! @@ -176,7 +238,7 @@ QAudioFormat QAudioDeviceInfo::preferredFormat() const QAudioFormat QAudioDeviceInfo::nearestFormat(const QAudioFormat &settings) const { - return d->nearestFormat(settings); + return isNull() ? QAudioFormat() : d->info->nearestFormat(settings); } /*! @@ -193,7 +255,7 @@ QAudioFormat QAudioDeviceInfo::nearestFormat(const QAudioFormat &settings) const QStringList QAudioDeviceInfo::supportedCodecs() const { - return d->codecList(); + return isNull() ? QStringList() : d->info->codecList(); } /*! @@ -202,7 +264,7 @@ QStringList QAudioDeviceInfo::supportedCodecs() const QList QAudioDeviceInfo::supportedFrequencies() const { - return d->frequencyList(); + return isNull() ? QList() : d->info->frequencyList(); } /*! @@ -211,7 +273,7 @@ QList QAudioDeviceInfo::supportedFrequencies() const QList QAudioDeviceInfo::supportedChannels() const { - return d->channelsList(); + return isNull() ? QList() : d->info->channelsList(); } /*! @@ -220,7 +282,7 @@ QList QAudioDeviceInfo::supportedChannels() const QList QAudioDeviceInfo::supportedSampleSizes() const { - return d->sampleSizeList(); + return isNull() ? QList() : d->info->sampleSizeList(); } /*! @@ -229,7 +291,7 @@ QList QAudioDeviceInfo::supportedSampleSizes() const QList QAudioDeviceInfo::supportedByteOrders() const { - return d->byteOrderList(); + return isNull() ? QList() : d->info->byteOrderList(); } /*! @@ -238,7 +300,7 @@ QList QAudioDeviceInfo::supportedByteOrders() const QList QAudioDeviceInfo::supportedSampleTypes() const { - return d->sampleTypeList(); + return isNull() ? QList() : d->info->sampleTypeList(); } /*! @@ -246,7 +308,7 @@ QList QAudioDeviceInfo::supportedSampleTypes() const All platform and audio plugin implementations provide a default audio device to use. */ -QAudioDeviceId QAudioDeviceInfo::defaultInputDevice() +QAudioDeviceInfo QAudioDeviceInfo::defaultInputDevice() { return QAudioDeviceFactory::defaultInputDevice(); } @@ -256,7 +318,7 @@ QAudioDeviceId QAudioDeviceInfo::defaultInputDevice() All platform and audio plugin implementations provide a default audio device to use. */ -QAudioDeviceId QAudioDeviceInfo::defaultOutputDevice() +QAudioDeviceInfo QAudioDeviceInfo::defaultOutputDevice() { return QAudioDeviceFactory::defaultOutputDevice(); } @@ -265,10 +327,48 @@ QAudioDeviceId QAudioDeviceInfo::defaultOutputDevice() Returns a list of audio devices that support \a mode. */ -QList QAudioDeviceInfo::deviceList(QAudio::Mode mode) +QList QAudioDeviceInfo::deviceList(QAudio::Mode mode) { return QAudioDeviceFactory::deviceList(mode); } + +/*! + \internal +*/ + +QAudioDeviceInfo::QAudioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode): + d(new QAudioDeviceInfoPrivate(realm, handle, mode)) +{ +} + +/*! + \internal +*/ + +QString QAudioDeviceInfo::realm() const +{ + return d->realm; +} + +/*! + \internal +*/ + +QByteArray QAudioDeviceInfo::handle() const +{ + return d->handle; +} + + +/*! + \internal +*/ + +QAudio::Mode QAudioDeviceInfo::mode() const +{ + return d->mode; +} + QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h index b6adb85..53b9904 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.h +++ b/src/multimedia/audio/qaudiodeviceinfo.h @@ -52,7 +52,7 @@ #include #include -#include + QT_BEGIN_HEADER @@ -60,17 +60,22 @@ QT_BEGIN_NAMESPACE QT_MODULE(Multimedia) +class QAudioDeviceFactory; -class QAbstractAudioDeviceInfo; - -class Q_MULTIMEDIA_EXPORT QAudioDeviceInfo : public QObject +class QAudioDeviceInfoPrivate; +class Q_MULTIMEDIA_EXPORT QAudioDeviceInfo { - Q_OBJECT + friend class QAudioDeviceFactory; public: - explicit QAudioDeviceInfo(const QAudioDeviceId &id, QObject *parent = 0); + QAudioDeviceInfo(); + QAudioDeviceInfo(const QAudioDeviceInfo& other); ~QAudioDeviceInfo(); + QAudioDeviceInfo& operator=(const QAudioDeviceInfo& other); + + bool isNull() const; + QString deviceName() const; bool isFormatSupported(const QAudioFormat &format) const; @@ -84,19 +89,24 @@ public: QList supportedByteOrders() const; QList supportedSampleTypes() const; - static QAudioDeviceId defaultInputDevice(); - static QAudioDeviceId defaultOutputDevice(); + static QAudioDeviceInfo defaultInputDevice(); + static QAudioDeviceInfo defaultOutputDevice(); - static QList deviceList(QAudio::Mode mode); + static QList deviceList(QAudio::Mode mode); private: - Q_DISABLE_COPY(QAudioDeviceInfo) + QAudioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode); + QString realm() const; + QByteArray handle() const; + QAudio::Mode mode() const; - QAbstractAudioDeviceInfo* d; + QSharedDataPointer d; }; QT_END_NAMESPACE QT_END_HEADER +Q_DECLARE_METATYPE(QAudioDeviceInfo) + #endif // QAUDIODEVICEINFO_H diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index c944cf0..dc24875 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mode) +QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode) { handle = 0; @@ -62,17 +62,17 @@ QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mo this->mode = mode; } -QAudioDeviceInfoPrivate::~QAudioDeviceInfoPrivate() +QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() { close(); } -bool QAudioDeviceInfoPrivate::isFormatSupported(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const { return testSettings(format); } -QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const +QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const { QAudioFormat nearest; if(mode == QAudio::AudioOutput) { @@ -97,7 +97,7 @@ QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const return nearest; } -QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) const +QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format) const { if(testSettings(format)) return format; @@ -105,48 +105,48 @@ QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) return preferredFormat(); } -QString QAudioDeviceInfoPrivate::deviceName() const +QString QAudioDeviceInfoInternal::deviceName() const { return device; } -QStringList QAudioDeviceInfoPrivate::codecList() +QStringList QAudioDeviceInfoInternal::codecList() { updateLists(); return codecz; } -QList QAudioDeviceInfoPrivate::frequencyList() +QList QAudioDeviceInfoInternal::frequencyList() { updateLists(); return freqz; } -QList QAudioDeviceInfoPrivate::channelsList() +QList QAudioDeviceInfoInternal::channelsList() { updateLists(); return channelz; } -QList QAudioDeviceInfoPrivate::sampleSizeList() +QList QAudioDeviceInfoInternal::sampleSizeList() { updateLists(); return sizez; } -QList QAudioDeviceInfoPrivate::byteOrderList() +QList QAudioDeviceInfoInternal::byteOrderList() { updateLists(); return byteOrderz; } -QList QAudioDeviceInfoPrivate::sampleTypeList() +QList QAudioDeviceInfoInternal::sampleTypeList() { updateLists(); return typez; } -bool QAudioDeviceInfoPrivate::open() +bool QAudioDeviceInfoInternal::open() { int err = 0; QString dev = device; @@ -166,14 +166,14 @@ bool QAudioDeviceInfoPrivate::open() return true; } -void QAudioDeviceInfoPrivate::close() +void QAudioDeviceInfoInternal::close() { if(handle) snd_pcm_close(handle); handle = 0; } -bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const { // Set nearest to closest settings that do work. // See if what is in settings will work (return value). @@ -324,7 +324,7 @@ bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const return false; } -void QAudioDeviceInfoPrivate::updateLists() +void QAudioDeviceInfoInternal::updateLists() { // redo all lists based on current settings freqz.clear(); @@ -358,7 +358,7 @@ void QAudioDeviceInfoPrivate::updateLists() close(); } -QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) +QList QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { QAudio::Mode _m; QList devices; @@ -416,7 +416,7 @@ QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) return devices; } -QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() +QByteArray QAudioDeviceInfoInternal::defaultInputDevice() { QList devices = deviceList(QAudio::AudioInput); if(devices.size() == 0) @@ -425,7 +425,7 @@ QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() return QByteArray("default"); } -QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() +QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() { QList devices = deviceList(QAudio::AudioOutput); if(devices.size() == 0) diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h index 9990281..10078ca 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h @@ -71,12 +71,12 @@ const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; -class QAudioDeviceInfoPrivate : public QAbstractAudioDeviceInfo +class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { Q_OBJECT public: - QAudioDeviceInfoPrivate(QByteArray dev,QAudio::Mode mode); - ~QAudioDeviceInfoPrivate(); + QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode); + ~QAudioDeviceInfoInternal(); bool testSettings(const QAudioFormat& format) const; void updateLists(); diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp index 957a5c7..ec07748 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE -QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray const& handle, QAudio::Mode) +QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray const& handle, QAudio::Mode) { QDataStream ds(handle); quint32 did, tm; @@ -76,12 +76,12 @@ QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray const& handle, QAudi mode = QAudio::Mode(tm); } -bool QAudioDeviceInfoPrivate::isFormatSupported(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const { return format.codec() == QString::fromLatin1("audio/pcm"); } -QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const +QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const { QAudioFormat rc; @@ -134,7 +134,7 @@ QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const return rc; } -QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) const +QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format) const { QAudioFormat rc(format); QAudioFormat target = preferredFormat(); @@ -158,17 +158,17 @@ QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) return rc; } -QString QAudioDeviceInfoPrivate::deviceName() const +QString QAudioDeviceInfoInternal::deviceName() const { return name; } -QStringList QAudioDeviceInfoPrivate::codecList() +QStringList QAudioDeviceInfoInternal::codecList() { return QStringList() << QString::fromLatin1("audio/pcm"); } -QList QAudioDeviceInfoPrivate::frequencyList() +QList QAudioDeviceInfoInternal::frequencyList() { QSet rc; @@ -208,7 +208,7 @@ QList QAudioDeviceInfoPrivate::frequencyList() return rc.toList(); } -QList QAudioDeviceInfoPrivate::channelsList() +QList QAudioDeviceInfoInternal::channelsList() { QList rc; @@ -248,17 +248,17 @@ QList QAudioDeviceInfoPrivate::channelsList() return rc; } -QList QAudioDeviceInfoPrivate::sampleSizeList() +QList QAudioDeviceInfoInternal::sampleSizeList() { return QList() << 8 << 16 << 24 << 32 << 64; } -QList QAudioDeviceInfoPrivate::byteOrderList() +QList QAudioDeviceInfoInternal::byteOrderList() { return QList() << QAudioFormat::LittleEndian << QAudioFormat::BigEndian; } -QList QAudioDeviceInfoPrivate::sampleTypeList() +QList QAudioDeviceInfoInternal::sampleTypeList() { return QList() << QAudioFormat::SignedInt << QAudioFormat::UnSignedInt << QAudioFormat::Float; } @@ -296,7 +296,7 @@ static QByteArray get_device_info(AudioDeviceID audioDevice, QAudio::Mode mode) return device; } -QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() +QByteArray QAudioDeviceInfoInternal::defaultInputDevice() { AudioDeviceID audioDevice; UInt32 size = sizeof(audioDevice); @@ -310,7 +310,7 @@ QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() return get_device_info(audioDevice, QAudio::AudioInput); } -QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() +QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() { AudioDeviceID audioDevice; UInt32 size = sizeof(audioDevice); @@ -324,7 +324,7 @@ QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() return get_device_info(audioDevice, QAudio::AudioOutput); } -QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) +QList QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { QList devices; diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h index 7e8e752..60532a8 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h @@ -62,14 +62,14 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QAudioDeviceInfoPrivate : public QAbstractAudioDeviceInfo +class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { public: AudioDeviceID deviceId; QString name; QAudio::Mode mode; - QAudioDeviceInfoPrivate(QByteArray const& handle, QAudio::Mode mode); + QAudioDeviceInfoInternal(QByteArray const& handle, QAudio::Mode mode); bool isFormatSupported(const QAudioFormat& format) const; QAudioFormat preferredFormat() const; diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index ba9f5e2..69d5c94 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -74,23 +74,23 @@ QT_BEGIN_NAMESPACE #endif -QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mode) +QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode) { device = QLatin1String(dev); this->mode = mode; } -QAudioDeviceInfoPrivate::~QAudioDeviceInfoPrivate() +QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() { close(); } -bool QAudioDeviceInfoPrivate::isFormatSupported(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const { return testSettings(format); } -QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const +QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const { QAudioFormat nearest; if(mode == QAudio::AudioOutput) { @@ -110,7 +110,7 @@ QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const return nearest; } -QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) const +QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format) const { if(testSettings(format)) return format; @@ -118,58 +118,58 @@ QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) return preferredFormat(); } -QString QAudioDeviceInfoPrivate::deviceName() const +QString QAudioDeviceInfoInternal::deviceName() const { return device; } -QStringList QAudioDeviceInfoPrivate::codecList() +QStringList QAudioDeviceInfoInternal::codecList() { updateLists(); return codecz; } -QList QAudioDeviceInfoPrivate::frequencyList() +QList QAudioDeviceInfoInternal::frequencyList() { updateLists(); return freqz; } -QList QAudioDeviceInfoPrivate::channelsList() +QList QAudioDeviceInfoInternal::channelsList() { updateLists(); return channelz; } -QList QAudioDeviceInfoPrivate::sampleSizeList() +QList QAudioDeviceInfoInternal::sampleSizeList() { updateLists(); return sizez; } -QList QAudioDeviceInfoPrivate::byteOrderList() +QList QAudioDeviceInfoInternal::byteOrderList() { updateLists(); return byteOrderz; } -QList QAudioDeviceInfoPrivate::sampleTypeList() +QList QAudioDeviceInfoInternal::sampleTypeList() { updateLists(); return typez; } -bool QAudioDeviceInfoPrivate::open() +bool QAudioDeviceInfoInternal::open() { return true; } -void QAudioDeviceInfoPrivate::close() +void QAudioDeviceInfoInternal::close() { } -bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const { // Set nearest to closest settings that do work. // See if what is in settings will work (return value). @@ -199,7 +199,7 @@ bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const return false; } -void QAudioDeviceInfoPrivate::updateLists() +void QAudioDeviceInfoInternal::updateLists() { // redo all lists based on current settings bool base = false; @@ -333,7 +333,7 @@ void QAudioDeviceInfoPrivate::updateLists() } } -QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) +QList QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { Q_UNUSED(mode) @@ -367,12 +367,12 @@ QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) return devices; } -QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() +QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() { return QByteArray("default"); } -QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() +QByteArray QAudioDeviceInfoInternal::defaultInputDevice() { return QByteArray("default"); } diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h index 7cf7f45..0d2ee29 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h @@ -68,13 +68,13 @@ QT_BEGIN_NAMESPACE const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; -class QAudioDeviceInfoPrivate : public QAbstractAudioDeviceInfo +class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { Q_OBJECT public: - QAudioDeviceInfoPrivate(QByteArray dev,QAudio::Mode mode); - ~QAudioDeviceInfoPrivate(); + QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode); + ~QAudioDeviceInfoInternal(); bool open(); void close(); diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index c23e454..86fe85b 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -286,7 +286,7 @@ int QAudioFormat::sampleSize() const \sa QAudioDeviceInfo::supportedCodecs() */ -void QAudioFormat::setCodec(QString codec) +void QAudioFormat::setCodec(const QString &codec) { d->codec = codec; } diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h index 4cd6e23..d5841ce 100644 --- a/src/multimedia/audio/qaudioformat.h +++ b/src/multimedia/audio/qaudioformat.h @@ -82,7 +82,7 @@ public: void setSampleSize(int sampleSize); int sampleSize() const; - void setCodec(QString codec); + void setCodec(const QString &codec); QString codec() const; void setByteOrder(QAudioFormat::Endian byteOrder); diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 3c0d98e..858846f 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE You can construct an audio input with the system's \l{QAudioDeviceInfo::defaultInputDevice()}{default audio input device}. It is also possible to create QAudioInput with a - specific QAudioDeviceId. When you create the audio input, you + specific QAudioDeviceInfo. When you create the audio input, you should also send in the QAudioFormat to be used for the recording (see the QAudioFormat class description for details). @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE QAudioInput lets you record audio with an audio input device. The default constructor of this class will use the systems default - audio device, but you can also specify a QAudioDeviceId for a + audio device, but you can also specify a QAudioDeviceInfo for a specific device. You also need to pass in the QAudioFormat in which you wish to record. @@ -154,14 +154,14 @@ QAudioInput::QAudioInput(const QAudioFormat &format, QObject *parent): /*! Construct a new audio input and attach it to \a parent. - The \a id of the audio input device is used with the input + The device referenced by \a audioDevice is used with the input \a format parameters. */ -QAudioInput::QAudioInput(const QAudioDeviceId &id, const QAudioFormat &format, QObject *parent): +QAudioInput::QAudioInput(const QAudioDeviceInfo &audioDevice, const QAudioFormat &format, QObject *parent): QObject(parent) { - d = QAudioDeviceFactory::createInputDevice(id, format); + d = QAudioDeviceFactory::createInputDevice(audioDevice, format); connect(d, SIGNAL(notify()), SIGNAL(notify())); connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State))); } diff --git a/src/multimedia/audio/qaudioinput.h b/src/multimedia/audio/qaudioinput.h index 277a6cf..c8094f5 100644 --- a/src/multimedia/audio/qaudioinput.h +++ b/src/multimedia/audio/qaudioinput.h @@ -48,7 +48,8 @@ #include #include -#include +#include + QT_BEGIN_HEADER @@ -65,7 +66,7 @@ class Q_MULTIMEDIA_EXPORT QAudioInput : public QObject public: explicit QAudioInput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); - explicit QAudioInput(const QAudioDeviceId &id, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); + explicit QAudioInput(const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); ~QAudioInput(); QAudioFormat format() const; diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 8a8edb4..3d3f5f5 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE You can construct an audio output with the system's \l{QAudioDeviceInfo::defaultOutputDevice()}{default audio output device}. It is also possible to create QAudioOutput with a - specific QAudioDeviceId. When you create the audio output, you + specific QAudioDeviceInfo. When you create the audio output, you should also send in the QAudioFormat to be used for the playback (see the QAudioFormat class description for details). @@ -155,14 +155,14 @@ QAudioOutput::QAudioOutput(const QAudioFormat &format, QObject *parent): /*! Construct a new audio output and attach it to \a parent. - The \a id of the audio output device is used with the output + The device referenced by \a audioDevice is used with the output \a format parameters. */ -QAudioOutput::QAudioOutput(const QAudioDeviceId &id, const QAudioFormat &format, QObject *parent): +QAudioOutput::QAudioOutput(const QAudioDeviceInfo &audioDevice, const QAudioFormat &format, QObject *parent): QObject(parent) { - d = QAudioDeviceFactory::createOutputDevice(id, format); + d = QAudioDeviceFactory::createOutputDevice(audioDevice, format); connect(d, SIGNAL(notify()), SIGNAL(notify())); connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State))); } diff --git a/src/multimedia/audio/qaudiooutput.h b/src/multimedia/audio/qaudiooutput.h index 1ed3d06..bb3496e 100644 --- a/src/multimedia/audio/qaudiooutput.h +++ b/src/multimedia/audio/qaudiooutput.h @@ -48,7 +48,7 @@ #include #include -#include +#include QT_BEGIN_HEADER @@ -66,7 +66,7 @@ class Q_MULTIMEDIA_EXPORT QAudioOutput : public QObject public: explicit QAudioOutput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); - explicit QAudioOutput(const QAudioDeviceId &id, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); + explicit QAudioOutput(const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); ~QAudioOutput(); QAudioFormat format() const; diff --git a/tests/auto/qaudiodeviceid/qaudiodeviceid.pro b/tests/auto/qaudiodeviceid/qaudiodeviceid.pro deleted file mode 100644 index e0c7d4d..0000000 --- a/tests/auto/qaudiodeviceid/qaudiodeviceid.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) - -DEFINES += SRCDIR=\\\"$$PWD/\\\" - -SOURCES += tst_qaudiodeviceid.cpp - -QT = core multimedia diff --git a/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp b/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp deleted file mode 100644 index 02e475e..0000000 --- a/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 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 -#include -#include -#include - -#include -#include - - -class tst_QAudioDeviceId : public QObject -{ - Q_OBJECT - -public: - tst_QAudioDeviceId(QObject* parent=0) : QObject(parent) {} - -private slots: - void initTestCase(); - void checkNull(); - void checkEquality(); - -private: - bool available; -}; - -void tst_QAudioDeviceId::initTestCase() -{ - // Only perform tests if audio output device exists! - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); - if(devices.size() > 0) - available = true; - else { - qWarning()<<"NOTE: no audio output device found, no test will be performed"; - available = false; - } -} - -void tst_QAudioDeviceId::checkNull() -{ - if(available) { - // Default constructed is null. - QAudioDeviceId deviceId0; - QVERIFY(deviceId0.isNull()); - - // Null is transferred - QAudioDeviceId deviceId1(deviceId0); - QVERIFY(deviceId1.isNull()); - } -} - -void tst_QAudioDeviceId::checkEquality() -{ - if(available) { - QAudioDeviceId deviceId0; - QAudioDeviceId deviceId1; - - // Null ids are equivalent - QVERIFY(deviceId0 == deviceId1); - QVERIFY(!(deviceId0 != deviceId1)); - - deviceId1 = QAudioDeviceInfo::defaultOutputDevice(); - - // Different - QVERIFY(deviceId0 != deviceId1); - QVERIFY(!(deviceId0 == deviceId1)); - - // Same - deviceId0 = deviceId1; - - QVERIFY(deviceId0 == deviceId1); - QVERIFY(!(deviceId0 != deviceId1)); - } -} - -QTEST_MAIN(tst_QAudioDeviceId) - -#include "tst_qaudiodeviceid.moc" diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp index 45912e2..7b9a422 100644 --- a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp +++ b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp @@ -77,7 +77,7 @@ private: void tst_QAudioDeviceInfo::initTestCase() { // Only perform tests if audio output device exists! - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); if(devices.size() > 0) available = true; else { @@ -90,7 +90,7 @@ void tst_QAudioDeviceInfo::checkAvailableDefaultInput() { // Only perform tests if audio input device exists! bool storeAvailable = available; - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); if(devices.size() > 0) available = true; else { @@ -111,9 +111,9 @@ void tst_QAudioDeviceInfo::checkAvailableDefaultOutput() void tst_QAudioDeviceInfo::outputList() { if(available) { - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); QVERIFY(devices.size() > 0); - device = new QAudioDeviceInfo(devices.at(0), this); + device = new QAudioDeviceInfo(devices.at(0)); } } diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index bf11961..7331072 100644 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -75,7 +75,7 @@ void tst_QAudioInput::initTestCase() format.setSampleType(QAudioFormat::UnSignedInt); // Only perform tests if audio input device exists! - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); if(devices.size() > 0) available = true; else { diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index db2444b..b45a57e 100644 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -78,7 +78,7 @@ void tst_QAudioOutput::initTestCase() format.setSampleType(QAudioFormat::UnSignedInt); // Only perform tests if audio output device exists! - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); if(devices.size() > 0) available = true; else { -- cgit v0.12 From 8a7a3d173d94cabc5bbfa2518f22849d1aa6f855 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Thu, 24 Sep 2009 13:22:57 +1000 Subject: AudioServices; Nicer examples. Reviewed-by: Bill King --- doc/src/examples/audioinput.qdoc | 2 +- .../multimedia/audio/audioinput/audioinput.cpp | 198 ++++++--------------- examples/multimedia/audio/audioinput/audioinput.h | 40 ++--- .../multimedia/audio/audiooutput/audiooutput.cpp | 34 ++-- .../multimedia/audio/audiooutput/audiooutput.h | 2 - 5 files changed, 83 insertions(+), 193 deletions(-) diff --git a/doc/src/examples/audioinput.qdoc b/doc/src/examples/audioinput.qdoc index 0b1b551..ac44d75 100644 --- a/doc/src/examples/audioinput.qdoc +++ b/doc/src/examples/audioinput.qdoc @@ -49,6 +49,6 @@ Qt provides the QAudioInput class to enable audio functionality within a standard application user interface. - This example uses a fast-fourier transform on the input audio from the microphone + This example calculates the maximum linear value of the input audio from the microphone and displays the output. */ diff --git a/examples/multimedia/audio/audioinput/audioinput.cpp b/examples/multimedia/audio/audioinput/audioinput.cpp index c09e7d9..05723ae 100644 --- a/examples/multimedia/audio/audioinput/audioinput.cpp +++ b/examples/multimedia/audio/audioinput/audioinput.cpp @@ -50,46 +50,31 @@ #include #include "audioinput.h" -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif +#define BUFFER_SIZE 4096 -Spectrum::Spectrum(QObject* parent, QAudioInput* device, float* out) +AudioInfo::AudioInfo(QObject* parent, QAudioInput* device) :QIODevice( parent ) { input = device; - output = out; - unsigned int i; - - // Allocate sample buffer and initialize sin and cos lookup tables - fftState = (fft_state *) malloc (sizeof(fft_state)); - - for(i = 0; i < BUFFER_SIZE; i++) { - bitReverse[i] = reverseBits(i); - } - for(i = 0; i < BUFFER_SIZE / 2; i++) { - float j = 2 * M_PI * i / BUFFER_SIZE; - costable[i] = cos(j); - sintable[i] = sin(j); - } + m_maxValue = 0; } -Spectrum::~Spectrum() +AudioInfo::~AudioInfo() { } -void Spectrum::start() +void AudioInfo::start() { open(QIODevice::WriteOnly); } -void Spectrum::stop() +void AudioInfo::stop() { close(); } -qint64 Spectrum::readData(char *data, qint64 maxlen) +qint64 AudioInfo::readData(char *data, qint64 maxlen) { Q_UNUSED(data) Q_UNUSED(maxlen) @@ -97,97 +82,39 @@ qint64 Spectrum::readData(char *data, qint64 maxlen) return 0; } -qint64 Spectrum::writeData(const char *data, qint64 len) +qint64 AudioInfo::writeData(const char *data, qint64 len) { - performFFT((sound_sample*)data); - emit update(); - - return len; -} - -int Spectrum::reverseBits(unsigned int initial) { - // BIT-REVERSE-COPY(a,A) - - unsigned int reversed = 0, loop; - for(loop = 0; loop < BUFFER_SIZE_LOG; loop++) { - reversed <<= 1; - reversed += (initial & 1); - initial >>= 1; - } - return reversed; -} - -void Spectrum::performFFT(const sound_sample *input) { - /* Convert to reverse bit order for FFT */ - prepFFT(input, fftState->real, fftState->imag); + int samples = len/2; // 2 bytes per sample + int maxAmp = 32768; // max for S16 samples + bool clipping = false; - /* Calculate FFT */ - calcFFT(fftState->real, fftState->imag); - - /* Convert FFT to intensities */ - outputFFT(fftState->real, fftState->imag); -} + m_maxValue = 0; -void Spectrum::prepFFT(const sound_sample *input, float * re, float * im) { - unsigned int i; - float *realptr = re; - float *imagptr = im; + qint16* s = (qint16*)data; - /* Get input, in reverse bit order */ - for(i = 0; i < BUFFER_SIZE; i++) { - *realptr++ = input[bitReverse[i]]; - *imagptr++ = 0; - } -} + // sample format is S16LE, only! -void Spectrum::calcFFT(float * re, float * im) { - unsigned int i, j, k; - unsigned int exchanges; - float fact_real, fact_imag; - float tmp_real, tmp_imag; - unsigned int factfact; - - /* Set up some variables to reduce calculation in the loops */ - exchanges = 1; - factfact = BUFFER_SIZE / 2; - - /* divide and conquer method */ - for(i = BUFFER_SIZE_LOG; i != 0; i--) { - for(j = 0; j != exchanges; j++) { - fact_real = costable[j * factfact]; - fact_imag = sintable[j * factfact]; - for(k = j; k < BUFFER_SIZE; k += exchanges << 1) { - int k1 = k + exchanges; - tmp_real = fact_real * re[k1] - fact_imag * im[k1]; - tmp_imag = fact_real * im[k1] + fact_imag * re[k1]; - re[k1] = re[k] - tmp_real; - im[k1] = im[k] - tmp_imag; - re[k] += tmp_real; - im[k] += tmp_imag; - } - } - exchanges <<= 1; - factfact >>= 1; + for(int i=0;i m_maxValue) m_maxValue = abs(sample); } -} + // check for clipping + if(m_maxValue>=(maxAmp-1)) clipping = true; -void Spectrum::outputFFT(const float * re, const float * im) { - const float *realptr = re; - const float *imagptr = im; - float *outputptr = output; + float value = ((float)m_maxValue/(float)maxAmp); + if(clipping) m_maxValue = 100; + else m_maxValue = (int)(value*100); - float *endptr = output + BUFFER_SIZE / 2; - - /* Convert FFT to intensities */ + emit update(); - while(outputptr <= endptr) { - *outputptr = (*realptr * *realptr) + (*imagptr * *imagptr); - outputptr++; realptr++; imagptr++; - } - *output /= 4; - *endptr /= 4; + return len; } +int AudioInfo::LinearMax() +{ + return m_maxValue; +} RenderArea::RenderArea(QWidget *parent) : QWidget(parent) @@ -195,8 +122,7 @@ RenderArea::RenderArea(QWidget *parent) setBackgroundRole(QPalette::Base); setAutoFillBackground(true); - samples = 0; - sampleSize = 0; + level = 0; setMinimumHeight(30); setMinimumWidth(200); } @@ -205,38 +131,32 @@ void RenderArea::paintEvent(QPaintEvent * /* event */) { QPainter painter(this); - if(sampleSize == 0) + painter.setPen(Qt::black); + painter.drawRect(QRect(painter.viewport().left()+10, painter.viewport().top()+10, + painter.viewport().right()-20, painter.viewport().bottom()-20)); + + if(level == 0) return; painter.setPen(Qt::red); - int max = 0; - for(int i=0;i max) - max = m; - } - int x1,y1,x2,y2; + int pos = ((painter.viewport().right()-20)-(painter.viewport().left()+11))*level/100; + int x1,y1,x2,y2; for(int i=0;i<10;i++) { x1 = painter.viewport().left()+11; y1 = painter.viewport().top()+10+i; - x2 = painter.viewport().right()-20-max; + x2 = painter.viewport().left()+20+pos; y2 = painter.viewport().top()+10+i; if(x2 < painter.viewport().left()+10) x2 = painter.viewport().left()+10; painter.drawLine(QPoint(x1,y1),QPoint(x2,y2)); } - - painter.setPen(Qt::black); - painter.drawRect(QRect(painter.viewport().left()+10, painter.viewport().top()+10, - painter.viewport().right()-20, painter.viewport().bottom()-20)); } -void RenderArea::spectrum(float* output, int size) +void RenderArea::setLevel(int value) { - samples = output; - sampleSize = size; + level = value; repaint(); } @@ -271,25 +191,25 @@ InputTest::InputTest() setCentralWidget(window); window->show(); - buffer = new char[BUFFER_SIZE*10]; - output = new float[1024]; + buffer = new char[BUFFER_SIZE]; pullMode = true; + // AudioInfo class only supports mono S16LE samples! format.setFrequency(8000); format.setChannels(1); - format.setSampleSize(8); - format.setSampleType(QAudioFormat::UnSignedInt); + format.setSampleSize(16); + format.setSampleType(QAudioFormat::SignedInt); format.setByteOrder(QAudioFormat::LittleEndian); format.setCodec("audio/pcm"); audioInput = new QAudioInput(format,this); connect(audioInput,SIGNAL(notify()),SLOT(status())); connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); - spec = new Spectrum(this,audioInput,output); - connect(spec,SIGNAL(update()),SLOT(refreshDisplay())); - spec->start(); - audioInput->start(spec); + audioinfo = new AudioInfo(this,audioInput); + connect(audioinfo,SIGNAL(update()),SLOT(refreshDisplay())); + audioinfo->start(); + audioInput->start(audioinfo); } InputTest::~InputTest() {} @@ -304,11 +224,11 @@ void InputTest::readMore() if(!audioInput) return; qint64 len = audioInput->bytesReady(); - if(len > BUFFER_SIZE*10) - len = BUFFER_SIZE*10; + if(len > 4096) + len = 4096; qint64 l = input->read(buffer,len); if(l > 0) { - spec->write(buffer,l); + audioinfo->write(buffer,l); } } @@ -317,15 +237,15 @@ void InputTest::toggleMode() // Change bewteen pull and push modes audioInput->stop(); - if(pullMode) { - button->setText(tr("Click for Push Mode")); + if (pullMode) { + button->setText(tr("Click for Pull Mode")); input = audioInput->start(0); connect(input,SIGNAL(readyRead()),SLOT(readMore())); pullMode = false; } else { - button->setText(tr("Click for Pull Mode")); + button->setText(tr("Click for Push Mode")); pullMode = true; - audioInput->start(spec); + audioInput->start(audioinfo); } } @@ -356,13 +276,13 @@ void InputTest::state(QAudio::State state) void InputTest::refreshDisplay() { - canvas->spectrum(output,256); + canvas->setLevel(audioinfo->LinearMax()); canvas->repaint(); } void InputTest::deviceChanged(int idx) { - spec->stop(); + audioinfo->stop(); audioInput->stop(); audioInput->disconnect(this); delete audioInput; @@ -371,6 +291,6 @@ void InputTest::deviceChanged(int idx) audioInput = new QAudioInput(device, format, this); connect(audioInput,SIGNAL(notify()),SLOT(status())); connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); - spec->start(); - audioInput->start(spec); + audioinfo->start(); + audioInput->start(audioinfo); } diff --git a/examples/multimedia/audio/audioinput/audioinput.h b/examples/multimedia/audio/audioinput/audioinput.h index 7ba6f1f..14e1bac 100644 --- a/examples/multimedia/audio/audioinput/audioinput.h +++ b/examples/multimedia/audio/audioinput/audioinput.h @@ -48,42 +48,25 @@ #include -#define BUFFER_SIZE_LOG 9 -#define BUFFER_SIZE (1 << BUFFER_SIZE_LOG) - -struct _struct_fft_state { - float real[BUFFER_SIZE]; - float imag[BUFFER_SIZE]; -}; -typedef _struct_fft_state fft_state; -typedef short int sound_sample; - -class Spectrum : public QIODevice +class AudioInfo : public QIODevice { Q_OBJECT public: - Spectrum(QObject* parent, QAudioInput* device, float* out); - ~Spectrum(); + AudioInfo(QObject* parent, QAudioInput* device); + ~AudioInfo(); void start(); void stop(); + int LinearMax(); + qint64 readData(char *data, qint64 maxlen); qint64 writeData(const char *data, qint64 len); QAudioInput* input; - float* output; - fft_state* fftState; - unsigned int bitReverse[BUFFER_SIZE]; - float sintable[BUFFER_SIZE / 2]; - float costable[BUFFER_SIZE / 2]; - - void prepFFT (const sound_sample *input, float *re, float *im); - void calcFFT (float *re, float *im); - void outputFFT (const float *re, const float *im); - int reverseBits (unsigned int initial); - void performFFT (const sound_sample *input); +private: + int m_maxValue; signals: void update(); @@ -97,16 +80,14 @@ class RenderArea : public QWidget public: RenderArea(QWidget *parent = 0); - void spectrum(float* output, int size); + void setLevel(int value); protected: void paintEvent(QPaintEvent *event); private: + int level; QPixmap pixmap; - - float* samples; - int sampleSize; }; class InputTest : public QMainWindow @@ -119,7 +100,7 @@ public: QAudioDeviceInfo device; QAudioFormat format; QAudioInput* audioInput; - Spectrum* spec; + AudioInfo* audioinfo; QIODevice* input; RenderArea* canvas; @@ -130,7 +111,6 @@ public: QComboBox* deviceBox; char* buffer; - float* output; private slots: void refreshDisplay(); diff --git a/examples/multimedia/audio/audiooutput/audiooutput.cpp b/examples/multimedia/audio/audiooutput/audiooutput.cpp index 19f7a3f..9e532cd 100644 --- a/examples/multimedia/audio/audiooutput/audiooutput.cpp +++ b/examples/multimedia/audio/audiooutput/audiooutput.cpp @@ -50,18 +50,19 @@ #define M_PI 3.14159265358979323846 #endif +#define SECONDS 1 +#define FREQ 600 +#define SYSTEM_FREQ 44100 + Generator::Generator(QObject *parent) :QIODevice( parent ) { finished = false; - buffer = new char[SECONDS*44100*4+1000]; + buffer = new char[SECONDS*SYSTEM_FREQ*4+1000]; t=buffer; - len=fillData(t+4,450,SECONDS); /* left channel, 450Hz sine */ - len+=fillData(t+6,452,SECONDS); /* right channel, 452Hz sine */ - putLong(t,len); - putLong(buffer+4,len+8+16+8); + len=fillData(t,FREQ,SECONDS); /* mono FREQHz sine */ pos = 0; - total = len+8+16+8; + total = len; } Generator::~Generator() @@ -86,21 +87,12 @@ int Generator::putShort(char *t, unsigned int value) return 2; } -int Generator::putLong(char *t, unsigned int value) -{ - *(unsigned char *)(t++)=value&255; - *(unsigned char *)(t++)=(value/256)&255; - *(unsigned char *)(t++)=(value/(256*256))&255; - *(unsigned char *)(t)=(value/(256*256*256))&255; - return 4; -} - int Generator::fillData(char *start, int frequency, int seconds) { int i, len=0; int value; - for(i=0; i 16384) len = 16384; - if(len < (SECONDS*44100*4+1000)-pos) { + if(len < (SECONDS*SYSTEM_FREQ*2)-pos) { // Normal memcpy(data,t+pos,len); pos+=len; return len; } else { // Whats left and reset to start - qint64 left = (SECONDS*44100*4+1000)-pos; + qint64 left = (SECONDS*SYSTEM_FREQ*2)-pos; memcpy(data,t+pos,left); pos=0; return left; @@ -172,8 +164,8 @@ AudioTest::AudioTest() gen->start(); - settings.setFrequency(44100); - settings.setChannels(2); + settings.setFrequency(SYSTEM_FREQ); + settings.setChannels(1); settings.setSampleSize(16); settings.setCodec("audio/pcm"); settings.setByteOrder(QAudioFormat::LittleEndian); diff --git a/examples/multimedia/audio/audiooutput/audiooutput.h b/examples/multimedia/audio/audiooutput/audiooutput.h index a5c0289..6c07a3a 100644 --- a/examples/multimedia/audio/audiooutput/audiooutput.h +++ b/examples/multimedia/audio/audiooutput/audiooutput.h @@ -42,7 +42,6 @@ #include #define BUFFER_SIZE 32768 -#define SECONDS 3 #include #include @@ -76,7 +75,6 @@ public: private: int putShort(char *t, unsigned int value); - int putLong(char *t, unsigned int value); int fillData(char *start, int frequency, int seconds); }; -- cgit v0.12 From c89cd924858c4fce30b0855e295e0a6adfaea875 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 24 Sep 2009 08:51:24 +0300 Subject: Fixed "warning: variable / argument 'window' is not used in function" The warning was reported by Nokia X86 compiler when compiling for S60 emulator. The fix was a t rivial change to add Q_UNUSED macro for #ifdef branches where window parameter was not used. --- src/testlib/qtestsystem.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index 540b18d..a9a2193 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -76,8 +76,10 @@ namespace QTest #if defined(Q_WS_X11) qt_x11_wait_for_window_manager(window); #elif defined(Q_WS_QWS) + Q_UNUSED(window); qWait(100); #else + Q_UNUSED(window); qWait(50); #endif return true; -- cgit v0.12 From 39d0ded8f6e94df2a08876ee1cf00253ef2b7de3 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 24 Sep 2009 09:36:27 +0300 Subject: Fixed compiler error in qsqldatabase auto test. Nokia X86 compiler i.e. S60 emulator compiler reported the following error when compiling qsqldatabase auto test. function call '[QLatin1String].QLatin1String(const QString)' does not match Reviewed-by: Aleksandar Sasha Babic --- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 675b170..4198bfc 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -2182,18 +2182,18 @@ void tst_QSqlDatabase::oci_synonymstest() QSqlQuery q(db); QString creator(qTableName("CREATOR")), appuser(qTableName("APPUSER")), table1(qTableName("TABLE1")); // QVERIFY_SQL(q, exec("drop public synonym "+table1)); - QVERIFY_SQL(q, exec(QLatin1String("create user "+creator+" identified by "+creator+" default tablespace users temporary tablespace temp"))); - QVERIFY_SQL(q, exec(QLatin1String("grant CONNECT to "+creator))); - QVERIFY_SQL(q, exec(QLatin1String("grant RESOURCE to "+creator))); + QVERIFY_SQL(q, exec(QString("create user %1 identified by %2 default tablespace users temporary tablespace temp").arg(creator).arg(creator))); + QVERIFY_SQL(q, exec(QString("grant CONNECT to %1").arg(creator))); + QVERIFY_SQL(q, exec(QString("grant RESOURCE to %1").arg(creator))); QSqlDatabase db2=db.cloneDatabase(db, QLatin1String("oci_synonymstest")); db2.close(); QVERIFY_SQL(db2, open(creator,creator)); QSqlQuery q2(db2); - QVERIFY_SQL(q2, exec("create table "+table1+"(id int primary key)")); - QVERIFY_SQL(q, exec(QLatin1String("create user "+appuser+" identified by "+appuser+" default tablespace users temporary tablespace temp"))); - QVERIFY_SQL(q, exec(QLatin1String("grant CREATE ANY SYNONYM to "+appuser))); - QVERIFY_SQL(q, exec(QLatin1String("grant CONNECT to "+appuser))); - QVERIFY_SQL(q2, exec(QLatin1String("grant select, insert, update, delete on "+table1+" to "+appuser))); + QVERIFY_SQL(q2, exec(QString("create table %1(id int primary key)").arg(table1))); + QVERIFY_SQL(q, exec(QString("create user %1 identified by %2 default tablespace users temporary tablespace temp").arg(appuser).arg(appuser))); + QVERIFY_SQL(q, exec(QString("grant CREATE ANY SYNONYM to %1").arg(appuser))); + QVERIFY_SQL(q, exec(QString("grant CONNECT to %1").arg(appuser))); + QVERIFY_SQL(q2, exec(QString("grant select, insert, update, delete on %1 to %2").arg(table1).arg(appuser))); QSqlDatabase db3=db.cloneDatabase(db, QLatin1String("oci_synonymstest2")); db3.close(); QVERIFY_SQL(db3, open(appuser,appuser)); -- cgit v0.12 From 856b36f49b567a1573d119b5606300c07649b443 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 24 Sep 2009 09:15:10 +0200 Subject: Compile tests --- tests/auto/qcompleter/tst_qcompleter.cpp | 2 +- tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index f7b9d98..43205e1 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1011,7 +1011,7 @@ void tst_QCompleter::multipleWidgets() QWidget window; window.show(); QApplication::setActiveWindow(&window); - QApplicaion::qWaitForWindowShown(&window); + QTest::qWaitForWindowShown(&window); QTRY_VERIFY(qApp->activeWindow() == &window); QFocusEvent focusIn(QEvent::FocusIn); diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index b92e140..f86e81d 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -55,10 +55,10 @@ public: int duration() const { return -1; /* not time driven */ } protected: - void updateCurrentTime(int msecs) + void updateCurrentTime() { - QPropertyAnimation::updateCurrentTime(msecs); - if (msecs >= QPropertyAnimation::duration()) + QPropertyAnimation::updateCurrentTime(); + if (currentTime() >= QPropertyAnimation::duration() || currentLoop() >= 1) stop(); } }; @@ -239,7 +239,7 @@ void tst_QPropertyAnimation::statesAndSignals() { QFETCH(bool, uncontrolled); QPropertyAnimation *anim; - if (uncontrolled) + if (uncontrolled) anim = new UncontrolledAnimation; else anim = new DummyPropertyAnimation; -- cgit v0.12 From e8a71fcacb21897418b80ac1977b3a5c64b4fb71 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 24 Sep 2009 01:12:29 +0200 Subject: Fixes for WebKit trunk import Updated file lists. Reviewed-by: Trust me --- util/webkit/mkdist-webkit | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 49d4785..3afccba 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -42,7 +42,7 @@ excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.xcodep excluded_directories="$excluded_directories JavaScriptCore/tests" excluded_directories="$excluded_directories JavaScriptCore/API/tests" excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.vcproj" -excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.pro" +excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.gyp" excluded_directories="$excluded_directories JavaScriptCore/wtf/wx" excluded_directories="$excluded_directories JavaScriptCore/wtf/gtk" excluded_directories="$excluded_directories JavaScriptCore/wtf/mac" @@ -51,9 +51,12 @@ excluded_directories="$excluded_directories JavaScriptCore/wtf/chromium" excluded_directories="$excluded_directories JavaScriptCore/wtf/haiku" excluded_directories="$excluded_directories WebCore/WebCore.vcproj" +excluded_directories="$excluded_directories WebCore/WebCore.gyp" excluded_directories="$excluded_directories WebCore/DerivedSources.make" excluded_directories="$excluded_directories WebCore/GNUmakefile.am" excluded_directories="$excluded_directories WebCore/WebCore.base.exp" +excluded_directories="$excluded_directories WebCore/WebCore.PluginHostProcess.exp" +excluded_directories="$excluded_directories WebCore/WebCore.OrientationEvents.exp" excluded_directories="$excluded_directories WebCore/WebCore.xcodeproj" excluded_directories="$excluded_directories WebCore/Configurations" @@ -145,6 +148,7 @@ excluded_directories="$excluded_directories WebKit/win" excluded_directories="$excluded_directories WebKit/wx" excluded_directories="$excluded_directories WebKit/cf" excluded_directories="$excluded_directories WebKit/haiku" +excluded_directories="$excluded_directories WebKit/chromium" excluded_directories="$excluded_directories WebKit/English.lproj WebKit/WebKit.xcodeproj" excluded_directories="$excluded_directories WebCore/English.lproj" -- cgit v0.12 From 3ec68c8948284437b8591010bbbbe2ea97b8cc46 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 24 Sep 2009 10:33:39 +0200 Subject: Fixed background scrolling in the SVG viewer example. Reviewed-by: Trond --- examples/painting/svgviewer/svgview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/painting/svgviewer/svgview.cpp b/examples/painting/svgviewer/svgview.cpp index 0938ff8..76c6469 100644 --- a/examples/painting/svgviewer/svgview.cpp +++ b/examples/painting/svgviewer/svgview.cpp @@ -62,6 +62,7 @@ SvgView::SvgView(QWidget *parent) setScene(new QGraphicsScene(this)); setTransformationAnchor(AnchorUnderMouse); setDragMode(ScrollHandDrag); + setViewportUpdateMode(FullViewportUpdate); // Prepare background check-board pattern QPixmap tilePixmap(64, 64); -- cgit v0.12 From 600cef0aa62dedafac9190809230e01e3b200356 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 24 Sep 2009 10:53:30 +0200 Subject: Revert "Autotest: This test does requires internal builds (with autotests)." This reverts commit df47e0d40290f5e40054a9612f75177d9ef8537a. There is no "private_build" in Qt 4.5 Reviewed-By: thiago --- tests/auto/qkeysequence/qkeysequence.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/qkeysequence/qkeysequence.pro b/tests/auto/qkeysequence/qkeysequence.pro index d4779af..bd85402 100644 --- a/tests/auto/qkeysequence/qkeysequence.pro +++ b/tests/auto/qkeysequence/qkeysequence.pro @@ -1,5 +1,4 @@ load(qttest_p4) -requires(contains(QT_CONFIG,private_tests)) SOURCES += tst_qkeysequence.cpp RESOURCES += qkeysequence.qrc \ No newline at end of file -- cgit v0.12 From 6d21ee6269a40c0d70e358cc1149d332ca84f868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 23 Sep 2009 14:22:03 +0200 Subject: Made fast blur in GL 2 engine be radius independent. This is useful when animating the blur radius, as you don't want to suffer the hit of compiling / linking a new shader program for each radius the first time the animation is played. Also use the fast blur when the radius is 5 or below, as the quality difference is insignificant. Reviewed-by: Rhys Weatherley --- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 1 + src/opengl/qglpixmapfilter.cpp | 236 +++++++++------------ 2 files changed, 97 insertions(+), 140 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 738626f..f245945 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -273,6 +273,7 @@ public: QScopedPointer convolutionFilter; QScopedPointer colorizeFilter; QScopedPointer blurFilter; + QScopedPointer fastBlurFilter; }; QT_END_NAMESPACE diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index b48c497..b68ff45 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -102,7 +102,7 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapBlurFilter(); + QGLPixmapBlurFilter(Qt::TransformationMode quality); void setUniforms(QGLShaderProgram *program); @@ -110,15 +110,14 @@ protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const; private: - static QByteArray generateBlurShader(int radius, bool gaussianBlur); + static QByteArray generateGaussianShader(int radius); mutable QSize m_textureSize; - mutable bool m_horizontalBlur; mutable bool m_haveCached; mutable int m_cachedRadius; - mutable Qt::TransformationMode m_cachedQuality; + mutable Qt::TransformationMode m_quality; }; extern QGLWidget *qt_gl_share_widget(); @@ -132,10 +131,17 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr d->colorizeFilter.reset(new QGLPixmapColorizeFilter); return d->colorizeFilter.data(); - case QPixmapFilter::BlurFilter: + case QPixmapFilter::BlurFilter: { + const QPixmapBlurFilter *proto = static_cast(prototype); + if (proto->quality() == Qt::FastTransformation || proto->radius() <= 5) { + if (!d->fastBlurFilter) + d->fastBlurFilter.reset(new QGLPixmapBlurFilter(Qt::FastTransformation)); + return d->fastBlurFilter.data(); + } if (!d->blurFilter) - d->blurFilter.reset(new QGLPixmapBlurFilter); + d->blurFilter.reset(new QGLPixmapBlurFilter(Qt::SmoothTransformation)); return d->blurFilter.data(); + } case QPixmapFilter::ConvolutionFilter: if (!d->convolutionFilter) @@ -309,10 +315,29 @@ bool QGLPixmapConvolutionFilter::processGL(QPainter *, const QPointF &pos, const return true; } -QGLPixmapBlurFilter::QGLPixmapBlurFilter() - : m_haveCached(false), m_cachedRadius(5), - m_cachedQuality(Qt::FastTransformation) +static const char *qt_gl_blur_filter_fast = + "const int samples = 9;" + "uniform mediump vec2 delta;" + "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {" + " mediump vec4 color = vec4(0.0, 0.0, 0.0, 0.0);" + " mediump float offset = (float(samples) - 1.0) / 2.0;" + " for (int i = 0; i < samples; i++) {" + " mediump vec2 coord = srcCoords + delta * (offset - float(i)) / offset;" + " color += texture2D(src, coord);" + " }" + " return color * (1.0 / float(samples));" + "}"; + +QGLPixmapBlurFilter::QGLPixmapBlurFilter(Qt::TransformationMode quality) + : m_haveCached(false) + , m_cachedRadius(5) + , m_quality(quality) { + if (quality == Qt::FastTransformation) { + QGLPixmapBlurFilter *filter = const_cast(this); + filter->setSource(qt_gl_blur_filter_fast); + m_haveCached = true; + } } bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const @@ -320,15 +345,11 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QGLPixmapBlurFilter *filter = const_cast(this); int radius = this->radius(); - Qt::TransformationMode quality = this->quality(); - - if (!m_haveCached || radius != m_cachedRadius || - quality != m_cachedQuality) { + if (!m_haveCached || (m_quality == Qt::SmoothTransformation && radius != m_cachedRadius)) { // Only regenerate the shader from source if parameters have changed. m_haveCached = true; m_cachedRadius = radius; - m_cachedQuality = quality; - filter->setSource(generateBlurShader(radius, quality == Qt::SmoothTransformation)); + filter->setSource(generateGaussianShader(radius)); } QGLFramebufferObjectFormat format; @@ -386,12 +407,21 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) { - program->setUniformValue("invTextureSize", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); + if (m_quality == Qt::SmoothTransformation) { + if (m_horizontalBlur) + program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0); + else + program->setUniformValue("delta", 0.0, 1.0 / m_textureSize.height()); + } else { + // 1.4 is chosen to most closely match the blurriness of the gaussian blur + // at low radii + qreal blur = radius() / 1.4f; - if (m_horizontalBlur) - program->setUniformValue("delta", 1.0, 0.0); - else - program->setUniformValue("delta", 0.0, 1.0); + if (m_horizontalBlur) + program->setUniformValue("delta", blur / m_textureSize.width(), 0.0); + else + program->setUniformValue("delta", 0.0, blur / m_textureSize.height()); + } } static inline qreal gaussian(qreal dx, qreal sigma) @@ -399,68 +429,46 @@ static inline qreal gaussian(qreal dx, qreal sigma) return exp(-dx * dx / (2 * sigma * sigma)) / (Q_2PI * sigma * sigma); } -QByteArray QGLPixmapBlurFilter::generateBlurShader(int radius, bool gaussianBlur) +QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius) { Q_ASSERT(radius >= 1); QByteArray source; source.reserve(1000); - source.append("uniform highp vec2 invTextureSize;\n"); - - bool separateXY = true; - bool clip = false; - - if (separateXY) { - source.append("uniform highp vec2 delta;\n"); - - if (clip) - source.append("uniform highp vec2 clip;\n"); - } else if (clip) { - source.append("uniform highp vec4 clip;\n"); - } - + source.append("uniform highp vec2 delta;\n"); source.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n"); QVector sampleOffsets; QVector weights; - if (gaussianBlur) { - QVector gaussianComponents; + QVector gaussianComponents; - qreal sigma = radius / 1.65; + qreal sigma = radius / 1.65; - qreal sum = 0; - for (int i = -radius; i <= radius; ++i) { - float value = gaussian(i, sigma); - gaussianComponents << value; - sum += value; - } + qreal sum = 0; + for (int i = -radius; i <= radius; ++i) { + float value = gaussian(i, sigma); + gaussianComponents << value; + sum += value; + } - // normalize - for (int i = 0; i < gaussianComponents.size(); ++i) - gaussianComponents[i] /= sum; + // normalize + for (int i = 0; i < gaussianComponents.size(); ++i) + gaussianComponents[i] /= sum; - for (int i = 0; i < gaussianComponents.size() - 1; i += 2) { - qreal weight = gaussianComponents.at(i) + gaussianComponents.at(i + 1); - qreal offset = i - radius + gaussianComponents.at(i + 1) / weight; + for (int i = 0; i < gaussianComponents.size() - 1; i += 2) { + qreal weight = gaussianComponents.at(i) + gaussianComponents.at(i + 1); + qreal offset = i - radius + gaussianComponents.at(i + 1) / weight; - sampleOffsets << offset; - weights << weight; - } + sampleOffsets << offset; + weights << weight; + } - // odd size ? - if (gaussianComponents.size() & 1) { - sampleOffsets << radius; - weights << gaussianComponents.last(); - } - } else { - for (int i = 0; i < radius; ++i) { - sampleOffsets << 2 * i - radius + 0.5; - weights << qreal(1); - } + // odd size ? + if (gaussianComponents.size() & 1) { sampleOffsets << radius; - weights << qreal(0.5); + weights << gaussianComponents.last(); } int currentVariable = 1; @@ -468,88 +476,36 @@ QByteArray QGLPixmapBlurFilter::generateBlurShader(int radius, bool gaussianBlur source.append(" mediump vec2 coord;\n"); qreal weightSum = 0; - if (separateXY) { - source.append(" mediump float c;\n"); - for (int i = 0; i < sampleOffsets.size(); ++i) { - qreal delta = sampleOffsets.at(i); - - ++currentVariable; - - QByteArray coordinate = "srcCoords"; - if (delta != qreal(0)) { - coordinate.append(" + invTextureSize * delta * float("); - coordinate.append(QByteArray::number(delta)); - coordinate.append(")"); - } - - source.append(" coord = "); - source.append(coordinate); - source.append(";\n"); + source.append(" mediump float c;\n"); + for (int i = 0; i < sampleOffsets.size(); ++i) { + qreal delta = sampleOffsets.at(i); + + ++currentVariable; - if (clip) { - source.append(" c = dot(coord, delta);\n"); - source.append(" if (c > clip.x && c < clip.y)\n "); - } - - source.append(" sample += texture2D(src, coord)"); - - weightSum += weights.at(i); - if (weights.at(i) != qreal(1)) { - source.append(" * float("); - source.append(QByteArray::number(weights.at(i))); - source.append(");\n"); - } else { - source.append(";\n"); - } + QByteArray coordinate = "srcCoords"; + if (delta != qreal(0)) { + coordinate.append(" + delta * float("); + coordinate.append(QByteArray::number(delta)); + coordinate.append(")"); } - } else { - for (int y = 0; y < sampleOffsets.size(); ++y) { - for (int x = 0; x < sampleOffsets.size(); ++x) { - QByteArray coordinate = "srcCoords"; - - qreal dx = sampleOffsets.at(x); - qreal dy = sampleOffsets.at(y); - - if (dx != qreal(0) || dy != qreal(0)) { - coordinate.append(" + invTextureSize * vec2(float("); - coordinate.append(QByteArray::number(dx)); - coordinate.append("), float("); - coordinate.append(QByteArray::number(dy)); - coordinate.append("))"); - } - - source.append(" coord = "); - source.append(coordinate); - source.append(";\n"); - - if (clip) - source.append(" if (coord.x > clip.x && coord.x < clip.y && coord.y > clip.z && coord.y < clip.w)\n "); - - source.append(" sample += texture2D(src, coord)"); - - ++currentVariable; - - weightSum += weights.at(x) * weights.at(y); - if ((weights.at(x) != qreal(1) || weights.at(y) != qreal(1))) { - source.append(" * float("); - source.append(QByteArray::number(weights.at(x) * weights.at(y))); - source.append(");\n"); - } else { - source.append(";\n"); - } - } + + source.append(" coord = "); + source.append(coordinate); + source.append(";\n"); + + source.append(" sample += texture2D(src, coord)"); + + weightSum += weights.at(i); + if (weights.at(i) != qreal(1)) { + source.append(" * float("); + source.append(QByteArray::number(weights.at(i))); + source.append(");\n"); + } else { + source.append(";\n"); } } source.append(" return "); - if (!gaussianBlur) { - source.append("float("); - if (separateXY) - source.append(QByteArray::number(1 / weightSum)); - else - source.append(QByteArray::number(1 / weightSum)); - source.append(") * "); - } source.append("sample;\n"); source.append("}\n"); -- cgit v0.12 From d57e2f4d01534f44dde629b71398783777fdad4e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 24 Sep 2009 09:36:35 +0200 Subject: Stabilize Q3Table test If there is no focus widget while doing keyClick, the test crashes --- tests/auto/q3table/tst_q3table.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/auto/q3table/tst_q3table.cpp b/tests/auto/q3table/tst_q3table.cpp index f911dd4..770bf4d 100644 --- a/tests/auto/q3table/tst_q3table.cpp +++ b/tests/auto/q3table/tst_q3table.cpp @@ -523,6 +523,7 @@ void tst_Q3Table::simpleKeyboardNavigation() // After the first keyevent, the table starts editing the item w = testWidget->cellWidget(0, 0); + QVERIFY(w); #ifdef WAITS QTest::qWait(50); @@ -1205,12 +1206,17 @@ void tst_Q3Table::editCheck() EditCheckQ3Table table(10, 10, 0); table.show(); + QApplication::setActiveWindow(&table); QTest::qWaitForWindowShown(&table); + QTRY_COMPARE(QApplication::activeWindow(), &table); table.setCurrentCell(0, 0); #ifdef WAITS QTest::qWait(50); #endif QTest::keyClick(table.viewport(), Qt::Key_T); +#ifdef WAITS + QTest::qWait(50); +#endif // After the first keyevent, the table starts editing the item QLineEdit *le = qFindChild(testWidget->viewport(), "qt_lineeditor"); #ifdef WAITS @@ -1337,6 +1343,9 @@ void tst_Q3Table::valueChanged() testWidget->setItem(0, 0, ti); connect(testWidget,SIGNAL(valueChanged(int,int)),this,SLOT(onValueChanged(int,int))); testWidget->show(); + QApplication::setActiveWindow(testWidget); + QTest::qWaitForWindowShown(testWidget); + QTRY_COMPARE(QApplication::activeWindow(), testWidget); #ifdef WAITS QTest::qWait(50); #endif @@ -1344,6 +1353,7 @@ void tst_Q3Table::valueChanged() #ifdef WAITS QTest::qWait(50); #endif + QTRY_VERIFY(qApp->focusWidget()); QTest::keyClick(qApp->focusWidget(), Qt::Key_Enter); #ifdef WAITS QTest::qWait(50); @@ -1383,7 +1393,9 @@ void tst_Q3Table::dateTimeEdit() TimeTableItem *ti = new TimeTableItem(testWidget); testWidget->setItem(0, 0, ti); testWidget->show(); + QApplication::setActiveWindow(testWidget); QTest::qWaitForWindowShown(testWidget); + QTRY_COMPARE(QApplication::activeWindow(), testWidget); #ifdef WAITS QTest::qWait(50); #endif @@ -1391,6 +1403,7 @@ void tst_Q3Table::dateTimeEdit() #ifdef WAITS QTest::qWait(50); #endif + QTRY_VERIFY(qApp->focusWidget()); QTest::keyClick(qApp->focusWidget(), Qt::Key_Enter); #ifdef WAITS QTest::qWait(50); -- cgit v0.12 From 06aa9b6704637864130e318e8700f1b0b4f8a5e3 Mon Sep 17 00:00:00 2001 From: mae Date: Thu, 24 Sep 2009 12:31:51 +0200 Subject: Fix QTextDocument::revision() The revision was bound to the current depth of the undo stack. This had the negative side effect, that equal revisions could point to different documents, and sometimes changes would not even increase the revision (in the case of undo command merging). Reviewed-by: Roberto Raggi --- src/gui/text/qtextdocument.cpp | 2 +- src/gui/text/qtextdocument_p.cpp | 33 +++++++++------------- src/gui/text/qtextdocument_p.h | 5 ++-- tests/auto/qtextdocument/tst_qtextdocument.cpp | 39 ++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 23 deletions(-) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 57d4b7a..5540958 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -985,7 +985,7 @@ bool QTextDocument::isRedoAvailable() const int QTextDocument::revision() const { Q_D(const QTextDocument); - return d->undoState; + return d->revision; } diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 7bfdf6c..2ad6512 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -195,6 +195,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() docChangeFrom = -1; undoState = 0; + revision = -1; // init() inserts a block, bringing it to 0 lout = 0; @@ -203,7 +204,6 @@ QTextDocumentPrivate::QTextDocumentPrivate() undoEnabled = true; inContentsChange = false; - inEdit = false; defaultTextOption.setTabStop(80); // same as in qtextengine.cpp defaultTextOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); @@ -429,11 +429,11 @@ int QTextDocumentPrivate::insertBlock(const QChar &blockSeparator, Q_ASSERT(undoState == undoStack.size()); // update revision numbers of the modified blocks. - B->revision = (atBlockEnd && !atBlockStart)? oldRevision : undoState; + B->revision = (atBlockEnd && !atBlockStart)? oldRevision : revision; b = blocks.next(b); if (b) { B = blocks.fragment(b); - B->revision = atBlockStart ? oldRevision : undoState; + B->revision = atBlockStart ? oldRevision : revision; } if (formats.charFormat(charFormat).objectIndex() == -1) @@ -456,7 +456,6 @@ void QTextDocumentPrivate::insert(int pos, int strPos, int strLength, int format Q_ASSERT(pos >= 0 && pos < fragments.length()); Q_ASSERT(formats.format(format).isCharFormat()); - beginEdit(); insert_string(pos, strPos, strLength, format, QTextUndoCommand::MoveCursor); if (undoEnabled) { int b = blocks.findNode(pos); @@ -466,7 +465,7 @@ void QTextDocumentPrivate::insert(int pos, int strPos, int strLength, int format QTextUndoCommand::MoveCursor, format, strPos, pos, strLength, B->revision); appendUndoItem(c); - B->revision = undoState; + B->revision = revision; Q_ASSERT(undoState == undoStack.size()); } finishEdit(); @@ -582,7 +581,6 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O if (pos == to) return; - beginEdit(); const bool needsInsert = to != -1; #if !defined(QT_NO_DEBUG) @@ -653,7 +651,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O } appendUndoItem(c); if (B) - B->revision = undoState; + B->revision = revision; x = n; if (needsInsert) @@ -1111,6 +1109,7 @@ void QTextDocumentPrivate::joinPreviousEditBlock() void QTextDocumentPrivate::endEditBlock() { + Q_ASSERT(editBlock > 0); if (--editBlock) return; @@ -1131,8 +1130,6 @@ void QTextDocumentPrivate::finishEdit() if (editBlock) return; - inEdit = false; - if (framesDirty) scan_frames(docChangeFrom, docChangeOldLength, docChangeLength); @@ -1195,19 +1192,19 @@ void QTextDocumentPrivate::documentChange(int from, int length) adjustDocumentChangesAndCursors is called whenever there is an insert or remove of characters. param from is the cursor position in the document param addedOrRemoved is the amount of characters added or removed. A negative number means characters are removed. + + The function stores information to be emitted when finishEdit() is called. */ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOrRemoved, QTextUndoCommand::Operation op) { - Q_Q(QTextDocument); + if (!editBlock) + ++revision; + for (int i = 0; i < cursors.size(); ++i) { QTextCursorPrivate *curs = cursors.at(i); if (curs->adjustPosition(from, addedOrRemoved, op) == QTextCursorPrivate::CursorMoved) { - if (editBlock || inEdit) { - if (!changedCursors.contains(curs)) - changedCursors.append(curs); - } else { - emit q->cursorPositionChanged(QTextCursor(curs)); - } + if (!changedCursors.contains(curs)) + changedCursors.append(curs); } } @@ -1223,7 +1220,6 @@ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOr } // qDebug("adjustDocumentChanges:"); // qDebug(" -> %d %d %d", docChangeFrom, docChangeOldLength, docChangeLength); - contentsChanged(); return; } @@ -1248,7 +1244,6 @@ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOr docChangeLength += added - removedInside + diff; // qDebug(" -> %d %d %d", docChangeFrom, docChangeOldLength, docChangeLength); - contentsChanged(); } @@ -1541,7 +1536,7 @@ void QTextDocumentPrivate::deleteObject(QTextObject *object) void QTextDocumentPrivate::contentsChanged() { Q_Q(QTextDocument); - if (editBlock || inEdit) + if (editBlock) return; bool m = undoEnabled ? (modifiedState != undoState) : true; diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index 36f3241..ce25c57 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -201,10 +201,9 @@ public: inline void undo() { undoRedo(true); } inline void redo() { undoRedo(false); } void appendUndoItem(QAbstractUndoItem *); - inline void beginEditBlock() { editBlock++; } + inline void beginEditBlock() { if (0 == editBlock++) ++revision; } void joinPreviousEditBlock(); void endEditBlock(); - inline void beginEdit() { inEdit = true; } void finishEdit(); inline bool isInEditBlock() const { return editBlock; } void enableUndoRedo(bool enable); @@ -306,6 +305,7 @@ private: QVector undoStack; bool undoEnabled; int undoState; + int revision; // position in undo stack of the last setModified(false) call int modifiedState; bool modified; @@ -340,7 +340,6 @@ public: int maximumBlockCount; uint needsEnsureMaximumBlockCount : 1; uint inContentsChange : 1; - uint inEdit : 1; // between beginEdit() and finishEdit() QSizeF pageSize; QString title; QString url; diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 323df58..c0d7ed3 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -168,6 +168,7 @@ private slots: void characterAt(); void revisions(); + void revisionWithUndoCompressionAndUndo(); void testUndoCommandAdded(); @@ -2499,6 +2500,44 @@ void tst_QTextDocument::revisions() QCOMPARE(cursor.block().revision(), 5); } +void tst_QTextDocument::revisionWithUndoCompressionAndUndo() +{ + QTextDocument doc; + QTextCursor cursor(&doc); + cursor.insertText("This is the beginning of it all."); + QCOMPARE(doc.firstBlock().revision(), 1); + QCOMPARE(doc.revision(), 1); + cursor.insertBlock(); + QCOMPARE(doc.revision(), 2); + cursor.insertText("this"); + QCOMPARE(doc.revision(), 3); + cursor.insertText("is"); + QCOMPARE(doc.revision(), 4); + cursor.insertText("compressed"); + QCOMPARE(doc.revision(), 5); + doc.undo(); + QCOMPARE(doc.revision(), 6); + QCOMPARE(doc.toPlainText(), QString("This is the beginning of it all.\n")) ; + cursor.setPosition(0); + QCOMPARE(doc.firstBlock().revision(), 1); + cursor.insertText("Very beginnig"); + QCOMPARE(doc.firstBlock().revision(), 7); + doc.undo(); + QCOMPARE(doc.revision(), 8); + QCOMPARE(doc.firstBlock().revision(), 1); + + cursor.beginEditBlock(); + cursor.insertText("Hello"); + cursor.insertBlock(); + cursor.insertText("world"); + cursor.endEditBlock(); + QCOMPARE(doc.revision(), 9); + doc.undo(); + QCOMPARE(doc.revision(), 10); + + +} + void tst_QTextDocument::testUndoCommandAdded() { QVERIFY(doc); -- cgit v0.12 From 6e2e8f79eb941e9ed302f0d12b2a09f2e9ca46cf Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 24 Sep 2009 11:29:10 +0100 Subject: Uninitialised variable fix for qfilesystemwatcher_symbian The errorCode member was uninitialised, this caused the watcher thread startup to fail. Reviewed-by: Miikka Heikkinen --- src/corelib/io/qfilesystemwatcher_symbian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp index be0e8a9..a07d084 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian.cpp +++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp @@ -106,7 +106,7 @@ void QNotifyChangeEvent::DoCancel() } QSymbianFileSystemWatcherEngine::QSymbianFileSystemWatcherEngine() : - watcherStarted(false) + errorCode(KErrNone), watcherStarted(false) { moveToThread(this); } -- cgit v0.12 From 8f6b71b2ea4453d6d1f2c070145970630df9ee27 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 24 Sep 2009 13:03:51 +0200 Subject: Use '=' for comparison in shell script, not '==' Fixes the build with some ancient shells --- configure | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/configure b/configure index a9ad276..6a4b079 100755 --- a/configure +++ b/configure @@ -2919,7 +2919,7 @@ elif [ "$CFG_PRECOMPILE" = "yes" ] && [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; fi #auto-detect DWARF2 on the mac -if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" == "auto" ]; then +if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then CFG_MAC_DWARF2=no else @@ -2928,7 +2928,7 @@ if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" == "auto" ]; then fi # auto-detect support for -Xarch on the mac -if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" == "auto" ]; then +if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" = "auto" ]; then if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then CFG_MAC_XARCH=no else @@ -5739,7 +5739,7 @@ if [ "$CFG_OPENVG" != "no" ]; then CFG_OPENVG=no fi fi - if [ "$CFG_OPENVG" == "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/shivavg" "ShivaVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then + if [ "$CFG_OPENVG" = "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/shivavg" "ShivaVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then CFG_OPENVG_SHIVA=yes fi fi @@ -5814,13 +5814,13 @@ fi # Carbon builds: 32 bit x86/ppc. # For "-cocoa" builds on snow leopard : compiler default (64-bit). # For "-cocoa" builds on leopard : compiler default (32-bit). -if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_ARCHS" == "" ]; then +if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_ARCHS" = "" ]; then source "$mactests/defaultarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" if [ "$CFG_MAC_COCOA" != "yes" ]; then - if [ "$QT_MAC_DEFAULT_ARCH" == "x86_64" ]; then + if [ "$QT_MAC_DEFAULT_ARCH" = "x86_64" ]; then CFG_MAC_ARCHS=" x86" - elif [ "$QT_MAC_DEFAULT_ARCH" == "ppc64" ]; then + elif [ "$QT_MAC_DEFAULT_ARCH" = "ppc64" ]; then CFG_MAC_ARCHS=" ppc" else CFG_MAC_ARCHS=" $QT_MAC_DEFAULT_ARCH" @@ -5829,7 +5829,7 @@ if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_ARCHS" == "" ]; then CFG_MAC_ARCHS=" $QT_MAC_DEFAULT_ARCH" fi - [ "$OPT_VERBOSE" == "yes" ] && echo "Setting Mac architechture to$CFG_MAC_ARCHS." + [ "$OPT_VERBOSE" = "yes" ] && echo "Setting Mac architechture to$CFG_MAC_ARCHS." fi # enable cocoa and/or carbon on Mac @@ -7197,7 +7197,7 @@ EOF *) ;; esac -if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" == "no" ] && [ "$CFG_WEBKIT" = "yes" ] && [ "$CFG_DEBUG_RELEASE" == "yes" ]; then +if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "no" ] && [ "$CFG_WEBKIT" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then cat < Date: Thu, 24 Sep 2009 13:07:38 +0200 Subject: Fixed a text drawing problem in the GL2 engine under X11. In certain situations text would toggle between sub-pixel hinted and normal antialiased, when e.g. drawing menus with -graphicssystem opengl. Reviewed-by: Samuel --- src/gui/text/qfontengine_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 788417a..3da1593 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1856,7 +1856,7 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g) QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, int margin, const QTransform &t) { - if (t.type() != QTransform::TxTranslate) + if (t.type() > QTransform::TxTranslate) return QFontEngine::alphaRGBMapForGlyph(g, margin, t); lockFace(); -- cgit v0.12 From bc101d83b313d9ebf7c54789077d6710d3e78cd9 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 24 Sep 2009 22:09:03 +1000 Subject: Fixed compile of tests. Test qaudiodeviceid was replaced with qaudiodeviceinfo. Reviewed-by: Paul --- tests/auto/auto.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 0638679..a2e1407 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -278,7 +278,7 @@ SUBDIRS += \ qsocks5socketengine \ qsortfilterproxymodel \ qsound \ - qaudiodeviceid \ + qaudiodeviceinfo \ qaudioformat \ qaudiooutput \ qaudioinput \ -- cgit v0.12 From 121349cb90d66625728fdcecc8e4f75f268b3a53 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 24 Sep 2009 14:31:17 +0200 Subject: Only account for a negative right bearing in QTextLayout We only want to expand the width of the text, never shrink it. This is so that we can account for text where the pixels of the text extend beyond the edge of the last glyph. When we shrinked the width, code that depended on the natural text width equalling the advance of the text (such as WebKit) broke, and some text items would be positioned wrongly. We now only take negative right bearings into account (right bearing is left-bound), meaning that we only expand the text width, never shrink it due to right bearing. Reviewed-by: Simon Hausmann --- src/gui/text/qtextlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 39a8bb8..c5f0e35 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1813,7 +1813,7 @@ void QTextLine::layout_helper(int maxGlyphs) glyph_t glyph = glyphs.glyphs[logClusters[pos - 1]]; glyph_metrics_t gi = fontEngine->boundingBox(glyph); if (gi.isValid()) - lbh.rightBearing = -qRound(gi.xoff - gi.x - gi.width); + lbh.rightBearing = qMax(QFixed(), -(gi.xoff - gi.x - gi.width)); } if ((sb_or_ws|breakany) && lbh.checkFullOtherwiseExtend(line)) { -- cgit v0.12 From cb89aab6b29fd5761f3b9d41354abcde11e103dc Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Thu, 24 Sep 2009 14:53:53 +0200 Subject: Update mkdist-webkit script to use latest tag Reviewed-by: Simon Hausmann --- util/webkit/mkdist-webkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 3afccba..09a99b9 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -5,7 +5,7 @@ die() { exit 1 } -default_tag="qtwebkit-4.6-snapshot-18092009" +default_tag="qtwebkit-4.6-snapshot-24092009" if [ $# -eq 0 ]; then tag="$default_tag" -- cgit v0.12 From 512d332d21860b1d08e86d6de96b80ce12d742bf Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Thu, 24 Sep 2009 14:56:11 +0200 Subject: Updated WebKit from /home/joce/dev/qtwebkit3/ to qtwebkit-4.6-snapshot-24092009 ( 75c44947a340d74a9e0098a3dfffabce0c9512ef ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-09-24 Martin Smith Reviewed by Simon Hausmann. qdoc: Added \brief texts to all the since 4.6 functions. * Api/qwebhistory.cpp: 2009-09-23 J-P Nurmi Reviewed by Simon Hausmann. Prevent QWebPage::setView() from changing the viewport size on the fly in case the view doesn't actually change. QWebPage::setView() is called upon every QWebGraphicsItem::hoverMoveEvent(), which forced the viewport size to be equal to the size of the whole graphics view. https://bugs.webkit.org/show_bug.cgi?id=29676 * Api/qwebpage.cpp: (QWebPage::setView): 2009-09-23 Jedrzej Nowacki Reviewed by Simon Hausmann. [Qt] Crash fix in QWebHistory back and forward methods. QWebHistory::back() and QWebHistory::forward() were crashing on ASSERT in WebCore::BackForwardList. The methods should check canGoBack() and canGoForward() at the beginning. https://bugs.webkit.org/show_bug.cgi?id=29675 * Api/qwebhistory.cpp: (QWebHistory::back): (QWebHistory::forward): 2009-09-23 Jedrzej Nowacki Reviewed by Simon Hausmann. [Qt] Bug fix. QWebHistory should call QWebPage::updateNavigationActions In QWebHistory's methods that change item count or current item call to QWebPage::updateNavigationActions should be executed. QWebHistory::clear() and QWebHistory::restorState() were changed. New helper method, QWebPagePrivate accesor, were created in QWebHistoryPrivate class. Two autotest were developed. https://bugs.webkit.org/show_bug.cgi?id=29246 * Api/qwebhistory.cpp: (QWebHistory::clear): (QWebHistory::restoreState): (QWebHistoryPrivate::page): * Api/qwebhistory_p.h: * tests/qwebhistory/tst_qwebhistory.cpp: (tst_QWebHistory::saveAndRestore_1): (tst_QWebHistory::clear): 2009-09-23 Norbert Leser Reviewed by Tor Arne Vestbø. Need to guard QX11Info include with Q_WS_X11. That class may not be available (in QT 4.5 for Symbian, for instance). Completes fixes in r48627 and r48604. * Api/qwebgraphicsitem.cpp: * Api/qwebview.cpp: 2009-09-22 Jocelyn Turcotte Reviewed by Simon Hausmann. [Qt] Add default timeout while waiting for signals in QWebPage auto tests. https://bugs.webkit.org/show_bug.cgi?id=29637 * tests/qwebpage/tst_qwebpage.cpp: (waitForSignal): 2009-09-22 Tor Arne Vestbø Reivewed by Simon Hausmann. Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class) There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget() takes a QWidget*, not a QWebPageClient* * Api/qwebgraphicsitem.cpp: (QWebGraphicsItemPrivate::screenNumber): * Api/qwebview.cpp: (QWebViewPrivate::screenNumber): 2009-09-21 Kenneth Rohde Christiansen Reviewed by Simon Hausmann. For Qt, platformPageClient() will now return a class derived from the QWebPageClient, so the patch adapts our Qt hooks to go though this class and not depend on the QWebView. * Api/qwebgraphicsitem.cpp: (QWebGraphicsItemPrivate::scroll): (QWebGraphicsItemPrivate::update): (QWebGraphicsItemPrivate::cursor): (QWebGraphicsItemPrivate::updateCursor): (QWebGraphicsItemPrivate::screenNumber): (QWebGraphicsItemPrivate::winId): (QWebGraphicsItem::event): (QWebGraphicsItem::setPage): * Api/qwebgraphicsitem.h: * Api/qwebpage.cpp: (QWebPagePrivate::QWebPagePrivate): * Api/qwebpage_p.h: * Api/qwebview.cpp: (QWebViewPrivate::scroll): (QWebViewPrivate::update): (QWebViewPrivate::cursor): (QWebViewPrivate::updateCursor): (QWebViewPrivate::screenNumber): (QWebViewPrivate::winId): (QWebView::setPage): (QWebView::event): * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::repaint): (WebCore::ChromeClientQt::scroll): (WebCore::ChromeClientQt::platformPageClient): 2009-09-21 Yael Aharon Reviewed by Simon Hausmann. https://bugs.webkit.org/show_bug.cgi?id=29609 Build fix for windows when using Qt 4.5.0. * Api/qwebpage.cpp: (QWebPage::userAgentForUrl): 2009-09-19 Benjamin Poulain Reviewed by Simon Hausmann. https://bugs.webkit.org/show_bug.cgi?id=29345 The tests of QWebFrame did not use QTRY_VERIFY for tests involving the event loop. * tests/qwebframe/tst_qwebframe.cpp: * tests/util.h: Added. Copy of tests/shared/util.h of Qt 2009-09-19 Jakub Wieczorek Reviewed by Simon Hausmann. [Qt] Add an autotest stub for QWebGraphicsItem. It just calls all the functions and makes sure they don't crash. * tests/qwebgraphicsitem/qwebgraphicsitem.pro: Added. * tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Added. (tst_QWebGraphicsItem::qwebgraphicsitem): * tests/tests.pro: 2009-09-18 Norbert Leser Reviewed by Eric Seidel. Corrected the Symbian specific UID3 values to be assigned from the "unprotected" pool that permits self-signing of those test and demo executables. (Added new UID3 values where they were missing for new components.) * QGVLauncher/QGVLauncher.pro: * QtLauncher/QtLauncher.pro: * tests/benchmarks/loading/tst_loading.pro: * tests/benchmarks/painting/tst_painting.pro: * tests/qwebelement/qwebelement.pro: * tests/qwebframe/qwebframe.pro: * tests/qwebhistory/qwebhistory.pro: * tests/qwebhistoryinterface/qwebhistoryinterface.pro: * tests/qwebpage/qwebpage.pro: * tests/qwebplugindatabase/qwebplugindatabase.pro: * tests/qwebview/qwebview.pro: 2009-09-17 Kenneth Rohde Christiansen Reviewed by Simon Hausmann. Make PlatformWindow return something else than PlatformWidget https://bugs.webkit.org/show_bug.cgi?id=29085 Reflect the rename of platformWindow and it's return type. * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::platformPageClient): * WebCoreSupport/ChromeClientQt.h: 2009-09-18 Jocelyn Turcotte Reviewed by Simon Hausmann. [Qt] Add persistence support for configuration options in the inspector. * Api/qwebinspector.cpp: * QtLauncher/main.cpp: (main): * WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientQt::populateSetting): (WebCore::InspectorClientQt::storeSetting): (WebCore::variantToSetting): (WebCore::settingToVariant): 2009-09-17 Kenneth Rohde Christiansen Reviewed by Simon Hausmann. Improve documentation for Page Cache. * Api/qwebsettings.cpp: 2009-09-17 Tor Arne Vestbø Reviewed by Simon Hausmann. [Qt] Update QWebSettings::setUserStyleSheetUrl() docs and test https://bugs.webkit.org/show_bug.cgi?id=29081 The documentation now specifies that the URL has to be a local file or a a data-URL (with utf-8 and base64-encoded data), as these are the only two schemes that the current code path accepts. The auto-test has been updated to reflect this limitation. At a later point we should concider adding API for the new way of doing both user defined stylesheets and scripts. * Api/qwebsettings.cpp: * tests/qwebpage/tst_qwebpage.cpp: --- src/3rdparty/webkit/ChangeLog | 81 + .../webkit/JavaScriptCore/API/JSStringRef.h | 2 +- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 529 ++++ .../webkit/JavaScriptCore/JavaScriptCore.pri | 3 +- .../webkit/JavaScriptCore/JavaScriptCore.pro | 69 + .../JavaScriptCore/assembler/ARMAssembler.cpp | 4 +- .../webkit/JavaScriptCore/assembler/ARMAssembler.h | 4 +- .../JavaScriptCore/assembler/ARMv7Assembler.h | 4 +- .../JavaScriptCore/assembler/MacroAssembler.h | 4 +- .../JavaScriptCore/assembler/MacroAssemblerARM.cpp | 4 +- .../JavaScriptCore/assembler/MacroAssemblerARM.h | 4 +- .../assembler/MacroAssemblerCodeRef.h | 6 +- .../webkit/JavaScriptCore/bytecode/EvalCodeCache.h | 2 +- .../JavaScriptCore/bytecode/SamplingTool.cpp | 30 +- .../webkit/JavaScriptCore/bytecode/SamplingTool.h | 22 +- .../bytecompiler/BytecodeGenerator.cpp | 8 +- .../bytecompiler/BytecodeGenerator.h | 9 +- .../webkit/JavaScriptCore/debugger/Debugger.cpp | 2 +- .../JavaScriptCore/debugger/DebuggerActivation.cpp | 8 +- .../JavaScriptCore/debugger/DebuggerActivation.h | 4 +- .../JavaScriptCore/debugger/DebuggerCallFrame.cpp | 2 +- .../JavaScriptCore/interpreter/Interpreter.cpp | 12 +- .../JavaScriptCore/interpreter/RegisterFile.cpp | 3 + .../JavaScriptCore/jit/ExecutableAllocator.h | 35 +- src/3rdparty/webkit/JavaScriptCore/jit/JIT.h | 10 +- .../webkit/JavaScriptCore/jit/JITInlineMethods.h | 22 +- .../webkit/JavaScriptCore/jit/JITOpcodes.cpp | 2 +- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 52 +- src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h | 6 +- .../webkit/JavaScriptCore/parser/Nodes.cpp | 8 - .../webkit/JavaScriptCore/parser/SourceCode.h | 3 +- .../runtime/BatchedTransitionOptimizer.h | 2 +- .../JavaScriptCore/runtime/CommonIdentifiers.h | 3 + .../webkit/JavaScriptCore/runtime/Completion.cpp | 4 +- .../webkit/JavaScriptCore/runtime/Executable.cpp | 2 +- .../webkit/JavaScriptCore/runtime/Executable.h | 58 +- .../webkit/JavaScriptCore/runtime/JSArray.cpp | 2 +- .../JavaScriptCore/runtime/JSGlobalObject.cpp | 8 +- .../webkit/JavaScriptCore/runtime/JSGlobalObject.h | 4 +- .../runtime/JSGlobalObjectFunctions.cpp | 2 +- .../webkit/JavaScriptCore/runtime/JSObject.cpp | 137 +- .../webkit/JavaScriptCore/runtime/JSObject.h | 5 +- .../JavaScriptCore/runtime/MarkStackPosix.cpp | 22 + .../JavaScriptCore/runtime/ObjectConstructor.cpp | 174 +- .../JavaScriptCore/runtime/PropertyDescriptor.cpp | 116 +- .../JavaScriptCore/runtime/PropertyDescriptor.h | 31 +- .../webkit/JavaScriptCore/runtime/Structure.cpp | 44 +- .../webkit/JavaScriptCore/runtime/Structure.h | 17 +- .../JavaScriptCore/runtime/StructureChain.cpp | 1 + .../webkit/JavaScriptCore/wtf/Assertions.h | 24 +- src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h | 5 +- .../webkit/JavaScriptCore/wtf/HashCountedSet.h | 24 +- .../webkit/JavaScriptCore/wtf/ListRefPtr.h | 20 +- src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 61 +- src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h | 2 +- src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h | 28 + .../webkit/JavaScriptCore/wtf/unicode/Unicode.h | 4 + .../webkit/JavaScriptCore/yarr/RegexJIT.cpp | 2 +- src/3rdparty/webkit/VERSION | 4 +- src/3rdparty/webkit/WebCore/ChangeLog | 2657 ++++++++++++++++++++ src/3rdparty/webkit/WebCore/DerivedSources.cpp | 1 - src/3rdparty/webkit/WebCore/WebCore.LP64.exp | 15 - src/3rdparty/webkit/WebCore/WebCore.gypi | 6 +- src/3rdparty/webkit/WebCore/WebCore.pro | 21 +- .../WebCore/accessibility/AccessibilityObject.h | 1 + .../accessibility/AccessibilityRenderObject.cpp | 40 +- .../accessibility/AccessibilityRenderObject.h | 2 + .../WebCore/bindings/js/JSAbstractWorkerCustom.cpp | 15 - .../bindings/js/JSCustomXPathNSResolver.cpp | 22 +- .../WebCore/bindings/js/JSCustomXPathNSResolver.h | 8 +- .../bindings/js/JSDOMApplicationCacheCustom.cpp | 22 - .../webkit/WebCore/bindings/js/JSDOMBinding.cpp | 13 +- .../webkit/WebCore/bindings/js/JSDOMBinding.h | 2 + .../WebCore/bindings/js/JSDOMWindowCustom.cpp | 46 +- .../WebCore/bindings/js/JSDOMWindowShell.cpp | 13 +- .../webkit/WebCore/bindings/js/JSDOMWindowShell.h | 5 +- .../bindings/js/JSDedicatedWorkerContextCustom.cpp | 7 - .../webkit/WebCore/bindings/js/JSEventListener.cpp | 19 +- .../webkit/WebCore/bindings/js/JSEventListener.h | 2 +- .../WebCore/bindings/js/JSEventSourceCustom.cpp | 17 - .../WebCore/bindings/js/JSGeolocationCustom.cpp | 22 +- .../WebCore/bindings/js/JSHTMLCollectionCustom.cpp | 11 +- .../bindings/js/JSHTMLFormElementCustom.cpp | 13 +- .../WebCore/bindings/js/JSLocationCustom.cpp | 26 +- .../WebCore/bindings/js/JSMessagePortCustom.cpp | 10 +- .../WebCore/bindings/js/JSNamedNodesCollection.cpp | 125 - .../WebCore/bindings/js/JSNamedNodesCollection.h | 67 - .../webkit/WebCore/bindings/js/JSNodeCustom.cpp | 6 +- .../bindings/js/JSQuarantinedObjectWrapper.cpp | 29 +- .../bindings/js/JSQuarantinedObjectWrapper.h | 1 + .../bindings/js/JSSharedWorkerConstructor.cpp | 7 +- .../bindings/js/JSSharedWorkerContextCustom.cpp | 50 - .../WebCore/bindings/js/JSWebSocketCustom.cpp | 8 - .../WebCore/bindings/js/JSWorkerContextCustom.cpp | 10 +- .../webkit/WebCore/bindings/js/JSWorkerCustom.cpp | 7 - .../WebCore/bindings/js/JSXMLHttpRequestCustom.cpp | 15 +- .../bindings/js/JSXMLHttpRequestUploadCustom.cpp | 14 +- .../WebCore/bindings/js/ScriptController.cpp | 7 +- .../WebCore/bindings/scripts/CodeGeneratorJS.pm | 48 +- .../WebCore/bindings/scripts/CodeGeneratorV8.pm | 7 +- .../webkit/WebCore/bridge/qt/qt_instance.cpp | 39 +- .../webkit/WebCore/bridge/qt/qt_instance.h | 2 +- src/3rdparty/webkit/WebCore/bridge/runtime.cpp | 30 +- src/3rdparty/webkit/WebCore/bridge/runtime.h | 12 +- .../webkit/WebCore/bridge/runtime_object.cpp | 65 +- .../webkit/WebCore/bridge/runtime_object.h | 12 +- .../WebCore/css/CSSComputedStyleDeclaration.cpp | 2 +- src/3rdparty/webkit/WebCore/css/CSSParser.cpp | 2 +- .../webkit/WebCore/css/CSSPrimitiveValueMappings.h | 5 +- .../webkit/WebCore/css/CSSStyleSelector.cpp | 15 +- src/3rdparty/webkit/WebCore/css/mathml.css | 170 ++ .../webkit/WebCore/css/mediaControlsChromium.css | 1 + src/3rdparty/webkit/WebCore/dom/ActiveDOMObject.h | 6 +- src/3rdparty/webkit/WebCore/dom/CharacterData.cpp | 6 +- src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp | 53 +- src/3rdparty/webkit/WebCore/dom/Document.cpp | 52 +- src/3rdparty/webkit/WebCore/dom/Document.h | 51 +- src/3rdparty/webkit/WebCore/dom/Element.h | 45 + src/3rdparty/webkit/WebCore/dom/EventListener.h | 9 +- src/3rdparty/webkit/WebCore/dom/EventNames.h | 3 + src/3rdparty/webkit/WebCore/dom/EventTarget.cpp | 181 +- src/3rdparty/webkit/WebCore/dom/EventTarget.h | 133 +- src/3rdparty/webkit/WebCore/dom/InputElement.cpp | 59 +- src/3rdparty/webkit/WebCore/dom/MessageEvent.h | 2 +- src/3rdparty/webkit/WebCore/dom/MessagePort.cpp | 75 +- src/3rdparty/webkit/WebCore/dom/MessagePort.h | 25 +- src/3rdparty/webkit/WebCore/dom/MessagePort.idl | 1 + src/3rdparty/webkit/WebCore/dom/MutationEvent.h | 7 +- src/3rdparty/webkit/WebCore/dom/Node.cpp | 601 +---- src/3rdparty/webkit/WebCore/dom/Node.h | 124 +- src/3rdparty/webkit/WebCore/dom/Node.idl | 1 + src/3rdparty/webkit/WebCore/dom/NodeRareData.h | 12 +- .../webkit/WebCore/dom/RegisteredEventListener.cpp | 8 - .../webkit/WebCore/dom/RegisteredEventListener.h | 44 +- .../webkit/WebCore/generated/HTMLNames.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/HTMLNames.h | 1 + .../webkit/WebCore/generated/JSAbstractWorker.cpp | 10 +- .../webkit/WebCore/generated/JSBarInfo.cpp | 2 +- .../webkit/WebCore/generated/JSCSSRule.cpp | 2 +- .../webkit/WebCore/generated/JSCSSRuleList.cpp | 2 +- .../WebCore/generated/JSCSSStyleDeclaration.cpp | 2 +- .../webkit/WebCore/generated/JSCSSValue.cpp | 2 +- .../generated/JSCSSVariablesDeclaration.cpp | 2 +- .../webkit/WebCore/generated/JSCanvasArray.cpp | 2 +- .../WebCore/generated/JSCanvasArrayBuffer.cpp | 2 +- .../webkit/WebCore/generated/JSCanvasGradient.cpp | 2 +- .../webkit/WebCore/generated/JSCanvasPattern.cpp | 2 +- .../WebCore/generated/JSCanvasRenderingContext.cpp | 2 +- .../webkit/WebCore/generated/JSClientRect.cpp | 2 +- .../webkit/WebCore/generated/JSClientRectList.cpp | 2 +- .../webkit/WebCore/generated/JSClipboard.cpp | 2 +- .../webkit/WebCore/generated/JSConsole.cpp | 2 +- .../webkit/WebCore/generated/JSCoordinates.cpp | 2 +- .../webkit/WebCore/generated/JSCounter.cpp | 2 +- .../WebCore/generated/JSDOMApplicationCache.cpp | 10 +- .../WebCore/generated/JSDOMCoreException.cpp | 2 +- .../WebCore/generated/JSDOMImplementation.cpp | 2 +- .../webkit/WebCore/generated/JSDOMParser.cpp | 2 +- .../webkit/WebCore/generated/JSDOMSelection.cpp | 2 +- .../webkit/WebCore/generated/JSDOMWindow.cpp | 25 +- .../webkit/WebCore/generated/JSDOMWindow.h | 8 +- .../webkit/WebCore/generated/JSDataGridColumn.cpp | 2 +- .../WebCore/generated/JSDataGridColumnList.cpp | 2 +- .../webkit/WebCore/generated/JSDatabase.cpp | 2 +- .../WebCore/generated/JSDedicatedWorkerContext.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSEvent.cpp | 2 +- .../webkit/WebCore/generated/JSEventException.cpp | 2 +- .../webkit/WebCore/generated/JSEventSource.cpp | 10 +- src/3rdparty/webkit/WebCore/generated/JSFile.cpp | 2 +- .../webkit/WebCore/generated/JSFileList.cpp | 2 +- .../webkit/WebCore/generated/JSGeolocation.cpp | 2 +- .../webkit/WebCore/generated/JSGeoposition.cpp | 2 +- .../webkit/WebCore/generated/JSHTMLCollection.cpp | 2 +- .../WebCore/generated/JSHTMLTextAreaElement.cpp | 17 +- .../WebCore/generated/JSHTMLTextAreaElement.h | 2 + .../webkit/WebCore/generated/JSHistory.cpp | 2 +- .../webkit/WebCore/generated/JSImageData.cpp | 2 +- .../WebCore/generated/JSInspectorBackend.cpp | 52 +- .../webkit/WebCore/generated/JSInspectorBackend.h | 3 + .../WebCore/generated/JSJavaScriptCallFrame.cpp | 2 +- .../webkit/WebCore/generated/JSLocation.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSLocation.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSMedia.cpp | 2 +- .../webkit/WebCore/generated/JSMediaError.cpp | 2 +- .../webkit/WebCore/generated/JSMediaList.cpp | 2 +- .../webkit/WebCore/generated/JSMessageChannel.cpp | 2 +- .../webkit/WebCore/generated/JSMessagePort.cpp | 4 +- .../webkit/WebCore/generated/JSMimeType.cpp | 2 +- .../webkit/WebCore/generated/JSMimeTypeArray.cpp | 2 +- .../webkit/WebCore/generated/JSNamedNodeMap.cpp | 2 +- .../webkit/WebCore/generated/JSNavigator.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSNode.cpp | 4 +- .../webkit/WebCore/generated/JSNodeFilter.cpp | 2 +- .../webkit/WebCore/generated/JSNodeIterator.cpp | 2 +- .../webkit/WebCore/generated/JSNodeList.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp | 2 +- .../webkit/WebCore/generated/JSPluginArray.cpp | 2 +- .../webkit/WebCore/generated/JSPositionError.cpp | 2 +- .../webkit/WebCore/generated/JSRGBColor.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSRange.cpp | 2 +- .../webkit/WebCore/generated/JSRangeException.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSRect.cpp | 2 +- .../webkit/WebCore/generated/JSSQLError.cpp | 2 +- .../webkit/WebCore/generated/JSSQLResultSet.cpp | 2 +- .../WebCore/generated/JSSQLResultSetRowList.cpp | 2 +- .../webkit/WebCore/generated/JSSQLTransaction.cpp | 2 +- .../webkit/WebCore/generated/JSSVGAngle.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedAngle.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedBoolean.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedEnumeration.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedInteger.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedLength.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedLengthList.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedNumber.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedNumberList.cpp | 2 +- .../generated/JSSVGAnimatedPreserveAspectRatio.cpp | 2 +- .../webkit/WebCore/generated/JSSVGAnimatedRect.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedString.cpp | 2 +- .../generated/JSSVGAnimatedTransformList.cpp | 2 +- .../WebCore/generated/JSSVGElementInstance.cpp | 2 +- .../WebCore/generated/JSSVGElementInstanceList.cpp | 2 +- .../webkit/WebCore/generated/JSSVGException.cpp | 2 +- .../webkit/WebCore/generated/JSSVGLength.cpp | 2 +- .../webkit/WebCore/generated/JSSVGLengthList.cpp | 2 +- .../webkit/WebCore/generated/JSSVGMatrix.cpp | 2 +- .../webkit/WebCore/generated/JSSVGNumber.cpp | 2 +- .../webkit/WebCore/generated/JSSVGNumberList.cpp | 2 +- .../webkit/WebCore/generated/JSSVGPathSeg.cpp | 2 +- .../webkit/WebCore/generated/JSSVGPathSegList.cpp | 2 +- .../webkit/WebCore/generated/JSSVGPoint.cpp | 2 +- .../webkit/WebCore/generated/JSSVGPointList.cpp | 2 +- .../WebCore/generated/JSSVGPreserveAspectRatio.cpp | 2 +- .../webkit/WebCore/generated/JSSVGRect.cpp | 2 +- .../WebCore/generated/JSSVGRenderingIntent.cpp | 2 +- .../webkit/WebCore/generated/JSSVGStringList.cpp | 2 +- .../webkit/WebCore/generated/JSSVGTransform.cpp | 2 +- .../WebCore/generated/JSSVGTransformList.cpp | 2 +- .../webkit/WebCore/generated/JSSVGUnitTypes.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSScreen.cpp | 2 +- .../WebCore/generated/JSSharedWorkerContext.h | 6 - .../webkit/WebCore/generated/JSStorage.cpp | 2 +- .../webkit/WebCore/generated/JSStyleSheet.cpp | 2 +- .../webkit/WebCore/generated/JSStyleSheetList.cpp | 2 +- .../webkit/WebCore/generated/JSTextMetrics.cpp | 2 +- .../webkit/WebCore/generated/JSTimeRanges.cpp | 2 +- .../webkit/WebCore/generated/JSTreeWalker.cpp | 2 +- .../webkit/WebCore/generated/JSValidityState.cpp | 2 +- .../webkit/WebCore/generated/JSVoidCallback.cpp | 2 +- .../webkit/WebCore/generated/JSWebKitCSSMatrix.cpp | 2 +- .../webkit/WebCore/generated/JSWebKitPoint.cpp | 2 +- .../webkit/WebCore/generated/JSWebSocket.cpp | 10 +- src/3rdparty/webkit/WebCore/generated/JSWorker.h | 4 +- .../webkit/WebCore/generated/JSWorkerContext.cpp | 7 + .../webkit/WebCore/generated/JSWorkerContext.h | 1 + .../webkit/WebCore/generated/JSWorkerLocation.cpp | 2 +- .../webkit/WebCore/generated/JSWorkerNavigator.cpp | 2 +- .../webkit/WebCore/generated/JSXMLHttpRequest.cpp | 4 +- .../generated/JSXMLHttpRequestException.cpp | 2 +- .../WebCore/generated/JSXMLHttpRequestUpload.cpp | 4 +- .../webkit/WebCore/generated/JSXMLSerializer.cpp | 2 +- .../webkit/WebCore/generated/JSXPathEvaluator.cpp | 2 +- .../webkit/WebCore/generated/JSXPathException.cpp | 2 +- .../webkit/WebCore/generated/JSXPathExpression.cpp | 2 +- .../webkit/WebCore/generated/JSXPathNSResolver.cpp | 2 +- .../webkit/WebCore/generated/JSXPathResult.cpp | 2 +- .../webkit/WebCore/generated/JSXSLTProcessor.cpp | 2 +- .../webkit/WebCore/generated/WebKitVersion.h | 2 +- .../webkit/WebCore/history/CachedFrame.cpp | 4 +- .../webkit/WebCore/html/HTMLAttributeNames.in | 1 + .../webkit/WebCore/html/HTMLBodyElement.cpp | 124 +- src/3rdparty/webkit/WebCore/html/HTMLBodyElement.h | 41 +- .../webkit/WebCore/html/HTMLBodyElement.idl | 4 + .../webkit/WebCore/html/HTMLFormControlElement.cpp | 5 +- .../webkit/WebCore/html/HTMLFormElement.cpp | 10 +- src/3rdparty/webkit/WebCore/html/HTMLFormElement.h | 2 +- .../webkit/WebCore/html/HTMLFrameSetElement.cpp | 124 +- .../webkit/WebCore/html/HTMLFrameSetElement.h | 46 +- .../webkit/WebCore/html/HTMLFrameSetElement.idl | 4 + .../webkit/WebCore/html/HTMLImageLoader.cpp | 3 +- .../webkit/WebCore/html/HTMLInputElement.cpp | 2 +- .../webkit/WebCore/html/HTMLMediaElement.cpp | 90 +- .../webkit/WebCore/html/HTMLMediaElement.h | 3 +- .../webkit/WebCore/html/HTMLScriptElement.cpp | 5 +- .../webkit/WebCore/html/HTMLSourceElement.cpp | 3 +- .../webkit/WebCore/html/HTMLTextAreaElement.cpp | 37 + .../webkit/WebCore/html/HTMLTextAreaElement.h | 5 + .../webkit/WebCore/html/HTMLTextAreaElement.idl | 1 + src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp | 5 +- .../html/canvas/CanvasRenderingContext2D.cpp | 10 +- .../webkit/WebCore/inspector/InspectorBackend.cpp | 22 +- .../webkit/WebCore/inspector/InspectorBackend.h | 3 + .../webkit/WebCore/inspector/InspectorBackend.idl | 3 + .../WebCore/inspector/InspectorController.cpp | 101 +- .../webkit/WebCore/inspector/InspectorController.h | 8 + .../webkit/WebCore/inspector/InspectorDOMAgent.cpp | 2 +- .../webkit/WebCore/inspector/InspectorDOMAgent.h | 2 +- .../inspector/InspectorDOMStorageResource.cpp | 57 +- .../inspector/InspectorDOMStorageResource.h | 18 +- .../webkit/WebCore/inspector/InspectorFrontend.cpp | 47 +- .../webkit/WebCore/inspector/InspectorFrontend.h | 6 +- .../webkit/WebCore/inspector/InspectorResource.cpp | 51 +- .../webkit/WebCore/inspector/InspectorResource.h | 8 + .../WebCore/inspector/front-end/ConsoleView.js | 45 +- .../WebCore/inspector/front-end/DOMStorage.js | 46 +- .../inspector/front-end/DOMStorageDataGrid.js | 42 +- .../inspector/front-end/DOMStorageItemsView.js | 85 +- .../inspector/front-end/ElementsTreeOutline.js | 11 - .../WebCore/inspector/front-end/ImageView.js | 1 + .../inspector/front-end/Images/errorRedDot.png | Bin 0 -> 549 bytes .../inspector/front-end/Images/successGreenDot.png | Bin 0 -> 585 bytes .../front-end/Images/warningOrangeDot.png | Bin 0 -> 580 bytes .../WebCore/inspector/front-end/InjectedScript.js | 88 +- .../inspector/front-end/InjectedScriptAccess.js | 1 + .../WebCore/inspector/front-end/ObjectProxy.js | 8 + .../webkit/WebCore/inspector/front-end/Resource.js | 63 + .../WebCore/inspector/front-end/ResourceView.js | 50 +- .../WebCore/inspector/front-end/ScriptsPanel.js | 8 + .../WebCore/inspector/front-end/StoragePanel.js | 110 +- .../WebCore/inspector/front-end/inspector.css | 31 +- .../WebCore/inspector/front-end/inspector.js | 99 +- .../WebCore/inspector/front-end/utilities.js | 6 + .../webkit/WebCore/loader/CachedResourceHandle.h | 15 +- src/3rdparty/webkit/WebCore/loader/EmptyClients.h | 2 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp | 193 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.h | 16 +- .../webkit/WebCore/loader/ImageDocument.cpp | 4 +- .../loader/appcache/ApplicationCacheGroup.cpp | 4 +- .../loader/appcache/ApplicationCacheHost.cpp | 9 +- .../WebCore/loader/appcache/ApplicationCacheHost.h | 2 +- .../loader/appcache/DOMApplicationCache.cpp | 94 +- .../WebCore/loader/appcache/DOMApplicationCache.h | 58 +- .../loader/appcache/DOMApplicationCache.idl | 2 +- .../webkit/WebCore/mathml/MathMLElement.cpp | 52 + src/3rdparty/webkit/WebCore/mathml/MathMLElement.h | 45 + .../mathml/MathMLInlineContainerElement.cpp | 54 + .../WebCore/mathml/MathMLInlineContainerElement.h | 43 + .../webkit/WebCore/mathml/MathMLMathElement.cpp | 46 + .../webkit/WebCore/mathml/MathMLMathElement.h | 41 + src/3rdparty/webkit/WebCore/mathml/mathtags.in | 21 + .../webkit/WebCore/notifications/Notification.cpp | 132 +- .../webkit/WebCore/notifications/Notification.h | 32 +- .../webkit/WebCore/notifications/Notification.idl | 3 +- src/3rdparty/webkit/WebCore/page/Chrome.cpp | 4 +- src/3rdparty/webkit/WebCore/page/Chrome.h | 2 +- src/3rdparty/webkit/WebCore/page/ChromeClient.h | 2 +- src/3rdparty/webkit/WebCore/page/DOMWindow.cpp | 966 +------ src/3rdparty/webkit/WebCore/page/DOMWindow.h | 240 +- src/3rdparty/webkit/WebCore/page/DOMWindow.idl | 12 +- .../webkit/WebCore/page/DragController.cpp | 30 +- src/3rdparty/webkit/WebCore/page/EventHandler.cpp | 39 +- src/3rdparty/webkit/WebCore/page/EventHandler.h | 4 +- src/3rdparty/webkit/WebCore/page/EventSource.cpp | 91 +- src/3rdparty/webkit/WebCore/page/EventSource.h | 30 +- src/3rdparty/webkit/WebCore/page/EventSource.idl | 2 +- .../webkit/WebCore/page/FocusController.cpp | 7 +- src/3rdparty/webkit/WebCore/page/Frame.cpp | 25 +- src/3rdparty/webkit/WebCore/page/Frame.h | 14 +- src/3rdparty/webkit/WebCore/page/FrameView.cpp | 19 +- src/3rdparty/webkit/WebCore/page/FrameView.h | 1 + src/3rdparty/webkit/WebCore/page/Page.cpp | 4 +- .../webkit/WebCore/page/PageGroupLoadDeferrer.cpp | 6 +- src/3rdparty/webkit/WebCore/page/PositionOptions.h | 12 +- .../webkit/WebCore/page/SecurityOrigin.cpp | 16 + src/3rdparty/webkit/WebCore/page/SecurityOrigin.h | 5 + src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp | 4 +- .../WebCore/page/animation/AnimationController.cpp | 6 +- src/3rdparty/webkit/WebCore/platform/HostWindow.h | 4 +- .../webkit/WebCore/platform/StaticConstructors.h | 4 +- src/3rdparty/webkit/WebCore/platform/Widget.h | 7 + .../webkit/WebCore/platform/graphics/FloatPoint.h | 5 +- .../webkit/WebCore/platform/graphics/FloatRect.h | 5 +- .../webkit/WebCore/platform/graphics/FloatSize.h | 5 +- .../WebCore/platform/graphics/FontDescription.h | 8 +- .../WebCore/platform/graphics/FontSmoothingMode.h | 35 + .../webkit/WebCore/platform/graphics/IntRect.h | 8 +- .../graphics/qt/MediaPlayerPrivatePhonon.cpp | 3 + .../platform/network/qt/DnsPrefetchHelper.cpp | 1 + .../platform/network/qt/SocketStreamError.h | 50 + .../platform/network/qt/SocketStreamHandle.h | 68 + .../platform/network/qt/SocketStreamHandleSoup.cpp | 88 + .../webkit/WebCore/platform/qt/CookieJarQt.cpp | 2 + .../WebCore/platform/qt/PlatformScreenQt.cpp | 36 +- .../webkit/WebCore/platform/qt/PopupMenuQt.cpp | 5 +- .../webkit/WebCore/platform/qt/QWebPageClient.h | 62 + .../webkit/WebCore/platform/qt/WidgetQt.cpp | 14 +- .../WebCore/platform/sql/SQLiteTransaction.cpp | 15 +- .../WebCore/platform/sql/SQLiteTransaction.h | 5 +- .../webkit/WebCore/platform/text/PlatformString.h | 8 + .../webkit/WebCore/platform/text/String.cpp | 26 + .../webkit/WebCore/plugins/mac/PluginViewMac.cpp | 24 +- .../webkit/WebCore/plugins/qt/PluginViewQt.cpp | 17 +- .../webkit/WebCore/plugins/win/PluginViewWin.cpp | 16 +- .../webkit/WebCore/rendering/FixedTableLayout.cpp | 23 + .../webkit/WebCore/rendering/RenderBlock.cpp | 2 +- .../webkit/WebCore/rendering/RenderBox.cpp | 13 +- src/3rdparty/webkit/WebCore/rendering/RenderBox.h | 2 +- .../webkit/WebCore/rendering/RenderForeignObject.h | 1 + .../webkit/WebCore/rendering/RenderLayer.cpp | 22 +- .../webkit/WebCore/rendering/RenderLayer.h | 1 + .../WebCore/rendering/RenderLayerBacking.cpp | 37 +- .../webkit/WebCore/rendering/RenderLayerBacking.h | 2 + .../WebCore/rendering/RenderLayerCompositor.cpp | 15 +- .../webkit/WebCore/rendering/RenderListBox.cpp | 3 +- .../webkit/WebCore/rendering/RenderObject.cpp | 5 + .../webkit/WebCore/rendering/RenderObject.h | 1 + .../webkit/WebCore/rendering/RenderTextControl.cpp | 2 +- .../rendering/RenderTextControlMultiLine.cpp | 4 +- .../WebCore/rendering/RenderThemeChromiumMac.h | 307 ++- .../WebCore/rendering/RenderThemeChromiumMac.mm | 1310 ++++------ .../WebCore/rendering/RenderThemeChromiumSkia.cpp | 7 +- .../WebCore/rendering/RenderThemeChromiumWin.cpp | 46 + .../WebCore/rendering/RenderThemeChromiumWin.h | 1 + .../webkit/WebCore/rendering/style/RenderStyle.h | 5 +- .../WebCore/rendering/style/RenderStyleConstants.h | 4 - .../webkit/WebCore/storage/SQLTransaction.cpp | 4 +- .../webkit/WebCore/storage/SQLTransaction.h | 1 + .../WebCore/storage/SQLTransactionCoordinator.cpp | 71 +- .../WebCore/storage/SQLTransactionCoordinator.h | 15 +- src/3rdparty/webkit/WebCore/svg/SVGElement.cpp | 19 +- .../webkit/WebCore/svg/SVGElementInstance.cpp | 443 +--- .../webkit/WebCore/svg/SVGElementInstance.h | 131 +- src/3rdparty/webkit/WebCore/svg/SVGImageLoader.cpp | 3 +- .../webkit/WebCore/svg/SVGScriptElement.cpp | 3 +- src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp | 24 +- .../WebCore/svg/animation/SVGSMILElement.cpp | 4 +- .../webkit/WebCore/websockets/WebSocket.cpp | 103 +- src/3rdparty/webkit/WebCore/websockets/WebSocket.h | 26 +- .../webkit/WebCore/websockets/WebSocket.idl | 6 +- .../webkit/WebCore/workers/AbstractWorker.cpp | 94 +- .../webkit/WebCore/workers/AbstractWorker.h | 22 +- .../webkit/WebCore/workers/AbstractWorker.idl | 2 +- .../WebCore/workers/DedicatedWorkerContext.cpp | 17 - .../WebCore/workers/DedicatedWorkerContext.h | 5 +- .../WebCore/workers/DedicatedWorkerContext.idl | 1 - .../workers/DefaultSharedWorkerRepository.cpp | 29 +- .../webkit/WebCore/workers/SharedWorkerContext.cpp | 28 +- .../webkit/WebCore/workers/SharedWorkerContext.h | 9 +- .../webkit/WebCore/workers/SharedWorkerContext.idl | 1 - src/3rdparty/webkit/WebCore/workers/Worker.cpp | 17 +- src/3rdparty/webkit/WebCore/workers/Worker.h | 12 +- src/3rdparty/webkit/WebCore/workers/Worker.idl | 1 - .../webkit/WebCore/workers/WorkerContext.cpp | 61 +- .../webkit/WebCore/workers/WorkerContext.h | 21 +- .../webkit/WebCore/workers/WorkerContext.idl | 1 + .../WebCore/workers/WorkerMessagingProxy.cpp | 9 +- .../webkit/WebCore/workers/WorkerRunLoop.cpp | 2 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp | 161 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h | 55 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl | 1 + .../WebCore/xml/XMLHttpRequestProgressEvent.h | 2 +- .../webkit/WebCore/xml/XMLHttpRequestUpload.cpp | 94 +- .../webkit/WebCore/xml/XMLHttpRequestUpload.h | 48 +- .../webkit/WebCore/xml/XMLHttpRequestUpload.idl | 3 +- src/3rdparty/webkit/WebCore/xml/XPathValue.cpp | 5 + src/3rdparty/webkit/WebCore/xml/XPathValue.h | 13 +- src/3rdparty/webkit/WebKit/ChangeLog | 23 + .../WebKit/mac/Configurations/Version.xcconfig | 2 +- .../webkit/WebKit/qt/Api/qwebgraphicsitem.cpp | 77 +- .../webkit/WebKit/qt/Api/qwebgraphicsitem.h | 2 - src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp | 26 +- src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h | 5 + .../webkit/WebKit/qt/Api/qwebinspector.cpp | 25 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 9 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h | 4 +- src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp | 15 +- src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 88 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 245 ++ .../webkit/WebKit/qt/QGVLauncher/QGVLauncher.pro | 2 +- .../WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 15 +- .../WebKit/qt/WebCoreSupport/ChromeClientQt.h | 2 +- .../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 96 +- .../qt/tests/benchmarks/loading/tst_loading.pro | 2 + .../qt/tests/benchmarks/painting/tst_painting.pro | 2 + .../WebKit/qt/tests/qwebelement/qwebelement.pro | 2 +- .../webkit/WebKit/qt/tests/qwebframe/qwebframe.pro | 2 +- .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 19 +- .../qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro | 6 + .../qwebgraphicsitem/tst_qwebgraphicsitem.cpp | 58 + .../WebKit/qt/tests/qwebhistory/qwebhistory.pro | 2 +- .../qt/tests/qwebhistory/tst_qwebhistory.cpp | 13 +- .../qwebhistoryinterface/qwebhistoryinterface.pro | 2 +- .../webkit/WebKit/qt/tests/qwebpage/qwebpage.pro | 2 +- .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 24 +- .../qwebplugindatabase/qwebplugindatabase.pro | 2 + .../webkit/WebKit/qt/tests/qwebview/qwebview.pro | 2 +- src/3rdparty/webkit/WebKit/qt/tests/tests.pro | 2 +- src/3rdparty/webkit/WebKit/qt/tests/util.h | 48 + 487 files changed, 9608 insertions(+), 6525 deletions(-) create mode 100644 src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro delete mode 100644 src/3rdparty/webkit/WebCore/WebCore.LP64.exp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodesCollection.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerContextCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/css/mathml.css create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/errorRedDot.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/successGreenDot.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/warningOrangeDot.png create mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLElement.cpp create mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLElement.h create mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.cpp create mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.h create mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.cpp create mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.h create mode 100644 src/3rdparty/webkit/WebCore/mathml/mathtags.in create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/FontSmoothingMode.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamError.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandle.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/util.h diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 4a08347..9065b3a 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,84 @@ +2009-09-23 Xan Lopez + + Reviewed by Gustavo Noronha. + + Do not add unneeded include paths for gir files, and add the + include paths for headers manually instead of relying on our own + pc file and installed headers, since that adds a circular + dependency. + + * GNUmakefile.am: + +2009-09-23 Jan Michael Alonzo + + Reviewed by Xan Lopez. + + Minor reorganization to the patch landed in + http://trac.webkit.org/changeset/48670. Also move JSCore-1.0.gir + in the gtk directory as that's only useful to the Gtk port at the + moment. + + * GNUmakefile.am: + * configure.ac: + +2009-09-23 Xan Lopez + + Reviewed by Gustavo Noronha. + + [GTK] We should generate our own gir file for introspection + https://bugs.webkit.org/show_bug.cgi?id=29603 + + Generate gir and typelib files for WebKit and JSCore. The JSCore + gir file is handwritten (since it's only useful, for now, as a + dependency of the WebKit gir file), the WebKit one is + autogenerated from the headers. + + * GNUmakefile.am: + * JSCore-1.0.gir: Added. + * configure.ac: + +2009-09-22 Philippe Normand + + Reviewed by Xan Lopez. + + link errors due to wrong UNICODE_LIBS on Ubuntu Jaunty + https://bugs.webkit.org/show_bug.cgi?id=29638 + + Call icu-cconfig with ldflags-libsonly to prevent having a -L + statement that could override libs installed in another prefix. + + * autotools/webkit.m4: + +2009-09-21 Xan Lopez + + Reviewed by Gustavo Noronha. + + Bump version for 1.1.15 release. + + * configure.ac: + +2009-09-18 Xan Lopez + + Reviewed by Gustavo Noronha and Jan Alonzo. + + [GTK] context menu overriding API is very limited + https://bugs.webkit.org/show_bug.cgi?id=27546 + + Add new tests to the build. + + * GNUmakefile.am: + +2009-09-18 Xan Lopez + + Reviewed by Gustavo Noronha and Jan Alonzo. + + [GTK] context menu overriding API is very limited + https://bugs.webkit.org/show_bug.cgi?id=27546 + + Add WebKitHitTestResult to the build. + + * GNUmakefile.am: + 2009-09-10 Laszlo Gombos Reviewed by Ariya Hidayat. diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h index 8b17ee2..c58b958 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h @@ -37,7 +37,7 @@ extern "C" { #endif -#if !defined(WIN32) && !defined(_WIN32) +#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) /*! @typedef JSChar @abstract A Unicode character. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 8aa8c1d..4899919 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,532 @@ +2009-09-23 Geoffrey Garen + + A piece of my last patch that I forgot. + + * wtf/HashCountedSet.h: + (WTF::::clear): Added HashCountedSet::clear. + +2009-09-24 Gabor Loki + + Reviewed by Gavin Barraclough. + + Avoid __clear_cache built-in function if DISABLE_BUILTIN_CLEAR_CACHE define is set + https://bugs.webkit.org/show_bug.cgi?id=28886 + + There are some GCC packages (for example GCC-2006q3 from CodeSourcery) + which contain __clear_cache built-in function only for C while the C++ + version of __clear_cache is missing on ARM architectures. + + Fixed a small bug in the inline assembly of cacheFlush function on + ARM_TRADITIONAL. + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + +2009-09-23 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added the ability to swap vectors with inline capacities, so you can + store a vector with inline capacity in a hash table. + + * wtf/Vector.h: + (WTF::swap): + (WTF::VectorBuffer::swap): + +2009-09-23 David Kilzer + + Move definition of USE(PLUGIN_HOST_PROCESS) from WebKitPrefix.h to Platform.h + + Reviewed by Mark Rowe. + + * wtf/Platform.h: Define WTF_USE_PLUGIN_HOST_PROCESS to 1 when + building on 64-bit SnowLeopard. Define to 0 elsewhere. + +2009-09-22 Oliver Hunt + + Reviewed by Geoff Garen. + + Code sampling builds are broken. + https://bugs.webkit.org/show_bug.cgi?id=29662 + + Fix build. + + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::get): + * bytecode/SamplingTool.cpp: + (JSC::ScriptSampleRecord::sample): + (JSC::SamplingTool::doRun): + (JSC::SamplingTool::notifyOfScope): + (JSC::compareScriptSampleRecords): + (JSC::SamplingTool::dump): + * bytecode/SamplingTool.h: + (JSC::ScriptSampleRecord::ScriptSampleRecord): + (JSC::ScriptSampleRecord::~ScriptSampleRecord): + (JSC::SamplingTool::SamplingTool): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + (JSC::BytecodeGenerator::emitNewFunction): + (JSC::BytecodeGenerator::emitNewFunctionExpression): + * bytecompiler/BytecodeGenerator.h: + (JSC::BytecodeGenerator::makeFunction): + * debugger/Debugger.cpp: + (JSC::evaluateInGlobalCallFrame): + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::evaluate): + * parser/Nodes.cpp: + (JSC::ScopeNode::ScopeNode): + * runtime/Completion.cpp: + (JSC::checkSyntax): + (JSC::evaluate): + * runtime/Executable.cpp: + (JSC::FunctionExecutable::fromGlobalCode): + * runtime/Executable.h: + (JSC::ScriptExecutable::ScriptExecutable): + (JSC::EvalExecutable::EvalExecutable): + (JSC::EvalExecutable::create): + (JSC::ProgramExecutable::ProgramExecutable): + (JSC::FunctionExecutable::create): + (JSC::FunctionExecutable::FunctionExecutable): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::globalFuncEval): + +2009-09-22 Darin Adler + + Reviewed by Sam Weinig. + + * wtf/Forward.h: Added PassOwnPtr. + +2009-09-22 Yaar Schnitman + + Reviewed by David Levin. + + Ported chromium.org's javascriptcore.gyp for the webkit chromium port. + + https://bugs.webkit.org/show_bug.cgi?id=29617 + + * JavaScriptCore.gyp/JavaScriptCore.gyp: Added. + +2009-09-22 Thiago Macieira + + Reviewed by Simon Hausmann. + + Fix compilation with WINSCW: no varargs macros + + Disable variadic arguments for WINSCW just like we do + for MSVC7. + + * wtf/Assertions.h: + +2009-09-22 Kent Hansen + + Reviewed by Simon Hausmann. + + Disable variadic macros on MSVC7. + + This was originally added in r26589 but not extended + when LOG_DISABLED/ASSERT_DISABLED was introduced. + + * wtf/Assertions.h: + +2009-09-22 Simon Hausmann + + Unreviewed build fix for Windows CE < 5 + + Define WINCEBASIC to disable the IsDebuggerPresent() code in + wtf/Assertions.cpp. + + * JavaScriptCore.pri: + +2009-09-22 Joerg Bornemann + + Reviewed by Simon Hausmann. + + Fix major memory leak in JavaScriptCore RegisterFile on Windows CE + + https://bugs.webkit.org/show_bug.cgi?id=29367 + + On Widows CE we must decommit all committed pages before we release + them. See VirtualFree documentation. + Desktop Windows behaves much smoother in this situation. + + * interpreter/RegisterFile.cpp: + (JSC::RegisterFile::~RegisterFile): + +2009-09-21 Greg Bolsinga + + Reviewed by Simon Fraser & Sam Weinig. + + Add ENABLE(ORIENTATION_EVENTS) + https://bugs.webkit.org/show_bug.cgi?id=29508 + + * wtf/Platform.h: Also sort PLATFORM(IPHONE) #defines. + +2009-09-21 Jedrzej Nowacki + + Reviewed by Eric Seidel. + + [Fix] SourceCode's uninitialized member + + Potential source of crashes and bugs was fixed. Default constructor + didn't initialized m_provider member. + + https://bugs.webkit.org/show_bug.cgi?id=29364 + + * parser/SourceCode.h: + (JSC::SourceCode::SourceCode): + +2009-09-21 Oliver Hunt + + Reviewed by Geoff Garen. + + REGRESSION (r48582): Crash in StructureStubInfo::initPutByIdTransition when reloading trac.webkit.org + https://bugs.webkit.org/show_bug.cgi?id=29599 + + It is unsafe to attempt to cache new property transitions on + dictionaries of any type. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::tryCachePutByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + +2009-09-21 Oliver Hunt + + RS=Maciej Stachowiak. + + Re-land SNES fix with corrected assertion. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::resolveGlobal): + (JSC::Interpreter::tryCachePutByID): + (JSC::Interpreter::tryCacheGetByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/BatchedTransitionOptimizer.h: + (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): + * runtime/JSObject.cpp: + (JSC::JSObject::removeDirect): + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::getEnumerablePropertyNames): + (JSC::Structure::despecifyDictionaryFunction): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::toCacheableDictionaryTransition): + (JSC::Structure::toUncacheableDictionaryTransition): + (JSC::Structure::fromDictionaryTransition): + (JSC::Structure::removePropertyWithoutTransition): + * runtime/Structure.h: + (JSC::Structure::isDictionary): + (JSC::Structure::isUncacheableDictionary): + (JSC::Structure::): + * runtime/StructureChain.cpp: + (JSC::StructureChain::isCacheable): + +2009-09-21 Adam Roben + + Revert r48573, as it caused many assertion failures + + * interpreter/Interpreter.cpp: + * jit/JITStubs.cpp: + * runtime/BatchedTransitionOptimizer.h: + * runtime/JSObject.cpp: + * runtime/Structure.cpp: + * runtime/Structure.h: + * runtime/StructureChain.cpp: + +2009-09-21 Gustavo Noronha Silva + + Unreviewed make dist build fix. Missing files. + + * GNUmakefile.am: + +2009-09-19 Gavin Barraclough + + Reviewed by Sam 'Cabin Boy' Weinig. + + Fix stack alignment with ARM THUMB2 JIT. + https://bugs.webkit.org/show_bug.cgi?id=29526 + + Stack is currently being decremented by 0x3c, bump this to 0x40 to make this a + multiple of 16 bytes. + + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + * jit/JITStubs.h: + +2009-09-20 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + SNES is too slow + https://bugs.webkit.org/show_bug.cgi?id=29534 + + The problem was that the emulator used multiple classes with + more properties than our dictionary cutoff allowed, this resulted + in more or less all critical logic inside the emulator requiring + uncached property access. + + Rather than simply bumping the dictionary cutoff, this patch + recognises that there are two ways to create a "dictionary" + structure. Either by adding a large number of properties, or + by removing a property. In the case of adding properties we + know all the existing properties will maintain their existing + offsets, so we could cache access to those properties, if we + know they won't be removed. + + To make this possible, this patch adds the logic required to + distinguish a dictionary created by addition from one created + by removal. With this logic in place we can now cache access + to objects with large numbers of properties. + + SNES performance improved by more than 6x. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::resolveGlobal): + (JSC::Interpreter::tryCachePutByID): + (JSC::Interpreter::tryCacheGetByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/BatchedTransitionOptimizer.h: + (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): + * runtime/JSObject.cpp: + (JSC::JSObject::removeDirect): + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::getEnumerablePropertyNames): + (JSC::Structure::despecifyDictionaryFunction): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::toCacheableDictionaryTransition): + (JSC::Structure::toUncacheableDictionaryTransition): + (JSC::Structure::fromDictionaryTransition): + (JSC::Structure::removePropertyWithoutTransition): + * runtime/Structure.h: + (JSC::Structure::isDictionary): + (JSC::Structure::isUncacheableDictionary): + (JSC::Structure::): + * runtime/StructureChain.cpp: + (JSC::StructureChain::isCacheable): + +2009-09-19 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + Implement ES5 Object.create function + https://bugs.webkit.org/show_bug.cgi?id=29524 + + Implement Object.create. Very simple patch, effectively Object.defineProperties + only creating the target object itself. + + * runtime/CommonIdentifiers.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConstructorCreate): + +2009-09-19 Dan Bernstein + + Fix clean debug builds. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-19 Joerg Bornemann + + Reviewed by George Staikos. + + QtWebKit Windows CE compile fix + + https://bugs.webkit.org/show_bug.cgi?id=29379 + + There is no _aligned_alloc or _aligned_free on Windows CE. + We just use the Windows code that was there before and use VirtualAlloc. + But that also means that the BLOCK_SIZE must be 64K as this function + allocates on 64K boundaries. + + * runtime/Collector.cpp: + (JSC::Heap::allocateBlock): + (JSC::Heap::freeBlock): + * runtime/Collector.h: + +2009-09-19 Oliver Hunt + + Reviewed by Sam Weinig. + + Implement ES5 Object.defineProperties function + https://bugs.webkit.org/show_bug.cgi?id=29522 + + Implement Object.defineProperties. Fairly simple patch, simply makes use of + existing functionality used for defineProperty. + + * runtime/CommonIdentifiers.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::defineProperties): + (JSC::objectConstructorDefineProperties): + +2009-09-19 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Windows build fix part2 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-19 Oliver Hunt + + Reviewed by NOBODY (Buildfix). + + Windows build fix part 1. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-09-18 Oliver Hunt + + Reviewed by Geoff Garen. + + Implement ES5 Object.defineProperty function + https://bugs.webkit.org/show_bug.cgi?id=29503 + + Implement Object.defineProperty. This requires adding the API to + ObjectConstructor, along with a helper function that implements the + ES5 internal [[ToPropertyDescriptor]] function. It then adds + JSObject::defineOwnProperty that implements the appropriate ES5 semantics. + Currently defineOwnProperty uses a delete followed by a put to redefine + attributes of a property, clearly this is less efficient than it could be + but we can improve this if it needs to be possible in future. + + * JavaScriptCore.exp: + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::defineGetter): + (JSC::DebuggerActivation::defineSetter): + * debugger/DebuggerActivation.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + Update defineGetter/Setter calls + * runtime/CommonIdentifiers.h: + * runtime/JSArray.cpp: + (JSC::JSArray::getOwnPropertySlot): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::defineGetter): + (JSC::JSGlobalObject::defineSetter): + * runtime/JSGlobalObject.h: + * runtime/JSObject.cpp: + (JSC::JSObject::defineGetter): + (JSC::JSObject::defineSetter): + (JSC::putDescriptor): + (JSC::JSObject::defineOwnProperty): + * runtime/JSObject.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConstructorGetOwnPropertyDescriptor): + (JSC::toPropertyDescriptor): + (JSC::objectConstructorDefineProperty): + * runtime/ObjectPrototype.cpp: + (JSC::objectProtoFuncDefineGetter): + (JSC::objectProtoFuncDefineSetter): + * runtime/PropertyDescriptor.cpp: + (JSC::PropertyDescriptor::writable): + (JSC::PropertyDescriptor::enumerable): + (JSC::PropertyDescriptor::configurable): + (JSC::PropertyDescriptor::isDataDescriptor): + (JSC::PropertyDescriptor::isGenericDescriptor): + (JSC::PropertyDescriptor::isAccessorDescriptor): + (JSC::PropertyDescriptor::getter): + (JSC::PropertyDescriptor::setter): + (JSC::PropertyDescriptor::setDescriptor): + (JSC::PropertyDescriptor::setAccessorDescriptor): + (JSC::PropertyDescriptor::setWritable): + (JSC::PropertyDescriptor::setEnumerable): + (JSC::PropertyDescriptor::setConfigurable): + (JSC::PropertyDescriptor::setSetter): + (JSC::PropertyDescriptor::setGetter): + (JSC::PropertyDescriptor::equalTo): + (JSC::PropertyDescriptor::attributesEqual): + (JSC::PropertyDescriptor::attributesWithOverride): + * runtime/PropertyDescriptor.h: + (JSC::PropertyDescriptor::PropertyDescriptor): + (JSC::PropertyDescriptor::value): + (JSC::PropertyDescriptor::setValue): + (JSC::PropertyDescriptor::isEmpty): + (JSC::PropertyDescriptor::writablePresent): + (JSC::PropertyDescriptor::enumerablePresent): + (JSC::PropertyDescriptor::configurablePresent): + (JSC::PropertyDescriptor::setterPresent): + (JSC::PropertyDescriptor::getterPresent): + (JSC::PropertyDescriptor::operator==): + (JSC::PropertyDescriptor::): + +2009-09-18 Gabor Loki + + Reviewed by Gavin Barraclough. + + Build fix to enable ARM_THUMB2 on Linux + https://bugs.webkit.org/show_bug.cgi?id= + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + * jit/JITStubs.cpp: + * wtf/Platform.h: + +2009-09-18 Gabor Loki + + Reviewed by Gavin Barraclough. + + Defines two pseudo-platforms for ARM and Thumb-2 instruction set. + https://bugs.webkit.org/show_bug.cgi?id=29122 + + Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2 + macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used + when Thumb-2 instruction set is the required target. The + PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In + case where the code is common the PLATFORM(ARM) have to be used. + + * assembler/ARMAssembler.cpp: + * assembler/ARMAssembler.h: + * assembler/ARMv7Assembler.h: + * assembler/MacroAssembler.h: + * assembler/MacroAssemblerARM.cpp: + * assembler/MacroAssemblerARM.h: + * assembler/MacroAssemblerCodeRef.h: + (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): + * jit/ExecutableAllocator.h: + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::beginUninterruptedSequence): + (JSC::JIT::preserveReturnAddressAfterCall): + (JSC::JIT::restoreReturnAddressBeforeReturn): + (JSC::JIT::restoreArgumentReference): + (JSC::JIT::restoreArgumentReferenceForTrampoline): + * jit/JITOpcodes.cpp: + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + * jit/JITStubs.h: + * wtf/Platform.h: + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateEnter): + +2009-09-18 Joerg Bornemann + + Reviewed by Simon Hausmann. + + Fix the Qt/Windows CE build. + + * JavaScriptCore.pri: Build the ce_time.cpp functions from + within Qt externally. + * wtf/DateMath.cpp: Removed unnecessary Qt #ifdef, for the + Qt build these functions are no external, too. + 2009-09-17 Janne Koskinen Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index bd80add..7a815e3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -50,10 +50,9 @@ win32-* { } } -win32-msvc*: INCLUDEPATH += $$PWD/os-win32 wince* { - INCLUDEPATH += $$PWD/os-win32 SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.cpp + DEFINES += WINCEBASIC } include(pcre/pcre.pri) diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro new file mode 100644 index 0000000..0cd2e1a --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro @@ -0,0 +1,69 @@ +# JavaScriptCore - qmake build info +CONFIG += building-libs +include($$PWD/../WebKit.pri) + +TEMPLATE = lib +CONFIG += staticlib +TARGET = JavaScriptCore + +CONFIG += depend_includepath + +contains(QT_CONFIG, embedded):CONFIG += embedded + +CONFIG(QTDIR_build) { + GENERATED_SOURCES_DIR = $$PWD/generated + OLDDESTDIR = $$DESTDIR + include($$QT_SOURCE_TREE/src/qbase.pri) + INSTALLS = + DESTDIR = $$OLDDESTDIR + PRECOMPILED_HEADER = $$PWD/../WebKit/qt/WebKit_pch.h + DEFINES *= NDEBUG +} + +isEmpty(GENERATED_SOURCES_DIR):GENERATED_SOURCES_DIR = tmp +GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP} + +INCLUDEPATH += $$GENERATED_SOURCES_DIR + +!CONFIG(QTDIR_build) { + CONFIG(debug, debug|release) { + OBJECTS_DIR = obj/debug + } else { # Release + OBJECTS_DIR = obj/release + } +} + +CONFIG(release):!CONFIG(QTDIR_build) { + contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols + unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions +} + +linux-*: DEFINES += HAVE_STDINT_H +freebsd-*: DEFINES += HAVE_PTHREAD_NP_H + +DEFINES += BUILD_WEBKIT + +win32-*: DEFINES += _HAS_TR1=0 + +# Pick up 3rdparty libraries from INCLUDE/LIB just like with MSVC +win32-g++ { + TMPPATH = $$quote($$(INCLUDE)) + QMAKE_INCDIR_POST += $$split(TMPPATH,";") + TMPPATH = $$quote($$(LIB)) + QMAKE_LIBDIR_POST += $$split(TMPPATH,";") +} + +DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 + +DEFINES += WTF_CHANGES=1 + +include(JavaScriptCore.pri) + +QMAKE_EXTRA_TARGETS += generated_files + +lessThan(QT_MINOR_VERSION, 4) { + DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE="" +} + +*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2 +*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3 diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp index 77d7a53..1324586 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp @@ -26,7 +26,7 @@ #include "config.h" -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "ARMAssembler.h" @@ -390,4 +390,4 @@ void* ARMAssembler::executableCopy(ExecutablePool* allocator) } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h index 0b04bb4..9f9a450 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h @@ -29,7 +29,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "AssemblerBufferWithConstantPool.h" #include @@ -764,6 +764,6 @@ namespace JSC { } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #endif // ARMAssembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h index e920255..078de44 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) #include "AssemblerBuffer.h" #include @@ -1753,6 +1753,6 @@ private: } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM_ARM_ARCH(7) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) #endif // ARMAssembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h index 9e1c5d3..2743ab4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h @@ -30,11 +30,11 @@ #if ENABLE(ASSEMBLER) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) #include "MacroAssemblerARMv7.h" namespace JSC { typedef MacroAssemblerARMv7 MacroAssemblerBase; }; -#elif PLATFORM(ARM) +#elif PLATFORM(ARM_TRADITIONAL) #include "MacroAssemblerARM.h" namespace JSC { typedef MacroAssemblerARM MacroAssemblerBase; }; diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp index 33fac64..43648c4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp @@ -26,7 +26,7 @@ #include "config.h" -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "MacroAssemblerARM.h" @@ -64,4 +64,4 @@ const bool MacroAssemblerARM::s_isVFPPresent = isVFPPresent(); } -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h index 4a7c10a..0c696c9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -30,7 +30,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "ARMAssembler.h" #include "AbstractMacroAssembler.h" @@ -797,6 +797,6 @@ private: } -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #endif // MacroAssemblerARM_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h index 341a7ff..568260a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h @@ -37,7 +37,7 @@ // ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid // instruction address on the platform (for example, check any alignment requirements). -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // ARM/thumb instructions must be 16-bit aligned, but all code pointers to be loaded // into the processor are decorated with the bottom bit set, indicating that this is // thumb code (as oposed to 32-bit traditional ARM). The first test checks for both @@ -124,7 +124,7 @@ public: } explicit MacroAssemblerCodePtr(void* value) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // Decorate the pointer as a thumb code pointer. : m_value(reinterpret_cast(value) + 1) #else @@ -141,7 +141,7 @@ public: } void* executableAddress() const { return m_value; } -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // To use this pointer as a data address remove the decoration. void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return reinterpret_cast(m_value) - 1; } #else diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h index 0e1fb1e..05834fc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h @@ -50,7 +50,7 @@ namespace JSC { evalExecutable = m_cacheMap.get(evalSource.rep()); if (!evalExecutable) { - evalExecutable = EvalExecutable::create(makeSource(evalSource)); + evalExecutable = EvalExecutable::create(exec, makeSource(evalSource)); exceptionValue = evalExecutable->compile(exec, scopeChain); if (exceptionValue) return 0; diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp index 8d0faa1..865c919 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp @@ -157,7 +157,7 @@ void SamplingThread::stop() } -void ScopeSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC) +void ScriptSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC) { if (!m_samples) { m_size = codeBlock->instructions().size(); @@ -196,8 +196,8 @@ void SamplingTool::doRun() #if ENABLE(CODEBLOCK_SAMPLING) if (CodeBlock* codeBlock = sample.codeBlock()) { - MutexLocker locker(m_scopeSampleMapMutex); - ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable()); + MutexLocker locker(m_scriptSampleMapMutex); + ScriptSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable()); ASSERT(record); record->sample(codeBlock, sample.vPC()); } @@ -209,13 +209,13 @@ void SamplingTool::sample() s_samplingTool->doRun(); } -void SamplingTool::notifyOfScope(ScopeNode* scope) +void SamplingTool::notifyOfScope(ScriptExecutable* script) { #if ENABLE(CODEBLOCK_SAMPLING) - MutexLocker locker(m_scopeSampleMapMutex); - m_scopeSampleMap->set(scope, new ScopeSampleRecord(scope)); + MutexLocker locker(m_scriptSampleMapMutex); + m_scopeSampleMap->set(script, new ScriptSampleRecord(script)); #else - UNUSED_PARAM(scope); + UNUSED_PARAM(script); #endif } @@ -254,10 +254,10 @@ static int compareLineCountInfoSampling(const void* left, const void* right) return (leftLineCount->line > rightLineCount->line) ? 1 : (leftLineCount->line < rightLineCount->line) ? -1 : 0; } -static int compareScopeSampleRecords(const void* left, const void* right) +static int compareScriptSampleRecords(const void* left, const void* right) { - const ScopeSampleRecord* const leftValue = *static_cast(left); - const ScopeSampleRecord* const rightValue = *static_cast(right); + const ScriptSampleRecord* const leftValue = *static_cast(left); + const ScriptSampleRecord* const rightValue = *static_cast(right); return (leftValue->m_sampleCount < rightValue->m_sampleCount) ? 1 : (leftValue->m_sampleCount > rightValue->m_sampleCount) ? -1 : 0; } @@ -318,26 +318,26 @@ void SamplingTool::dump(ExecState* exec) // (3) Build and sort 'codeBlockSamples' array. int scopeCount = m_scopeSampleMap->size(); - Vector codeBlockSamples(scopeCount); - ScopeSampleRecordMap::iterator iter = m_scopeSampleMap->begin(); + Vector codeBlockSamples(scopeCount); + ScriptSampleRecordMap::iterator iter = m_scopeSampleMap->begin(); for (int i = 0; i < scopeCount; ++i, ++iter) codeBlockSamples[i] = iter->second; - qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScopeSampleRecord*), compareScopeSampleRecords); + qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScriptSampleRecord*), compareScriptSampleRecords); // (4) Print data from 'codeBlockSamples' array. printf("\nCodeBlock samples\n\n"); for (int i = 0; i < scopeCount; ++i) { - ScopeSampleRecord* record = codeBlockSamples[i]; + ScriptSampleRecord* record = codeBlockSamples[i]; CodeBlock* codeBlock = record->m_codeBlock; double blockPercent = (record->m_sampleCount * 100.0) / m_sampleCount; if (blockPercent >= 1) { //Instruction* code = codeBlock->instructions().begin(); - printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_scope->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent); + printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_executable->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent); if (i < 10) { HashMap lineCounts; codeBlock->dump(exec); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h index 1a3f7cf..711b086 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h @@ -38,6 +38,8 @@ namespace JSC { + class ScriptExecutable; + class SamplingFlags { friend class JIT; public: @@ -92,9 +94,9 @@ namespace JSC { class ScopeNode; struct Instruction; - struct ScopeSampleRecord { - ScopeSampleRecord(ScopeNode* scope) - : m_scope(scope) + struct ScriptSampleRecord { + ScriptSampleRecord(ScriptExecutable* executable) + : m_executable(executable) , m_codeBlock(0) , m_sampleCount(0) , m_opcodeSampleCount(0) @@ -103,7 +105,7 @@ namespace JSC { { } - ~ScopeSampleRecord() + ~ScriptSampleRecord() { if (m_samples) free(m_samples); @@ -111,7 +113,7 @@ namespace JSC { void sample(CodeBlock*, Instruction*); - RefPtr m_scope; + ScriptExecutable* m_executable; CodeBlock* m_codeBlock; int m_sampleCount; int m_opcodeSampleCount; @@ -119,7 +121,7 @@ namespace JSC { unsigned m_size; }; - typedef WTF::HashMap ScopeSampleRecordMap; + typedef WTF::HashMap ScriptSampleRecordMap; class SamplingThread { public: @@ -193,7 +195,7 @@ namespace JSC { , m_sampleCount(0) , m_opcodeSampleCount(0) #if ENABLE(CODEBLOCK_SAMPLING) - , m_scopeSampleMap(new ScopeSampleRecordMap()) + , m_scopeSampleMap(new ScriptSampleRecordMap()) #endif { memset(m_opcodeSamples, 0, sizeof(m_opcodeSamples)); @@ -210,7 +212,7 @@ namespace JSC { void setup(); void dump(ExecState*); - void notifyOfScope(ScopeNode* scope); + void notifyOfScope(ScriptExecutable* scope); void sample(CodeBlock* codeBlock, Instruction* vPC) { @@ -266,8 +268,8 @@ namespace JSC { unsigned m_opcodeSamplesInCTIFunctions[numOpcodeIDs]; #if ENABLE(CODEBLOCK_SAMPLING) - Mutex m_scopeSampleMapMutex; - OwnPtr m_scopeSampleMap; + Mutex m_scriptSampleMapMutex; + OwnPtr m_scopeSampleMap; #endif }; diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index af8f784..8951ce3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -273,7 +273,7 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d } else { for (size_t i = 0; i < functionStack.size(); ++i) { FunctionBodyNode* function = functionStack[i]; - globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, makeFunction(function), scopeChain.node()), DontDelete); + globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, makeFunction(exec, function), scopeChain.node()), DontDelete); } for (size_t i = 0; i < varStack.size(); ++i) { if (globalObject->hasProperty(exec, *varStack[i].first)) @@ -399,7 +399,7 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack(); for (size_t i = 0; i < functionStack.size(); ++i) - m_codeBlock->addFunctionDecl(makeFunction(functionStack[i])); + m_codeBlock->addFunctionDecl(makeFunction(m_globalData, functionStack[i])); const DeclarationStacks::VarStack& varStack = evalNode->varStack(); unsigned numVariables = varStack.size(); @@ -1316,7 +1316,7 @@ RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elemen RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function) { - unsigned index = m_codeBlock->addFunctionDecl(makeFunction(function)); + unsigned index = m_codeBlock->addFunctionDecl(makeFunction(m_globalData, function)); emitOpcode(op_new_func); instructions().append(dst->index()); @@ -1336,7 +1336,7 @@ RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp) RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n) { FunctionBodyNode* function = n->body(); - unsigned index = m_codeBlock->addFunctionExpr(makeFunction(function)); + unsigned index = m_codeBlock->addFunctionExpr(makeFunction(m_globalData, function)); emitOpcode(op_new_func_exp); instructions().append(r0->index()); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 650b362..1a83ce9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -417,9 +417,14 @@ namespace JSC { RegisterID* addConstantValue(JSValue); unsigned addRegExp(RegExp*); - PassRefPtr makeFunction(FunctionBodyNode* body) + PassRefPtr makeFunction(ExecState* exec, FunctionBodyNode* body) { - return FunctionExecutable::create(body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); + return FunctionExecutable::create(exec, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); + } + + PassRefPtr makeFunction(JSGlobalData* globalData, FunctionBodyNode* body) + { + return FunctionExecutable::create(globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); } Vector& instructions() { return m_codeBlock->instructions(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp index 61167d4..db02329 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp @@ -100,7 +100,7 @@ JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSG { CallFrame* globalCallFrame = globalObject->globalExec(); - EvalExecutable eval(makeSource(script)); + EvalExecutable eval(globalCallFrame, makeSource(script)); JSObject* error = eval.compile(globalCallFrame, globalCallFrame->scopeChain()); if (error) return error; diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp index 7a68d7d..5cc9a9f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp @@ -81,14 +81,14 @@ bool DebuggerActivation::getPropertyAttributes(JSC::ExecState* exec, const Ident return m_activation->getPropertyAttributes(exec, propertyName, attributes); } -void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) +void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) { - m_activation->defineGetter(exec, propertyName, getterFunction); + m_activation->defineGetter(exec, propertyName, getterFunction, attributes); } -void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction) +void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) { - m_activation->defineSetter(exec, propertyName, setterFunction); + m_activation->defineSetter(exec, propertyName, setterFunction, attributes); } JSValue DebuggerActivation::lookupGetter(ExecState* exec, const Identifier& propertyName) diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h index 06aea5a..dd34265 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h @@ -44,8 +44,8 @@ namespace JSC { virtual bool deleteProperty(ExecState*, const Identifier& propertyName); virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const; - virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction); - virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction); + virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes); + virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes); virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName); virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName); diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp index 9c8ca2a..88b14e6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp @@ -79,7 +79,7 @@ JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) c if (!m_callFrame->codeBlock()) return JSValue(); - EvalExecutable eval(makeSource(script)); + EvalExecutable eval(m_callFrame, makeSource(script)); JSObject* error = eval.compile(m_callFrame, m_callFrame->scopeChain()); if (error) return error; diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 4560db0..8a8fb3c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -169,7 +169,7 @@ NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction* PropertySlot slot(globalObject); if (globalObject->getPropertySlot(callFrame, ident, slot)) { JSValue result = slot.getValue(callFrame, ident); - if (slot.isCacheable() && !globalObject->structure()->isDictionary() && slot.slotBase() == globalObject) { + if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) { if (vPC[4].u.structure) vPC[4].u.structure->deref(); globalObject->structure()->ref(); @@ -953,7 +953,7 @@ NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* JSCell* baseCell = asCell(baseValue); Structure* structure = baseCell->structure(); - if (structure->isDictionary()) { + if (structure->isUncacheableDictionary()) { vPC[0] = getOpcode(op_put_by_id_generic); return; } @@ -988,6 +988,10 @@ NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* // Structure transition, cache transition info if (slot.type() == PutPropertySlot::NewProperty) { + if (structure->isDictionary()) { + vPC[0] = getOpcode(op_put_by_id_generic); + return; + } vPC[0] = getOpcode(op_put_by_id_transition); vPC[4] = structure->previousID(); vPC[5] = structure; @@ -1040,7 +1044,7 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* Structure* structure = asCell(baseValue)->structure(); - if (structure->isDictionary()) { + if (structure->isUncacheableDictionary()) { vPC[0] = getOpcode(op_get_by_id_generic); return; } @@ -3731,7 +3735,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi JSObject* baseObj = asObject(callFrame->r(base).jsValue()); Identifier& ident = callFrame->codeBlock()->identifier(property); ASSERT(callFrame->r(function).jsValue().isObject()); - baseObj->defineSetter(callFrame, ident, asObject(callFrame->r(function).jsValue())); + baseObj->defineSetter(callFrame, ident, asObject(callFrame->r(function).jsValue()), 0); ++vPC; NEXT_INSTRUCTION(); diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp index 06ddefc..5424199 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp @@ -36,6 +36,9 @@ RegisterFile::~RegisterFile() #if HAVE(MMAP) munmap(m_buffer, ((m_max - m_start) + m_maxGlobals) * sizeof(Register)); #elif HAVE(VIRTUALALLOC) +#if PLATFORM(WINCE) + VirtualFree(m_buffer, DWORD(m_commitEnd) - DWORD(m_buffer), MEM_DECOMMIT); +#endif VirtualFree(m_buffer, 0, MEM_RELEASE); #else fastFree(m_buffer); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h index 51ada03..12e2a32 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h @@ -180,7 +180,7 @@ public: static void cacheFlush(void*, size_t) { } -#elif PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) +#elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) static void cacheFlush(void* code, size_t size) { sys_dcache_flush(code, size); @@ -191,24 +191,29 @@ public: { User::IMB_Range(code, static_cast(code) + size); } -#elif PLATFORM(ARM) +#elif PLATFORM(ARM) && COMPILER(GCC) && (GCC_VERSION >= 30406) && !defined(DISABLE_BUILTIN_CLEAR_CACHE) static void cacheFlush(void* code, size_t size) { - #if COMPILER(GCC) && (GCC_VERSION >= 30406) __clear_cache(reinterpret_cast(code), reinterpret_cast(code) + size); - #else - const int syscall = 0xf0002; - __asm __volatile ( - "mov r0, %0\n" - "mov r1, %1\n" - "mov r7, %2\n" - "mov r2, #0x0\n" - "swi 0x00000000\n" - : - : "r" (code), "r" (reinterpret_cast(code) + size), "r" (syscall) - : "r0", "r1", "r7"); - #endif // COMPILER(GCC) && (GCC_VERSION >= 30406) } +#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX) + static void cacheFlush(void* code, size_t size) + { + asm volatile ( + "push {r7}\n" + "mov r0, %0\n" + "mov r1, %1\n" + "mov r7, #0xf0000\n" + "add r7, r7, #0x2\n" + "mov r2, #0x0\n" + "svc 0x0\n" + "pop {r7}\n" + : + : "r" (code), "r" (reinterpret_cast(code) + size) + : "r0", "r1"); + } +#else + #error "The cacheFlush support is missing on this platform." #endif private: diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h index f7ac20e..5c58e9d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h @@ -226,7 +226,7 @@ namespace JSC { static const FPRegisterID fpRegT0 = X86Registers::xmm0; static const FPRegisterID fpRegT1 = X86Registers::xmm1; static const FPRegisterID fpRegT2 = X86Registers::xmm2; -#elif PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_THUMB2) static const RegisterID returnValueRegister = ARMRegisters::r0; static const RegisterID cachedResultRegister = ARMRegisters::r0; static const RegisterID firstArgumentRegister = ARMRegisters::r0; @@ -242,7 +242,7 @@ namespace JSC { static const FPRegisterID fpRegT0 = ARMRegisters::d0; static const FPRegisterID fpRegT1 = ARMRegisters::d1; static const FPRegisterID fpRegT2 = ARMRegisters::d2; -#elif PLATFORM(ARM) +#elif PLATFORM(ARM_TRADITIONAL) static const RegisterID returnValueRegister = ARMRegisters::r0; static const RegisterID cachedResultRegister = ARMRegisters::r0; static const RegisterID firstArgumentRegister = ARMRegisters::r0; @@ -571,7 +571,7 @@ namespace JSC { static const int patchOffsetMethodCheckProtoObj = 11; static const int patchOffsetMethodCheckProtoStruct = 18; static const int patchOffsetMethodCheckPutFunction = 29; -#elif PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_THUMB2) // These architecture specific value are used to enable patching - see comment on op_put_by_id. static const int patchOffsetPutByIdStructure = 10; static const int patchOffsetPutByIdExternalLoad = 20; @@ -594,7 +594,7 @@ namespace JSC { static const int patchOffsetMethodCheckProtoObj = 18; static const int patchOffsetMethodCheckProtoStruct = 28; static const int patchOffsetMethodCheckPutFunction = 46; -#elif PLATFORM(ARM) +#elif PLATFORM(ARM_TRADITIONAL) // These architecture specific value are used to enable patching - see comment on op_put_by_id. static const int patchOffsetPutByIdStructure = 4; static const int patchOffsetPutByIdExternalLoad = 16; @@ -620,7 +620,7 @@ namespace JSC { #endif #endif // USE(JSVALUE32_64) -#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_TRADITIONAL) // sequenceOpCall static const int sequenceOpCallInstructionSpace = 12; static const int sequenceOpCallConstantSpace = 2; diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h index 60c9658..e69e273 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h @@ -110,7 +110,7 @@ ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function) ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace) { -#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_TRADITIONAL) #ifndef NDEBUG // Ensure the label after the sequence can also fit insnSpace += sizeof(ARMWord); @@ -139,38 +139,38 @@ ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace) #endif -#if PLATFORM(X86) || PLATFORM(X86_64) || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)) +#if PLATFORM(ARM_THUMB2) ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) { - pop(reg); + move(linkRegister, reg); } ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg) { - push(reg); + move(reg, linkRegister); } ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address) { - push(address); + loadPtr(address, linkRegister); } -#elif PLATFORM_ARM_ARCH(7) +#else // PLATFORM(X86) || PLATFORM(X86_64) || PLATFORM(ARM_TRADITIONAL) ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) { - move(linkRegister, reg); + pop(reg); } ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg) { - move(reg, linkRegister); + push(reg); } ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address) { - loadPtr(address, linkRegister); + push(address); } #endif @@ -186,7 +186,7 @@ ALWAYS_INLINE void JIT::restoreArgumentReference() { move(stackPointerRegister, firstArgumentRegister); poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*)); -#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_TRADITIONAL) move(ctiReturnRegister, ARMRegisters::lr); #endif } @@ -195,7 +195,7 @@ ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline() #if PLATFORM(X86) // Within a trampoline the return address will be on the stack at this point. addPtr(Imm32(sizeof(void*)), stackPointerRegister, firstArgumentRegister); -#elif PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_THUMB2) move(stackPointerRegister, firstArgumentRegister); #endif // In the trampoline on x86-64, the first argument register is not overwritten. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index 1c9cd7e..28d630b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -1681,7 +1681,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr* executable // so pull them off now addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister); -#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_TRADITIONAL) emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0); // Allocate stack space for our arglist diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 4ab58d5..055a536 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -69,6 +69,12 @@ namespace JSC { #define SYMBOL_STRING(name) #name #endif +#if PLATFORM(IPHONE) +#define THUMB_FUNC_PARAM(name) SYMBOL_STRING(name) +#else +#define THUMB_FUNC_PARAM(name) +#endif + #if USE(JSVALUE32_64) #if COMPILER(GCC) && PLATFORM(X86) @@ -193,7 +199,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "ret" "\n" ); -#elif COMPILER(GCC) && PLATFORM_ARM_ARCH(7) +#elif COMPILER(GCC) && PLATFORM(ARM_THUMB2) #if USE(JIT_STUB_ARGUMENT_VA_LIST) #error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7." @@ -204,7 +210,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiTrampoline) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "sub sp, sp, #0x3c" "\n" "str lr, [sp, #0x20]" "\n" @@ -230,7 +236,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "cpy r0, sp" "\n" "bl " SYMBOL_STRING(cti_vm_throw) "\n" @@ -247,7 +253,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "ldr r6, [sp, #0x2c]" "\n" "ldr r5, [sp, #0x28]" "\n" @@ -452,7 +458,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "ret" "\n" ); -#elif COMPILER(GCC) && PLATFORM_ARM_ARCH(7) +#elif COMPILER(GCC) && PLATFORM(ARM_THUMB2) #if USE(JIT_STUB_ARGUMENT_VA_LIST) #error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7." @@ -463,9 +469,9 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiTrampoline) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" - "sub sp, sp, #0x3c" "\n" + "sub sp, sp, #0x40" "\n" "str lr, [sp, #0x20]" "\n" "str r4, [sp, #0x24]" "\n" "str r5, [sp, #0x28]" "\n" @@ -480,7 +486,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" "ldr r5, [sp, #0x28]" "\n" "ldr r4, [sp, #0x24]" "\n" "ldr lr, [sp, #0x20]" "\n" - "add sp, sp, #0x3c" "\n" + "add sp, sp, #0x40" "\n" "bx lr" "\n" ); @@ -489,7 +495,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "cpy r0, sp" "\n" "bl " SYMBOL_STRING(cti_vm_throw) "\n" @@ -497,7 +503,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "ldr r5, [sp, #0x28]" "\n" "ldr r4, [sp, #0x24]" "\n" "ldr lr, [sp, #0x20]" "\n" - "add sp, sp, #0x3c" "\n" + "add sp, sp, #0x40" "\n" "bx lr" "\n" ); @@ -506,7 +512,7 @@ asm volatile ( ".align 2" "\n" ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" ".thumb" "\n" -".thumb_func " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "ldr r6, [sp, #0x2c]" "\n" "ldr r5, [sp, #0x28]" "\n" @@ -516,7 +522,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "bx lr" "\n" ); -#elif COMPILER(GCC) && PLATFORM(ARM) +#elif COMPILER(GCC) && PLATFORM(ARM_TRADITIONAL) asm volatile ( ".globl " SYMBOL_STRING(ctiTrampoline) "\n" @@ -636,7 +642,7 @@ JITThunks::JITThunks(JSGlobalData* globalData) { JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_ctiStringLengthTrampoline, &m_ctiVirtualCallLink, &m_ctiVirtualCall, &m_ctiNativeCallThunk); -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) // Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it contains non POD types), // and the OBJECT_OFFSETOF macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT // macros. @@ -649,7 +655,7 @@ JITThunks::JITThunks(JSGlobalData* globalData) ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, callFrame) == 0x34); ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, exception) == 0x38); // The fifth argument is the first item already on the stack. - ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == 0x3c); + ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == 0x40); ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, thunkReturnAddress) == 0x1C); #endif @@ -673,7 +679,7 @@ NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* co JSCell* baseCell = asCell(baseValue); Structure* structure = baseCell->structure(); - if (structure->isDictionary()) { + if (structure->isUncacheableDictionary()) { ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_put_by_id_generic)); return; } @@ -689,7 +695,7 @@ NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* co // Structure transition, cache transition info if (slot.type() == PutPropertySlot::NewProperty) { StructureChain* prototypeChain = structure->prototypeChain(callFrame); - if (!prototypeChain->isCacheable()) { + if (!prototypeChain->isCacheable() || structure->isDictionary()) { ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_put_by_id_generic)); return; } @@ -737,7 +743,7 @@ NEVER_INLINE void JITThunks::tryCacheGetByID(CallFrame* callFrame, CodeBlock* co JSCell* baseCell = asCell(baseValue); Structure* structure = baseCell->structure(); - if (structure->isDictionary()) { + if (structure->isUncacheableDictionary()) { ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic)); return; } @@ -876,7 +882,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD } \ } while (0) -#if PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_THUMB2) #define DEFINE_STUB_FUNCTION(rtype, op) \ extern "C" { \ @@ -887,7 +893,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD ".align 2" "\n" \ ".globl " SYMBOL_STRING(cti_##op) "\n" \ ".thumb" "\n" \ - ".thumb_func " SYMBOL_STRING(cti_##op) "\n" \ + ".thumb_func " THUMB_FUNC_PARAM(cti_##op) "\n" \ SYMBOL_STRING(cti_##op) ":" "\n" \ "str lr, [sp, #0x1c]" "\n" \ "bl " SYMBOL_STRING(JITStubThunked_##op) "\n" \ @@ -1148,7 +1154,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_method_check) JSObject* slotBaseObject; if (baseValue.isCell() && slot.isCacheable() - && !(structure = asCell(baseValue)->structure())->isDictionary() + && !(structure = asCell(baseValue)->structure())->isUncacheableDictionary() && (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific) && specific ) { @@ -1222,7 +1228,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_self_fail) if (baseValue.isCell() && slot.isCacheable() - && !asCell(baseValue)->structure()->isDictionary() + && !asCell(baseValue)->structure()->isUncacheableDictionary() && slot.slotBase() == baseValue) { CodeBlock* codeBlock = callFrame->codeBlock(); @@ -1293,7 +1299,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_list) CHECK_FOR_EXCEPTION(); - if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isDictionary()) { + if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isUncacheableDictionary()) { ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail)); return JSValue::encode(result); } @@ -2182,7 +2188,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_global) PropertySlot slot(globalObject); if (globalObject->getPropertySlot(callFrame, ident, slot)) { JSValue result = slot.getValue(callFrame, ident); - if (slot.isCacheable() && !globalObject->structure()->isDictionary() && slot.slotBase() == globalObject) { + if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) { GlobalResolveInfo& globalResolveInfo = callFrame->codeBlock()->globalResolveInfo(globalResolveInfoIndex); if (globalResolveInfo.structure) globalResolveInfo.structure->deref(); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h index 1dbdeaa..46973ee 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h @@ -129,7 +129,7 @@ namespace JSC { #if COMPILER(MSVC) #pragma pack(pop) #endif // COMPILER(MSVC) -#elif PLATFORM_ARM_ARCH(7) +#elif PLATFORM(ARM_THUMB2) struct JITStackFrame { void* reserved; // Unused JITStubArg args[6]; @@ -149,13 +149,15 @@ namespace JSC { CallFrame* callFrame; JSValue* exception; + void* padding2; + // These arguments passed on the stack. Profiler** enabledProfilerReference; JSGlobalData* globalData; ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; } }; -#elif PLATFORM(ARM) +#elif PLATFORM(ARM_TRADITIONAL) struct JITStackFrame { JITStubArg padding; // Unused JITStubArg args[7]; diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp index 14a398a..3bd318a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp @@ -1886,10 +1886,6 @@ ScopeNode::ScopeNode(JSGlobalData* globalData) , ParserArenaRefCounted(globalData) , m_features(NoFeatures) { -#if ENABLE(CODEBLOCK_SAMPLING) - if (SamplingTool* sampler = globalData->interpreter->sampler()) - sampler->notifyOfScope(this); -#endif } ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, CodeFeatures features, int numConstants) @@ -1899,10 +1895,6 @@ ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceE , m_features(features) , m_source(source) { -#if ENABLE(CODEBLOCK_SAMPLING) - if (SamplingTool* sampler = globalData->interpreter->sampler()) - sampler->notifyOfScope(this); -#endif } inline void ScopeNode::emitStatementsBytecode(BytecodeGenerator& generator, RegisterID* dst) diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h b/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h index 84360b8..9ba4da3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h +++ b/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h @@ -37,7 +37,8 @@ namespace JSC { class SourceCode { public: SourceCode() - : m_startChar(0) + : m_provider(0) + , m_startChar(0) , m_endChar(0) , m_firstLine(0) { diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h b/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h index b9f738f..929a5e7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h @@ -38,7 +38,7 @@ namespace JSC { : m_object(object) { if (!m_object->structure()->isDictionary()) - m_object->setStructure(Structure::toDictionaryTransition(m_object->structure())); + m_object->setStructure(Structure::toCacheableDictionaryTransition(m_object->structure())); } ~BatchedTransitionOptimizer() diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h b/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h index 8493d73..abe5038 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h @@ -39,6 +39,9 @@ macro(compile) \ macro(configurable) \ macro(constructor) \ + macro(create) \ + macro(defineProperty) \ + macro(defineProperties) \ macro(enumerable) \ macro(eval) \ macro(exec) \ diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp index f36de54..ec3e000 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp @@ -37,7 +37,7 @@ Completion checkSyntax(ExecState* exec, const SourceCode& source) { JSLock lock(exec); - ProgramExecutable program(source); + ProgramExecutable program(exec, source); JSObject* error = program.checkSyntax(exec); if (error) return Completion(Throw, error); @@ -49,7 +49,7 @@ Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& s { JSLock lock(exec); - ProgramExecutable program(source); + ProgramExecutable program(exec, source); JSObject* error = program.compile(exec, scopeChain.node()); if (error) return Completion(Throw, error); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp index 5e79794..7586746 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp @@ -259,7 +259,7 @@ PassRefPtr FunctionExecutable::fromGlobalCode(const Identifi FunctionBodyNode* body = static_cast(funcExpr)->body(); ASSERT(body); - return FunctionExecutable::create(functionName, body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); + return FunctionExecutable::create(&exec->globalData(), functionName, body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); } UString FunctionExecutable::paramString() const diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h index d437d46..9728775 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h @@ -27,7 +27,9 @@ #define Executable_h #include "JSFunction.h" +#include "Interpreter.h" #include "Nodes.h" +#include "SamplingTool.h" namespace JSC { @@ -102,11 +104,30 @@ namespace JSC { class ScriptExecutable : public ExecutableBase { public: - ScriptExecutable(const SourceCode& source) + ScriptExecutable(JSGlobalData* globalData, const SourceCode& source) : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED) , m_source(source) , m_features(0) { +#if ENABLE(CODEBLOCK_SAMPLING) + if (SamplingTool* sampler = globalData->interpreter->sampler()) + sampler->notifyOfScope(this); +#else + UNUSED_PARAM(globalData); +#endif + } + + ScriptExecutable(ExecState* exec, const SourceCode& source) + : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED) + , m_source(source) + , m_features(0) + { +#if ENABLE(CODEBLOCK_SAMPLING) + if (SamplingTool* sampler = exec->globalData().interpreter->sampler()) + sampler->notifyOfScope(this); +#else + UNUSED_PARAM(exec); +#endif } const SourceCode& source() { return m_source; } @@ -137,8 +158,8 @@ namespace JSC { class EvalExecutable : public ScriptExecutable { public: - EvalExecutable(const SourceCode& source) - : ScriptExecutable(source) + EvalExecutable(ExecState* exec, const SourceCode& source) + : ScriptExecutable(exec, source) , m_evalCodeBlock(0) { } @@ -157,7 +178,7 @@ namespace JSC { JSObject* compile(ExecState*, ScopeChainNode*); ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); - static PassRefPtr create(const SourceCode& source) { return adoptRef(new EvalExecutable(source)); } + static PassRefPtr create(ExecState* exec, const SourceCode& source) { return adoptRef(new EvalExecutable(exec, source)); } private: EvalCodeBlock* m_evalCodeBlock; @@ -178,8 +199,8 @@ namespace JSC { class ProgramExecutable : public ScriptExecutable { public: - ProgramExecutable(const SourceCode& source) - : ScriptExecutable(source) + ProgramExecutable(ExecState* exec, const SourceCode& source) + : ScriptExecutable(exec, source) , m_programCodeBlock(0) { } @@ -221,9 +242,14 @@ namespace JSC { class FunctionExecutable : public ScriptExecutable { friend class JIT; public: - static PassRefPtr create(const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + static PassRefPtr create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + { + return adoptRef(new FunctionExecutable(exec, name, source, forceUsesArguments, parameters, firstLine, lastLine)); + } + + static PassRefPtr create(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) { - return adoptRef(new FunctionExecutable(name, source, forceUsesArguments, parameters, firstLine, lastLine)); + return adoptRef(new FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, firstLine, lastLine)); } ~FunctionExecutable(); @@ -263,8 +289,20 @@ namespace JSC { static PassRefPtr fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0); private: - FunctionExecutable(const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) - : ScriptExecutable(source) + FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + : ScriptExecutable(globalData, source) + , m_forceUsesArguments(forceUsesArguments) + , m_parameters(parameters) + , m_codeBlock(0) + , m_name(name) + , m_numVariables(0) + { + m_firstLine = firstLine; + m_lastLine = lastLine; + } + + FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) + : ScriptExecutable(exec, source) , m_forceUsesArguments(forceUsesArguments) , m_parameters(parameters) , m_codeBlock(0) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp index 1fcca81..101f543 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp @@ -223,7 +223,7 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot } } - return false; + return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, i), slot); } bool JSArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp index 3a1909d..8d71ac3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -175,18 +175,18 @@ void JSGlobalObject::putWithAttributes(ExecState* exec, const Identifier& proper } } -void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc) +void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes) { PropertySlot slot; if (!symbolTableGet(propertyName, slot)) - JSVariableObject::defineGetter(exec, propertyName, getterFunc); + JSVariableObject::defineGetter(exec, propertyName, getterFunc, attributes); } -void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc) +void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes) { PropertySlot slot; if (!symbolTableGet(propertyName, slot)) - JSVariableObject::defineSetter(exec, propertyName, setterFunc); + JSVariableObject::defineSetter(exec, propertyName, setterFunc, attributes); } static inline JSObject* lastInPrototypeChain(JSObject* object) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h index d1150cc..5f7137f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h @@ -175,8 +175,8 @@ namespace JSC { virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&); virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes); - virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc); - virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc); + virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes); + virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes); // Linked list of all global objects that use the same JSGlobalData. JSGlobalObject*& head() { return d()->globalData->head; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp index b11070f..5ded370 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp @@ -286,7 +286,7 @@ JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec, JSObject* function, JSValu if (JSValue parsedObject = preparser.tryLiteralParse()) return parsedObject; - EvalExecutable eval(makeSource(s)); + EvalExecutable eval(exec, makeSource(s)); JSObject* error = eval.compile(exec, static_cast(unwrappedObject)->globalScopeChain().node()); if (error) return throwError(exec, error); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp index f910603..74af4b1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp @@ -275,7 +275,7 @@ const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifi return 0; } -void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) +void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) { JSValue object = getDirect(propertyName); if (object && object.isGetterSetter()) { @@ -286,7 +286,7 @@ void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSO PutPropertySlot slot; GetterSetter* getterSetter = new (exec) GetterSetter(exec); - putDirectInternal(exec->globalData(), propertyName, getterSetter, Getter, true, slot); + putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Getter, true, slot); // putDirect will change our Structure if we add a new property. For // getters and setters, though, we also need to change our Structure @@ -302,7 +302,7 @@ void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSO getterSetter->setGetter(getterFunction); } -void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction) +void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) { JSValue object = getDirect(propertyName); if (object && object.isGetterSetter()) { @@ -313,7 +313,7 @@ void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSO PutPropertySlot slot; GetterSetter* getterSetter = new (exec) GetterSetter(exec); - putDirectInternal(exec->globalData(), propertyName, getterSetter, Setter, true, slot); + putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot); // putDirect will change our Structure if we add a new property. For // getters and setters, though, we also need to change our Structure @@ -471,7 +471,7 @@ JSObject* JSObject::unwrappedObject() void JSObject::removeDirect(const Identifier& propertyName) { size_t offset; - if (m_structure->isDictionary()) { + if (m_structure->isUncacheableDictionary()) { offset = m_structure->removePropertyWithoutTransition(propertyName); if (offset != WTF::notFound) putDirectOffset(offset, jsUndefined()); @@ -541,4 +541,131 @@ bool JSObject::getPropertyDescriptor(ExecState* exec, const Identifier& property object = asObject(prototype); } } + +static bool putDescriptor(ExecState* exec, JSObject* target, const Identifier& propertyName, PropertyDescriptor& descriptor, unsigned attributes, JSValue oldValue) +{ + if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) { + target->putWithAttributes(exec, propertyName, descriptor.value() ? descriptor.value() : oldValue, attributes & ~(Getter | Setter)); + return true; + } + attributes &= ~ReadOnly; + if (descriptor.getter() && descriptor.getter().isObject()) + target->defineGetter(exec, propertyName, asObject(descriptor.getter()), attributes); + if (exec->hadException()) + return false; + if (descriptor.setter() && descriptor.setter().isObject()) + target->defineSetter(exec, propertyName, asObject(descriptor.setter()), attributes); + return !exec->hadException(); +} + +bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +{ + // If we have a new property we can just put it on normally + PropertyDescriptor current; + if (!getOwnPropertyDescriptor(exec, propertyName, current)) + return putDescriptor(exec, this, propertyName, descriptor, descriptor.attributes(), jsUndefined()); + + if (descriptor.isEmpty()) + return true; + + if (current.equalTo(descriptor)) + return true; + + // Filter out invalid changes + if (!current.configurable()) { + if (descriptor.configurable()) { + if (throwException) + throwError(exec, TypeError, "Attempting to configurable attribute of unconfigurable property."); + return false; + } + if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) { + if (throwException) + throwError(exec, TypeError, "Attempting to change enumerable attribute of unconfigurable property."); + return false; + } + } + + // A generic descriptor is simply changing the attributes of an existing property + if (descriptor.isGenericDescriptor()) { + if (!current.attributesEqual(descriptor)) { + deleteProperty(exec, propertyName); + putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value()); + } + return true; + } + + // Changing between a normal property or an accessor property + if (descriptor.isDataDescriptor() != current.isDataDescriptor()) { + if (!current.configurable()) { + if (throwException) + throwError(exec, TypeError, "Attempting to change access mechanism for an unconfigurable property."); + return false; + } + deleteProperty(exec, propertyName); + return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value() ? current.value() : jsUndefined()); + } + + // Changing the value and attributes of an existing property + if (descriptor.isDataDescriptor()) { + if (!current.configurable()) { + if (!current.writable() && descriptor.writable()) { + if (throwException) + throwError(exec, TypeError, "Attempting to change writable attribute of unconfigurable property."); + return false; + } + if (!current.writable()) { + if (descriptor.value() || !JSValue::strictEqual(current.value(), descriptor.value())) { + if (throwException) + throwError(exec, TypeError, "Attempting to change value of a readonly property."); + return false; + } + } + } else if (current.attributesEqual(descriptor)) { + if (!descriptor.value()) + return true; + PutPropertySlot slot; + put(exec, propertyName, descriptor.value(), slot); + if (exec->hadException()) + return false; + return true; + } + deleteProperty(exec, propertyName); + return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value()); + } + + // Changing the accessor functions of an existing accessor property + ASSERT(descriptor.isAccessorDescriptor()); + if (!current.configurable()) { + if (descriptor.setterPresent() && !(current.setter() && JSValue::strictEqual(current.setter(), descriptor.setter()))) { + if (throwException) + throwError(exec, TypeError, "Attempting to change the setter of an unconfigurable property."); + return false; + } + if (descriptor.getterPresent() && !(current.getter() && JSValue::strictEqual(current.getter(), descriptor.getter()))) { + if (throwException) + throwError(exec, TypeError, "Attempting to change the getter of an unconfigurable property."); + return false; + } + } + JSValue accessor = getDirect(propertyName); + if (!accessor) + return false; + GetterSetter* getterSetter = asGetterSetter(accessor); + if (current.attributesEqual(descriptor)) { + if (descriptor.setter()) + getterSetter->setSetter(asObject(descriptor.setter())); + if (descriptor.getter()) + getterSetter->setGetter(asObject(descriptor.getter())); + return true; + } + deleteProperty(exec, propertyName); + unsigned attrs = current.attributesWithOverride(descriptor); + if (descriptor.setter()) + attrs |= Setter; + if (descriptor.getter()) + attrs |= Getter; + putDirect(propertyName, getterSetter, attrs); + return true; +} + } // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h index bdc949b..3fd1e3c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h @@ -186,10 +186,11 @@ namespace JSC { void fillGetterPropertySlot(PropertySlot&, JSValue* location); - virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction); - virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction); + virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0); + virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0); virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName); virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName); + virtual bool defineOwnProperty(ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); virtual bool isGlobalObject() const { return false; } virtual bool isVariableObject() const { return false; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp index 8e78ff3..43f8b29 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp @@ -29,22 +29,44 @@ #include "MarkStack.h" #include +#if defined (__SYMBIAN32__) +#include "wtf/FastMalloc.h" +#include +#include +#include +#include +#else #include +#endif namespace JSC { void MarkStack::initializePagesize() { +#if defined (__SYMBIAN32__) + TInt page_size; + UserHal::PageSizeInBytes(page_size); + MarkStack::s_pageSize = page_size; +#else MarkStack::s_pageSize = getpagesize(); +#endif } void* MarkStack::allocateStack(size_t size) { +#if defined (__SYMBIAN32__) + return fastMalloc(size); +#else return mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); +#endif } void MarkStack::releaseStack(void* addr, size_t size) { +#if defined (__SYMBIAN32__) + fastFree(addr); +#else munmap(addr, size); +#endif } } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp index fd45c45..2992f1b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp @@ -37,6 +37,9 @@ ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor); static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*, JSObject*, JSValue, const ArgList&); static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*, JSObject*, JSValue, const ArgList&); static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*, JSObject*, JSValue, const ArgList&); +static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*, JSObject*, JSValue, const ArgList&); +static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*, JSObject*, JSValue, const ArgList&); +static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*, JSObject*, JSValue, const ArgList&); ObjectConstructor::ObjectConstructor(ExecState* exec, PassRefPtr structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure) : InternalFunction(&exec->globalData(), structure, Identifier(exec, "Object")) @@ -50,6 +53,9 @@ ObjectConstructor::ObjectConstructor(ExecState* exec, PassRefPtr stru putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().getPrototypeOf, objectConstructorGetPrototypeOf), DontEnum); putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().getOwnPropertyDescriptor, objectConstructorGetOwnPropertyDescriptor), DontEnum); putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().keys, objectConstructorKeys), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 3, exec->propertyNames().defineProperty, objectConstructorDefineProperty), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().defineProperties, objectConstructorDefineProperties), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().create, objectConstructorCreate), DontEnum); } // ECMA 15.2.2 @@ -103,15 +109,14 @@ JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec, return jsUndefined(); if (exec->hadException()) return jsUndefined(); - ASSERT(descriptor.isValid()); JSObject* description = constructEmptyObject(exec); - if (!descriptor.hasAccessors()) { - description->putDirect(exec->propertyNames().value, descriptor.value(), 0); + if (!descriptor.isAccessorDescriptor()) { + description->putDirect(exec->propertyNames().value, descriptor.value() ? descriptor.value() : jsUndefined(), 0); description->putDirect(exec->propertyNames().writable, jsBoolean(descriptor.writable()), 0); } else { - description->putDirect(exec->propertyNames().get, descriptor.getter(), 0); - description->putDirect(exec->propertyNames().set, descriptor.setter(), 0); + description->putDirect(exec->propertyNames().get, descriptor.getter() ? descriptor.getter() : jsUndefined(), 0); + description->putDirect(exec->propertyNames().set, descriptor.setter() ? descriptor.setter() : jsUndefined(), 0); } description->putDirect(exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0); @@ -133,4 +138,163 @@ JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec, JSObject*, JSValue, return keys; } +// ES5 8.10.5 ToPropertyDescriptor +static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor& desc) +{ + if (!in.isObject()) { + throwError(exec, TypeError, "Property description must be an object."); + return false; + } + JSObject* description = asObject(in); + + PropertySlot enumerableSlot; + if (description->getPropertySlot(exec, exec->propertyNames().enumerable, enumerableSlot)) { + desc.setEnumerable(enumerableSlot.getValue(exec, exec->propertyNames().enumerable).toBoolean(exec)); + if (exec->hadException()) + return false; + } + + PropertySlot configurableSlot; + if (description->getPropertySlot(exec, exec->propertyNames().configurable, configurableSlot)) { + desc.setConfigurable(configurableSlot.getValue(exec, exec->propertyNames().configurable).toBoolean(exec)); + if (exec->hadException()) + return false; + } + + JSValue value; + PropertySlot valueSlot; + if (description->getPropertySlot(exec, exec->propertyNames().value, valueSlot)) { + desc.setValue(valueSlot.getValue(exec, exec->propertyNames().value)); + if (exec->hadException()) + return false; + } + + PropertySlot writableSlot; + if (description->getPropertySlot(exec, exec->propertyNames().writable, writableSlot)) { + desc.setWritable(writableSlot.getValue(exec, exec->propertyNames().writable).toBoolean(exec)); + if (exec->hadException()) + return false; + } + + PropertySlot getSlot; + if (description->getPropertySlot(exec, exec->propertyNames().get, getSlot)) { + JSValue get = getSlot.getValue(exec, exec->propertyNames().get); + if (exec->hadException()) + return false; + if (!get.isUndefined()) { + CallData callData; + if (get.getCallData(callData) == CallTypeNone) { + throwError(exec, TypeError, "Getter must be a function."); + return false; + } + } else + get = JSValue(); + desc.setGetter(get); + } + + PropertySlot setSlot; + if (description->getPropertySlot(exec, exec->propertyNames().set, setSlot)) { + JSValue set = setSlot.getValue(exec, exec->propertyNames().set); + if (exec->hadException()) + return false; + if (!set.isUndefined()) { + CallData callData; + if (set.getCallData(callData) == CallTypeNone) { + throwError(exec, TypeError, "Setter must be a function."); + return false; + } + } else + set = JSValue(); + + desc.setSetter(set); + } + + if (!desc.isAccessorDescriptor()) + return true; + + if (desc.value()) { + throwError(exec, TypeError, "Invalid property. 'value' present on property with getter or setter."); + return false; + } + + if (desc.writablePresent()) { + throwError(exec, TypeError, "Invalid property. 'writable' present on property with getter or setter."); + return false; + } + return true; +} + +JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec, JSObject*, JSValue, const ArgList& args) +{ + if (!args.at(0).isObject()) + return throwError(exec, TypeError, "Properties can only be defined on Objects."); + JSObject* O = asObject(args.at(0)); + UString propertyName = args.at(1).toString(exec); + if (exec->hadException()) + return jsNull(); + PropertyDescriptor descriptor; + if (!toPropertyDescriptor(exec, args.at(2), descriptor)) + return jsNull(); + ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor())); + ASSERT(!exec->hadException()); + O->defineOwnProperty(exec, Identifier(exec, propertyName), descriptor, true); + return O; +} + +static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* properties) +{ + PropertyNameArray propertyNames(exec); + asObject(properties)->getOwnPropertyNames(exec, propertyNames); + size_t numProperties = propertyNames.size(); + Vector descriptors; + MarkedArgumentBuffer markBuffer; + for (size_t i = 0; i < numProperties; i++) { + PropertySlot slot; + JSValue prop = properties->get(exec, propertyNames[i]); + if (exec->hadException()) + return jsNull(); + PropertyDescriptor descriptor; + if (!toPropertyDescriptor(exec, prop, descriptor)) + return jsNull(); + descriptors.append(descriptor); + // Ensure we mark all the values that we're accumulating + if (descriptor.isDataDescriptor() && descriptor.value()) + markBuffer.append(descriptor.value()); + if (descriptor.isAccessorDescriptor()) { + if (descriptor.getter()) + markBuffer.append(descriptor.getter()); + if (descriptor.setter()) + markBuffer.append(descriptor.setter()); + } + } + for (size_t i = 0; i < numProperties; i++) { + object->defineOwnProperty(exec, propertyNames[i], descriptors[i], true); + if (exec->hadException()) + return jsNull(); + } + return object; +} + +JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec, JSObject*, JSValue, const ArgList& args) +{ + if (!args.at(0).isObject()) + return throwError(exec, TypeError, "Properties can only be defined on Objects."); + if (!args.at(1).isObject()) + return throwError(exec, TypeError, "Property descriptor list must be an Object."); + return defineProperties(exec, asObject(args.at(0)), asObject(args.at(1))); +} + +JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec, JSObject*, JSValue, const ArgList& args) +{ + if (!args.at(0).isObject() && !args.at(0).isNull()) + return throwError(exec, TypeError, "Object prototype may only be an Object or null."); + JSObject* newObject = constructEmptyObject(exec); + newObject->setPrototype(args.at(0)); + if (args.at(1).isUndefined()) + return newObject; + if (!args.at(1).isObject()) + return throwError(exec, TypeError, "Property descriptor list must be an Object."); + return defineProperties(exec, newObject, asObject(args.at(1))); +} + } // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp index d892e0a..4db814f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp @@ -30,29 +30,40 @@ #include "GetterSetter.h" #include "JSObject.h" +#include "Operations.h" namespace JSC { +unsigned PropertyDescriptor::defaultAttributes = (DontDelete << 1) - 1; + bool PropertyDescriptor::writable() const { - ASSERT(!hasAccessors()); + ASSERT(!isAccessorDescriptor()); return !(m_attributes & ReadOnly); } bool PropertyDescriptor::enumerable() const { - ASSERT(isValid()); return !(m_attributes & DontEnum); } bool PropertyDescriptor::configurable() const { - ASSERT(isValid()); return !(m_attributes & DontDelete); } -bool PropertyDescriptor::hasAccessors() const +bool PropertyDescriptor::isDataDescriptor() const { - return !!(m_attributes & (Getter | Setter)); + return m_value || (m_seenAttributes & WritablePresent); +} + +bool PropertyDescriptor::isGenericDescriptor() const +{ + return !isAccessorDescriptor() && !isDataDescriptor(); +} + +bool PropertyDescriptor::isAccessorDescriptor() const +{ + return m_getter || m_setter; } void PropertyDescriptor::setUndefined() @@ -63,32 +74,31 @@ void PropertyDescriptor::setUndefined() JSValue PropertyDescriptor::getter() const { - ASSERT(hasAccessors()); - if (!m_getter) - return jsUndefined(); + ASSERT(isAccessorDescriptor()); return m_getter; } JSValue PropertyDescriptor::setter() const { - ASSERT(hasAccessors()); - if (!m_setter) - return jsUndefined(); + ASSERT(isAccessorDescriptor()); return m_setter; } void PropertyDescriptor::setDescriptor(JSValue value, unsigned attributes) { ASSERT(value); + m_attributes = attributes; if (attributes & (Getter | Setter)) { GetterSetter* accessor = asGetterSetter(value); m_getter = accessor->getter(); m_setter = accessor->setter(); ASSERT(m_getter || m_setter); + m_seenAttributes = EnumerablePresent | ConfigurablePresent; + m_attributes &= ~ReadOnly; } else { m_value = value; + m_seenAttributes = EnumerablePresent | ConfigurablePresent | WritablePresent; } - m_attributes = attributes; } void PropertyDescriptor::setAccessorDescriptor(JSValue getter, JSValue setter, unsigned attributes) @@ -98,6 +108,88 @@ void PropertyDescriptor::setAccessorDescriptor(JSValue getter, JSValue setter, u m_attributes = attributes; m_getter = getter; m_setter = setter; + m_attributes &= ~ReadOnly; + m_seenAttributes = EnumerablePresent | ConfigurablePresent; +} + +void PropertyDescriptor::setWritable(bool writable) +{ + if (writable) + m_attributes &= ~ReadOnly; + else + m_attributes |= ReadOnly; + m_seenAttributes |= WritablePresent; +} + +void PropertyDescriptor::setEnumerable(bool enumerable) +{ + if (enumerable) + m_attributes &= ~DontEnum; + else + m_attributes |= DontEnum; + m_seenAttributes |= EnumerablePresent; +} + +void PropertyDescriptor::setConfigurable(bool configurable) +{ + if (configurable) + m_attributes &= ~DontDelete; + else + m_attributes |= DontDelete; + m_seenAttributes |= ConfigurablePresent; +} + +void PropertyDescriptor::setSetter(JSValue setter) +{ + m_setter = setter; + m_attributes |= Setter; + m_attributes &= ~ReadOnly; +} + +void PropertyDescriptor::setGetter(JSValue getter) +{ + m_getter = getter; + m_attributes |= Getter; + m_attributes &= ~ReadOnly; +} + +bool PropertyDescriptor::equalTo(const PropertyDescriptor& other) const +{ + if (!other.m_value == m_value || + !other.m_getter == m_getter || + !other.m_setter == m_setter) + return false; + return (!m_value || JSValue::strictEqual(other.m_value, m_value)) && + (!m_getter || JSValue::strictEqual(other.m_getter, m_getter)) && + (!m_setter || JSValue::strictEqual(other.m_setter, m_setter)) && + attributesEqual(other); +} + +bool PropertyDescriptor::attributesEqual(const PropertyDescriptor& other) const +{ + unsigned mismatch = other.m_attributes ^ m_attributes; + unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes; + if (sharedSeen & WritablePresent && mismatch & ReadOnly) + return false; + if (sharedSeen & ConfigurablePresent && mismatch & DontDelete) + return false; + if (sharedSeen & EnumerablePresent && mismatch & DontEnum) + return false; + return true; +} + +unsigned PropertyDescriptor::attributesWithOverride(const PropertyDescriptor& other) const +{ + unsigned mismatch = other.m_attributes ^ m_attributes; + unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes; + unsigned newAttributes = m_attributes & defaultAttributes; + if (sharedSeen & WritablePresent && mismatch & ReadOnly) + newAttributes ^= ReadOnly; + if (sharedSeen & ConfigurablePresent && mismatch & DontDelete) + newAttributes ^= DontDelete; + if (sharedSeen & EnumerablePresent && mismatch & DontEnum) + newAttributes ^= DontEnum; + return newAttributes; } } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h index ad7c056..40bec86 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h @@ -32,29 +32,48 @@ namespace JSC { class PropertyDescriptor { public: PropertyDescriptor() - : m_attributes(0) + : m_attributes(defaultAttributes) + , m_seenAttributes(0) { } bool writable() const; bool enumerable() const; bool configurable() const; - bool hasAccessors() const; + bool isDataDescriptor() const; + bool isGenericDescriptor() const; + bool isAccessorDescriptor() const; unsigned attributes() const { return m_attributes; } -#ifndef NDEBUG - bool isValid() const { return m_value || ((m_getter || m_setter) && hasAccessors()); } -#endif - JSValue value() const { ASSERT(m_value); return m_value; } + JSValue value() const { return m_value; } JSValue getter() const; JSValue setter() const; void setUndefined(); void setDescriptor(JSValue value, unsigned attributes); void setAccessorDescriptor(JSValue getter, JSValue setter, unsigned attributes); + void setWritable(bool); + void setEnumerable(bool); + void setConfigurable(bool); + void setValue(JSValue value) { m_value = value; } + void setSetter(JSValue); + void setGetter(JSValue); + bool isEmpty() const { return !(m_value || m_getter || m_setter || m_seenAttributes); } + bool writablePresent() const { return m_seenAttributes & WritablePresent; } + bool enumerablePresent() const { return m_seenAttributes & EnumerablePresent; } + bool configurablePresent() const { return m_seenAttributes & ConfigurablePresent; } + bool setterPresent() const { return m_setter; } + bool getterPresent() const { return m_getter; } + bool equalTo(const PropertyDescriptor& other) const; + bool attributesEqual(const PropertyDescriptor& other) const; + unsigned attributesWithOverride(const PropertyDescriptor& other) const; private: + static unsigned defaultAttributes; + bool operator==(const PropertyDescriptor&){ return false; } + enum { WritablePresent = 1, EnumerablePresent = 2, ConfigurablePresent = 4}; // May be a getter/setter JSValue m_value; JSValue m_getter; JSValue m_setter; unsigned m_attributes; + unsigned m_seenAttributes; }; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp index 34c27b7..7209b5f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp @@ -127,7 +127,7 @@ Structure::Structure(JSValue prototype, const TypeInfo& typeInfo) , m_propertyTable(0) , m_propertyStorageCapacity(JSObject::inlineStorageCapacity) , m_offset(noOffset) - , m_isDictionary(false) + , m_dictionaryKind(NoneDictionaryKind) , m_isPinnedPropertyTable(false) , m_hasGetterSetterProperties(false) , m_attributesInPrevious(0) @@ -290,7 +290,7 @@ void Structure::getOwnEnumerablePropertyNames(ExecState* exec, PropertyNameArray void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject) { - bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_isDictionary); + bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || isDictionary()); if (shouldCache && m_cachedPropertyNameArrayData) { if (m_cachedPropertyNameArrayData->cachedPrototypeChain() == prototypeChain(exec)) { @@ -349,7 +349,7 @@ void Structure::despecifyDictionaryFunction(const Identifier& propertyName) materializePropertyMapIfNecessary(); - ASSERT(m_isDictionary); + ASSERT(isDictionary()); ASSERT(m_propertyTable); unsigned i = rep->computedHash(); @@ -391,7 +391,7 @@ void Structure::despecifyDictionaryFunction(const Identifier& propertyName) PassRefPtr Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { - ASSERT(!structure->m_isDictionary); + ASSERT(!structure->isDictionary()); ASSERT(structure->typeInfo().type() == ObjectType); if (Structure* existingTransition = structure->table.get(make_pair(propertyName.ustring().rep(), attributes), specificValue)) { @@ -405,12 +405,12 @@ PassRefPtr Structure::addPropertyTransitionToExistingStructure(Struct PassRefPtr Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { - ASSERT(!structure->m_isDictionary); + ASSERT(!structure->isDictionary()); ASSERT(structure->typeInfo().type() == ObjectType); ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset)); if (structure->transitionCount() > s_maxTransitionLength) { - RefPtr transition = toDictionaryTransition(structure); + RefPtr transition = toCacheableDictionaryTransition(structure); ASSERT(structure != transition); offset = transition->put(propertyName, attributes, specificValue); if (transition->propertyStorageSize() > transition->propertyStorageCapacity()) @@ -454,9 +454,9 @@ PassRefPtr Structure::addPropertyTransition(Structure* structure, con PassRefPtr Structure::removePropertyTransition(Structure* structure, const Identifier& propertyName, size_t& offset) { - ASSERT(!structure->m_isDictionary); + ASSERT(!structure->isUncacheableDictionary()); - RefPtr transition = toDictionaryTransition(structure); + RefPtr transition = toUncacheableDictionaryTransition(structure); offset = transition->remove(propertyName); @@ -554,25 +554,35 @@ PassRefPtr Structure::getterSetterTransition(Structure* structure) return transition.release(); } -PassRefPtr Structure::toDictionaryTransition(Structure* structure) +PassRefPtr Structure::toDictionaryTransition(Structure* structure, DictionaryKind kind) { - ASSERT(!structure->m_isDictionary); - + ASSERT(!structure->isUncacheableDictionary()); + RefPtr transition = create(structure->m_prototype, structure->typeInfo()); - transition->m_isDictionary = true; + transition->m_dictionaryKind = kind; transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; - + structure->materializePropertyMapIfNecessary(); transition->m_propertyTable = structure->copyPropertyTable(); transition->m_isPinnedPropertyTable = true; - + return transition.release(); } +PassRefPtr Structure::toCacheableDictionaryTransition(Structure* structure) +{ + return toDictionaryTransition(structure, CachedDictionaryKind); +} + +PassRefPtr Structure::toUncacheableDictionaryTransition(Structure* structure) +{ + return toDictionaryTransition(structure, UncachedDictionaryKind); +} + PassRefPtr Structure::fromDictionaryTransition(Structure* structure) { - ASSERT(structure->m_isDictionary); + ASSERT(structure->isDictionary()); // Since dictionary Structures are not shared, and no opcodes specialize // for them, we don't need to allocate a new Structure when transitioning @@ -581,7 +591,7 @@ PassRefPtr Structure::fromDictionaryTransition(Structure* structure) // FIMXE: We can make this more efficient by canonicalizing the Structure (draining the // deleted offsets vector) before transitioning from dictionary. if (!structure->m_propertyTable || !structure->m_propertyTable->deletedOffsets || structure->m_propertyTable->deletedOffsets->isEmpty()) - structure->m_isDictionary = false; + structure->m_dictionaryKind = NoneDictionaryKind; return structure; } @@ -600,7 +610,7 @@ size_t Structure::addPropertyWithoutTransition(const Identifier& propertyName, u size_t Structure::removePropertyWithoutTransition(const Identifier& propertyName) { - ASSERT(m_isDictionary); + ASSERT(isUncacheableDictionary()); materializePropertyMapIfNecessary(); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h index f7cb04b..ed9f6e5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h @@ -70,7 +70,8 @@ namespace JSC { static PassRefPtr despecifyFunctionTransition(Structure*, const Identifier&); static PassRefPtr addAnonymousSlotsTransition(Structure*, unsigned count); static PassRefPtr getterSetterTransition(Structure*); - static PassRefPtr toDictionaryTransition(Structure*); + static PassRefPtr toCacheableDictionaryTransition(Structure*); + static PassRefPtr toUncacheableDictionaryTransition(Structure*); static PassRefPtr fromDictionaryTransition(Structure*); ~Structure(); @@ -81,8 +82,9 @@ namespace JSC { size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); size_t removePropertyWithoutTransition(const Identifier& propertyName); void setPrototypeWithoutTransition(JSValue prototype) { m_prototype = prototype; } - - bool isDictionary() const { return m_isDictionary; } + + bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; } + bool isUncacheableDictionary() const { return m_dictionaryKind == UncachedDictionaryKind; } const TypeInfo& typeInfo() const { return m_typeInfo; } @@ -127,6 +129,13 @@ namespace JSC { private: Structure(JSValue prototype, const TypeInfo&); + + typedef enum { + NoneDictionaryKind = 0, + CachedDictionaryKind = 1, + UncachedDictionaryKind = 2 + } DictionaryKind; + static PassRefPtr toDictionaryTransition(Structure*, DictionaryKind); size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); size_t remove(const Identifier& propertyName); @@ -187,7 +196,7 @@ namespace JSC { size_t m_propertyStorageCapacity; signed char m_offset; - bool m_isDictionary : 1; + unsigned m_dictionaryKind : 2; bool m_isPinnedPropertyTable : 1; bool m_hasGetterSetterProperties : 1; #if COMPILER(WINSCW) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp index eb57a5ac..6e8a0ee 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp @@ -51,6 +51,7 @@ bool StructureChain::isCacheable() const uint32_t i = 0; while (m_vector[i]) { + // Both classes of dictionary structure may change arbitrarily so we can't cache them if (m_vector[i]->isDictionary()) return false; if (!m_vector[i++]->typeInfo().hasDefaultGetPropertyNames()) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h index 59efd84..b68e70c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h @@ -144,7 +144,13 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann #if ASSERT_DISABLED #define ASSERT(assertion) ((void)0) +#if COMPILER(MSVC7) +#define ASSERT_WITH_MESSAGE(assertion) ((void)0) +#elif PLATFORM(SYMBIAN) +#define ASSERT_WITH_MESSAGE(assertion...) ((void)0) +#else #define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0) +#endif /* COMPILER(MSVC7) */ #define ASSERT_NOT_REACHED() ((void)0) #define ASSERT_UNUSED(variable, assertion) ((void)variable) @@ -158,6 +164,8 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann while (0) #if COMPILER(MSVC7) #define ASSERT_WITH_MESSAGE(assertion) ((void)0) +#elif PLATFORM(SYMBIAN) +#define ASSERT_WITH_MESSAGE(assertion...) ((void)0) #else #define ASSERT_WITH_MESSAGE(assertion, ...) do \ if (!(assertion)) { \ @@ -199,10 +207,12 @@ while (0) /* FATAL */ -#if FATAL_DISABLED +#if FATAL_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN) #define FATAL(...) ((void)0) #elif COMPILER(MSVC7) #define FATAL() ((void)0) +#elif PLATFORM(SYMBIAN) +#define FATAL(args...) ((void)0) #else #define FATAL(...) do { \ WTFReportFatalError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__); \ @@ -212,20 +222,24 @@ while (0) /* LOG_ERROR */ -#if ERROR_DISABLED +#if ERROR_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN) #define LOG_ERROR(...) ((void)0) #elif COMPILER(MSVC7) #define LOG_ERROR() ((void)0) +#elif PLATFORM(SYMBIAN) +#define LOG_ERROR(args...) ((void)0) #else #define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__) #endif /* LOG */ -#if LOG_DISABLED +#if LOG_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN) #define LOG(channel, ...) ((void)0) #elif COMPILER(MSVC7) #define LOG() ((void)0) +#elif PLATFORM(SYMBIAN) +#define LOG(channel, args...) ((void)0) #else #define LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) #define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) @@ -234,10 +248,12 @@ while (0) /* LOG_VERBOSE */ -#if LOG_DISABLED +#if LOG_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN) #define LOG_VERBOSE(channel, ...) ((void)0) #elif COMPILER(MSVC7) #define LOG_VERBOSE(channel) ((void)0) +#elif PLATFORM(SYMBIAN) +#define LOG_VERBOSE(channel, args...) ((void)0) #else #define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h index 67dc3be..448de7d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,6 +27,7 @@ namespace WTF { template class ListRefPtr; template class OwnArrayPtr; template class OwnPtr; + template class PassOwnPtr; template class PassRefPtr; template class RefPtr; template class Vector; @@ -35,9 +36,9 @@ namespace WTF { using WTF::ListRefPtr; using WTF::OwnArrayPtr; using WTF::OwnPtr; +using WTF::PassOwnPtr; using WTF::PassRefPtr; using WTF::RefPtr; using WTF::Vector; #endif // WTF_Forward_h - diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h index 1a422d8..1fda9c1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h @@ -64,8 +64,13 @@ namespace WTF { void remove(const ValueType& value); void remove(iterator it); - void clear(); - + // removes the value, regardless of its count + void clear(iterator it); + void clear(const ValueType& value); + + // clears the whole set + void clear(); + private: ImplType m_impl; }; @@ -166,6 +171,21 @@ namespace WTF { } template + inline void HashCountedSet::clear(const ValueType& value) + { + clear(find(value)); + } + + template + inline void HashCountedSet::clear(iterator it) + { + if (it == end()) + return; + + m_impl.remove(it); + } + + template inline void HashCountedSet::clear() { m_impl.clear(); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h index 9f9a354..d863226 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h @@ -34,13 +34,8 @@ namespace WTF { ListRefPtr(const RefPtr& o) : RefPtr(o) {} // see comment in PassRefPtr.h for why this takes const reference template ListRefPtr(const PassRefPtr& o) : RefPtr(o) {} - - ~ListRefPtr() - { - RefPtr reaper = this->release(); - while (reaper && reaper->hasOneRef()) - reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper - } + + ~ListRefPtr(); ListRefPtr& operator=(T* optr) { RefPtr::operator=(optr); return *this; } ListRefPtr& operator=(const RefPtr& o) { RefPtr::operator=(o); return *this; } @@ -49,6 +44,17 @@ namespace WTF { template ListRefPtr& operator=(const PassRefPtr& o) { RefPtr::operator=(o); return *this; } }; + template +#if !COMPILER(WINSCW) + inline +#endif + ListRefPtr::~ListRefPtr() + { + RefPtr reaper = this->release(); + while (reaper && reaper->hasOneRef()) + reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper + } + template inline T* getPtr(const ListRefPtr& p) { return p.get(); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 2abf3d2..e508f77 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -226,8 +226,11 @@ #endif /* PLATFORM(ARM) */ +#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N) + #if defined(arm) \ - || defined(__arm__) + || defined(__arm__) \ + || defined(__MARM__) #define WTF_PLATFORM_ARM 1 #if defined(__ARMEB__) #define WTF_PLATFORM_BIG_ENDIAN 1 @@ -241,22 +244,35 @@ #endif #if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ - || defined(__ARM_ARCH_5TEJ__) + || defined(__ARM_ARCH_5TEJ__) || defined(__MARM_ARMV5__) #undef ARM_ARCH_VERSION #define ARM_ARCH_VERSION 5 #endif #if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ - || defined(__ARM_ARCH_6ZK__) + || defined(__ARM_ARCH_6ZK__) || defined(__ARMV6__) #undef ARM_ARCH_VERSION #define ARM_ARCH_VERSION 6 #endif -#if defined(__ARM_ARCH_7A__) +#if defined(__ARM_ARCH_7A__) || defined(__ARMV7__) #undef ARM_ARCH_VERSION #define ARM_ARCH_VERSION 7 #endif +/* Defines two pseudo-platforms for ARM and Thumb-2 instruction set. */ +#if !defined(WTF_PLATFORM_ARM_TRADITIONAL) && !defined(WTF_PLATFORM_ARM_THUMB2) +# if defined(thumb2) || defined(__thumb2__) +# define WTF_PLATFORM_ARM_TRADITIONAL 0 +# define WTF_PLATFORM_ARM_THUMB2 1 +# elif PLATFORM_ARM_ARCH(4) || PLATFORM_ARM_ARCH(5) +# define WTF_PLATFORM_ARM_TRADITIONAL 1 +# define WTF_PLATFORM_ARM_THUMB2 0 +# else +# error "Not supported ARM architecture" +# endif +#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(ARM_THUMB2) /* Sanity Check */ +# error "Cannot use both of WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2 platforms" +#endif // !defined(ARM_TRADITIONAL) && !defined(ARM_THUMB2) #endif /* ARM */ -#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N) /* PLATFORM(X86) */ #if defined(__i386__) \ @@ -392,6 +408,9 @@ #if PLATFORM(MAC) && !PLATFORM(IPHONE) #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && defined(__x86_64__) +#define WTF_USE_PLUGIN_HOST_PROCESS 1 +#endif #if !defined(ENABLE_MAC_JAVA_BRIDGE) #define ENABLE_MAC_JAVA_BRIDGE 1 #endif @@ -400,7 +419,7 @@ #endif #define HAVE_READLINE 1 #define HAVE_RUNLOOP_TIMER 1 -#endif +#endif // PLATFORM(MAC) && !PLATFORM(IPHONE) #if PLATFORM(CHROMIUM) && PLATFORM(DARWIN) #define WTF_PLATFORM_CF 1 @@ -408,18 +427,19 @@ #endif #if PLATFORM(IPHONE) -#define WTF_PLATFORM_CF 1 -#define WTF_USE_PTHREADS 1 #define ENABLE_CONTEXT_MENUS 0 #define ENABLE_DRAG_SUPPORT 0 #define ENABLE_FTPDIR 1 +#define ENABLE_GEOLOCATION 1 +#define ENABLE_ICONDATABASE 0 #define ENABLE_INSPECTOR 0 #define ENABLE_MAC_JAVA_BRIDGE 0 -#define ENABLE_ICONDATABASE 0 -#define ENABLE_GEOLOCATION 1 #define ENABLE_NETSCAPE_PLUGIN_API 0 -#define HAVE_READLINE 1 +#define ENABLE_ORIENTATION_EVENTS 1 #define ENABLE_REPAINT_THROTTLING 1 +#define HAVE_READLINE 1 +#define WTF_PLATFORM_CF 1 +#define WTF_USE_PTHREADS 1 #endif #if PLATFORM(WIN) @@ -579,6 +599,14 @@ #define ENABLE_NETSCAPE_PLUGIN_API 1 #endif +#if !defined(WTF_USE_PLUGIN_HOST_PROCESS) +#define WTF_USE_PLUGIN_HOST_PROCESS 0 +#endif + +#if !defined(ENABLE_ORIENTATION_EVENTS) +#define ENABLE_ORIENTATION_EVENTS 0 +#endif + #if !defined(ENABLE_OPCODE_STATS) #define ENABLE_OPCODE_STATS 0 #endif @@ -637,7 +665,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #elif PLATFORM(X86) && PLATFORM(MAC) #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 -#elif PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) +#elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) /* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ #define ENABLE_JIT 0 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0 @@ -656,8 +684,11 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #elif PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100 #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 -#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX) +#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX) #define ENABLE_JIT 1 + #if PLATFORM(ARM_THUMB2) + #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0 + #endif #endif #endif /* PLATFORM(QT) */ @@ -703,7 +734,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #if (PLATFORM(X86) && PLATFORM(MAC)) \ || (PLATFORM(X86_64) && PLATFORM(MAC)) \ /* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ \ - || (PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) && 0) \ + || (PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) && 0) \ || (PLATFORM(X86) && PLATFORM(WIN)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 @@ -713,7 +744,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #if (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ || (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC)) \ || (PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100) \ - || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX)) + || (PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h index 77835ad..1a0b1fe 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h @@ -50,7 +50,7 @@ namespace WTF { ~RefPtr() { T* ptr = m_ptr; derefIfNotNull(ptr); } - template RefPtr(const RefPtr& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); } + template RefPtr(const RefPtr& o) : m_ptr(static_cast(o.get())) { if (T* ptr = static_cast(m_ptr)) ptr->ref(); } T* get() const { return m_ptr; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h index 7cba4e4..e1fc5b4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h @@ -63,6 +63,13 @@ namespace WTF { template struct AlignedBuffer { WTF_ALIGNED(AlignedBufferChar, buffer[size], 32); }; template struct AlignedBuffer { WTF_ALIGNED(AlignedBufferChar, buffer[size], 64); }; + template + void swap(AlignedBuffer& a, AlignedBuffer& b) + { + for (size_t i = 0; i < size; ++i) + std::swap(a.buffer[i], b.buffer[i]); + } + template class VectorDestructor; @@ -404,6 +411,27 @@ namespace WTF { Base::deallocateBuffer(bufferToDeallocate); } + void swap(VectorBuffer& other) + { + if (buffer() == inlineBuffer() && other.buffer() == other.inlineBuffer()) { + WTF::swap(m_inlineBuffer, other.m_inlineBuffer); + std::swap(m_capacity, other.m_capacity); + } else if (buffer() == inlineBuffer()) { + m_buffer = other.m_buffer; + other.m_buffer = other.inlineBuffer(); + WTF::swap(m_inlineBuffer, other.m_inlineBuffer); + std::swap(m_capacity, other.m_capacity); + } else if (other.buffer() == other.inlineBuffer()) { + other.m_buffer = m_buffer; + m_buffer = inlineBuffer(); + WTF::swap(m_inlineBuffer, other.m_inlineBuffer); + std::swap(m_capacity, other.m_capacity); + } else { + std::swap(m_buffer, other.m_buffer); + std::swap(m_capacity, other.m_capacity); + } + } + void restoreInlineBufferIfNeeded() { if (m_buffer) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h index d59439d..7016a03 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h @@ -26,7 +26,11 @@ #include #if USE(QT4_UNICODE) +#if COMPILER(WINSCW) || COMPILER(RVCT) +#include "wtf/unicode/qt4/UnicodeQt4.h" +#else #include "qt4/UnicodeQt4.h" +#endif #elif USE(ICU_UNICODE) #include #elif USE(GLIB_UNICODE) diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp index 16b1ecc..4390b5b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp @@ -1309,7 +1309,7 @@ class RegexGenerator : private MacroAssembler { loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output); #endif #elif PLATFORM(ARM) -#if !PLATFORM_ARM_ARCH(7) +#if PLATFORM(ARM_TRADITIONAL) push(ARMRegisters::lr); #endif push(ARMRegisters::r4); diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 16d854d..e13219b 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,8 +4,8 @@ This is a snapshot of the Qt port of WebKit from The commit imported was from the - origin/qtwebkit-4.6-staging branch/tag + qtwebkit-4.6-snapshot-24092009 branch/tag and has the sha1 checksum - f572f72dce91be9a4525941c87d1b0a8c383ba39 + 75c44947a340d74a9e0098a3dfffabce0c9512ef diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 8a278ce..5d83c7b 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,2660 @@ +2009-09-24 Oswald Buddenhagen + + Reviewed by Simon Hausmann. + + Fix QApp::translate() calls to provide the correct class name without + a trailing comma. + + * platform/qt/Localizations.cpp: + (WebCore::localizedMediaTimeDescription): + +2009-09-24 Geoffrey Garen + + More build fix: Removed JSSharedWorkerContextCustom.cpp from project + files, since it no longer exists in the repository. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + +2009-09-24 Geoffrey Garen + + Windows build fix: Declare set/unsetPendingActivity public, so + SharedWorkerScriptLoader can call them. + + * dom/ActiveDOMObject.h: + +2009-09-24 Geoffrey Garen + + Fixed a bit of the Windows build. + + * workers/SharedWorker.idl: Declare a custom mark function. (I accidentally + removed this in my last patch.) + * WebCore.xcodeproj/project.pbxproj: Added JSSharedWorkerCustom.cpp back + to the build. (I accidentally removed this in my last patch.) + +2009-09-23 Geoffrey Garen + + 32-bit build fix: restore previous cast that I thought was unnecessary. + + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::didSendData): + (WebCore::XMLHttpRequest::didReceiveData): + +2009-09-23 Geoffrey Garen + + Reviewed by Sam Weinig. + + Bring a little sanity to this crazy EventTarget world of ours + https://bugs.webkit.org/show_bug.cgi?id=29701 + + Lots of EventTarget refactoring to achieve a single shared implementation + that fixes some of the performance and correctness bugs of the many individual + implementations, and makes reasoning about EventTargets and EventListeners + much easier. + + The basic design is this: + - EventTarget manages a set of EventListeners. + - onXXX EventListener attributes forward to standard EventTarget APIs. + - Since the onXXX code is repetitive, it is usually done with macros + of the form DEFINE_ATTRIBUTE_EVENT_LISTENER(attributeName). + - EventTarget provides a shared implementation of dispatchEvent, + which subclasses with special event dispatch rules, like Node, override. + - To support Node, which lazily instantiates its EventTarget data, + EventTarget has no data members, and instead makes a virtual call + to get its data from wherever its subclass chose to store it. + + Code that used to call dispatchEvent, passing an ExceptionCode paratmeter, + even though no exception could be thrown, has been changed not to do so, + to improve clarity and performance. + + Code that used to call a special dispatchXXXEvent function, which just + turned around and called dispatchEvent, has been changed to call + dispatchEvent, to improve clarity and performance. + + * WebCore.base.exp: + * WebCore.xcodeproj/project.pbxproj: Another day in the life of a WebKit + engineer. + + * bindings/js/JSDOMBinding.cpp: + (WebCore::isObservableThroughDOM): Updated for Node API change. Added + "is not in the document but is firing event listeners" as a condition + that makes a Node observable in the DOM, so that event listeners firing + on removed nodes are not destroyed midstream. (This was a long-standing + bug that was somewhat hidden by the old implementation's habit of + copying the RegisteredEventListener vector before firing events, which + would keep almost all the relevant objects from being destroyed.) + + * bindings/js/JSEventListener.cpp: + (WebCore::JSEventListener::handleEvent): Removed the isWindowEvent flag + because it was one of the most elaborately planned no-ops in the history + of software crime, and one of the reasons clients thought they needed more + than one dispatchEvent function even though they didn't. + * bindings/js/JSEventListener.h: + + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::markChildren): + (WebCore::JSMessagePort::markChildren): + * bindings/js/JSNodeCustom.cpp: + (WebCore::JSNode::markChildren): + * bindings/js/JSAbstractWorkerCustom.cpp: + * bindings/js/JSDOMApplicationCacheCustom.cpp: + * bindings/js/JSDedicatedWorkerContextCustom.cpp: + * bindings/js/JSEventSourceCustom.cpp: + * bindings/js/JSMessagePortCustom.cpp: + * bindings/js/JSSharedWorkerContextCustom.cpp: Removed. + * bindings/js/JSWebSocketCustom.cpp: + * bindings/js/JSWorkerContextCustom.cpp: + (WebCore::JSWorkerContext::markChildren): + * bindings/js/JSWorkerCustom.cpp: + * bindings/js/JSXMLHttpRequestCustom.cpp: + (WebCore::JSXMLHttpRequest::markChildren): + * bindings/js/JSXMLHttpRequestUploadCustom.cpp: + (WebCore::JSXMLHttpRequestUpload::markChildren): EventListener marking is + now autogenerated. Classes that still have custom mark functions for other + reasons now call a shared EventTarget API to mark their EventListeners. + + * bindings/objc/ObjCEventListener.h: + * bindings/objc/ObjCEventListener.mm: + (WebCore::ObjCEventListener::handleEvent): Bye bye isWindowEvent. + + * bindings/scripts/CodeGeneratorJS.pm: Autogeneration support for + marking and invalidating event listeners. + + * dom/CharacterData.cpp: + (WebCore::CharacterData::dispatchModifiedEvent): + * dom/ContainerNode.cpp: + (WebCore::ContainerNode::insertBefore): + (WebCore::ContainerNode::replaceChild): + (WebCore::willRemoveChild): + (WebCore::ContainerNode::appendChild): + (WebCore::dispatchChildInsertionEvents): + (WebCore::dispatchChildRemovalEvents): + * dom/Document.cpp: + (WebCore::Document::removeAllEventListeners): + (WebCore::Document::implicitClose): + (WebCore::Document::setFocusedNode): + (WebCore::Document::dispatchWindowEvent): + (WebCore::Document::dispatchWindowLoadEvent): + (WebCore::Document::finishedParsing): + * dom/Document.h: Use dispatchEvent directly. + + * dom/Element.h: Moved a few event listener attributes down from Node, + since they don't apply to all Nodes, only Elements. + + * dom/EventListener.h: Removed isWindowEvent parameter. + + * dom/EventNames.h: Added the "display" event name, so it works correctly + with attribute macros, and for performance. + + * dom/EventTarget.cpp: + (WebCore::forbidEventDispatch): + (WebCore::allowEventDispatch): + (WebCore::eventDispatchForbidden): Made this code (embarrasingly) thread + safe, since it's now called on multiple threads. (Currently, we only forbid + event dispatch on the main thread. If we ever want to forbid event dispatch + on secondary threads, we can improve it then.) + + (WebCore::EventTarget::addEventListener): + (WebCore::EventTarget::removeEventListener): + (WebCore::EventTarget::setAttributeEventListener): + (WebCore::EventTarget::getAttributeEventListener): + (WebCore::EventTarget::clearAttributeEventListener): + (WebCore::EventTarget::dispatchEvent): + (WebCore::EventTarget::fireEventListeners): + (WebCore::EventTarget::getEventListeners): + (WebCore::EventTarget::removeAllEventListeners): + * dom/EventTarget.h: + (WebCore::FiringEventEndIterator::FiringEventEndIterator): + (WebCore::EventTarget::ref): + (WebCore::EventTarget::deref): + (WebCore::EventTarget::markEventListeners): + (WebCore::EventTarget::invalidateEventListeners): + (WebCore::EventTarget::isFiringEventListeners): + (WebCore::EventTarget::hasEventListeners): The ONE TRUE IMPLEMENTATION of + EventTarget APIs, crafted from an amalgam of all the different versions + we used to have. The most significant change here is that we no longer + make a copy of an EventListener vector before firing the events in the + vector -- instead, we use a reference to the original vector, along with + a notification mechanism for the unlikely case when an EventListener is + removed from the vector. This substantially reduces malloc, copying, and + refcount overhead, and complexity. + + * dom/InputElement.cpp: + (WebCore::InputElement::setValueFromRenderer): + * dom/MessageEvent.h: + (WebCore::MessageEvent::create): Use dispatchEvent directly. + + * dom/MessagePort.cpp: + (WebCore::MessagePort::dispatchMessages): + (WebCore::MessagePort::eventTargetData): + (WebCore::MessagePort::ensureEventTargetData): + * dom/MessagePort.h: + (WebCore::MessagePort::setOnmessage): + (WebCore::MessagePort::onmessage): + * dom/MessagePort.idl: Removed custom EventTarget implementation. + + * dom/MutationEvent.h: + (WebCore::MutationEvent::create): Added some default values so callers + can construct MutationEvents more easily, without calling a custom dispatch + function. + + * dom/Node.cpp: + (WebCore::Node::addEventListener): + (WebCore::Node::removeEventListener): + (WebCore::Node::eventTargetData): + (WebCore::Node::ensureEventTargetData): + (WebCore::Node::handleLocalEvents): + (WebCore::Node::dispatchEvent): + (WebCore::Node::dispatchGenericEvent): + (WebCore::Node::dispatchSubtreeModifiedEvent): + (WebCore::Node::dispatchUIEvent): + (WebCore::Node::dispatchKeyEvent): + (WebCore::Node::dispatchMouseEvent): + (WebCore::Node::dispatchWheelEvent): + (WebCore::Node::dispatchFocusEvent): + (WebCore::Node::dispatchBlurEvent): + * dom/Node.h: + (WebCore::Node::preDispatchEventHandler): + (WebCore::Node::postDispatchEventHandler): + * dom/Node.idl: + * dom/NodeRareData.h: + (WebCore::NodeRareData::eventTargetData): + (WebCore::NodeRareData::ensureEventTargetData): Use the shared EventTarget + interface, and call dispatchEvent directly instead of custom dispatchXXXEvent + functions that just forwarded to dispatchEvent. + + * dom/RegisteredEventListener.cpp: + * dom/RegisteredEventListener.h: + (WebCore::RegisteredEventListener::RegisteredEventListener): + (WebCore::operator==): This is just a simple struct now, since we no longer + do a complicated copy / refCount / isRemoved dance just to honor the rule + that an EventListener can be removed during event dispatch. + + * history/CachedFrame.cpp: + (WebCore::CachedFrameBase::restore): Removed another custom dispatchEvent. + + * html/HTMLBodyElement.cpp: + * html/HTMLBodyElement.h: Use the shared EventTarget API. + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::dispatchFormControlChangeEvent): + (WebCore::HTMLFormControlElement::checkValidity): + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::handleLocalEvents): + (WebCore::HTMLFormElement::prepareSubmit): + (WebCore::HTMLFormElement::reset): + * html/HTMLFormElement.h: Use the standard dispatchEvent API. + + * html/HTMLFrameSetElement.cpp: + * html/HTMLFrameSetElement.h: Use the shared EventTarget API. + + * html/HTMLImageLoader.cpp: + (WebCore::HTMLImageLoader::dispatchLoadEvent): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::onSearch): + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::loadInternal): + * html/HTMLScriptElement.cpp: + (WebCore::HTMLScriptElement::dispatchLoadEvent): + (WebCore::HTMLScriptElement::dispatchErrorEvent): + * html/HTMLSourceElement.cpp: + (WebCore::HTMLSourceElement::errorEventTimerFired): + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::notifyFinished): Use the standard dispatchEvent API. + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::handleEvent): + * inspector/InspectorDOMAgent.h: + * inspector/InspectorDOMStorageResource.cpp: + (WebCore::InspectorDOMStorageResource::handleEvent): + * inspector/InspectorDOMStorageResource.h: + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::stopLoading): + (WebCore::FrameLoader::canCachePageContainingThisFrame): + (WebCore::FrameLoader::logCanCacheFrameDecision): + (WebCore::HashChangeEventTask::performTask): + (WebCore::FrameLoader::pageHidden): No more isWindowEvent. + + * loader/ImageDocument.cpp: + (WebCore::ImageEventListener::handleEvent): + * loader/appcache/ApplicationCacheGroup.cpp: + (WebCore::CallCacheListenerTask::performTask): + * loader/appcache/ApplicationCacheHost.cpp: + (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): + * loader/appcache/ApplicationCacheHost.h: + * loader/appcache/DOMApplicationCache.cpp: + (WebCore::DOMApplicationCache::eventTargetData): + (WebCore::DOMApplicationCache::ensureEventTargetData): + * loader/appcache/DOMApplicationCache.h: + * loader/appcache/DOMApplicationCache.idl: Switched to the standard + EventTarget API. As a part of this, I switched this class from using a + custom internal event name enumeration to using the standard EventNames. + + * notifications/Notification.cpp: + (WebCore::Notification::eventTargetData): + (WebCore::Notification::ensureEventTargetData): + * notifications/Notification.h: + (WebCore::Notification::scriptExecutionContext): + * notifications/Notification.idl: Switched to the standard EventTarget API. + + * page/DOMWindow.cpp: + (WebCore::PostMessageTimer::event): + (WebCore::windowsWithUnloadEventListeners): + (WebCore::windowsWithBeforeUnloadEventListeners): + (WebCore::allowsBeforeUnloadListeners): + (WebCore::DOMWindow::dispatchAllPendingBeforeUnloadEvents): + (WebCore::DOMWindow::pendingUnloadEventListeners): + (WebCore::DOMWindow::dispatchAllPendingUnloadEvents): Changed the "pending" + unload / beforeunload listener tracker just to track which windows had + such listeners, instead of actually keeping a copy of the listeners. Now, + this code can use the standard EventTarget API. + + (WebCore::DOMWindow::~DOMWindow): + (WebCore::DOMWindow::postMessageTimerFired): + (WebCore::DOMWindow::addEventListener): + (WebCore::DOMWindow::removeEventListener): + (WebCore::DOMWindow::dispatchLoadEvent): + (WebCore::DOMWindow::dispatchEvent): + (WebCore::DOMWindow::removeAllEventListeners): + (WebCore::DOMWindow::captureEvents): + (WebCore::DOMWindow::releaseEvents): + (WebCore::DOMWindow::eventTargetData): + (WebCore::DOMWindow::ensureEventTargetData): + * page/DOMWindow.h: + * page/DOMWindow.idl: Use the standard EventTarget APIs. + + * page/EventHandler.cpp: + (WebCore::EventHandler::canMouseDownStartSelect): + (WebCore::EventHandler::canMouseDragExtendSelect): + (WebCore::EventHandler::sendResizeEvent): + (WebCore::EventHandler::sendScrollEvent): Use dispatchEvent directly. + + * page/EventSource.cpp: + (WebCore::EventSource::endRequest): + (WebCore::EventSource::didReceiveResponse): + (WebCore::EventSource::parseEventStreamLine): + (WebCore::EventSource::stop): + (WebCore::EventSource::createMessageEvent): + (WebCore::EventSource::eventTargetData): + (WebCore::EventSource::ensureEventTargetData): + * page/EventSource.h: + * page/EventSource.idl: Use the standard EventTarget APIs. + + * page/FocusController.cpp: + (WebCore::dispatchEventsOnWindowAndFocusedNode): + (WebCore::FocusController::setFocusedFrame): + * page/Frame.cpp: + (WebCore::Frame::shouldClose): + * page/Frame.h: + * page/Page.cpp: + (WebCore::networkStateChanged): + * page/animation/AnimationController.cpp: + (WebCore::AnimationControllerPrivate::updateStyleIfNeededDispatcherFired): + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::valueChanged): + * rendering/RenderTextControl.cpp: + (WebCore::RenderTextControl::selectionChanged): + * rendering/RenderTextControlMultiLine.cpp: + (WebCore::RenderTextControlMultiLine::subtreeHasChanged): Use dispatchEvent. + + * svg/SVGElement.cpp: + (WebCore::hasLoadListener): Rewritten for new EventTarget API. + + * svg/SVGElementInstance.cpp: + (WebCore::dummyEventTargetData): + (WebCore::SVGElementInstance::addEventListener): + (WebCore::SVGElementInstance::removeEventListener): + (WebCore::SVGElementInstance::removeAllEventListeners): + (WebCore::SVGElementInstance::dispatchEvent): + (WebCore::SVGElementInstance::eventTargetData): + (WebCore::SVGElementInstance::ensureEventTargetData): Use the EventTarget API. + + * svg/SVGElementInstance.h: + * svg/SVGImageLoader.cpp: + (WebCore::SVGImageLoader::dispatchLoadEvent): + * svg/SVGScriptElement.cpp: + (WebCore::SVGScriptElement::dispatchErrorEvent): Use dispatchEvent directly. + + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::transferEventListenersToShadowTree): Updated for + new EventTarget API. + + * svg/animation/SVGSMILElement.cpp: + (WebCore::ConditionEventListener::handleEvent): No more isWindowEvent. + + * websockets/WebSocket.cpp: + (WebCore::ProcessWebSocketEventTask::create): + (WebCore::ProcessWebSocketEventTask::performTask): + (WebCore::ProcessWebSocketEventTask::ProcessWebSocketEventTask): + (WebCore::WebSocket::didConnect): + (WebCore::WebSocket::didReceiveMessage): + (WebCore::WebSocket::didClose): + (WebCore::WebSocket::eventTargetData): + (WebCore::WebSocket::ensureEventTargetData): + * websockets/WebSocket.h: + * websockets/WebSocket.idl: + * workers/AbstractWorker.cpp: + (WebCore::AbstractWorker::eventTargetData): + (WebCore::AbstractWorker::ensureEventTargetData): + * workers/AbstractWorker.h: + * workers/AbstractWorker.idl: + * workers/DedicatedWorkerContext.cpp: + * workers/DedicatedWorkerContext.h: + * workers/DedicatedWorkerContext.idl: + * workers/DefaultSharedWorkerRepository.cpp: + (WebCore::SharedWorkerConnectTask::performTask): + (WebCore::SharedWorkerScriptLoader::load): + (WebCore::SharedWorkerScriptLoader::notifyFinished): + * workers/SharedWorker.idl: + * workers/SharedWorkerContext.cpp: + (WebCore::createConnectEvent): + * workers/SharedWorkerContext.h: + * workers/SharedWorkerContext.idl: + * workers/Worker.cpp: + (WebCore::Worker::notifyFinished): + * workers/Worker.h: + * workers/Worker.idl: + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::eventTargetData): + (WebCore::WorkerContext::ensureEventTargetData): + * workers/WorkerContext.h: + * workers/WorkerContext.idl: + * workers/WorkerMessagingProxy.cpp: + (WebCore::MessageWorkerContextTask::performTask): + (WebCore::MessageWorkerTask::performTask): + (WebCore::WorkerExceptionTask::performTask): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::callReadyStateChangeListener): + (WebCore::XMLHttpRequest::createRequest): + (WebCore::XMLHttpRequest::abort): + (WebCore::XMLHttpRequest::networkError): + (WebCore::XMLHttpRequest::abortError): + (WebCore::XMLHttpRequest::didSendData): + (WebCore::XMLHttpRequest::didReceiveData): + (WebCore::XMLHttpRequest::eventTargetData): + (WebCore::XMLHttpRequest::ensureEventTargetData): + * xml/XMLHttpRequest.h: + * xml/XMLHttpRequest.idl: + * xml/XMLHttpRequestProgressEvent.h: + (WebCore::XMLHttpRequestProgressEvent::create): + * xml/XMLHttpRequestUpload.cpp: + (WebCore::XMLHttpRequestUpload::eventTargetData): + (WebCore::XMLHttpRequestUpload::ensureEventTargetData): + * xml/XMLHttpRequestUpload.h: + * xml/XMLHttpRequestUpload.idl: Use new EventTarget API. + +2009-09-23 Kent Tamura + + Reviewed by Darin Adler. + + - Support for maxLength of