From e1f691d84dad17c5ee47c97c31ae743093ad8bc9 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 8 Oct 2009 09:15:20 +0200 Subject: Ensure that qmake doesn't lose the error code when processing subdirs When processing a project in a subdirs template failed for whatever reason then qmake would lose the result of that and would return an error code of 0 if the subdirs project file itself was processed fine. So now it ensures that any errors arising from processing a project referenced in a subdirs project file are not lost so that the error code returned from qmake will indicate an error actually occured. Task-number: QTBUG-4065 Reviewed-by: mariusSO Original-commit: c15b370c9db16fdbfd9e7bec89ee9bf8c1110827 --- qmake/generators/metamakefile.cpp | 17 ++++++++++++----- qmake/generators/metamakefile.h | 2 +- qmake/main.cpp | 6 +++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 5915fcf..819cdaf 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -291,6 +291,7 @@ SubdirsMetaMakefileGenerator::init() if(init_flag) return false; init_flag = true; + bool hasError = false; if(Option::recursive) { QString old_output_dir = Option::output_dir; @@ -336,14 +337,18 @@ SubdirsMetaMakefileGenerator::init() } qmake_setpwd(sub->input_dir); Option::output_dir = sub->output_dir; - sub_proj->read(subdir.fileName()); + bool tmpError = !sub_proj->read(subdir.fileName()); if(!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { fprintf(stderr, "Project file(%s) not recursed because all requirements not met:\n\t%s\n", subdir.fileName().toLatin1().constData(), sub_proj->values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData()); delete sub; delete sub_proj; + Option::output_dir = old_output_dir; + qmake_setpwd(oldpwd); continue; + } else { + hasError |= tmpError; } sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name); if(0 && sub->makefile->type() == SUBDIRSMETATYPE) { @@ -351,7 +356,7 @@ SubdirsMetaMakefileGenerator::init() } else { const QString output_name = Option::output.fileName(); Option::output.setFileName(sub->output_file); - sub->makefile->write(sub->output_dir); + hasError |= !sub->makefile->write(sub->output_dir); delete sub; qmakeClearCaches(); sub = 0; @@ -376,7 +381,7 @@ SubdirsMetaMakefileGenerator::init() self->makefile->init(); subs.append(self); - return true; + return !hasError; } bool @@ -482,7 +487,7 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) } MetaMakefileGenerator * -MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op) +MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op, bool *success) { MetaMakefileGenerator *ret = 0; if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || @@ -492,7 +497,9 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na } if (!ret) ret = new BuildsMetaMakefileGenerator(proj, name, op); - ret->init(); + bool res = ret->init(); + if (success) + *success = res; return ret; } diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h index e69304a..f74f4a2 100644 --- a/qmake/generators/metamakefile.h +++ b/qmake/generators/metamakefile.h @@ -62,7 +62,7 @@ public: virtual ~MetaMakefileGenerator(); - static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true); + static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = 0); static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false); inline QMakeProject *projectFile() const { return project; } diff --git a/qmake/main.cpp b/qmake/main.cpp index 73fdda9..a0346c5 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -168,7 +168,11 @@ int runQMake(int argc, char **argv) continue; } - MetaMakefileGenerator *mkfile = MetaMakefileGenerator::createMetaGenerator(&project, QString(), false); + bool success = true; + MetaMakefileGenerator *mkfile = MetaMakefileGenerator::createMetaGenerator(&project, QString(), false, &success); + if (!success) + exit_val = 3; + if(mkfile && !mkfile->write(oldpwd)) { if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) fprintf(stderr, "Unable to generate project file.\n"); -- cgit v0.12 From 26713a8b3fa4b82ea18c314c01b4d7ccb54d1125 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 26 Oct 2009 11:02:52 +0100 Subject: QDom: make tests fail only on Windows Reviewed-by: Carlos Duclos --- tests/auto/qdom/tst_qdom.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index 0d58554e..f3a7909 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -322,7 +322,9 @@ void tst_QDom::toString_01_data() */ void tst_QDom::toString_01() { +#ifdef Q_OS_WIN QFAIL("make test fail instead of timing out, will be fixed later (QT-2357)"); +#endif QFETCH(QString, fileName); QFile f(fileName); -- cgit v0.12 From d0b0e0ed8ac857d78e497b74bb1c3596273c53ba Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 27 Oct 2009 15:10:46 +0100 Subject: QLibrary on Windows: Do not show error boxes when library load fails When loading a library fails, the error message "The application or DLL ... is not a valid Windows image. Please check this against your installation diskette." is shown, which is not very helpful. Task-number: QT-2357 Reviewed-by: Marius Storm-Olsen --- src/corelib/plugin/qlibrary.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 2b463a1..6496876 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -659,7 +659,10 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) #endif if (!pHnd) { #ifdef Q_OS_WIN + //avoid 'Bad Image' message box + UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, DONT_RESOLVE_DLL_REFERENCES); + SetErrorMode(oldmode); #else # if defined(Q_OS_SYMBIAN) //Guard against accidentally trying to load non-plugin libraries by making sure the stub exists -- cgit v0.12 From 2d0b29c312ddf422595ce9debb3678bb5c4d51b6 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 27 Oct 2009 16:04:29 +0100 Subject: QAbstractSocket: wait with closing until all bytes have been written only disconnect from host when all bytes have been written; i.e. not only check whether the write buffer is empty, but also check whether the socket engine has still bytes to write. This is necessary for HTTP and SOCKS5 socket engine, because they both contain an inner TCP socket which also does buffering. For the native socket engine, there is no difference with this patch. Reviewed-by: Markus Goetz Reviewed-by: Thiago Macieira --- src/network/socket/qabstractsocket.cpp | 22 +++++++++++++++------- src/network/socket/qabstractsocketengine_p.h | 2 ++ src/network/socket/qhttpsocketengine.cpp | 10 ++++++++++ src/network/socket/qhttpsocketengine_p.h | 2 ++ src/network/socket/qnativesocketengine.cpp | 6 ++++++ src/network/socket/qnativesocketengine_p.h | 2 ++ src/network/socket/qsocks5socketengine.cpp | 14 ++++++++++++++ src/network/socket/qsocks5socketengine_p.h | 2 ++ src/network/ssl/qsslsocket.cpp | 2 ++ tests/auto/qsslsocket/tst_qsslsocket.cpp | 4 +--- 10 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 9fb0b47..955fee0 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -669,11 +669,11 @@ bool QAbstractSocketPrivate::canWriteNotification() if (socketEngine) { #if defined (Q_OS_WIN) - if (!writeBuffer.isEmpty()) - socketEngine->setWriteNotificationEnabled(true); + if (!writeBuffer.isEmpty()) + socketEngine->setWriteNotificationEnabled(true); #else - if (writeBuffer.isEmpty()) - socketEngine->setWriteNotificationEnabled(false); + if (writeBuffer.isEmpty() && socketEngine->bytesToWrite() == 0) + socketEngine->setWriteNotificationEnabled(false); #endif } @@ -710,11 +710,17 @@ void QAbstractSocketPrivate::connectionNotification() bool QAbstractSocketPrivate::flush() { Q_Q(QAbstractSocket); - if (!socketEngine || !socketEngine->isValid() || writeBuffer.isEmpty()) { + if (!socketEngine || !socketEngine->isValid() || (writeBuffer.isEmpty() + && socketEngine->bytesToWrite() == 0)) { #if defined (QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::flush() nothing to do: valid ? %s, writeBuffer.isEmpty() ? %s", socketEngine->isValid() ? "yes" : "no", writeBuffer.isEmpty() ? "yes" : "no"); #endif + + // this covers the case when the buffer was empty, but we had to wait for the socket engine to finish + if (state == QAbstractSocket::ClosingState) + q->disconnectFromHost(); + return false; } @@ -751,7 +757,8 @@ bool QAbstractSocketPrivate::flush() } } - if (writeBuffer.isEmpty() && socketEngine && socketEngine->isWriteNotificationEnabled()) + if (writeBuffer.isEmpty() && socketEngine && socketEngine->isWriteNotificationEnabled() + && !socketEngine->bytesToWrite()) socketEngine->setWriteNotificationEnabled(false); if (state == QAbstractSocket::ClosingState) q->disconnectFromHost(); @@ -2347,7 +2354,8 @@ void QAbstractSocket::disconnectFromHostImplementation() } // Wait for pending data to be written. - if (d->socketEngine && d->socketEngine->isValid() && d->writeBuffer.size() > 0) { + if (d->socketEngine && d->socketEngine->isValid() && (d->writeBuffer.size() > 0 + || d->socketEngine->bytesToWrite() > 0)) { d->socketEngine->setWriteNotificationEnabled(true); #if defined(QABSTRACTSOCKET_DEBUG) diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h index c639092..14b3c81 100644 --- a/src/network/socket/qabstractsocketengine_p.h +++ b/src/network/socket/qabstractsocketengine_p.h @@ -126,6 +126,8 @@ public: virtual qint64 pendingDatagramSize() const = 0; #endif + virtual qint64 bytesToWrite() const = 0; + virtual int option(SocketOption option) const = 0; virtual bool setOption(SocketOption option, int value) = 0; diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index fb61dbf..5c28318 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -276,6 +276,16 @@ qint64 QHttpSocketEngine::pendingDatagramSize() const } #endif // QT_NO_UDPSOCKET +qint64 QHttpSocketEngine::bytesToWrite() const +{ + Q_D(const QHttpSocketEngine); + if (d->socket) { + return d->socket->bytesToWrite(); + } else { + return 0; + } +} + int QHttpSocketEngine::option(SocketOption option) const { Q_D(const QHttpSocketEngine); diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h index a423116..76430db 100644 --- a/src/network/socket/qhttpsocketengine_p.h +++ b/src/network/socket/qhttpsocketengine_p.h @@ -110,6 +110,8 @@ public: qint64 pendingDatagramSize() const; #endif // QT_NO_UDPSOCKET + qint64 bytesToWrite() const; + int option(SocketOption option) const; bool setOption(SocketOption option, int value); diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index e7f8401..a150b26 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -754,6 +754,12 @@ qint64 QNativeSocketEngine::write(const char *data, qint64 size) return d->nativeWrite(data, size); } + +qint64 QNativeSocketEngine::bytesToWrite() const +{ + return 0; +} + /*! Reads up to \a maxSize bytes into \a data from the socket. Returns the number of bytes read, or -1 if an error occurred. diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 1f6a243..a03d8f1 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -135,6 +135,8 @@ public: bool hasPendingDatagrams() const; qint64 pendingDatagramSize() const; + qint64 bytesToWrite() const; + qint64 receiveBufferSize() const; void setReceiveBufferSize(qint64 bufferSize); diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 30074cf..bd60ad1 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1235,6 +1235,9 @@ void QSocks5SocketEnginePrivate::_q_controlSocketError(QAbstractSocket::SocketEr if (!readNotificationPending) connectData->readBuffer.clear(); emitReadNotification(); + data->controlSocket->close(); + // cause a disconnect in the outer socket + emitWriteNotification(); } else if (socks5State == Uninitialized || socks5State == AuthenticationMethodsSent || socks5State == Authenticating @@ -1245,6 +1248,7 @@ void QSocks5SocketEnginePrivate::_q_controlSocketError(QAbstractSocket::SocketEr } else { q_func()->setError(data->controlSocket->error(), data->controlSocket->errorString()); emitReadNotification(); + emitWriteNotification(); } } @@ -1623,6 +1627,16 @@ qint64 QSocks5SocketEngine::pendingDatagramSize() const } #endif // QT_NO_UDPSOCKET +qint64 QSocks5SocketEngine::bytesToWrite() const +{ + Q_D(const QSocks5SocketEngine); + if (d->data && d->data->controlSocket) { + return d->data->controlSocket->bytesToWrite(); + } else { + return 0; + } +} + int QSocks5SocketEngine::option(SocketOption option) const { Q_D(const QSocks5SocketEngine); diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h index 7cb0920..2402517 100644 --- a/src/network/socket/qsocks5socketengine_p.h +++ b/src/network/socket/qsocks5socketengine_p.h @@ -100,6 +100,8 @@ public: qint64 pendingDatagramSize() const; #endif // QT_NO_UDPSOCKET + qint64 bytesToWrite() const; + int option(SocketOption option) const; bool setOption(SocketOption option, int value); diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 2c88130..608d772 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -707,6 +707,8 @@ void QSslSocket::close() qDebug() << "QSslSocket::close()"; #endif Q_D(QSslSocket); + if (d->plainSocket) + d->plainSocket->close(); QTcpSocket::close(); // must be cleared, reading/writing not possible on closed socket: diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 2bd1684..db46b66 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -1755,9 +1755,7 @@ void tst_QSslSocket::readFromClosedSocket() socket->close(); QVERIFY(!socket->bytesAvailable()); QVERIFY(!socket->bytesToWrite()); - socket->waitForDisconnected(); - QVERIFY(!socket->bytesAvailable()); - QVERIFY(!socket->bytesToWrite()); + QVERIFY(socket->state() == QAbstractSocket::UnconnectedState); } void tst_QSslSocket::writeBigChunk() -- cgit v0.12 From 2c672ea518265496a0fc7c5de63ca7dda880dd85 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 27 Oct 2009 16:06:36 +0100 Subject: QAbstractSocket: insert timer to prevent timeout This fixes a timeout that occurred on Mac with the gui event dispatcher: we were waiting for a write notification, but timed out when we were in closing state and still waiting for the socket engine to complete writing. Now we close the socket anyway after 2 seconds. Reviewed-by: Thiago Macieira --- src/network/socket/qabstractsocket.cpp | 29 +++++++++++++++++++++++++++-- src/network/socket/qabstractsocket.h | 1 + src/network/socket/qabstractsocket_p.h | 2 ++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 955fee0..89a6e91 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -462,6 +462,7 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() isBuffered(false), blockingTimeout(30000), connectTimer(0), + disconnectTimer(0), connectTimeElapsed(0), hostLookupId(-1), socketType(QAbstractSocket::UnknownSocketType), @@ -497,9 +498,10 @@ void QAbstractSocketPrivate::resetSocketLayer() socketEngine = 0; cachedSocketDescriptor = -1; } - if (connectTimer) { + if (connectTimer) connectTimer->stop(); - } + if (disconnectTimer) + disconnectTimer->stop(); } /*! \internal @@ -1094,6 +1096,15 @@ void QAbstractSocketPrivate::_q_abortConnectionAttempt() } } +void QAbstractSocketPrivate::_q_forceDisconnect() +{ + Q_Q(QAbstractSocket); + if (socketEngine && socketEngine->isValid() && state == QAbstractSocket::ClosingState) { + socketEngine->close(); + q->disconnectFromHost(); + } +} + /*! \internal Reads data from the socket layer into the read buffer. Returns @@ -2356,6 +2367,20 @@ void QAbstractSocket::disconnectFromHostImplementation() // Wait for pending data to be written. if (d->socketEngine && d->socketEngine->isValid() && (d->writeBuffer.size() > 0 || d->socketEngine->bytesToWrite() > 0)) { + // hack: when we are waiting for the socket engine to write bytes (only + // possible when using Socks5 or HTTP socket engine), then close + // anyway after 2 seconds. This is to prevent a timeout on Mac, where we + // sometimes just did not get the write notifier from the underlying + // CFSocket and no progress was made. + if (d->writeBuffer.size() == 0 && d->socketEngine->bytesToWrite() > 0) { + if (!d->disconnectTimer) { + d->disconnectTimer = new QTimer(this); + connect(d->disconnectTimer, SIGNAL(timeout()), this, + SLOT(_q_forceDisconnect()), Qt::DirectConnection); + } + if (!d->disconnectTimer->isActive()) + d->disconnectTimer->start(2000); + } d->socketEngine->setWriteNotificationEnabled(true); #if defined(QABSTRACTSOCKET_DEBUG) diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h index 5d94a01..5cfae17 100644 --- a/src/network/socket/qabstractsocket.h +++ b/src/network/socket/qabstractsocket.h @@ -216,6 +216,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_startConnecting(const QHostInfo &)) Q_PRIVATE_SLOT(d_func(), void _q_abortConnectionAttempt()) Q_PRIVATE_SLOT(d_func(), void _q_testConnection()) + Q_PRIVATE_SLOT(d_func(), void _q_forceDisconnect()) #ifdef QT3_SUPPORT public: diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index 8ccddd3..acf82bf 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -93,6 +93,7 @@ public: void _q_startConnecting(const QHostInfo &hostInfo); void _q_testConnection(); void _q_abortConnectionAttempt(); + void _q_forceDisconnect(); bool readSocketNotifierCalled; bool readSocketNotifierState; @@ -148,6 +149,7 @@ public: int blockingTimeout; QTimer *connectTimer; + QTimer *disconnectTimer; int connectTimeElapsed; int hostLookupId; -- cgit v0.12 From ad342b62f1b4c6b9ca0997ddb937f3871f6d875b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 27 Oct 2009 18:19:53 +0100 Subject: Make QProcess report errors from a failed subprocess start. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: João Abecasis --- src/corelib/io/qprocess_unix.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 99296c7..f040d16 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -108,6 +108,10 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE +// POSIX requires PIPE_BUF to be 512 or larger +// so we will use 512 +static const int errorBufferMax = 512; + #ifdef Q_OS_INTEGRITY static inline char *strdup(const char *data) { @@ -752,18 +756,19 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv } // notify failure + QString error = qt_error_string(errno); #if defined (QPROCESS_DEBUG) - fprintf(stderr, "QProcessPrivate::execChild() failed, notifying parent process\n"); + fprintf(stderr, "QProcessPrivate::execChild() failed (%s), notifying parent process\n", qPrintable(error)); #endif - qt_safe_write(childStartedPipe[1], "", 1); + qt_safe_write(childStartedPipe[1], error.data(), error.length() * sizeof(QChar)); qt_safe_close(childStartedPipe[1]); childStartedPipe[1] = -1; } bool QProcessPrivate::processStarted() { - char c; - int i = qt_safe_read(childStartedPipe[0], &c, 1); + ushort buf[errorBufferMax]; + int i = qt_safe_read(childStartedPipe[0], &buf, sizeof buf); if (startupSocketNotifier) { startupSocketNotifier->setEnabled(false); startupSocketNotifier->deleteLater(); @@ -775,6 +780,11 @@ bool QProcessPrivate::processStarted() #if defined (QPROCESS_DEBUG) qDebug("QProcessPrivate::processStarted() == %s", i <= 0 ? "true" : "false"); #endif + + // did we read an error message? + if (i > 0) + q_func()->setErrorString(QString::fromUtf16(buf, i / sizeof(QChar))); + return i <= 0; } -- cgit v0.12 From b3435aa7ae1eb4a0766b82560980e49039aea1d8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 27 Oct 2009 17:54:03 +0100 Subject: Autotest: Add some debugging info as to why the subprocess fails to start --- tests/auto/qudpsocket/tst_qudpsocket.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp index 7ea2163..9418be0 100644 --- a/tests/auto/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp @@ -719,6 +719,8 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest() QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(serverProcess.waitForStarted(3000), + qPrintable("Failed to start subprocess: " + serverProcess.errorString())); // Wait until the server has started and reports success. while (!serverProcess.canReadLine()) @@ -732,6 +734,9 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest() clientProcess.start(QString::fromLatin1("clientserver/clientserver connectedclient %1 %2") .arg(QLatin1String("127.0.0.1")).arg(serverPort), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(clientProcess.waitForStarted(3000), + qPrintable("Failed to start subprocess: " + clientProcess.errorString())); + // Wait until the server has started and reports success. while (!clientProcess.canReadLine()) QVERIFY(clientProcess.waitForReadyRead(3000)); @@ -779,6 +784,8 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest() QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(serverProcess.waitForStarted(3000), + qPrintable("Failed to start subprocess: " + serverProcess.errorString())); // Wait until the server has started and reports success. while (!serverProcess.canReadLine()) @@ -792,6 +799,9 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest() clientProcess.start(QString::fromLatin1("clientserver/clientserver unconnectedclient %1 %2") .arg(QLatin1String("127.0.0.1")).arg(serverPort), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(clientProcess.waitForStarted(3000), + qPrintable("Failed to start subprocess: " + clientProcess.errorString())); + // Wait until the server has started and reports success. while (!clientProcess.canReadLine()) QVERIFY(clientProcess.waitForReadyRead(3000)); -- cgit v0.12 From a8b5aefc48d619c1fc0ff1e97c8e3a42baccb7c0 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 27 Oct 2009 19:07:03 +0100 Subject: QDom autotests: test is not failing anymore removing the temporary QFAIL Reviewed-by: Carlos Duclos --- tests/auto/qdom/tst_qdom.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index f3a7909..6637202 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -322,9 +322,6 @@ void tst_QDom::toString_01_data() */ void tst_QDom::toString_01() { -#ifdef Q_OS_WIN - QFAIL("make test fail instead of timing out, will be fixed later (QT-2357)"); -#endif QFETCH(QString, fileName); QFile f(fileName); -- cgit v0.12 From 5c7345809d7f620981f92cc2e93beb14b10504a9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Oct 2009 10:54:09 +0200 Subject: Add the ability for the match-rule builder to add argument matching. I'll use this feature to match the NameOwnerChanged signal from the bus. --- src/dbus/qdbusconnection.cpp | 4 ++-- src/dbus/qdbusconnection_p.h | 1 + src/dbus/qdbusintegrator.cpp | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index bb0d06f..bead369 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -609,7 +609,7 @@ bool QDBusConnection::connect(const QString &service, const QString &path, const QString owner = d->getNameOwner(service); // we don't care if the owner is empty hook.signature = signature; // it might get started later - if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false)) + if (!d->prepareHook(hook, key, service, owner, path, interface, name, QStringList(), receiver, slot, 0, false)) return false; // don't connect // avoid duplicating: @@ -663,7 +663,7 @@ bool QDBusConnection::disconnect(const QString &service, const QString &path, co QString owner = d->getNameOwner(service); // we don't care of owner is empty hook.signature = signature; - if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false)) + if (!d->prepareHook(hook, key, service, owner, path, interface, name, QStringList(), receiver, slot, 0, false)) return false; // don't disconnect // avoid duplicating: diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index ab96457..df51c27 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -278,6 +278,7 @@ public: static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, const QString &service, const QString &owner, const QString &path, const QString &interface, const QString &name, + const QStringList &argMatch, QObject *receiver, const char *signal, int minMIdx, bool buildSignature); static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *); diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index fb2dd77..9e41708 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -392,7 +392,7 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v static QByteArray buildMatchRule(const QString &service, const QString & /*owner*/, const QString &objectPath, const QString &interface, - const QString &member, const QString & /*signature*/) + const QString &member, const QStringList &argMatch, const QString & /*signature*/) { QString result = QLatin1String("type='signal',"); QString keyValue = QLatin1String("%1='%2',"); @@ -406,6 +406,14 @@ static QByteArray buildMatchRule(const QString &service, const QString & /*owner if (!member.isEmpty()) result += keyValue.arg(QLatin1String("member"), member); + // add the argument string-matching now + if (!argMatch.isEmpty()) { + keyValue = QLatin1String("arg%1='%2',"); + for (int i = 0; i < argMatch.count(); ++i) + if (!argMatch.at(i).isNull()) + result += keyValue.arg(i).arg(argMatch.at(i)); + } + result.chop(1); // remove ending comma return result.toLatin1(); } @@ -1195,6 +1203,7 @@ int QDBusConnectionPrivate::findSlot(QObject* obj, const QByteArray &normalizedN bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, const QString &service, const QString &owner, const QString &path, const QString &interface, const QString &name, + const QStringList &argMatch, QObject *receiver, const char *signal, int minMIdx, bool buildSignature) { @@ -1235,7 +1244,7 @@ bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hoo hook.signature += QLatin1String( QDBusMetaType::typeToSignature( hook.params.at(i) ) ); } - hook.matchRule = buildMatchRule(service, owner, path, interface, mname, hook.signature); + hook.matchRule = buildMatchRule(service, owner, path, interface, mname, argMatch, hook.signature); return true; // connect to this signal } @@ -2027,7 +2036,7 @@ void QDBusConnectionPrivate::connectRelay(const QString &service, const QString SignalHook hook; QString key; - if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal, + if (!prepareHook(hook, key, service, owner, path, interface, QString(), QStringList(), receiver, signal, QDBusAbstractInterface::staticMetaObject.methodCount(), true)) return; // don't connect @@ -2059,7 +2068,7 @@ void QDBusConnectionPrivate::disconnectRelay(const QString &service, const QStri SignalHook hook; QString key; - if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal, + if (!prepareHook(hook, key, service, owner, path, interface, QString(), QStringList(), receiver, signal, QDBusAbstractInterface::staticMetaObject.methodCount(), true)) return; // don't connect -- cgit v0.12 From 735525dc51952c90846c8129b755422b288b204b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Oct 2009 11:13:10 +0200 Subject: Add new public API to QDBusConnection for connecting with string matching. The bus allows us to match string arguments when receiving messages. This is very useful for the NameOwnerChanged signal, whose first argument is usually what we're interested in. By using these new functions, you can restrict receiving of signals to those that you truly want, instead of receiving NameOwnerChanged for all services registered/unregistered on the bus. --- src/dbus/qdbusconnection.cpp | 88 ++++++++++++++++++++++++++++++++++---------- src/dbus/qdbusconnection.h | 12 ++++-- 2 files changed, 78 insertions(+), 22 deletions(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index bead369..3aaba68 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -557,42 +557,61 @@ QDBusPendingCall QDBusConnection::asyncCall(const QDBusMessage &message, int tim bool QDBusConnection::connect(const QString &service, const QString &path, const QString& interface, const QString &name, QObject *receiver, const char *slot) { - return connect(service, path, interface, name, QString(), receiver, slot); + return connect(service, path, interface, name, QStringList(), QString(), receiver, slot); } /*! - Disconnects the signal specified by the \a service, \a path, \a interface and \a name parameters from - the slot \a slot in object \a receiver. The arguments \a service and \a path can be empty, - denoting a disconnection from all signals of the (\a interface, \a name) pair, from all remote - applications. + \overload - Returns true if the disconnection was successful. + Connects the signal to the slot \a slot in object \a + receiver. Unlike the previous connect() overload, this function + allows one to specify the parameter signature to be connected + using the \a signature variable. The function will then verify + that this signature can be delivered to the slot specified by \a + slot and return false otherwise. + + Returns true if the connection was successful. + + \note This function verifies that the signal signature matches the + slot's parameters, but it does not verify that the actual + signal exists with the given signature in the remote + service. */ -bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString &interface, - const QString &name, QObject *receiver, const char *slot) +bool QDBusConnection::connect(const QString &service, const QString &path, const QString& interface, + const QString &name, const QString &signature, + QObject *receiver, const char *slot) { - return disconnect(service, path, interface, name, QString(), receiver, slot); + return connect(service, path, interface, name, QStringList(), signature, receiver, slot); } /*! \overload + \since 4.6 Connects the signal to the slot \a slot in object \a - receiver. Unlike the other connect() overload, this function + receiver. Unlike the previous connect() overload, this function allows one to specify the parameter signature to be connected using the \a signature variable. The function will then verify that this signature can be delivered to the slot specified by \a slot and return false otherwise. + The \a argumentMatch parameter lists the string parameters to be matched, + in sequential order. Note that, to match an empty string, you need to + pass a QString that is empty but not null (i.e., QString("")). A null + QString skips matching at that position. + + Returns true if the connection was successful. + \note This function verifies that the signal signature matches the slot's parameters, but it does not verify that the actual signal exists with the given signature in the remote service. */ bool QDBusConnection::connect(const QString &service, const QString &path, const QString& interface, - const QString &name, const QString &signature, + const QString &name, const QStringList &argumentMatch, const QString &signature, QObject *receiver, const char *slot) { + if (!receiver || !slot || !d || !d->connection) return false; if (!interface.isEmpty() && !QDBusUtil::isValidInterfaceName(interface)) @@ -609,7 +628,7 @@ bool QDBusConnection::connect(const QString &service, const QString &path, const QString owner = d->getNameOwner(service); // we don't care if the owner is empty hook.signature = signature; // it might get started later - if (!d->prepareHook(hook, key, service, owner, path, interface, name, QStringList(), receiver, slot, 0, false)) + if (!d->prepareHook(hook, key, service, owner, path, interface, name, argumentMatch, receiver, slot, 0, false)) return false; // don't connect // avoid duplicating: @@ -634,19 +653,50 @@ bool QDBusConnection::connect(const QString &service, const QString &path, const } /*! + Disconnects the signal specified by the \a service, \a path, \a interface + and \a name parameters from the slot \a slot in object \a receiver. The + arguments must be the same as passed to the connect() function. + + Returns true if the disconnection was successful. +*/ +bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString &interface, + const QString &name, QObject *receiver, const char *slot) +{ + return disconnect(service, path, interface, name, QStringList(), QString(), receiver, slot); +} + +/*! \overload - Disconnects the signal from the slot \a slot in object \a - receiver. Unlike the other disconnect() overload, this function - allows one to specify the parameter signature to be disconnected - using the \a signature variable. The function will then verify - that this signature is connected to the slot specified by \a slot - and return false otherwise. + Disconnects the signal specified by the \a service, \a path, \a + interface, \a name, and \a signature parameters from the slot \a slot in + object \a receiver. The arguments must be the same as passed to the + connect() function. + + Returns true if the disconnection was successful. */ bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString& interface, const QString &name, const QString &signature, QObject *receiver, const char *slot) { + return disconnect(service, path, interface, name, QStringList(), signature, receiver, slot); +} + +/*! + \overload + \since 4.6 + + Disconnects the signal specified by the \a service, \a path, \a + interface, \a name, \a argumentMatch, and \a signature parameters from + the slot \a slot in object \a receiver. The arguments must be the same as + passed to the connect() function. + + Returns true if the disconnection was successful. +*/ +bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString& interface, + const QString &name, const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot) +{ if (!receiver || !slot || !d || !d->connection) return false; if (!interface.isEmpty() && !QDBusUtil::isValidInterfaceName(interface)) @@ -663,7 +713,7 @@ bool QDBusConnection::disconnect(const QString &service, const QString &path, co QString owner = d->getNameOwner(service); // we don't care of owner is empty hook.signature = signature; - if (!d->prepareHook(hook, key, service, owner, path, interface, name, QStringList(), receiver, slot, 0, false)) + if (!d->prepareHook(hook, key, service, owner, path, interface, name, argumentMatch, receiver, slot, 0, false)) return false; // don't disconnect // avoid duplicating: diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h index 85fc7c2..82ae726 100644 --- a/src/dbus/qdbusconnection.h +++ b/src/dbus/qdbusconnection.h @@ -132,15 +132,21 @@ public: bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot); - bool disconnect(const QString &service, const QString &path, const QString &interface, - const QString &name, QObject *receiver, const char *slot); - bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString& signature, QObject *receiver, const char *slot); + bool connect(const QString &service, const QString &path, const QString &interface, + const QString &name, const QStringList &argumentMatch, const QString& signature, + QObject *receiver, const char *slot); + + bool disconnect(const QString &service, const QString &path, const QString &interface, + const QString &name, QObject *receiver, const char *slot); bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString& signature, QObject *receiver, const char *slot); + bool disconnect(const QString &service, const QString &path, const QString &interface, + const QString &name, const QStringList &argumentMatch, const QString& signature, + QObject *receiver, const char *slot); bool registerObject(const QString &path, QObject *object, RegisterOptions options = ExportAdaptors); -- cgit v0.12 From c180071b66d4e5c22248c488df57c6acd6aa36ed Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Oct 2009 19:23:51 +0200 Subject: Autotest: fix improper use of the serviceOwnerChanged signal This test was doubly wrong: it first registered a service name, then it connected to signal to watch it. You can't receive a signal if you connect to it after it's emitted... Second, it waited for any serviceOwnerChanged() signal to exit the event loop, not necessarily the one we wanted to receive. This used to work because we'd always connect to the D-Bus signal, but now we don't anymore. --- tests/auto/qdbusinterface/tst_qdbusinterface.cpp | 34 ++++++++---------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp index e31a3a0..62d6342 100644 --- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp @@ -171,6 +171,13 @@ class tst_QDBusInterface: public QObject { Q_OBJECT MyObject obj; +public slots: + void testServiceOwnerChanged(const QString &service) + { + if (service == "com.example.Test") + QTestEventLoop::instance().exitLoop(); + } + private slots: void initTestCase(); @@ -235,32 +242,13 @@ void tst_QDBusInterface::invalidAfterServiceOwnerChanged() QDBusInterface invalidInterface("com.example.Test", "/"); QVERIFY(!invalidInterface.isValid()); + QTestEventLoop::instance().connect(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString)), + SLOT(exitLoop())); QVERIFY(connIface->registerService("com.example.Test") == QDBusConnectionInterface::ServiceRegistered); - QSignalSpy serviceOwnerChangedSpy(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString))); - - QEventLoop loop; - QObject::connect(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString)), - &loop, SLOT(quit())); - loop.exec(); - - // at least once, but other services might have changed while running the test, too. - QVERIFY(serviceOwnerChangedSpy.count() >= 1); - bool foundOurService = false; - for (int i = 0; i < serviceOwnerChangedSpy.count(); ++i) { - QList args = serviceOwnerChangedSpy.at(i); - QString name = args[0].toString(); - QString oldOwner = args[1].toString(); - QString newOwner = args[2].toString(); - if (name == QLatin1String("com.example.Test")) { - if (newOwner == conn.baseService()) { - foundOurService = true; - break; - } - } - } - QVERIFY(foundOurService); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(!invalidInterface.isValid()); } -- cgit v0.12 From feca69fb15a4176689e4f58252361750f3444275 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Oct 2009 19:25:56 +0200 Subject: Autotest: add a test that tries to follow a service changing owners. I'm not sure if this used to work before... --- .../tst_qdbusabstractinterface.cpp | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index baf769f..d84350b 100644 --- a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -103,6 +103,8 @@ private slots: void getComplexSignal_data(); void getComplexSignal(); + void followSignal(); + void createErrors_data(); void createErrors(); @@ -432,6 +434,60 @@ void tst_QDBusAbstractInterface::getComplexSignal() QCOMPARE(s[0][0].value(), expectedValue); } +void tst_QDBusAbstractInterface::followSignal() +{ + const QString serviceToFollow = "com.trolltech.tst_qdbusabstractinterface.FollowMe"; + Pinger p = getPinger(serviceToFollow); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusConnection con = p->connection(); + QVERIFY(!con.interface()->isServiceRegistered(serviceToFollow)); + Pinger control = getPinger(""); + + // we need to connect the signal somewhere in order for D-Bus to enable the rules + QTestEventLoop::instance().connect(p.data(), SIGNAL(voidSignal()), SLOT(exitLoop())); + QTestEventLoop::instance().connect(control.data(), SIGNAL(voidSignal()), SLOT(exitLoop())); + QSignalSpy s(p.data(), SIGNAL(voidSignal())); + + emit targetObj.voidSignal(); + QTestEventLoop::instance().enterLoop(200); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // signal must not have been received because the service isn't registered + QVERIFY(s.isEmpty()); + + // now register the service + QDBusReply r = + con.interface()->registerService(serviceToFollow, QDBusConnectionInterface::DontQueueService, + QDBusConnectionInterface::DontAllowReplacement); + QVERIFY(r.isValid() && r.value() == QDBusConnectionInterface::ServiceRegistered); + QVERIFY(con.interface()->isServiceRegistered(serviceToFollow)); + + // emit the signal again: + emit targetObj.voidSignal(); + QTestEventLoop::instance().enterLoop(2); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // now the signal must have been received: + QVERIFY(s.size() == 1); + QVERIFY(s.at(0).size() == 0); + s.clear(); + + // disconnect the signal + disconnect(p.data(), SIGNAL(voidSignal()), &QTestEventLoop::instance(), 0); + + // emit the signal again: + emit targetObj.voidSignal(); + QTestEventLoop::instance().enterLoop(2); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // and now it mustn't have been received + QVERIFY(s.isEmpty()); + + // cleanup: + con.interface()->unregisterService(serviceToFollow); +} + void tst_QDBusAbstractInterface::createErrors_data() { QTest::addColumn("service"); -- cgit v0.12 From 95d68417bfced3458e72ab3fdbc8f97ab15dd1db Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Oct 2009 12:02:40 +0200 Subject: Use the new argument-based rule-matching in QDBusAbstractInterface. This allows us to listen only to the activations we're really interested in. --- src/dbus/qdbusabstractinterface.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 61a9d95..bea365a 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -279,9 +279,17 @@ QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, : QDBusAbstractInterfaceBase(d, parent) { // keep track of the service owner - if (!d_func()->currentOwner.isEmpty()) - QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); + if (d.isValid && + d.connection.isConnected() + && !d.service.isEmpty() + && !d.service.startsWith(QLatin1Char(':'))) + d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service + QString(), // path + QLatin1String(DBUS_INTERFACE_DBUS), // interface + QLatin1String("NameOwnerChanged"), + QStringList() << d.service, + QString(), // signature + this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } /*! @@ -296,9 +304,17 @@ QDBusAbstractInterface::QDBusAbstractInterface(const QString &service, const QSt con, false), parent) { // keep track of the service owner - if (d_func()->connection.isConnected()) - QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); + if (d_func()->isValid && + d_func()->connection.isConnected() + && !service.isEmpty() + && !service.startsWith(QLatin1Char(':'))) + d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service + QString(), // path + QLatin1String(DBUS_INTERFACE_DBUS), // interface + QLatin1String("NameOwnerChanged"), + QStringList() << service, + QString(), //signature + this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } /*! -- cgit v0.12 From 26c5680cf5adbf0c87357d84f2e2a6256724d4b7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Oct 2009 19:28:35 +0200 Subject: Fix the use of the owner when connecting the service "watcher". Use null services to indicate we're not interested in the owner, but empty-but-not-null to indicate we don't know what the owner is. Since empty service names are not valid, this will mean that this rule won't match. --- src/dbus/qdbusabstractinterface.cpp | 11 +++++++++-- src/dbus/qdbusintegrator.cpp | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index bea365a..994da10 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -560,9 +560,16 @@ void QDBusAbstractInterface::connectNotify(const char *signal) return; QDBusConnectionPrivate *conn = d->connectionPrivate(); - if (conn) - conn->connectRelay(d->service, d->currentOwner, d->path, d->interface, + if (conn) { + // do we know what our owner is? + QString owner; + if (!d->service.isEmpty() && d->currentOwner.isNull()) + owner = QLatin1String(""); + else + owner = d->currentOwner; + conn->connectRelay(d->service, owner, d->path, d->interface, this, signal); + } } /*! diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 9e41708..8fff8b3 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1487,7 +1487,7 @@ void QDBusConnectionPrivate::handleSignal(const QString &key, const QDBusMessage //qDBusDebug() << signalHooks.keys(); for ( ; it != end && it.key() == key; ++it) { const SignalHook &hook = it.value(); - if (!hook.owner.isEmpty() && hook.owner != msg.service()) + if (!hook.owner.isNull() && hook.owner != msg.service()) continue; if (!hook.path.isEmpty() && hook.path != msg.path()) continue; -- cgit v0.12 From ed75146e45d41ca52b64193acbf433e6d2ceaaf5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Oct 2009 19:33:38 +0200 Subject: Move the bulk of the signal connecting/disconnecting code to QDBusConnectionPrivate I'll need to recurse into the signal connection mechanism in the next commit. --- src/dbus/qdbusconnection.cpp | 63 ++------------------------------------ src/dbus/qdbusconnection_p.h | 6 ++++ src/dbus/qdbusintegrator.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 60 deletions(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 3aaba68..71e433e 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -619,37 +619,10 @@ bool QDBusConnection::connect(const QString &service, const QString &path, const if (interface.isEmpty() && name.isEmpty()) return false; - // check the slot - QDBusConnectionPrivate::SignalHook hook; - QString key; - QString name2 = name; - if (name2.isNull()) - name2.detach(); - QString owner = d->getNameOwner(service); // we don't care if the owner is empty - hook.signature = signature; // it might get started later - if (!d->prepareHook(hook, key, service, owner, path, interface, name, argumentMatch, receiver, slot, 0, false)) - return false; // don't connect - - // avoid duplicating: + // it might get started later QDBusWriteLocker locker(ConnectAction, d); - QDBusConnectionPrivate::SignalHookHash::ConstIterator it = d->signalHooks.find(key); - QDBusConnectionPrivate::SignalHookHash::ConstIterator end = d->signalHooks.constEnd(); - for ( ; it != end && it.key() == key; ++it) { - const QDBusConnectionPrivate::SignalHook &entry = it.value(); - if (entry.service == hook.service && - entry.owner == hook.owner && - entry.path == hook.path && - entry.signature == hook.signature && - entry.obj == hook.obj && - entry.midx == hook.midx) { - // no need to compare the parameters if it's the same slot - return true; // already there - } - } - - d->connectSignal(key, hook); - return true; + return d->connectSignal(service, owner, path, interface, name, argumentMatch, signature, receiver, slot); } /*! @@ -704,38 +677,8 @@ bool QDBusConnection::disconnect(const QString &service, const QString &path, co if (interface.isEmpty() && name.isEmpty()) return false; - // check the slot - QDBusConnectionPrivate::SignalHook hook; - QString key; - QString name2 = name; - if (name2.isNull()) - name2.detach(); - - QString owner = d->getNameOwner(service); // we don't care of owner is empty - hook.signature = signature; - if (!d->prepareHook(hook, key, service, owner, path, interface, name, argumentMatch, receiver, slot, 0, false)) - return false; // don't disconnect - - // avoid duplicating: QDBusWriteLocker locker(DisconnectAction, d); - QDBusConnectionPrivate::SignalHookHash::Iterator it = d->signalHooks.find(key); - QDBusConnectionPrivate::SignalHookHash::Iterator end = d->signalHooks.end(); - for ( ; it != end && it.key() == key; ++it) { - const QDBusConnectionPrivate::SignalHook &entry = it.value(); - if (entry.service == hook.service && - entry.owner == hook.owner && - entry.path == hook.path && - entry.signature == hook.signature && - entry.obj == hook.obj && - entry.midx == hook.midx) { - // no need to compare the parameters if it's the same slot - d->disconnectSignal(it); - return true; // it was there - } - } - - // the slot was not found - return false; + return d->disconnectSignal(service, path, interface, name, argumentMatch, signature, receiver, slot); } /*! diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index df51c27..2402719 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -175,8 +175,14 @@ public: QDBusPendingCallPrivate *sendWithReplyAsync(const QDBusMessage &message, int timeout = -1); int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, const char *returnMethod, const char *errorMethod, int timeout = -1); + bool connectSignal(const QString &service, const QString &owner, const QString &path, const QString& interface, + const QString &name, const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot); void connectSignal(const QString &key, const SignalHook &hook); SignalHookHash::Iterator disconnectSignal(SignalHookHash::Iterator &it); + bool disconnectSignal(const QString &service, const QString &path, const QString& interface, + const QString &name, const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot); void registerObject(const ObjectTreeNode *node); void connectRelay(const QString &service, const QString ¤tOwner, const QString &path, const QString &interface, diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 8fff8b3..89a7449 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1942,6 +1942,42 @@ int QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, QObj return 1; } +bool QDBusConnectionPrivate::connectSignal(const QString &service, const QString &owner, + const QString &path, const QString &interface, const QString &name, + const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot) +{ + // check the slot + QDBusConnectionPrivate::SignalHook hook; + QString key; + QString name2 = name; + if (name2.isNull()) + name2.detach(); + + hook.signature = signature; + if (!prepareHook(hook, key, service, owner, path, interface, name, argumentMatch, receiver, slot, 0, false)) + return false; // don't connect + + // avoid duplicating: + QDBusConnectionPrivate::SignalHookHash::ConstIterator it = signalHooks.find(key); + QDBusConnectionPrivate::SignalHookHash::ConstIterator end = signalHooks.constEnd(); + for ( ; it != end && it.key() == key; ++it) { + const QDBusConnectionPrivate::SignalHook &entry = it.value(); + if (entry.service == hook.service && + entry.owner == hook.owner && + entry.path == hook.path && + entry.signature == hook.signature && + entry.obj == hook.obj && + entry.midx == hook.midx) { + // no need to compare the parameters if it's the same slot + return true; // already there + } + } + + connectSignal(key, hook); + return true; +} + void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook &hook) { signalHooks.insertMulti(key, hook); @@ -1973,6 +2009,43 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook } } +bool QDBusConnectionPrivate::disconnectSignal(const QString &service, + const QString &path, const QString &interface, const QString &name, + const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot) +{ + // check the slot + QDBusConnectionPrivate::SignalHook hook; + QString key; + QString name2 = name; + if (name2.isNull()) + name2.detach(); + + hook.signature = signature; + if (!prepareHook(hook, key, service, QString(), path, interface, name, argumentMatch, receiver, slot, 0, false)) + return false; // don't disconnect + + // avoid duplicating: + QDBusConnectionPrivate::SignalHookHash::Iterator it = signalHooks.find(key); + QDBusConnectionPrivate::SignalHookHash::Iterator end = signalHooks.end(); + for ( ; it != end && it.key() == key; ++it) { + const QDBusConnectionPrivate::SignalHook &entry = it.value(); + if (entry.service == hook.service && + //entry.owner == hook.owner && + entry.path == hook.path && + entry.signature == hook.signature && + entry.obj == hook.obj && + entry.midx == hook.midx) { + // no need to compare the parameters if it's the same slot + disconnectSignal(it); + return true; // it was there + } + } + + // the slot was not found + return false; +} + QDBusConnectionPrivate::SignalHookHash::Iterator QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it) { -- cgit v0.12 From 1176ecf0b533279e5a1c97f183e5c5f1c57fb188 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Oct 2009 19:35:19 +0200 Subject: Stop using the NameOwnerChanged signal without arg0 in QtDBus itself We were using this signal to update the signal hooks when the remote service changed. That meant each Qt app received every single service creation, change or destruction. Now we only watch the services we're really interested in. --- src/dbus/qdbusconnection.cpp | 4 ---- src/dbus/qdbusconnection_p.h | 2 ++ src/dbus/qdbusintegrator.cpp | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 71e433e..d7088ff 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -1005,14 +1005,10 @@ void QDBusConnectionPrivate::setBusService(const QDBusConnection &connection) busService = new QDBusConnectionInterface(connection, this); ref.deref(); // busService has increased the refcounting to us // avoid cyclic refcounting -// if (mode != PeerMode) - QObject::connect(busService, SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SIGNAL(serviceOwnerChanged(QString,QString,QString))); QObject::connect(this, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), busService, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), Qt::QueuedConnection); - } /*! diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 2402719..ed29e4e 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -154,6 +154,7 @@ public: typedef QMultiHash SignalHookHash; typedef QHash MetaObjectHash; typedef QHash MatchRefCountHash; + typedef QHash WatchedServicesHash; public: // public methods are entry points from other objects @@ -270,6 +271,7 @@ public: QDBusError lastError; QStringList serviceNames; + WatchedServicesHash watchedServiceNames; SignalHookHash signalHooks; MatchRefCountHash matchRefCounts; ObjectTreeNode rootNode; diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 89a7449..c7538c3 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -501,6 +501,11 @@ static QObject *findChildObject(const QDBusConnectionPrivate::ObjectTreeNode *ro return 0; } +static bool shouldWatchService(const QString &service) +{ + return !service.isEmpty() && !service.startsWith(QLatin1Char(':')); +} + extern QDBUS_EXPORT void qDBusAddSpyHook(QDBusSpyHook); void qDBusAddSpyHook(QDBusSpyHook hook) { @@ -941,6 +946,7 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) QDBusMetaTypeId::init(); rootNode.flags = 0; + watchedServiceNames[QLatin1String(DBUS_SERVICE_DBUS)] = 1; connect(this, SIGNAL(serviceOwnerChanged(QString,QString,QString)), this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); @@ -2005,6 +2011,22 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook hook.obj->metaObject()->method(hook.midx).signature(), qPrintable(qerror.name()), qPrintable(qerror.message())); Q_ASSERT(false); + } else { + // Successfully connected the signal + // Do we need to watch for this name? + if (shouldWatchService(hook.service)) { + WatchedServicesHash::Iterator it = watchedServiceNames.find(hook.service); + if (it != watchedServiceNames.end()) { + // already watching + ++it.value(); + } else { + // we need to watch for this service changing + QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); + connectSignal(dbusServerService, dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), + QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), + this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); + } + } } } } @@ -2051,6 +2073,19 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it) { const SignalHook &hook = it.value(); + WatchedServicesHash::Iterator sit = watchedServiceNames.find(hook.service); + if (sit != watchedServiceNames.end()) { + if (sit.value() == 1) { + watchedServiceNames.erase(sit); + QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); + disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), + QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), + this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); + } else { + --sit.value(); + } + } + bool erase = false; MatchRefCountHash::iterator i = matchRefCounts.find(hook.matchRule); if (i == matchRefCounts.end()) { -- cgit v0.12 From da9a3a919326e35730b13d0660bb4a7b64e2c81c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Oct 2009 19:37:16 +0200 Subject: Add a warning to user's connecting to serviceOwnerChanged directly We want people to not use this signal directly. --- src/dbus/qdbusconnectioninterface.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dbus/qdbusconnectioninterface.cpp b/src/dbus/qdbusconnectioninterface.cpp index 8670ed5..414d318 100644 --- a/src/dbus/qdbusconnectioninterface.cpp +++ b/src/dbus/qdbusconnectioninterface.cpp @@ -336,8 +336,14 @@ void QDBusConnectionInterface::connectNotify(const char *signalName) else if (qstrcmp(signalName, SIGNAL(serviceUnregistered(QString))) == 0) QDBusAbstractInterface::connectNotify(SIGNAL(NameLost(QString))); - else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) + else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) { + static bool warningPrinted = false; + if (!warningPrinted) { + qWarning("Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)"); + warningPrinted = true; + } QDBusAbstractInterface::connectNotify(SIGNAL(NameOwnerChanged(QString,QString,QString))); + } } /*! -- cgit v0.12 From fb941d5c297e3205d421126c38a9f3a262584b88 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 26 Oct 2009 12:21:29 +0100 Subject: Add QDBusServiceWatcher class. --- src/dbus/dbus.pro | 148 ++++++++++++++------------- src/dbus/qdbusservicewatcher.cpp | 211 +++++++++++++++++++++++++++++++++++++++ src/dbus/qdbusservicewatcher.h | 103 +++++++++++++++++++ 3 files changed, 393 insertions(+), 69 deletions(-) create mode 100644 src/dbus/qdbusservicewatcher.cpp create mode 100644 src/dbus/qdbusservicewatcher.h diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index 57c6a58..9ab3920 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -1,77 +1,87 @@ -TARGET = QtDBus -QPRO_PWD = $$PWD -QT = core xml -CONFIG += link_pkgconfig -DEFINES += QDBUS_MAKEDLL DBUS_API_SUBJECT_TO_CHANGE +TARGET = QtDBus +QPRO_PWD = $$PWD +QT = core \ + xml +CONFIG += link_pkgconfig +DEFINES += QDBUS_MAKEDLL \ + DBUS_API_SUBJECT_TO_CHANGE QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS - -contains(QT_CONFIG, dbus-linked) { +contains(QT_CONFIG, dbus-linked) { LIBS_PRIVATE += $$QT_LIBS_DBUS - DEFINES += QT_LINKED_LIBDBUS + DEFINES += QT_LINKED_LIBDBUS } -#INCLUDEPATH += . - -unix { - QMAKE_PKGCONFIG_DESCRIPTION = Qt DBus module - QMAKE_PKGCONFIG_REQUIRES = QtCore QtXml +# INCLUDEPATH += . +unix { + QMAKE_PKGCONFIG_DESCRIPTION = Qt \ + DBus \ + module + QMAKE_PKGCONFIG_REQUIRES = QtCore \ + QtXml } - -win32 { - LIBS_PRIVATE += -lws2_32 -ladvapi32 -lnetapi32 -luser32 - CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d - else:LIBS_PRIVATE += -ldbus-1 +win32 { + LIBS_PRIVATE += -lws2_32 \ + -ladvapi32 \ + -lnetapi32 \ + -luser32 + CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d + else:LIBS_PRIVATE += -ldbus-1 } - include(../qbase.pri) - -PUB_HEADERS = qdbusargument.h \ - qdbusconnectioninterface.h \ - qdbusmacros.h \ - qdbuserror.h \ - qdbusextratypes.h \ - qdbusmessage.h \ - qdbusserver.h \ - qdbusconnection.h \ - qdbusabstractinterface.h \ - qdbusinterface.h \ - qdbusabstractadaptor.h \ - qdbusreply.h \ - qdbusmetatype.h \ - qdbuspendingcall.h \ - qdbuspendingreply.h \ - qdbuscontext.h - +PUB_HEADERS = qdbusargument.h \ + qdbusconnectioninterface.h \ + qdbusmacros.h \ + qdbuserror.h \ + qdbusextratypes.h \ + qdbusmessage.h \ + qdbusserver.h \ + qdbusconnection.h \ + qdbusabstractinterface.h \ + qdbusinterface.h \ + qdbusabstractadaptor.h \ + qdbusreply.h \ + qdbusmetatype.h \ + qdbuspendingcall.h \ + qdbuspendingreply.h \ + qdbuscontext.h HEADERS += $$PUB_HEADERS \ - qdbusconnection_p.h qdbusmessage_p.h \ - qdbusinterface_p.h qdbusxmlparser_p.h qdbusabstractadaptor_p.h \ - qdbusargument_p.h qdbusutil_p.h qdbusabstractinterface_p.h \ - qdbuscontext_p.h qdbusthreaddebug_p.h qdbusintegrator_p.h \ - qdbuspendingcall_p.h qdbus_symbols_p.h - -SOURCES += qdbusconnection.cpp \ - qdbusconnectioninterface.cpp \ - qdbuserror.cpp \ - qdbusintegrator.cpp \ - qdbusmessage.cpp \ - qdbusserver.cpp \ - qdbusabstractinterface.cpp \ - qdbusinterface.cpp \ - qdbusxmlparser.cpp \ - qdbusutil.cpp \ - qdbusintrospection.cpp \ - qdbusabstractadaptor.cpp \ - qdbusinternalfilters.cpp \ - qdbusmetaobject.cpp \ - qdbusxmlgenerator.cpp \ - qdbusmisc.cpp \ - qdbusargument.cpp \ - qdbusreply.cpp \ - qdbusmetatype.cpp \ - qdbusextratypes.cpp \ - qdbusmarshaller.cpp \ - qdbuscontext.cpp \ - qdbuspendingcall.cpp \ - qdbuspendingreply.cpp \ - qdbus_symbols.cpp - + qdbusconnection_p.h \ + qdbusmessage_p.h \ + qdbusinterface_p.h \ + qdbusxmlparser_p.h \ + qdbusabstractadaptor_p.h \ + qdbusargument_p.h \ + qdbusutil_p.h \ + qdbusabstractinterface_p.h \ + qdbuscontext_p.h \ + qdbusthreaddebug_p.h \ + qdbusintegrator_p.h \ + qdbuspendingcall_p.h \ + qdbus_symbols_p.h \ + qdbusservicewatcher.h +SOURCES += qdbusconnection.cpp \ + qdbusconnectioninterface.cpp \ + qdbuserror.cpp \ + qdbusintegrator.cpp \ + qdbusmessage.cpp \ + qdbusserver.cpp \ + qdbusabstractinterface.cpp \ + qdbusinterface.cpp \ + qdbusxmlparser.cpp \ + qdbusutil.cpp \ + qdbusintrospection.cpp \ + qdbusabstractadaptor.cpp \ + qdbusinternalfilters.cpp \ + qdbusmetaobject.cpp \ + qdbusxmlgenerator.cpp \ + qdbusmisc.cpp \ + qdbusargument.cpp \ + qdbusreply.cpp \ + qdbusmetatype.cpp \ + qdbusextratypes.cpp \ + qdbusmarshaller.cpp \ + qdbuscontext.cpp \ + qdbuspendingcall.cpp \ + qdbuspendingreply.cpp \ + qdbus_symbols.cpp \ + qdbusservicewatcher.cpp diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp new file mode 100644 index 0000000..d8a33c3 --- /dev/null +++ b/src/dbus/qdbusservicewatcher.cpp @@ -0,0 +1,211 @@ +/**************************************************************************** +** +** 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 QtDBus 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 "qdbusservicewatcher.h" +#include "qdbusconnection.h" +#include "qdbus_symbols_p.h" + +#include + +#include + +Q_GLOBAL_STATIC_WITH_ARGS(QString, busService, (QLatin1String(DBUS_SERVICE_DBUS))) +Q_GLOBAL_STATIC_WITH_ARGS(QString, busPath, (QLatin1String(DBUS_PATH_DBUS))) +Q_GLOBAL_STATIC_WITH_ARGS(QString, busInterface, (QLatin1String(DBUS_INTERFACE_DBUS))) +Q_GLOBAL_STATIC_WITH_ARGS(QString, signalName, (QLatin1String("NameOwnerChanged"))) + +class QDBusServiceWatcherPrivate: public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QDBusServiceWatcher) +public: + QDBusServiceWatcherPrivate(const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm) + : connection(c), watchMode(wm) + { + } + + QStringList servicesWatched; + QDBusConnection connection; + QDBusServiceWatcher::WatchMode watchMode; + + void _q_serviceOwnerChanged(const QString &, const QString &, const QString &); + void setConnection(const QStringList &services, const QDBusConnection &c, QDBusServiceWatcher::WatchMode watchMode); + + QStringList matchArgsForService(const QString &service); + void addService(const QString &service); + void removeService(const QString &service); +}; + +void QDBusServiceWatcherPrivate::_q_serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner) +{ + Q_Q(QDBusServiceWatcher); + emit q->serviceOwnerChanged(service, oldOwner, newOwner); + if (oldOwner.isEmpty()) + emit q->serviceRegistered(service); + else if (newOwner.isEmpty()) + emit q->serviceUnregistered(service); +} + +void QDBusServiceWatcherPrivate::setConnection(const QStringList &s, const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm) +{ + if (connection.isConnected()) { + // remove older rules + foreach (const QString &s, servicesWatched) + removeService(s); + } + + connection = c; + watchMode = wm; + servicesWatched = s; + + if (connection.isConnected()) { + // add new rules + foreach (const QString &s, servicesWatched) + addService(s); + } +} + +QStringList QDBusServiceWatcherPrivate::matchArgsForService(const QString &service) +{ + QStringList matchArgs; + matchArgs << service; + + switch (watchMode) { + case QDBusServiceWatcher::WatchForOwnerChange: + break; + + case QDBusServiceWatcher::WatchForRegistration: + matchArgs << QString::fromLatin1("", 0); + break; + + case QDBusServiceWatcher::WatchForUnregistration: + matchArgs << QString() << QString::fromLatin1("", 0); + break; + } + return matchArgs; +} + +void QDBusServiceWatcherPrivate::addService(const QString &service) +{ + QStringList matchArgs = matchArgsForService(service); + connection.connect(*busService(), *busPath(), *busInterface(), *signalName(), + matchArgs, QString(), q_func(), + SLOT(_q_serviceOwnerChanged(QString,QString,QString))); +} + +void QDBusServiceWatcherPrivate::removeService(const QString &service) +{ + QStringList matchArgs = matchArgsForService(service); + connection.disconnect(*busService(), *busPath(), *busInterface(), *signalName(), + matchArgs, QString(), q_func(), + SLOT(_q_serviceOwnerChanged(QString,QString,QString))); +} + +QDBusServiceWatcher::QDBusServiceWatcher(QObject *parent) + : QObject(*new QDBusServiceWatcherPrivate(QDBusConnection(QString()), WatchForOwnerChange), parent) +{ +} + +QDBusServiceWatcher::QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, WatchMode watchMode, QObject *parent) + : QObject(*new QDBusServiceWatcherPrivate(connection, watchMode), parent) +{ + d_func()->setConnection(QStringList() << service, connection, watchMode); +} + +QDBusServiceWatcher::~QDBusServiceWatcher() +{ +} + +QStringList QDBusServiceWatcher::watchedServices() const +{ + return d_func()->servicesWatched; +} + +void QDBusServiceWatcher::setWatchedServices(const QStringList &services) +{ + Q_D(QDBusServiceWatcher); + if (services == d->servicesWatched) + return; + d->setConnection(services, d->connection, d->watchMode); +} + +void QDBusServiceWatcher::addWatchedService(const QString &newService) +{ + Q_D(QDBusServiceWatcher); + if (d->servicesWatched.contains(newService)) + return; + d->addService(newService); + d->servicesWatched << newService; +} + +bool QDBusServiceWatcher::removeWatchedService(const QString &service) +{ + Q_D(QDBusServiceWatcher); + d->removeService(service); + return d->servicesWatched.removeOne(service); +} + +QDBusServiceWatcher::WatchMode QDBusServiceWatcher::watchMode() const +{ + return d_func()->watchMode; +} + +void QDBusServiceWatcher::setWatchMode(WatchMode mode) +{ + Q_D(QDBusServiceWatcher); + if (mode == d->watchMode) + return; + d->setConnection(d->servicesWatched, d->connection, mode); +} + +QDBusConnection QDBusServiceWatcher::connection() const +{ + return d_func()->connection; +} + +void QDBusServiceWatcher::setConnection(const QDBusConnection &connection) +{ + Q_D(QDBusServiceWatcher); + if (connection.name() == d->connection.name()) + return; + d->setConnection(d->servicesWatched, connection, d->watchMode); +} + +#include "moc_qdbusservicewatcher.cpp" diff --git a/src/dbus/qdbusservicewatcher.h b/src/dbus/qdbusservicewatcher.h new file mode 100644 index 0000000..a968a9c --- /dev/null +++ b/src/dbus/qdbusservicewatcher.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** 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 QtDBus 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 QDBUSSERVICEWATCHER_H +#define QDBUSSERVICEWATCHER_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusConnection; + +class QDBusServiceWatcherPrivate; +class QDBUS_EXPORT QDBusServiceWatcher: public QObject +{ + Q_OBJECT + Q_PROPERTY(QStringList watchedServices READ watchedServices WRITE setWatchedServices) + Q_PROPERTY(WatchMode watchMode READ watchMode WRITE setWatchMode) +public: + enum WatchModeFlag { + WatchForRegistration = 0x01, + WatchForUnregistration = 0x02, + WatchForOwnerChange = 0x03 + }; + Q_DECLARE_FLAGS(WatchMode, WatchModeFlag) + + explicit QDBusServiceWatcher(QObject *parent = 0); + QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, + WatchMode watchMode = WatchForOwnerChange, QObject *parent = 0); + ~QDBusServiceWatcher(); + + QStringList watchedServices() const; + void setWatchedServices(const QStringList &services); + void addWatchedService(const QString &newService); + bool removeWatchedService(const QString &service); + + WatchMode watchMode() const; + void setWatchMode(WatchMode mode); + + QDBusConnection connection() const; + void setConnection(const QDBusConnection &connection); + +Q_SIGNALS: + void serviceRegistered(const QString &service); + void serviceUnregistered(const QString &service); + void serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner); + +private: + Q_PRIVATE_SLOT(d_func(), void _q_serviceOwnerChanged(QString,QString,QString)) + Q_DISABLE_COPY(QDBusServiceWatcher) + Q_DECLARE_PRIVATE(QDBusServiceWatcher) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusServiceWatcher::WatchMode) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDBUSSERVICEWATCHER_H -- cgit v0.12 From f9b55c5263ba25e707c8cc35988935a804af2f50 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 26 Oct 2009 14:08:01 +0100 Subject: Autotest: add unit test for QDBusServiceWatcher --- .../qdbusservicewatcher/qdbusservicewatcher.pro | 8 + .../tst_qdbusservicewatcher.cpp | 273 +++++++++++++++++++++ 2 files changed, 281 insertions(+) create mode 100644 tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro create mode 100644 tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp diff --git a/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro b/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro new file mode 100644 index 0000000..4970f16 --- /dev/null +++ b/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +QT = core +contains(QT_CONFIG,dbus): { + SOURCES += tst_qdbusservicewatcher.cpp + QT += dbus +} else { + SOURCES += ../qdbusmarshall/dummy.cpp +} diff --git a/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp b/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp new file mode 100644 index 0000000..10b43b1 --- /dev/null +++ b/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp @@ -0,0 +1,273 @@ +/**************************************************************************** +** +** 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 + +class tst_QDBusServiceWatcher: public QObject +{ + Q_OBJECT + QString serviceName; +public: + tst_QDBusServiceWatcher(); + +private slots: + void initTestCase(); + void cleanup(); + + void watchForCreation(); + void watchForDisappearance(); + void watchForOwnerChange(); + void modeChange(); +}; + +tst_QDBusServiceWatcher::tst_QDBusServiceWatcher() + : serviceName("com.example.TestName") +{ +} + +void tst_QDBusServiceWatcher::initTestCase() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); +} + +void tst_QDBusServiceWatcher::cleanup() +{ + // ensure that the name isn't registered + QDBusConnection::sessionBus().unregisterService(serviceName); +} + +void tst_QDBusServiceWatcher::watchForCreation() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForRegistration); + + QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); + QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); + QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString))); + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop())); + + // register a name + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 0); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QVERIFY(spyO.at(0).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); + + spyR.clear(); + spyU.clear(); + spyO.clear(); + + // unregister it: + con.unregisterService(serviceName); + + // and register again + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 0); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QVERIFY(spyO.at(0).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); +} + +void tst_QDBusServiceWatcher::watchForDisappearance() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForUnregistration); + + QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); + QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); + QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString))); + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceUnregistered(QString)), SLOT(exitLoop())); + + // register a name + QVERIFY(con.registerService(serviceName)); + + // unregister it: + con.unregisterService(serviceName); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 0); + + QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); + QVERIFY(spyO.at(0).at(2).toString().isEmpty()); +} + +void tst_QDBusServiceWatcher::watchForOwnerChange() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForOwnerChange); + + QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); + QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); + QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString))); + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop())); + + // register a name + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 0); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QVERIFY(spyO.at(0).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); + + spyR.clear(); + spyU.clear(); + spyO.clear(); + + // unregister it: + con.unregisterService(serviceName); + + // and register again + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyO.count(), 2); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); + QVERIFY(spyO.at(0).at(2).toString().isEmpty()); + QCOMPARE(spyO.at(1).at(0).toString(), serviceName); + QVERIFY(spyO.at(1).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(1).at(2).toString(), con.baseService()); +} + +void tst_QDBusServiceWatcher::modeChange() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForRegistration); + + QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); + QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); + QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString))); + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop())); + + // register a name + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 0); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QVERIFY(spyO.at(0).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); + + spyR.clear(); + spyU.clear(); + spyO.clear(); + + watcher.setWatchMode(QDBusServiceWatcher::WatchForUnregistration); + + // unregister it: + con.unregisterService(serviceName); + + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceUnregistered(QString)), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 0); + + QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); + QVERIFY(spyO.at(0).at(2).toString().isEmpty()); +} + +QTEST_MAIN(tst_QDBusServiceWatcher) +#include "tst_qdbusservicewatcher.moc" -- cgit v0.12 From bd9a8091eb8c731569e4972a04f23c9a2f48391c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 26 Oct 2009 15:16:47 +0100 Subject: Doc: add documentation for QDBusServiceWatcher class. --- src/dbus/qdbusservicewatcher.cpp | 163 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp index d8a33c3..4872732 100644 --- a/src/dbus/qdbusservicewatcher.cpp +++ b/src/dbus/qdbusservicewatcher.cpp @@ -138,26 +138,159 @@ void QDBusServiceWatcherPrivate::removeService(const QString &service) SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } +/*! + \class QDBusServiceWatcher + \since 4.6 + \inmodule QtDBus + + \brief The QDBusServiceWatcher class allows the user to watch for a bus service change. + + A QDBusServiceWatcher object can be used to notify the application about + an ownership change of a service name on the bus. It has three watch + modes: + + \list + \o watching for service registration only + \o watching for service unregistration only + \o watching for any kind of service ownership change (the default mode) + \endlist + + Besides being created or deleted, services may change owners without a + unregister/register operation happening. So the \ref serviceRegistered() + and \ref serviceUnregistered() signals may not be emitted if that + happens. + + This class is more efficient than using the + QDBusConnectionInterface::serviceOwnerChanged() signal because it allows + one to receive only the signals for which the class is interested in. + + \sa QDBusConnection +*/ + +/*! + \enum QDBusServiceWatcher::WatchModeFlag + + QDBusServiceWatcher supports three different watch modes, which are configured by this flag: + + \value WatchForRegistration watch for service registration only, ignoring + any signals related to other service ownership change. + + \value WatchForUnregistration watch for service unregistration only, + ignoring any signals related to other service ownership change. + + \value WatchForOwnerChange watch for any kind of service ownership + change. +*/ + +/*! + \property QDBusServiceWatcher::watchMode + + The \c watchMode property holds the current watch mode for this + QDBusServiceWatcher object. The default value for this property is + QDBusServiceWatcher::WatchForOwnershipChange. +*/ + +/*! + \property QDBusServiceWatcher::watchedServices + + The \c servicesWatched property holds the list of services watched. + + Note that modifying this list with setServicesWatched() is an expensive + operation. If you can, prefer to change it by way of addWatchedService() + and removeWatchedService(). +*/ + +/*! + \fn void QDBusServiceWatcher::serviceRegistered(const QString &serviceName) + + This signal is emitted whenever this object detects that the service \a + serviceName became available on the bus. + + \sa serviceUnregistered(), serviceOwnerChanged() +*/ + +/*! + \fn void QDBusServiceWatcher::serviceUnregistered(const QString &serviceName) + + This signal is emitted whenever this object detects that the service \a + serviceName was unregistered from the bus and is no longer available. + + \sa serviceRegistered(), serviceOwnerChanged() +*/ + +/*! + \fn void QDBusServiceWatcher::serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner) + + This signal is emitted whenever this object detects that there was a + service ownership change relating to the \a serviceName service. The \a + oldOwner parameter contains the old owner name and \a newOwner is the new + owner. Both \a oldOwner and \a newOwner are unique connection names. + + Note that this signal is also emitted whenever the \a serviceName service + was registered or unregistered. If it was registered, \a oldOwner will + contain an empty string, whereas if it was unregistered, \a newOwner will + contain an empty string. + + If you need only to find out if the service is registered or unregistered + only, without being notified that the ownership changed, consider using + the specific modes for those operations. This class is more efficient if + you use the more specific modes. + + \sa serviceRegistered(), serviceUnregistered() +*/ + +/*! + Creates a QDBusServiceWatcher object. Note that until you set a + connection with setConnection(), this object will not emit any signals. + + The \a parent parameter is passed to QObject to set the parent of this + object. +*/ QDBusServiceWatcher::QDBusServiceWatcher(QObject *parent) : QObject(*new QDBusServiceWatcherPrivate(QDBusConnection(QString()), WatchForOwnerChange), parent) { } +/*! + Creates a QDBusServiceWatcher object and attaches it to the \a connection + connection. Also, this function immediately starts watching for \a + watchMode changes to service \a service. + + The \a parent parameter is passed to QObject to set the parent of this + object. +*/ QDBusServiceWatcher::QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, WatchMode watchMode, QObject *parent) : QObject(*new QDBusServiceWatcherPrivate(connection, watchMode), parent) { d_func()->setConnection(QStringList() << service, connection, watchMode); } +/*! + Destroys the QDBusServiceWatcher object and releases any resources + associated with it. +*/ QDBusServiceWatcher::~QDBusServiceWatcher() { } +/*! + Returns the list of D-Bus services that are being watched. + + \sa setWatchedServices() +*/ QStringList QDBusServiceWatcher::watchedServices() const { return d_func()->servicesWatched; } +/*! + Sets the list of D-Bus services being watched to be \a services. + + Note that setting the entire list means removing all previous rules for + watching services and adding new ones. This is an expensive operation and + should be avoided, if possible. Instead, use addWatchedService() and + removeWatchedService() if you can to manipulate entries in the list. +*/ void QDBusServiceWatcher::setWatchedServices(const QStringList &services) { Q_D(QDBusServiceWatcher); @@ -166,6 +299,11 @@ void QDBusServiceWatcher::setWatchedServices(const QStringList &services) d->setConnection(services, d->connection, d->watchMode); } +/*! + Adds \a newService to the list of services to be watched by this object. + This function is more efficient than setWatchedServices() and should be + used whenever possible to add services. +*/ void QDBusServiceWatcher::addWatchedService(const QString &newService) { Q_D(QDBusServiceWatcher); @@ -175,6 +313,14 @@ void QDBusServiceWatcher::addWatchedService(const QString &newService) d->servicesWatched << newService; } +/*! + Removes the \a service from the list of services being watched by this + object. Note that D-Bus notifications are asynchronous, so there may + still be signals pending delivery about \a service. Those signals will + still be emitted whenever the D-Bus messages are processed. + + This function returns true if any services were removed. +*/ bool QDBusServiceWatcher::removeWatchedService(const QString &service) { Q_D(QDBusServiceWatcher); @@ -195,11 +341,28 @@ void QDBusServiceWatcher::setWatchMode(WatchMode mode) d->setConnection(d->servicesWatched, d->connection, mode); } +/*! + Returns the QDBusConnection that this object is attached to. + + \sa setConnection() +*/ QDBusConnection QDBusServiceWatcher::connection() const { return d_func()->connection; } +/*! + Sets the D-Bus connection that this object is attached to be \a + connection. All services watched will be transferred to this connection. + + Note that QDBusConnection objects are reference counted: + QDBusServiceWatcher will keep a reference for this connection while it + exists. The connection is not closed until the reference count drops to + zero, so this will ensure that any notifications are received while this + QDBusServiceWatcher object exists. + + \sa connection() +*/ void QDBusServiceWatcher::setConnection(const QDBusConnection &connection) { Q_D(QDBusServiceWatcher); -- cgit v0.12 From 0283ca4cf2ad1c9e642b24f8376aa7179fa54599 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 22 Oct 2009 20:59:07 +0200 Subject: Add some STL compatibility for QContiguousCache and private inheritance The private inheritance ensures that we don't try to access the types under the wrong pointer. If we did that, we'd cause strict aliasing violations. Reviewed-by: Olivier Goffart --- src/corelib/tools/qcontiguouscache.h | 125 ++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 60 deletions(-) diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index ad78d1f..862df61 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -62,6 +62,12 @@ struct Q_CORE_EXPORT QContiguousCacheData int start; int offset; uint sharable : 1; + // uint unused : 31; + + // total is 24 bytes (HP-UX aCC: 40 bytes) + // the next entry is already aligned to 8 bytes + // there will be an 8 byte gap here if T requires 16-byte alignment + // (such as long double on 64-bit platforms, __int128, __float128) #ifdef QT_QCONTIGUOUSCACHE_DEBUG void dump() const; @@ -69,33 +75,32 @@ struct Q_CORE_EXPORT QContiguousCacheData }; template -struct QContiguousCacheTypedData +struct QContiguousCacheTypedData: private QContiguousCacheData { - QBasicAtomicInt ref; - int alloc; - int count; - int start; - int offset; - uint sharable : 1; - // uint unused : 31; - - // total is 24 bytes (HP-UX aCC: 40 bytes) - // the next entry is already aligned to 8 bytes - // there will be an 8 byte gap here if T requires 16-byte alignment - // (such as long double on 64-bit platforms, __int128, __float128) - + // private inheritance to avoid aliasing warningss T array[1]; + + static inline void free(QContiguousCacheTypedData *data) { QContiguousCacheData::free(data); } }; template class QContiguousCache { typedef QContiguousCacheTypedData Data; - union { QContiguousCacheData *p; QContiguousCacheTypedData *d; }; + union { QContiguousCacheData *d; QContiguousCacheTypedData *p; }; public: + // STL compatibility + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef ptrdiff_t difference_type; + typedef int size_type; + explicit QContiguousCache(int capacity = 0); QContiguousCache(const QContiguousCache &v) : d(v.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } - inline ~QContiguousCache() { if (!d) return; if (!d->ref.deref()) free(d); } + inline ~QContiguousCache() { if (!d) return; if (!d->ref.deref()) free(p); } inline void detach() { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } @@ -128,10 +133,10 @@ public: inline int firstIndex() const { return d->offset; } inline int lastIndex() const { return d->offset + d->count - 1; } - inline const T &first() const { Q_ASSERT(!isEmpty()); return d->array[d->start]; } - inline const T &last() const { Q_ASSERT(!isEmpty()); return d->array[(d->start + d->count -1) % d->alloc]; } - inline T &first() { Q_ASSERT(!isEmpty()); detach(); return d->array[d->start]; } - inline T &last() { Q_ASSERT(!isEmpty()); detach(); return d->array[(d->start + d->count -1) % d->alloc]; } + inline const T &first() const { Q_ASSERT(!isEmpty()); return p->array[d->start]; } + inline const T &last() const { Q_ASSERT(!isEmpty()); return p->array[(d->start + d->count -1) % d->alloc]; } + inline T &first() { Q_ASSERT(!isEmpty()); detach(); return p->array[d->start]; } + inline T &last() { Q_ASSERT(!isEmpty()); detach(); return p->array[(d->start + d->count -1) % d->alloc]; } void removeFirst(); T takeFirst(); @@ -161,9 +166,9 @@ private: template void QContiguousCache::detach_helper() { - union { QContiguousCacheData *p; QContiguousCacheTypedData *d; } x; + union { QContiguousCacheData *d; QContiguousCacheTypedData *p; } x; - x.p = malloc(d->alloc); + x.d = malloc(d->alloc); x.d->ref = 1; x.d->count = d->count; x.d->start = d->start; @@ -171,8 +176,8 @@ void QContiguousCache::detach_helper() x.d->alloc = d->alloc; x.d->sharable = true; - T *dest = x.d->array + x.d->start; - T *src = d->array + d->start; + T *dest = x.p->array + x.d->start; + T *src = p->array + d->start; int oldcount = x.d->count; while (oldcount--) { if (QTypeInfo::isComplex) { @@ -181,15 +186,15 @@ void QContiguousCache::detach_helper() *dest = *src; } dest++; - if (dest == x.d->array + x.d->alloc) - dest = x.d->array; + if (dest == x.p->array + x.d->alloc) + dest = x.p->array; src++; - if (src == d->array + d->alloc) - src = d->array; + if (src == p->array + d->alloc) + src = p->array; } if (!d->ref.deref()) - free(d); + free(p); d = x.d; } @@ -205,8 +210,8 @@ void QContiguousCache::setCapacity(int asize) x.d->count = qMin(d->count, asize); x.d->offset = d->offset + d->count - x.d->count; x.d->start = x.d->offset % x.d->alloc; - T *dest = x.d->array + (x.d->start + x.d->count-1) % x.d->alloc; - T *src = d->array + (d->start + d->count-1) % d->alloc; + T *dest = x.p->array + (x.d->start + x.d->count-1) % x.d->alloc; + T *src = p->array + (d->start + d->count-1) % d->alloc; int oldcount = x.d->count; while (oldcount--) { if (QTypeInfo::isComplex) { @@ -214,11 +219,11 @@ void QContiguousCache::setCapacity(int asize) } else { *dest = *src; } - if (dest == x.d->array) - dest = x.d->array + x.d->alloc; + if (dest == x.p->array) + dest = x.p->array + x.d->alloc; dest--; - if (src == d->array) - src = d->array + d->alloc; + if (src == p->array) + src = p->array + d->alloc; src--; } /* free old */ @@ -232,24 +237,24 @@ void QContiguousCache::clear() if (d->ref == 1) { if (QTypeInfo::isComplex) { int oldcount = d->count; - T * i = d->array + d->start; - T * e = d->array + d->alloc; + T * i = p->array + d->start; + T * e = p->array + d->alloc; while (oldcount--) { i->~T(); i++; if (i == e) - i = d->array; + i = p->array; } } d->count = d->start = d->offset = 0; } else { - union { QContiguousCacheData *p; QContiguousCacheTypedData *d; } x; - x.p = malloc(d->alloc); + union { QContiguousCacheData *d; QContiguousCacheTypedData *p; } x; + x.d = malloc(d->alloc); x.d->ref = 1; x.d->alloc = d->alloc; x.d->count = x.d->start = x.d->offset = 0; x.d->sharable = true; - if (!d->ref.deref()) free(d); + if (!d->ref.deref()) free(p); d = x.d; } } @@ -263,7 +268,7 @@ inline QContiguousCacheData *QContiguousCache::malloc(int aalloc) template QContiguousCache::QContiguousCache(int cap) { - p = malloc(cap); + d = malloc(cap); d->ref = 1; d->alloc = cap; d->count = d->start = d->offset = 0; @@ -303,13 +308,13 @@ void QContiguousCache::free(Data *x) { if (QTypeInfo::isComplex) { int oldcount = d->count; - T * i = d->array + d->start; - T * e = d->array + d->alloc; + T * i = p->array + d->start; + T * e = p->array + d->alloc; while (oldcount--) { i->~T(); i++; if (i == e) - i = d->array; + i = p->array; } } qFree(x); @@ -320,10 +325,10 @@ void QContiguousCache::append(const T &value) detach(); if (QTypeInfo::isComplex) { if (d->count == d->alloc) - (d->array + (d->start+d->count) % d->alloc)->~T(); - new (d->array + (d->start+d->count) % d->alloc) T(value); + (p->array + (d->start+d->count) % d->alloc)->~T(); + new (p->array + (d->start+d->count) % d->alloc) T(value); } else { - d->array[(d->start+d->count) % d->alloc] = value; + p->array[(d->start+d->count) % d->alloc] = value; } if (d->count == d->alloc) { @@ -349,12 +354,12 @@ void QContiguousCache::prepend(const T &value) d->count++; else if (d->count == d->alloc) - (d->array + d->start)->~T(); + (p->array + d->start)->~T(); if (QTypeInfo::isComplex) - new (d->array + d->start) T(value); + new (p->array + d->start) T(value); else - d->array[d->start] = value; + p->array[d->start] = value; } template @@ -364,9 +369,9 @@ void QContiguousCache::insert(int pos, const T &value) detach(); if (containsIndex(pos)) { if(QTypeInfo::isComplex) - new (d->array + pos % d->alloc) T(value); + new (p->array + pos % d->alloc) T(value); else - d->array[pos % d->alloc] = value; + p->array[pos % d->alloc] = value; } else if (pos == d->offset-1) prepend(value); else if (pos == d->offset+d->count) @@ -378,18 +383,18 @@ void QContiguousCache::insert(int pos, const T &value) d->start = pos % d->alloc; d->count = 1; if (QTypeInfo::isComplex) - new (d->array + d->start) T(value); + new (p->array + d->start) T(value); else - d->array[d->start] = value; + p->array[d->start] = value; } } template inline const T &QContiguousCache::at(int pos) const -{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache::at", "index out of range"); return d->array[pos % d->alloc]; } +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache::at", "index out of range"); return p->array[pos % d->alloc]; } template inline const T &QContiguousCache::operator[](int pos) const -{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache::at", "index out of range"); return d->array[pos % d->alloc]; } +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache::at", "index out of range"); return p->array[pos % d->alloc]; } template inline T &QContiguousCache::operator[](int pos) @@ -397,7 +402,7 @@ inline T &QContiguousCache::operator[](int pos) detach(); if (!containsIndex(pos)) insert(pos, T()); - return d->array[pos % d->alloc]; + return p->array[pos % d->alloc]; } template @@ -407,7 +412,7 @@ inline void QContiguousCache::removeFirst() detach(); d->count--; if (QTypeInfo::isComplex) - (d->array + d->start)->~T(); + (p->array + d->start)->~T(); d->start = (d->start + 1) % d->alloc; d->offset++; } @@ -419,7 +424,7 @@ inline void QContiguousCache::removeLast() detach(); d->count--; if (QTypeInfo::isComplex) - (d->array + (d->start + d->count) % d->alloc)->~T(); + (p->array + (d->start + d->count) % d->alloc)->~T(); } template -- cgit v0.12 From 3f0b969772cf3056ed54349bfe6837d9de2995ea Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 22 Oct 2009 18:57:53 +0200 Subject: Add the aligned versions of qMalloc/qRealloc/qFree --- src/corelib/global/qglobal.h | 3 ++ src/corelib/global/qmalloc.cpp | 100 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5ee1815..cbb8fda 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2065,6 +2065,9 @@ Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE); Q_CORE_EXPORT void *qMalloc(size_t size); Q_CORE_EXPORT void qFree(void *ptr); Q_CORE_EXPORT void *qRealloc(void *ptr, size_t size); +Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment); +Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment); +Q_CORE_EXPORT void qFreeAligned(void *ptr); Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n); Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp index a9f103c..db5e519 100644 --- a/src/corelib/global/qmalloc.cpp +++ b/src/corelib/global/qmalloc.cpp @@ -42,6 +42,7 @@ #include "qplatformdefs.h" #include +#include /* Define the container allocation functions in a separate file, so that our @@ -65,4 +66,103 @@ void *qRealloc(void *ptr, size_t size) return ::realloc(ptr, size); } +#if ((defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600)) +# define HAVE_POSIX_MEMALIGN +#endif + +void *qMallocAligned(size_t size, size_t alignment) +{ +#if defined(Q_OS_WIN) + return _aligned_malloc(size, alignment); +#elif defined(HAVE_POSIX_MEMALIGN) + if (alignment <= sizeof(void*)) + return qMalloc(size); + + // we have posix_memalign + void *ptr = 0; + if (posix_memalign(&ptr, alignment, size) == 0) + return ptr; + return 0; +#else + return qReallocAligned(0, size, 0, alignment); +#endif +} + +void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t alignment) +{ +#if defined(Q_OS_WIN) + Q_UNUSED(oldsize); + return _aligned_realloc(oldptr, newsize, alignment); +#elif defined(HAVE_POSIX_MEMALIGN) + if (alignment <= sizeof(void*)) + return qRealloc(oldptr, newsize); + + void *newptr = qMallocAligned(newsize, alignment); + if (!newptr) + return 0; + qMemCopy(newptr, oldptr, qMin(oldsize, newsize)); + qFree(oldptr); + return newptr; +#else + // fake an aligned allocation + Q_UNUSED(oldsize); + + void *actualptr = oldptr ? static_cast(oldptr)[-1] : 0; + if (alignment <= sizeof(void*)) { + // special, fast case + void **newptr = static_cast(qRealloc(actualptr, newsize + sizeof(void*))); + if (!newptr) + return 0; + if (newptr == actualptr) { + // realloc succeeded without reallocating + return oldptr; + } + + *newptr = newptr; + return newptr + 1; + } + + union { void *ptr; void **pptr; quintptr n; } real, faked; + + // qMalloc returns pointers aligned at least at sizeof(size_t) boundaries + // but usually more (8- or 16-byte boundaries). + // So we overallocate by alignment-sizeof(size_t) bytes, so we're guaranteed to find a + // somewhere within the first alignment-sizeof(size_t) that is properly aligned. + + // However, we need to store the actual pointer, so we need to allocate actually size + + // alignment anyway. + + real.ptr = qRealloc(actualptr, newsize + alignment); + if (!real.ptr) + return 0; + + faked.n = real.n + alignment; + faked.n &= ~(alignment - 1); + + // now save the value of the real pointer at faked-sizeof(void*) + // by construction, alignment > sizeof(void*) and is a power of 2, so + // faked-sizeof(void*) is properly aligned for a pointer + faked.pptr[-1] = real.ptr; + + // and save the actual size just before the pointer + //reinterpret_cast(faked.pptr - 1)[-1] = size; + + return faked.ptr; +#endif +} + +void qFreeAligned(void *ptr) +{ +#if defined(Q_OS_WIN) + _aligned_free(ptr); +#elif defined(HAVE_POSIX_MEMALIGN) + ::free(ptr); +#else + if (!ptr) + return; + void **ptr2 = static_cast(ptr); + free(ptr2[-1]); +#endif +} + QT_END_NAMESPACE -- cgit v0.12 From e83bb2fdfc2dc899526c8157fd8b77a68cdde9da Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 22 Oct 2009 21:09:24 +0200 Subject: Fix Qt containers to properly support types with strict alignments. QContiguousCache is a new type, so there are no binary compatibility issues. QHash and QMap didn't have any public qMalloc / qFree, so the entire logic is contained in .cpp code. However, since old code will not inform us of the alignment requirements, we need to add a bit to the structure to indicate whether strict alignment is in use or not. QList doesn't require any changes. For small, movable types, they're all stored in the pointer array itself, so they're aligned. For larger types, we use new(), so types with stricter requirements should define their own operator new(). QLinkedList cannot be fixed. It uses new() on the QLinkedListNode, which contains a T type. Sorry. QVector did have public qMalloc / qFree. I've moved the calls to the inner function and made it keep the old calls if the alignment requirement is below a certain threshold. The idea is that, if it's above, no one was using QVector anyway. Reviewed-by: Bradley T. Hughes --- src/corelib/global/qmalloc.cpp | 3 - src/corelib/tools/qcontiguouscache.cpp | 10 +++ src/corelib/tools/qcontiguouscache.h | 15 +++- src/corelib/tools/qhash.cpp | 27 ++++--- src/corelib/tools/qhash.h | 36 ++++++---- src/corelib/tools/qmap.cpp | 31 ++++++-- src/corelib/tools/qmap.h | 20 ++++-- src/corelib/tools/qvector.cpp | 27 +++++++ src/corelib/tools/qvector.h | 20 +++++- tests/auto/collections/tst_collections.cpp | 109 +++++++++++++++++++++++++++++ 10 files changed, 259 insertions(+), 39 deletions(-) diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp index db5e519..e33f77c 100644 --- a/src/corelib/global/qmalloc.cpp +++ b/src/corelib/global/qmalloc.cpp @@ -144,9 +144,6 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align // faked-sizeof(void*) is properly aligned for a pointer faked.pptr[-1] = real.ptr; - // and save the actual size just before the pointer - //reinterpret_cast(faked.pptr - 1)[-1] = size; - return faked.ptr; #endif } diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp index b0ed701..dd7cab6 100644 --- a/src/corelib/tools/qcontiguouscache.cpp +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -56,6 +56,16 @@ void QContiguousCacheData::dump() const } #endif +QContiguousCacheData *QContiguousCacheData::allocate(int size, int alignment) +{ + return static_cast(qMallocAligned(size, alignment)); +} + +void QContiguousCacheData::free(QContiguousCacheData *data) +{ + qFreeAligned(data); +} + /*! \class QContiguousCache \brief The QContiguousCache class is a template class that provides a contiguous cache. \ingroup tools diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index 862df61..b9d04b8 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -69,6 +69,9 @@ struct Q_CORE_EXPORT QContiguousCacheData // there will be an 8 byte gap here if T requires 16-byte alignment // (such as long double on 64-bit platforms, __int128, __float128) + static QContiguousCacheData *allocate(int size, int alignment); + static void free(QContiguousCacheData *data); + #ifdef QT_QCONTIGUOUSCACHE_DEBUG void dump() const; #endif @@ -161,6 +164,14 @@ private: // count the padding at the end return reinterpret_cast(&(reinterpret_cast(this))->array[1]) - reinterpret_cast(this); } + int alignOfTypedData() const + { +#ifdef Q_ALIGNOF + return qMax(sizeof(void*), Q_ALIGNOF(Data)); +#else + return 0; +#endif + } }; template @@ -262,7 +273,7 @@ void QContiguousCache::clear() template inline QContiguousCacheData *QContiguousCache::malloc(int aalloc) { - return static_cast(qMalloc(sizeOfTypedData() + (aalloc - 1) * sizeof(T))); + return QContiguousCacheData::allocate(sizeOfTypedData() + (aalloc - 1) * sizeof(T), alignOfTypedData()); } template @@ -317,7 +328,7 @@ void QContiguousCache::free(Data *x) i = p->array; } } - qFree(x); + x->free(x); } template void QContiguousCache::append(const T &value) diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index f33aba9..23fff1c 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -166,29 +166,38 @@ static int countBits(int hint) const int MinNumBits = 4; QHashData QHashData::shared_null = { - 0, 0, Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, MinNumBits, 0, 0, true + 0, 0, Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, MinNumBits, 0, 0, true, false }; void *QHashData::allocateNode() { - void *ptr = qMalloc(nodeSize); + return allocateNode(0); +} + +void *QHashData::allocateNode(int nodeAlign) +{ + void *ptr = strictAlignment ? qMallocAligned(nodeSize, nodeAlign) : qMalloc(nodeSize); Q_CHECK_PTR(ptr); return ptr; } void QHashData::freeNode(void *node) { - qFree(node); + if (strictAlignment) + qFreeAligned(node); + else + qFree(node); } QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), int nodeSize) { - return detach_helper( node_duplicate, 0, nodeSize ); + return detach_helper2( node_duplicate, 0, nodeSize, 0 ); } -QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), - void (*node_delete)(Node *), - int nodeSize) +QHashData *QHashData::detach_helper2(void (*node_duplicate)(Node *, void *), + void (*node_delete)(Node *), + int nodeSize, + int nodeAlign) { union { QHashData *d; @@ -204,6 +213,7 @@ QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), d->numBits = numBits; d->numBuckets = numBuckets; d->sharable = true; + d->strictAlignment = nodeAlign > 8; if (numBuckets) { QT_TRY { @@ -222,7 +232,7 @@ QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), Node *oldNode = buckets[i]; while (oldNode != this_e) { QT_TRY { - Node *dup = static_cast(allocateNode()); + Node *dup = static_cast(allocateNode(nodeAlign)); QT_TRY { node_duplicate(oldNode, dup); @@ -262,6 +272,7 @@ void QHashData::free_helper(void (*node_delete)(Node *)) while (cur != this_e) { Node *next = cur->next; node_delete(cur); + freeNode(cur); cur = next; } } diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index b65f1d3..67b394b 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -125,12 +125,14 @@ struct Q_CORE_EXPORT QHashData short numBits; int numBuckets; uint sharable : 1; + uint strictAlignment : 1; - void *allocateNode(); + void *allocateNode(); // ### Qt5 remove me + void *allocateNode(int nodeAlign); void freeNode(void *node); QHashData *detach_helper(void (*node_duplicate)(Node *, void *), int nodeSize); // ### Qt5 remove me - QHashData *detach_helper(void (*node_duplicate)(Node *, void *), void (*node_delete)(Node *), - int nodeSize); + QHashData *detach_helper2(void (*node_duplicate)(Node *, void *), void (*node_delete)(Node *), + int nodeSize, int nodeAlign); void mightGrow(); bool willGrow(); void hasShrunk(); @@ -267,6 +269,14 @@ class QHash return reinterpret_cast(node); } +#ifdef Q_ALIGNOF + static inline int alignOfNode() { return qMax(sizeof(void*), Q_ALIGNOF(Node)); } + static inline int alignOfDummyNode() { return qMax(sizeof(void*), Q_ALIGNOF(DummyNode)); } +#else + static inline int alignOfNode() { return 0; } + static inline int alignOfDummyNode() { return 0; } +#endif + public: inline QHash() : d(&QHashData::shared_null) { d->ref.ref(); } inline QHash(const QHash &other) : d(other.d) { d->ref.ref(); if (!d->sharable) detach(); } @@ -483,7 +493,7 @@ private: Node **findNode(const Key &key, uint *hp = 0) const; Node *createNode(uint h, const Key &key, const T &value, Node **nextNode); void deleteNode(Node *node); - static void deleteNode(QHashData::Node *node); + static void deleteNode2(QHashData::Node *node); static void duplicateNode(QHashData::Node *originalNode, void *newNode); }; @@ -492,12 +502,12 @@ private: template Q_INLINE_TEMPLATE void QHash::deleteNode(Node *node) { - deleteNode(reinterpret_cast(node)); + deleteNode2(reinterpret_cast(node)); + d->freeNode(node); } - template -Q_INLINE_TEMPLATE void QHash::deleteNode(QHashData::Node *node) +Q_INLINE_TEMPLATE void QHash::deleteNode2(QHashData::Node *node) { #ifdef Q_CC_BOR concrete(node)->~QHashNode(); @@ -506,7 +516,6 @@ Q_INLINE_TEMPLATE void QHash::deleteNode(QHashData::Node *node) #else concrete(node)->~Node(); #endif - qFree(node); } template @@ -527,9 +536,9 @@ QHash::createNode(uint ah, const Key &akey, const T &avalue, Node **anex Node *node; if (QTypeInfo::isDummy) { - node = reinterpret_cast(new (d->allocateNode()) DummyNode(akey)); + node = reinterpret_cast(new (d->allocateNode(alignOfDummyNode())) DummyNode(akey)); } else { - node = new (d->allocateNode()) Node(akey, avalue); + node = new (d->allocateNode(alignOfNode())) Node(akey, avalue); } node->h = ah; @@ -554,7 +563,7 @@ Q_INLINE_TEMPLATE QHash &QHash::unite(const QHash &other template Q_OUTOFLINE_TEMPLATE void QHash::freeData(QHashData *x) { - x->free_helper(deleteNode); + x->free_helper(deleteNode2); } template @@ -566,8 +575,9 @@ Q_INLINE_TEMPLATE void QHash::clear() template Q_OUTOFLINE_TEMPLATE void QHash::detach_helper() { - QHashData *x = d->detach_helper(duplicateNode, deleteNode, - QTypeInfo::isDummy ? sizeof(DummyNode) : sizeof(Node)); + QHashData *x = d->detach_helper2(duplicateNode, deleteNode2, + QTypeInfo::isDummy ? sizeof(DummyNode) : sizeof(Node), + QTypeInfo::isDummy ? alignOfDummyNode() : alignOfNode()); if (!d->ref.deref()) freeData(d); d = x; diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 1385810..cfb18b4 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -53,11 +53,16 @@ QT_BEGIN_NAMESPACE QMapData QMapData::shared_null = { &shared_null, { &shared_null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true + Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true, false }; QMapData *QMapData::createData() { + return createData(0); +} + +QMapData *QMapData::createData(int alignment) +{ QMapData *d = new QMapData; Q_CHECK_PTR(d); Node *e = reinterpret_cast(d); @@ -69,6 +74,7 @@ QMapData *QMapData::createData() d->randomBits = 0; d->insertInOrder = false; d->sharable = true; + d->strictAlignment = alignment > 8; return d; } @@ -80,11 +86,19 @@ void QMapData::continueFreeData(int offset) while (cur != e) { prev = cur; cur = cur->forward[0]; - qFree(reinterpret_cast(prev) - offset); + if (strictAlignment) + qFreeAligned(reinterpret_cast(prev) - offset); + else + qFree(reinterpret_cast(prev) - offset); } delete this; } +QMapData::Node *QMapData::node_create(Node *update[], int offset) +{ + return node_create(update, offset, 0); +} + /*! Creates a new node inside the data structure. @@ -94,10 +108,12 @@ void QMapData::continueFreeData(int offset) \a offset is an amount of bytes that needs to reserved just before the QMapData::Node structure. + \a alignment dictates the alignment for the data. + \internal \since 4.6 */ -QMapData::Node *QMapData::node_create(Node *update[], int offset) +QMapData::Node *QMapData::node_create(Node *update[], int offset, int alignment) { int level = 0; uint mask = (1 << Sparseness) - 1; @@ -118,7 +134,9 @@ QMapData::Node *QMapData::node_create(Node *update[], int offset) if (level == 3 && !insertInOrder) randomBits = qrand(); - void *concreteNode = qMalloc(offset + sizeof(Node) + level * sizeof(Node *)); + void *concreteNode = strictAlignment ? + qMallocAligned(offset + sizeof(Node) + level * sizeof(Node *), alignment) : + qMalloc(offset + sizeof(Node) + level * sizeof(Node *)); Q_CHECK_PTR(concreteNode); Node *abstractNode = reinterpret_cast(reinterpret_cast(concreteNode) + offset); @@ -145,7 +163,10 @@ void QMapData::node_delete(Node *update[], int offset, Node *node) update[i]->forward[i] = node->forward[i]; } --size; - qFree(reinterpret_cast(node) - offset); + if (strictAlignment) + qFreeAligned(reinterpret_cast(node) - offset); + else + qFree(reinterpret_cast(node) - offset); } #ifdef QT_QMAP_DEBUG diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 688aca6..20980e7 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -74,10 +74,13 @@ struct Q_CORE_EXPORT QMapData uint randomBits; uint insertInOrder : 1; uint sharable : 1; + uint strictAlignment : 1; - static QMapData *createData(); + static QMapData *createData(); // ### Qt5 remove me + static QMapData *createData(int alignment); void continueFreeData(int offset); - Node *node_create(Node *update[], int offset); + Node *node_create(Node *update[], int offset); // ### Qt5 remove me + Node *node_create(Node *update[], int offset, int alignment); void node_delete(Node *update[], int offset, Node *node); #ifdef QT_QMAP_DEBUG uint adjust_ptr(Node *node); @@ -145,6 +148,13 @@ class QMap }; static inline int payload() { return sizeof(PayloadNode) - sizeof(QMapData::Node *); } + static inline int alignment() { +#ifdef Q_ALIGNOF + return qMax(sizeof(void*), Q_ALIGNOF(Node)); +#else + return 0; +#endif + } static inline Node *concrete(QMapData::Node *node) { return reinterpret_cast(reinterpret_cast(node) - payload()); } @@ -414,7 +424,7 @@ template Q_INLINE_TEMPLATE typename QMapData::Node * QMap::node_create(QMapData *adt, QMapData::Node *aupdate[], const Key &akey, const T &avalue) { - QMapData::Node *abstractNode = adt->node_create(aupdate, payload()); + QMapData::Node *abstractNode = adt->node_create(aupdate, payload(), alignment()); QT_TRY { Node *concreteNode = concrete(abstractNode); new (&concreteNode->key) Key(akey); @@ -715,7 +725,7 @@ template Q_OUTOFLINE_TEMPLATE void QMap::detach_helper() { union { QMapData *d; QMapData::Node *e; } x; - x.d = QMapData::createData(); + x.d = QMapData::createData(alignment()); if (d->size) { x.d->insertInOrder = true; QMapData::Node *update[QMapData::LastLevel + 1]; @@ -905,7 +915,7 @@ Q_OUTOFLINE_TEMPLATE bool QMap::operator==(const QMap &other) co template Q_OUTOFLINE_TEMPLATE QMap::QMap(const std::map &other) { - d = QMapData::createData(); + d = QMapData::createData(alignment()); d->insertInOrder = true; typename std::map::const_iterator it = other.end(); while (it != other.begin()) { diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 20f3a80..6522791 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -45,6 +45,13 @@ QT_BEGIN_NAMESPACE +static inline int alignmentThreshold() +{ + // malloc on 32-bit platforms should return pointers that are 8-byte aligned or more + // while on 64-bit platforms they should be 16-byte aligned or more + return 2 * sizeof(void*); +} + QVectorData QVectorData::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, true, false }; QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init) @@ -55,6 +62,26 @@ QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVe return p; } +QVectorData *QVectorData::allocate(int size, int alignment) +{ + return static_cast(alignment > alignmentThreshold() ? qMallocAligned(size, alignment) : qMalloc(size)); +} + +QVectorData *QVectorData::reallocate(QVectorData *x, int newsize, int oldsize, int alignment) +{ + if (alignment > alignmentThreshold()) + return static_cast(qReallocAligned(x, newsize, oldsize, alignment)); + return static_cast(qRealloc(x, newsize)); +} + +void QVectorData::free(QVectorData *x, int alignment) +{ + if (alignment > alignmentThreshold()) + qFreeAligned(x); + else + qFree(x); +} + int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive) { if (excessive) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index b77b53a..cf7df12 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -79,6 +79,9 @@ struct Q_CORE_EXPORT QVectorData // some debugges when the QVector is member of a class within an unnamed namespace. // ### Qt 5: can be removed completely. (Ralf) static QVectorData *malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init); + static QVectorData *allocate(int size, int alignment); + static QVectorData *reallocate(QVectorData *old, int newsize, int oldsize, int alignment); + static void free(QVectorData *data, int alignment); static int grow(int sizeofTypedData, int size, int sizeofT, bool excessive); }; @@ -87,6 +90,8 @@ struct QVectorTypedData : private QVectorData { // private inheritance as we must not access QVectorData member thought QVectorTypedData // as this would break strict aliasing rules. (in the case of shared_null) T array[1]; + + static inline void free(QVectorTypedData *x, int alignment) { QVectorData::free(x, alignment); } }; class QRegion; @@ -302,6 +307,14 @@ private: // count the padding at the end return reinterpret_cast(&(reinterpret_cast(this))->array[1]) - reinterpret_cast(this); } + inline int alignOfTypedData() const + { +#ifdef Q_ALIGNOF + return qMax(sizeof(void*), Q_ALIGNOF(Data)); +#else + return 0; +#endif + } }; template @@ -373,7 +386,7 @@ QVector &QVector::operator=(const QVector &v) template inline QVectorData *QVector::malloc(int aalloc) { - QVectorData *vectordata = static_cast(qMalloc(sizeOfTypedData() + (aalloc - 1) * sizeof(T))); + QVectorData *vectordata = QVectorData::allocate(sizeOfTypedData() + (aalloc - 1) * sizeof(T), alignOfTypedData()); Q_CHECK_PTR(vectordata); return vectordata; } @@ -420,7 +433,7 @@ void QVector::free(Data *x) while (i-- != b) i->~T(); } - qFree(x); + x->free(x, alignOfTypedData()); } template @@ -459,7 +472,8 @@ void QVector::realloc(int asize, int aalloc) } } else { QT_TRY { - QVectorData *mem = static_cast(qRealloc(p, sizeOfTypedData() + (aalloc - 1) * sizeof(T))); + QVectorData *mem = QVectorData::reallocate(d, sizeOfTypedData() + (aalloc - 1) * sizeof(T), + sizeOfTypedData() + (d->alloc - 1) * sizeof(T), alignOfTypedData()); Q_CHECK_PTR(mem); x.d = d = mem; x.d->size = d->size; diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp index 670cff0..f97805e 100644 --- a/tests/auto/collections/tst_collections.cpp +++ b/tests/auto/collections/tst_collections.cpp @@ -164,6 +164,7 @@ private slots: void qtimerList(); void containerTypedefs(); void forwardDeclared(); + void alignment(); }; struct LargeStatic { @@ -3481,5 +3482,113 @@ void tst_Collections::forwardDeclared() { typedef QSet C; C *x = 0; /* C::iterator i; */ C::const_iterator j; Q_UNUSED(x) } } +#if defined(Q_ALIGNOF) && defined(Q_DECL_ALIGN) + +class Q_DECL_ALIGN(4) Aligned4 +{ + char i; +public: + Aligned4(int i = 0) : i(i) {} + bool checkAligned() const + { + return (quintptr(this) & 3) == 0; + } + + inline bool operator==(const Aligned4 &other) const { return i == other.i; } + inline bool operator<(const Aligned4 &other) const { return i < other.i; } + friend inline int qHash(const Aligned4 &a) { return qHash(a.i); } +}; + +class Q_DECL_ALIGN(128) Aligned128 +{ + char i; +public: + Aligned128(int i = 0) : i(i) {} + bool checkAligned() const + { + return (quintptr(this) & 127) == 0; + } + + inline bool operator==(const Aligned128 &other) const { return i == other.i; } + inline bool operator<(const Aligned128 &other) const { return i < other.i; } + friend inline int qHash(const Aligned128 &a) { return qHash(a.i); } +}; + +template +void testVectorAlignment() +{ + typedef typename C::value_type Aligned; + C container; + container.append(Aligned()); + QVERIFY(container[0].checkAligned()); + + for (int i = 0; i < 200; ++i) + container.append(Aligned()); + + for (int i = 0; i < container.size(); ++i) + QVERIFY(container.at(i).checkAligned()); +} + +template +void testContiguousCacheAlignment() +{ + typedef typename C::value_type Aligned; + C container(150); + container.append(Aligned()); + QVERIFY(container[container.firstIndex()].checkAligned()); + + for (int i = 0; i < 200; ++i) + container.append(Aligned()); + + for (int i = container.firstIndex(); i < container.lastIndex(); ++i) + QVERIFY(container.at(i).checkAligned()); +} + +template +void testAssociativeContainerAlignment() +{ + typedef typename C::key_type Key; + typedef typename C::mapped_type Value; + C container; + container.insert(Key(), Value()); + + typename C::const_iterator it = container.constBegin(); + QVERIFY(it.key().checkAligned()); + QVERIFY(it.value().checkAligned()); + + // add some more elements + for (int i = 0; i < 200; ++i) + container.insert(Key(i), Value(i)); + + it = container.constBegin(); + for ( ; it != container.constEnd(); ++it) { + QVERIFY(it.key().checkAligned()); + QVERIFY(it.value().checkAligned()); + } +} + +void tst_Collections::alignment() +{ + testVectorAlignment >(); + testVectorAlignment >(); + testContiguousCacheAlignment >(); + testContiguousCacheAlignment >(); + testAssociativeContainerAlignment >(); + testAssociativeContainerAlignment >(); + testAssociativeContainerAlignment >(); + testAssociativeContainerAlignment >(); + testAssociativeContainerAlignment >(); + testAssociativeContainerAlignment >(); + testAssociativeContainerAlignment >(); + testAssociativeContainerAlignment >(); +} + +#else +void tst_Collections::alignment() +{ + QSKIP("Compiler doesn't support necessary extension keywords", SkipAll) +} +#endif + QTEST_APPLESS_MAIN(tst_Collections) #include "tst_collections.moc" -- cgit v0.12 From 5b4b6b2be7b901ef9a29c37431998034730fa3d3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 28 Oct 2009 12:47:35 +0100 Subject: Initialise the reserved bits to 0. This is future compatibility: we must rely on them being 0 in older versions of Qt. Reviewed-by: Bradley T. Hughes --- src/corelib/tools/qcontiguouscache.h | 3 ++- src/corelib/tools/qhash.cpp | 3 ++- src/corelib/tools/qhash.h | 1 + src/corelib/tools/qmap.cpp | 3 ++- src/corelib/tools/qmap.h | 1 + src/corelib/tools/qvector.cpp | 2 +- src/corelib/tools/qvector.h | 2 ++ 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index b9d04b8..ef5b238 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -62,7 +62,7 @@ struct Q_CORE_EXPORT QContiguousCacheData int start; int offset; uint sharable : 1; - // uint unused : 31; + uint reserved : 31; // total is 24 bytes (HP-UX aCC: 40 bytes) // the next entry is already aligned to 8 bytes @@ -186,6 +186,7 @@ void QContiguousCache::detach_helper() x.d->offset = d->offset; x.d->alloc = d->alloc; x.d->sharable = true; + x.d->reserved = 0; T *dest = x.p->array + x.d->start; T *src = p->array + d->start; diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 23fff1c..c82c389 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -166,7 +166,7 @@ static int countBits(int hint) const int MinNumBits = 4; QHashData QHashData::shared_null = { - 0, 0, Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, MinNumBits, 0, 0, true, false + 0, 0, Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, MinNumBits, 0, 0, true, false, 0 }; void *QHashData::allocateNode() @@ -214,6 +214,7 @@ QHashData *QHashData::detach_helper2(void (*node_duplicate)(Node *, void *), d->numBuckets = numBuckets; d->sharable = true; d->strictAlignment = nodeAlign > 8; + d->reserved = 0; if (numBuckets) { QT_TRY { diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 67b394b..1918229 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -126,6 +126,7 @@ struct Q_CORE_EXPORT QHashData int numBuckets; uint sharable : 1; uint strictAlignment : 1; + uint reserved : 30; void *allocateNode(); // ### Qt5 remove me void *allocateNode(int nodeAlign); diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index cfb18b4..3b48c3f 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QMapData QMapData::shared_null = { &shared_null, { &shared_null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true, false + Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true, false, 0 }; QMapData *QMapData::createData() @@ -75,6 +75,7 @@ QMapData *QMapData::createData(int alignment) d->insertInOrder = false; d->sharable = true; d->strictAlignment = alignment > 8; + d->reserved = 0; return d; } diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 20980e7..65c3d2a 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -75,6 +75,7 @@ struct Q_CORE_EXPORT QMapData uint insertInOrder : 1; uint sharable : 1; uint strictAlignment : 1; + uint reserved : 29; static QMapData *createData(); // ### Qt5 remove me static QMapData *createData(int alignment); diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 6522791..8bb1074 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -52,7 +52,7 @@ static inline int alignmentThreshold() return 2 * sizeof(void*); } -QVectorData QVectorData::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, true, false }; +QVectorData QVectorData::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, true, false, 0 }; QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init) { diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index cf7df12..7402d77 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -72,6 +72,7 @@ struct Q_CORE_EXPORT QVectorData #else uint sharable : 1; uint capacity : 1; + uint reserved : 30; #endif static QVectorData shared_null; @@ -486,6 +487,7 @@ void QVector::realloc(int asize, int aalloc) x.d->alloc = aalloc; x.d->sharable = true; x.d->capacity = d->capacity; + x.d->reserved = 0; } if (QTypeInfo::isComplex) { -- cgit v0.12 From 138e8c17767959c183b3e00e3fb364ab5b6fbdfd Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 28 Oct 2009 14:14:25 +0100 Subject: QLocalServer: block indefinitely when timeout value is -1 ... as described in the documentation. Furthermore: * use qt_safe_select to timeout correctly * return immediately when timeout value is 0 Reviewed-by: Oswald Buddenhagen --- src/network/socket/qlocalserver_unix.cpp | 22 ++++++---------------- tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 2 +- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index 5ffe0c0..e09e547 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -216,24 +216,14 @@ void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut) timeout.tv_sec = msec / 1000; timeout.tv_usec = (msec % 1000) * 1000; - // timeout can not be 0 or else select will return an error. - if (0 == msec) - timeout.tv_usec = 1000; - int result = -1; - // on Linux timeout will be updated by select, but _not_ on other systems. - QTime timer; - timer.start(); - while (pendingConnections.isEmpty() && (-1 == msec || timer.elapsed() < msec)) { - result = ::select(listenSocket + 1, &readfds, 0, 0, &timeout); - if (-1 == result && errno != EINTR) { - setError(QLatin1String("QLocalServer::waitForNewConnection")); - closeServer(); - break; - } - if (result > 0) - _q_onNewConnection(); + result = qt_safe_select(listenSocket + 1, &readfds, 0, 0, (msec == -1) ? 0 : &timeout); + if (-1 == result) { + setError(QLatin1String("QLocalServer::waitForNewConnection")); + closeServer(); } + if (result > 0) + _q_onNewConnection(); if (timedOut) *timedOut = (result == 0); } diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index be39d00..ab7b0ac 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -976,7 +976,7 @@ void tst_QLocalSocket::writeOnlySocket() #if defined(Q_OS_SYMBIAN) QTest::qWait(250); #endif - QVERIFY(server.waitForNewConnection()); + QVERIFY(server.waitForNewConnection(200)); QLocalSocket* serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); -- cgit v0.12 From d5a228fbd44f7dd92a10981a5c835db66e3ea6f8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Oct 2009 09:59:40 +0100 Subject: Fix compilation in QContiguousCache. Reviewed-by: TrustMe --- src/corelib/tools/qcontiguouscache.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index ef5b238..3785938 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -216,8 +216,8 @@ void QContiguousCache::setCapacity(int asize) if (asize == d->alloc) return; detach(); - union { QContiguousCacheData *p; QContiguousCacheTypedData *d; } x; - x.p = malloc(asize); + union { QContiguousCacheData *d; QContiguousCacheTypedData *p; } x; + x.d = malloc(asize); x.d->alloc = asize; x.d->count = qMin(d->count, asize); x.d->offset = d->offset + d->count - x.d->count; @@ -239,7 +239,7 @@ void QContiguousCache::setCapacity(int asize) src--; } /* free old */ - free(d); + free(p); d = x.d; } -- cgit v0.12 From 8307d3511b35adbb945948eda2cf54bbd3c0a20e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Oct 2009 10:28:28 +0100 Subject: Update confusing qWarning message. Reviewed-by: Olivier Goffart --- src/corelib/kernel/qmetaobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index f98c449..71afc5b 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -574,8 +574,8 @@ int QMetaObjectPrivate::indexOfSignalRelative(const QMetaObject **baseObject, co if (i >= 0 && m && m->d.superdata) { int conflict = m->d.superdata->indexOfMethod(signal); if (conflict >= 0) - qWarning("QMetaObject::indexOfSignal:%s: Conflict with %s::%s", - m->d.stringdata, m->d.superdata->d.stringdata, signal); + qWarning("QMetaObject::indexOfSignal: signal %s from %s redefined in %s", + signal, m->d.superdata->d.stringdata, m->d.stringdata); } #endif return i; -- cgit v0.12 From ffe49ed60c9ee778b9999ee4145b44851b053f9f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Oct 2009 10:31:48 +0100 Subject: Fix compilation on Mac: there's no malloc.h there Reviewed-by: Trust Me --- src/corelib/global/qmalloc.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp index e33f77c..3584c50 100644 --- a/src/corelib/global/qmalloc.cpp +++ b/src/corelib/global/qmalloc.cpp @@ -42,7 +42,10 @@ #include "qplatformdefs.h" #include -#include + +#ifdef Q_OS_WIN +# include +#endif /* Define the container allocation functions in a separate file, so that our @@ -66,10 +69,6 @@ void *qRealloc(void *ptr, size_t size) return ::realloc(ptr, size); } -#if ((defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600)) -# define HAVE_POSIX_MEMALIGN -#endif - void *qMallocAligned(size_t size, size_t alignment) { #if defined(Q_OS_WIN) -- cgit v0.12 From 5e4035ede6505f638f4741dcebbf19e485a1b993 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 29 Oct 2009 14:50:51 +0100 Subject: qdoc3: Fixed a linking error for qml properties. This: https://qtmetrics.europe.nokia.com/kinetic-declarativeui/qml-item.html#rotation-prop should now be this: https://qtmetrics.europe.nokia.com/kinetic-declarativeui/qml-item.html#transformOrigin-prop) --- tools/qdoc3/htmlgenerator.cpp | 11 +++++++---- tools/qdoc3/pagegenerator.cpp | 19 +++++++------------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 18c7916..eaf4b2e 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3467,10 +3467,13 @@ QString HtmlGenerator::refForNode(const Node *node) ref += "-" + QString::number(func->overloadNumber()); } break; - case Node::Property: -#ifdef QDOC_QML +#ifdef QDOC_QML + case Node::Fake: + if (node->subType() != Node::QmlPropertyGroup) + break; case Node::QmlProperty: #endif + case Node::Property: ref = node->name() + "-prop"; break; #ifdef QDOC_QML @@ -3512,9 +3515,9 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative) // ### reintroduce this test, without breaking .dcf files if (fn != outFileName()) #endif - link += fn; + link += fn; - if (!node->isInnerNode()) { + if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { ref = refForNode(node); if (relative && fn == fileName(relative) && ref == refForNode(relative)) return QString(); diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 83ea561..7d9fbee 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -81,14 +81,13 @@ QString PageGenerator::fileBase(const Node *node) { if (node->relates()) node = node->relates(); - else if (!node->isInnerNode()) { + else if (!node->isInnerNode()) node = node->parent(); #ifdef QDOC_QML - if (node->subType() == Node::QmlPropertyGroup) { - node = node->parent(); - } -#endif + if (node->subType() == Node::QmlPropertyGroup) { + node = node->parent(); } +#endif QString base = node->doc().baseName(); if (!base.isEmpty()) @@ -97,6 +96,7 @@ QString PageGenerator::fileBase(const Node *node) const Node *p = node; forever { + const Node *pp = p->parent(); base.prepend(p->name()); #ifdef QDOC_QML /* @@ -104,15 +104,10 @@ QString PageGenerator::fileBase(const Node *node) we prepend "qml-" to the file name of QML element doc files. */ - if ((p->subType() == Node::QmlClass) || - (p->subType() == Node::QmlPropertyGroup)) - base.prepend("qml-"); - else if ((p->type() == Node::QmlProperty) || - (p->type() == Node::QmlSignal) || - (p->type() == Node::QmlMethod)) + if (p->subType() == Node::QmlClass) { base.prepend("qml-"); + } #endif - const Node *pp = p->parent(); if (!pp || pp->name().isEmpty() || pp->type() == Node::Fake) break; base.prepend(QLatin1Char('-')); -- cgit v0.12 From 4531ffbd8aa2cc0ae656715e449caca1649c18b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 29 Oct 2009 14:28:36 +0100 Subject: Added QImagePixmapCleanupHooks functions for enabling hooks. Better than having to befriend QPixmapData and setting is_cached manually. Reviewed-by: Tom Cooksey --- src/gui/image/qimagepixmapcleanuphooks.cpp | 18 +++++++++++++++++- src/gui/image/qimagepixmapcleanuphooks_p.h | 4 ++++ src/gui/image/qpixmapdata_p.h | 3 +-- src/opengl/qgl.cpp | 4 ++-- src/opengl/qgl_x11.cpp | 3 ++- src/opengl/qgl_x11egl.cpp | 3 ++- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index ac30646..35322e9 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -40,7 +40,8 @@ ****************************************************************************/ #include "qimagepixmapcleanuphooks_p.h" -#include "qpixmapdata_p.h" +#include "private/qpixmapdata_p.h" +#include "private/qimage_p.h" QT_BEGIN_NAMESPACE @@ -132,4 +133,19 @@ void QImagePixmapCleanupHooks::executeImageHooks(qint64 key) qt_image_cleanup_hook_64(key); } +void QImagePixmapCleanupHooks::enableCleanupHooks(const QPixmap &pixmap) +{ + enableCleanupHooks(const_cast(pixmap).data_ptr().data()); +} + +void QImagePixmapCleanupHooks::enableCleanupHooks(QPixmapData *pixmapData) +{ + pixmapData->is_cached = true; +} + +void QImagePixmapCleanupHooks::enableCleanupHooks(const QImage &image) +{ + const_cast(image).data_ptr()->is_cached = true; +} + QT_END_NAMESPACE diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h index 16c8974..9e490d7 100644 --- a/src/gui/image/qimagepixmapcleanuphooks_p.h +++ b/src/gui/image/qimagepixmapcleanuphooks_p.h @@ -70,6 +70,10 @@ public: static QImagePixmapCleanupHooks *instance(); + static void enableCleanupHooks(const QImage &image); + static void enableCleanupHooks(const QPixmap &pixmap); + static void enableCleanupHooks(QPixmapData *pixmapData); + // Gets called when a pixmap is about to be modified: void addPixmapModificationHook(_qt_pixmap_cleanup_hook_pm); diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 2f4f201..e99409c 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -131,12 +131,11 @@ protected: private: friend class QPixmap; - friend class QGLContextPrivate; friend class QX11PixmapData; friend class QS60PixmapData; + friend class QImagePixmapCleanupHooks; // Needs to set is_cached friend class QGLTextureCache; //Needs to check the reference count friend class QExplicitlySharedDataPointer; - friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs to set is_cached QAtomicInt ref; int detach_no; diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e80521b..3fec1f0 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2137,7 +2137,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G Q_ASSERT(texture); if (texture->id > 0) - const_cast(image).data_ptr()->is_cached = true; + QImagePixmapCleanupHooks::enableCleanupHooks(image); return texture; } @@ -2396,7 +2396,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, Q_ASSERT(texture); if (texture->id > 0) - const_cast(pixmap).data_ptr()->is_cached = true; + QImagePixmapCleanupHooks::enableCleanupHooks(pixmap); return texture; } diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 86e593d..899047a 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #ifdef Q_OS_HPUX // for GLXPBuffer #include @@ -1704,7 +1705,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con pixmapData->gl_surface = (Qt::HANDLE)glxPixmap; // Make sure the cleanup hook gets called so we can delete the glx pixmap - pixmapData->is_cached = true; + QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); } GLuint textureId; diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 7180682..9b20297 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -42,6 +42,7 @@ #include "qgl.h" #include #include +#include #include #include #include "qgl_egl_p.h" @@ -531,7 +532,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl Q_ASSERT(sizeof(Qt::HANDLE) >= sizeof(EGLSurface)); // Just to make totally sure! pixmapData->gl_surface = (Qt::HANDLE)pixmapSurface; - pixmapData->is_cached = true; // Make sure the cleanup hook gets called + QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); // Make sure the cleanup hook gets called return true; } -- cgit v0.12 From 2f9c37c4b48c4b5005c89f1c5a5fa036e1e22811 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 29 Oct 2009 17:14:47 +0100 Subject: Avoid infinite loop when laying out text with unconvertible chars When the stringToCMap() fails, it can be because it did not have enough space in the layout, or it can because of other errors. In order to implement "try-again" processing in a simple way, we had an infinite loop which assumed that stringToCMap() would always succeed in the second run (which would be the case if the only possible error was "not enough space".) Since there are other possible failures not related to the number of glyphs, you could easily get into an infinite loop here, e.g. when laying out text that contains the Byte Order Mark. The fix changes the implementation to explictly try stringToCMap() twice at max, and is also how it's implemented in the default qtextengine.cpp. Task-number: QTBUG-4680 Reviewed-by: Trond --- src/gui/text/qtextengine_mac.cpp | 73 ++++++++++++++---------------- tests/auto/qtextlayout/tst_qtextlayout.cpp | 13 ++++++ 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp index eeccc72..54be53b 100644 --- a/src/gui/text/qtextengine_mac.cpp +++ b/src/gui/text/qtextengine_mac.cpp @@ -594,53 +594,50 @@ void QTextEngine::shapeTextMac(int item) const str = reinterpret_cast(uc); } - while (true) { - ensureSpace(num_glyphs); - num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - - QGlyphLayout g = availableGlyphs(&si); - g.numGlyphs = num_glyphs; - unsigned short *log_clusters = logClusters(&si); + ensureSpace(num_glyphs); + num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - if (fe->stringToCMap(str, - len, - &g, - &num_glyphs, - flags, - log_clusters, - attributes())) { + QGlyphLayout g = availableGlyphs(&si); + g.numGlyphs = num_glyphs; + unsigned short *log_clusters = logClusters(&si); - heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - break; - } + bool stringToCMapFailed = false; + if (!fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, attributes())) { + ensureSpace(num_glyphs); + stringToCMapFailed = fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, + attributes()); } - si.num_glyphs = num_glyphs; + if (!stringToCMapFailed) { + heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - layoutData->used += si.num_glyphs; + si.num_glyphs = num_glyphs; - QGlyphLayout g = shapedGlyphs(&si); + layoutData->used += si.num_glyphs; - if (si.analysis.script == QUnicodeTables::Arabic) { - QVarLengthArray props(len + 2); - QArabicProperties *properties = props.data(); - int f = si.position; - int l = len; - if (f > 0) { - --f; - ++l; - ++properties; - } - if (f + l < layoutData->string.length()) { - ++l; - } - qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); + QGlyphLayout g = shapedGlyphs(&si); - unsigned short *log_clusters = logClusters(&si); + if (si.analysis.script == QUnicodeTables::Arabic) { + QVarLengthArray props(len + 2); + QArabicProperties *properties = props.data(); + int f = si.position; + int l = len; + if (f > 0) { + --f; + ++l; + ++properties; + } + if (f + l < layoutData->string.length()) { + ++l; + } + qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); - for (int i = 0; i < len; ++i) { - int gpos = log_clusters[i]; - g.attributes[gpos].justification = properties[i].justification; + unsigned short *log_clusters = logClusters(&si); + + for (int i = 0; i < len; ++i) { + int gpos = log_clusters[i]; + g.attributes[gpos].justification = properties[i].justification; + } } } diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index fe87dfb..7c3f4f2 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -118,6 +118,7 @@ private slots: void smallTextLengthWordWrap(); void smallTextLengthWrapAtWordBoundaryOrAnywhere(); void testLineBreakingAllSpaces(); + void lineWidthFromBOM(); private: @@ -1306,6 +1307,18 @@ void tst_QTextLayout::columnWrapWithTabs() } +void tst_QTextLayout::lineWidthFromBOM() +{ + const QString string(QChar(0xfeff)); // BYTE ORDER MARK + QTextLayout layout(string); + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(INT_MAX / 256); + layout.endLayout(); + + // Don't spin into an infinite loop + } + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From 9e01ced1d14467c06d7e1db57982556c9e861372 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Oct 2009 18:07:06 +0100 Subject: Remove the posix_memalign and Win32 _aligned_malloc MinGW doesn't have _aligned_malloc and posix_memalign doesn't have a realloc function. So use our own implementation in all platforms. Removing posix_memalign was reviewed by Brad, but I apparently lost the commit. Reviewed-by: Trust Me --- src/corelib/global/qmalloc.cpp | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp index 3584c50..4aab1bd 100644 --- a/src/corelib/global/qmalloc.cpp +++ b/src/corelib/global/qmalloc.cpp @@ -43,10 +43,6 @@ #include -#ifdef Q_OS_WIN -# include -#endif - /* Define the container allocation functions in a separate file, so that our users can easily override them. @@ -71,38 +67,11 @@ void *qRealloc(void *ptr, size_t size) void *qMallocAligned(size_t size, size_t alignment) { -#if defined(Q_OS_WIN) - return _aligned_malloc(size, alignment); -#elif defined(HAVE_POSIX_MEMALIGN) - if (alignment <= sizeof(void*)) - return qMalloc(size); - - // we have posix_memalign - void *ptr = 0; - if (posix_memalign(&ptr, alignment, size) == 0) - return ptr; - return 0; -#else return qReallocAligned(0, size, 0, alignment); -#endif } void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t alignment) { -#if defined(Q_OS_WIN) - Q_UNUSED(oldsize); - return _aligned_realloc(oldptr, newsize, alignment); -#elif defined(HAVE_POSIX_MEMALIGN) - if (alignment <= sizeof(void*)) - return qRealloc(oldptr, newsize); - - void *newptr = qMallocAligned(newsize, alignment); - if (!newptr) - return 0; - qMemCopy(newptr, oldptr, qMin(oldsize, newsize)); - qFree(oldptr); - return newptr; -#else // fake an aligned allocation Q_UNUSED(oldsize); @@ -144,21 +113,14 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align faked.pptr[-1] = real.ptr; return faked.ptr; -#endif } void qFreeAligned(void *ptr) { -#if defined(Q_OS_WIN) - _aligned_free(ptr); -#elif defined(HAVE_POSIX_MEMALIGN) - ::free(ptr); -#else if (!ptr) return; void **ptr2 = static_cast(ptr); free(ptr2[-1]); -#endif } QT_END_NAMESPACE -- cgit v0.12 From 6f602c01b9dc2b037cb42cacfe1c2df6e092a6b4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Oct 2009 18:13:21 +0100 Subject: Autotest: this test is failing, enable debugging to find out why. It doesn't happen on my machine, so I need to figure out what's different. Reviewed-by: Trust Me --- tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index d84350b..91050f5 100644 --- a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -132,6 +132,9 @@ tst_QDBusAbstractInterface::tst_QDBusAbstractInterface() void tst_QDBusAbstractInterface::initTestCase() { + // enable debugging temporarily: + putenv("QDBUS_DEBUG=1"); + // register the object QDBusConnection con = QDBusConnection::sessionBus(); QVERIFY(con.isConnected()); @@ -469,7 +472,7 @@ void tst_QDBusAbstractInterface::followSignal() QVERIFY(!QTestEventLoop::instance().timeout()); // now the signal must have been received: - QVERIFY(s.size() == 1); + QCOMPARE(s.size(), 1); QVERIFY(s.at(0).size() == 0); s.clear(); -- cgit v0.12 From 79eef278228aac21fbf8b21eaa337f2922bc68c1 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 28 Oct 2009 13:49:19 +0100 Subject: Lazily construct QPixmapData's for null pixmaps Reviewed-by: Trond --- src/gui/image/qpixmap.cpp | 64 +++++++++++++++++++++++++------------------ src/gui/image/qpixmap_mac.cpp | 3 ++ src/gui/image/qpixmap_qws.cpp | 8 +++--- src/gui/image/qpixmap_s60.cpp | 13 +++++---- src/gui/image/qpixmap_win.cpp | 3 ++ src/gui/image/qpixmap_x11.cpp | 7 +++-- src/gui/image/qpixmapdata.cpp | 13 +++++++++ src/gui/image/qpixmapdata_p.h | 2 ++ 8 files changed, 75 insertions(+), 38 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 45ff5f4..c452b9a 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -113,13 +113,10 @@ void QPixmap::init(int w, int h, Type type) void QPixmap::init(int w, int h, int type) { - QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); - if (gs) - data = gs->createPixmapData(static_cast(type)); + if ((w > 0 && h > 0) || type == QPixmapData::BitmapType) + data = QPixmapData::create(w, h, (QPixmapData::PixelType) type); else - data = QGraphicsSystem::createDefaultPixmapData(static_cast(type)); - - data->resize(w, h); + data = 0; } /*! @@ -307,7 +304,7 @@ QPixmap::QPixmap(const char * const xpm[]) QImage image(xpm); if (!image.isNull()) { - if (data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPixmapData::BitmapType) *this = QBitmap::fromImage(image); else *this = fromImage(image); @@ -322,8 +319,8 @@ QPixmap::QPixmap(const char * const xpm[]) QPixmap::~QPixmap() { - Q_ASSERT(data->ref >= 1); // Catch if ref-counting changes again - if (data->is_cached && data->ref == 1) // ref will be decrememnted after destructor returns + Q_ASSERT(!data || data->ref >= 1); // Catch if ref-counting changes again + if (data && data->is_cached && data->ref == 1) // ref will be decrememnted after destructor returns QImagePixmapCleanupHooks::executePixmapDestructionHooks(this); } @@ -544,7 +541,7 @@ bool QPixmap::isQBitmap() const */ bool QPixmap::isNull() const { - return data->isNull(); + return !data || data->isNull(); } /*! @@ -556,7 +553,7 @@ bool QPixmap::isNull() const */ int QPixmap::width() const { - return data->width(); + return data ? data->width() : 0; } /*! @@ -568,7 +565,7 @@ int QPixmap::width() const */ int QPixmap::height() const { - return data->height(); + return data ? data->height() : 0; } /*! @@ -581,7 +578,7 @@ int QPixmap::height() const */ QSize QPixmap::size() const { - return QSize(data->width(), data->height()); + return data ? QSize(data->width(), data->height()) : QSize(); } /*! @@ -593,7 +590,7 @@ QSize QPixmap::size() const */ QRect QPixmap::rect() const { - return QRect(0, 0, data->width(), data->height()); + return data ? QRect(0, 0, data->width(), data->height()) : QRect(); } /*! @@ -609,7 +606,7 @@ QRect QPixmap::rect() const */ int QPixmap::depth() const { - return data->depth(); + return data ? data->depth() : 0; } /*! @@ -639,7 +636,7 @@ void QPixmap::resize_helper(const QSize &s) return; // Create new pixmap - QPixmap pm(QSize(w, h), data->type); + QPixmap pm(QSize(w, h), data ? data->type : QPixmapData::PixmapType); bool uninit = false; #if defined(Q_WS_X11) QX11PixmapData *x11Data = data->classId() == QPixmapData::X11Class ? static_cast(data.data()) : 0; @@ -728,6 +725,9 @@ void QPixmap::setMask(const QBitmap &mask) return; } + if (isNull()) + return; + if (static_cast(mask).data == data) // trying to selfmask return; @@ -826,11 +826,14 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers QFileInfo info(fileName); QString key = QLatin1String("qt_pixmap_") + info.absoluteFilePath() + QLatin1Char('_') + QString::number(info.lastModified().toTime_t()) + QLatin1Char('_') + - QString::number(info.size()) + QLatin1Char('_') + QString::number(data->pixelType()); + QString::number(info.size()) + QLatin1Char('_') + QString::number(data ? data->pixelType() : QPixmapData::PixmapType); if (QPixmapCache::find(key, *this)) return true; + if (!data) + data = QPixmapData::create(0, 0, QPixmapData::PixmapType); + if (data->fromFile(fileName, format, flags)) { QPixmapCache::insert(key, *this); return true; @@ -863,6 +866,9 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I if (len == 0 || buf == 0) return false; + if (!data) + data = QPixmapData::create(0, 0, QPixmapData::PixmapType); + return data->fromData(buf, len, format, flags); } @@ -1008,6 +1014,9 @@ int QPixmap::serialNumber() const */ qint64 QPixmap::cacheKey() const { + if (isNull()) + return 0; + int classKey = data->classId(); if (classKey >= 1024) classKey = -(classKey >> 10); @@ -1224,7 +1233,7 @@ QPixmap::QPixmap(const QImage& image) QPixmap &QPixmap::operator=(const QImage &image) { - if (data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPixmapData::BitmapType) *this = QBitmap::fromImage(image); else *this = fromImage(image); @@ -1254,7 +1263,7 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Color */ bool QPixmap::convertFromImage(const QImage &image, ColorMode mode) { - if (data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPixmapData::BitmapType) *this = QBitmap::fromImage(image, colorModeToFlags(mode)); else *this = fromImage(image, colorModeToFlags(mode)); @@ -1341,7 +1350,7 @@ Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, bool QPixmap::isDetached() const { - return data->ref == 1; + return data && data->ref == 1; } /*! \internal @@ -1753,7 +1762,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) */ bool QPixmap::hasAlpha() const { - return (data->hasAlphaChannel() || !data->mask().isNull()); + return data && (data->hasAlphaChannel() || !data->mask().isNull()); } /*! @@ -1764,7 +1773,7 @@ bool QPixmap::hasAlpha() const */ bool QPixmap::hasAlphaChannel() const { - return data->hasAlphaChannel(); + return data && data->hasAlphaChannel(); } /*! @@ -1772,7 +1781,7 @@ bool QPixmap::hasAlphaChannel() const */ int QPixmap::metric(PaintDeviceMetric metric) const { - return data->metric(metric); + return data ? data->metric(metric) : 0; } /*! @@ -1844,7 +1853,7 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel) */ QPixmap QPixmap::alphaChannel() const { - return data->alphaChannel(); + return data ? data->alphaChannel() : QPixmap(); } /*! @@ -1852,7 +1861,7 @@ QPixmap QPixmap::alphaChannel() const */ QPaintEngine *QPixmap::paintEngine() const { - return data->paintEngine(); + return data ? data->paintEngine() : 0; } /*! @@ -1867,7 +1876,7 @@ QPaintEngine *QPixmap::paintEngine() const */ QBitmap QPixmap::mask() const { - return data->mask(); + return data ? data->mask() : QBitmap(); } /*! @@ -1916,6 +1925,9 @@ int QPixmap::defaultDepth() */ void QPixmap::detach() { + if (!data) + return; + QPixmapData::ClassId id = data->classId(); if (id == QPixmapData::RasterClass) { QRasterPixmapData *rasterData = static_cast(data.data()); diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index afa6f83..15350e8 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -965,6 +965,9 @@ Qt::HANDLE QPixmap::macQDAlphaHandle() const Qt::HANDLE QPixmap::macCGHandle() const { + if (isNull()) + return 0; + if (data->classId() == QPixmapData::MacClass) { QMacPixmapData *d = static_cast(data.data()); if (!d->cg_data) diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp index 6b4283e..a8516a5 100644 --- a/src/gui/image/qpixmap_qws.cpp +++ b/src/gui/image/qpixmap_qws.cpp @@ -114,7 +114,7 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) QRgb* QPixmap::clut() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast(data.data()); return d->image.colorTable().data(); } @@ -124,7 +124,7 @@ QRgb* QPixmap::clut() const int QPixmap::numCols() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast(data.data()); return d->image.numColors(); } @@ -134,7 +134,7 @@ int QPixmap::numCols() const const uchar* QPixmap::qwsBits() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast(data.data()); return d->image.bits(); } @@ -144,7 +144,7 @@ const uchar* QPixmap::qwsBits() const int QPixmap::qwsBytesPerLine() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast(data.data()); return d->image.bytesPerLine(); } diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 666d608..d4c97e1 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -311,7 +311,7 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h) CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const { QPixmapData *data = pixmapData(); - if (data->isNull()) + if (!data || data->isNull()) return 0; return reinterpret_cast(data->toNativeType(QPixmapData::FbsBitmap)); @@ -337,8 +337,9 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) if (!bitmap) return QPixmap(); - QPixmap pixmap; - pixmap.pixmapData()->fromNativeType(reinterpret_cast(bitmap), QPixmapData::FbsBitmap); + QScopedPointer data(new QS60PixmapData(QPixmapData::PixmapType)); + data->fromNativeType(reinterpret_cast(bitmap), QPixmapData::FbsBitmap); + QPixmap pixmap(data.take()); return pixmap; } @@ -752,9 +753,9 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) if (!sgImage) return QPixmap(); - QPixmap pixmap; - pixmap.pixmapData()->fromNativeType(reinterpret_cast(sgImage), QPixmapData::SgImage); - + QScopedPointer data(new QS60PixmapData(QPixmapData::PixmapType)); + data->fromNativeType(reinterpret_cast(bitmap), QPixmapData::SgImage); + QPixmap pixmap(data.take()); return pixmap; } diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 1b61484..04027c1 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -121,6 +121,9 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const { + if (isNull()) + return 0; + HBITMAP bitmap = 0; if (data->classId() == QPixmapData::RasterClass) { QRasterPixmapData* d = static_cast(data.data()); diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index ea9eff9..8a0120a 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1976,6 +1976,9 @@ void QPixmap::x11SetScreen(int screen) return; } + if (isNull()) + return; + if (data->classId() != QPixmapData::X11Class) return; @@ -2078,7 +2081,7 @@ bool QX11PixmapData::hasAlphaChannel() const const QX11Info &QPixmap::x11Info() const { - if (data->classId() == QPixmapData::X11Class) + if (data && data->classId() == QPixmapData::X11Class) return static_cast(data.data())->xinfo; else { static QX11Info nullX11Info; @@ -2135,7 +2138,7 @@ QPaintEngine* QX11PixmapData::paintEngine() const Qt::HANDLE QPixmap::x11PictureHandle() const { #ifndef QT_NO_XRENDER - if (data->classId() == QPixmapData::X11Class) + if (data && data->classId() == QPixmapData::X11Class) return static_cast(data.data())->picture; else return 0; diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 1ad1f02..10194e4 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -51,6 +51,19 @@ QT_BEGIN_NAMESPACE const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +QPixmapData *QPixmapData::create(int w, int h, PixelType type) +{ + QPixmapData *data; + QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); + if (gs) + data = gs->createPixmapData(static_cast(type)); + else + data = QGraphicsSystem::createDefaultPixmapData(static_cast(type)); + data->resize(w, h); + return data; +} + + QPixmapData::QPixmapData(PixelType pixelType, int objectId) : w(0), h(0), diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index e99409c..d1bb92a 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -122,6 +122,8 @@ public: virtual void fromNativeType(void* pixmap, NativeType type); #endif + static QPixmapData *create(int w, int h, PixelType type); + protected: void setSerialNumber(int serNo); int w; -- cgit v0.12 From 180e36e586437ffb751166f0088329ecbec3001e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Fri, 30 Oct 2009 13:43:40 +0200 Subject: S60Style: List items should be taller for touch use (5th Edition) This fixes private JIRA issue: QT-1479. The change makes itemview items taller by twice the QStyle::PM_FocusFrameVMargin amount (both margins) when touch is in use. It is rather curious that the QCommonStyle modifies QRect for itemviews in horizontal direction by twice the QStyle::PM_FocusFrameHMargin amount, but does not do it in vertical direction. Task-number: QT-1479 (private) Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b87f3a8..dc38397 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2266,10 +2266,19 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz += QSize(2*f->lineWidth, 4*f->lineWidth); break; case CT_TabBarTab: - QSize naviPaneSize = QS60StylePrivate::naviPaneSize(); + { + const QSize naviPaneSize = QS60StylePrivate::naviPaneSize(); + sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); + if (naviPaneSize.height() > sz.height()) + sz.setHeight(naviPaneSize.height()); + } + break; + case CT_ItemViewItem: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); - if (naviPaneSize.height() > sz.height()) - sz.setHeight(naviPaneSize.height()); + if (QS60StylePrivate::isTouchSupported()) + //Make itemview easier to use in touch devices + //QCommonStyle does not adjust height with horizontal margin, it only adjusts width + sz.setHeight(sz.height() + 2*pixelMetric(QStyle::PM_FocusFrameVMargin)); break; default: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); -- cgit v0.12 From e662c6a07a01506bd14b57790a887d5c68b79420 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 20 Oct 2009 16:42:06 +0200 Subject: Refactor of shader manager to not use partial shaders This is a first step towards supporting binary shaders. Note: This change will introduce a (rare) leak of shader objects, as the shaders will never be kicked out from the cache (because the cache is still a QList) :-) This will be corrected by the next patch. Reviewed-By: Samuel --- .../gl2paintengineex/qglcustomshaderstage.cpp | 21 +- .../gl2paintengineex/qglcustomshaderstage_p.h | 3 +- .../gl2paintengineex/qglengineshadermanager.cpp | 340 ++++++++++----------- .../gl2paintengineex/qglengineshadermanager_p.h | 64 ++-- 4 files changed, 211 insertions(+), 217 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp index ab2026c..b71a7b7 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp @@ -67,8 +67,10 @@ QGLCustomShaderStage::QGLCustomShaderStage() QGLCustomShaderStage::~QGLCustomShaderStage() { Q_D(QGLCustomShaderStage); - if (d->m_manager) - d->m_manager->removeCustomStage(this); + if (d->m_manager) { + d->m_manager->removeCustomStage(); + d->m_manager->sharedShaders->cleanupCustomStage(this); + } } void QGLCustomShaderStage::setUniformsDirty() @@ -85,6 +87,8 @@ bool QGLCustomShaderStage::setOnPainter(QPainter* p) qWarning("QGLCustomShaderStage::setOnPainter() - paint engine not OpenGL2"); return false; } + if (d->m_manager) + qWarning("Custom shader is already set on a painter"); QGL2PaintEngineEx *engine = static_cast(p->paintEngine()); d->m_manager = QGL2PaintEngineExPrivate::shaderManagerForEngine(engine); @@ -108,12 +112,21 @@ void QGLCustomShaderStage::removeFromPainter(QPainter* p) // This should leave the program in a compiled/linked state // if the next custom shader stage is this one again. d->m_manager->setCustomStage(0); + d->m_manager = 0; } -const char* QGLCustomShaderStage::source() const +QByteArray QGLCustomShaderStage::source() const { Q_D(const QGLCustomShaderStage); - return d->m_source.constData(); + return d->m_source; +} + +// Called by the shader manager if another custom shader is attached or +// the manager is deleted +void QGLCustomShaderStage::setInactive() +{ + Q_D(QGLCustomShaderStage); + d->m_manager = 0; } void QGLCustomShaderStage::setSource(const QByteArray& s) diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h index f8c13c5..e319389 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h @@ -74,8 +74,9 @@ public: bool setOnPainter(QPainter*); void removeFromPainter(QPainter*); - const char* source() const; + QByteArray source() const; + void setInactive(); protected: void setSource(const QByteArray&); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index af9306f..9dc2b53 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -78,7 +78,6 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) , blitShaderProg(0) , simpleShaderProg(0) { - memset(compiledShaders, 0, sizeof(compiledShaders)); /* Rather than having the shader source array statically initialised, it is initialised @@ -121,7 +120,7 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) code[ImageSrcFragmentShader] = qglslImageSrcFragmentShader; code[ImageSrcWithPatternFragmentShader] = qglslImageSrcWithPatternFragmentShader; code[NonPremultipliedImageSrcFragmentShader] = qglslNonPremultipliedImageSrcFragmentShader; - code[CustomImageSrcFragmentShader] = ""; // Supplied by app. + code[CustomImageSrcFragmentShader] = qglslCustomSrcFragmentShader; // Calls "customShader", which must be appended code[SolidBrushSrcFragmentShader] = qglslSolidBrushSrcFragmentShader; code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader; code[TextureBrushSrcWithPatternFragmentShader] = qglslTextureBrushSrcWithPatternFragmentShader; @@ -163,16 +162,26 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) qglEngineShaderSourceCodePopulated = true; } + QGLShader* fragShader; + QGLShader* vertexShader; + QByteArray source; + // Compile up the simple shader: + source.clear(); + source.append(qglEngineShaderSourceCode[MainVertexShader]); + source.append(qglEngineShaderSourceCode[PositionOnlyVertexShader]); + vertexShader = new QGLShader(QGLShader::VertexShader, context, this); + vertexShader->compile(source); + + source.clear(); + source.append(qglEngineShaderSourceCode[MainFragmentShader]); + source.append(qglEngineShaderSourceCode[ShockingPinkSrcFragmentShader]); + fragShader = new QGLShader(QGLShader::FragmentShader, context, this); + fragShader->compile(source); + simpleShaderProg = new QGLShaderProgram(context, this); - compileNamedShader(MainVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(PositionOnlyVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(MainFragmentShader, QGLShader::PartialFragmentShader); - compileNamedShader(ShockingPinkSrcFragmentShader, QGLShader::PartialFragmentShader); - simpleShaderProg->addShader(compiledShaders[MainVertexShader]); - simpleShaderProg->addShader(compiledShaders[PositionOnlyVertexShader]); - simpleShaderProg->addShader(compiledShaders[MainFragmentShader]); - simpleShaderProg->addShader(compiledShaders[ShockingPinkSrcFragmentShader]); + simpleShaderProg->addShader(vertexShader); + simpleShaderProg->addShader(fragShader); simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); simpleShaderProg->link(); if (!simpleShaderProg->isLinked()) { @@ -181,82 +190,29 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) } // Compile the blit shader: + source.clear(); + source.append(qglEngineShaderSourceCode[MainWithTexCoordsVertexShader]); + source.append(qglEngineShaderSourceCode[UntransformedPositionVertexShader]); + vertexShader = new QGLShader(QGLShader::VertexShader, context, this); + vertexShader->compile(source); + + source.clear(); + source.append(qglEngineShaderSourceCode[MainFragmentShader]); + source.append(qglEngineShaderSourceCode[ImageSrcFragmentShader]); + fragShader = new QGLShader(QGLShader::FragmentShader, context, this); + fragShader->compile(source); + blitShaderProg = new QGLShaderProgram(context, this); - compileNamedShader(MainWithTexCoordsVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(UntransformedPositionVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(MainFragmentShader, QGLShader::PartialFragmentShader); - compileNamedShader(ImageSrcFragmentShader, QGLShader::PartialFragmentShader); - blitShaderProg->addShader(compiledShaders[MainWithTexCoordsVertexShader]); - blitShaderProg->addShader(compiledShaders[UntransformedPositionVertexShader]); - blitShaderProg->addShader(compiledShaders[MainFragmentShader]); - blitShaderProg->addShader(compiledShaders[ImageSrcFragmentShader]); + blitShaderProg->addShader(vertexShader); + blitShaderProg->addShader(fragShader); blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); blitShaderProg->link(); if (!blitShaderProg->isLinked()) { qCritical() << "Errors linking blit shader:" - << blitShaderProg->log(); - } -} - -void QGLEngineSharedShaders::shaderDestroyed(QObject *shader) -{ - // Remove any shader programs which has this as the srcPixel shader: - for (int i = 0; i < cachedPrograms.size(); ++i) { - if (cachedPrograms.at(i).srcPixelFragShader == shader) { - delete cachedPrograms.at(i).program; - cachedPrograms.removeAt(i--); - } + << simpleShaderProg->log(); } - emit shaderProgNeedsChanging(); -} - -QGLShader *QGLEngineSharedShaders::compileNamedShader(ShaderName name, QGLShader::ShaderType type) -{ - Q_ASSERT(name != CustomImageSrcFragmentShader); - Q_ASSERT(name < InvalidShaderName); - - if (compiledShaders[name]) - return compiledShaders[name]; - - QByteArray source = qglEngineShaderSourceCode[name]; - QGLShader *newShader = new QGLShader(type, ctxGuard.context(), this); - newShader->compile(source); - -#if defined(QT_DEBUG) - // Name the shader for easier debugging - QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); - newShader->setObjectName(QLatin1String(m.valueToKey(name))); -#endif - - compiledShaders[name] = newShader; - return newShader; -} - -QGLShader *QGLEngineSharedShaders::compileCustomShader(QGLCustomShaderStage *stage, QGLShader::ShaderType type) -{ - QByteArray source = stage->source(); - source += qglslCustomSrcFragmentShader; - - QGLShader *newShader = customShaderCache.object(source); - if (newShader) - return newShader; - - newShader = new QGLShader(type, ctxGuard.context(), this); - newShader->compile(source); - customShaderCache.insert(source, newShader); - - connect(newShader, SIGNAL(destroyed(QObject *)), - this, SLOT(shaderDestroyed(QObject *))); - -#if defined(QT_DEBUG) - // Name the shader for easier debugging - QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); - newShader->setObjectName(QLatin1String(m.valueToKey(CustomImageSrcFragmentShader))); -#endif - - return newShader; } // The address returned here will only be valid until next time this function is called. @@ -270,14 +226,54 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS cachedPrograms.append(prog); QGLEngineShaderProg &cached = cachedPrograms.last(); + QByteArray source; + source.append(qglEngineShaderSourceCode[prog.mainFragShader]); + source.append(qglEngineShaderSourceCode[prog.srcPixelFragShader]); + if (prog.srcPixelFragShader == CustomImageSrcFragmentShader) + source.append(prog.customStageSource); + if (prog.compositionFragShader) + source.append(qglEngineShaderSourceCode[prog.compositionFragShader]); + if (prog.maskFragShader) + source.append(qglEngineShaderSourceCode[prog.maskFragShader]); + QGLShader* fragShader = new QGLShader(QGLShader::FragmentShader, ctxGuard.context(), this); + fragShader->compile(source); + + source.clear(); + source.append(qglEngineShaderSourceCode[prog.mainVertexShader]); + source.append(qglEngineShaderSourceCode[prog.positionVertexShader]); + QGLShader* vertexShader = new QGLShader(QGLShader::VertexShader, ctxGuard.context(), this); + vertexShader->compile(source); + +#if defined(QT_DEBUG) + // Name the shaders for easier debugging + QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); + QByteArray description; + description.append("Fragment shader: main="); + description.append(m.valueToKey(prog.mainFragShader)); + description.append(", srcPixel="); + description.append(m.valueToKey(prog.srcPixelFragShader)); + if (prog.compositionFragShader) { + description.append(", composition="); + description.append(m.valueToKey(prog.compositionFragShader)); + } + if (prog.maskFragShader) { + description.append(", mask="); + description.append(m.valueToKey(prog.maskFragShader)); + } + fragShader->setObjectName(QString::fromLatin1(description)); + + description.clear(); + description.append("Vertex shader: main="); + description.append(m.valueToKey(prog.mainVertexShader)); + description.append(", position="); + description.append(m.valueToKey(prog.positionVertexShader)); + vertexShader->setObjectName(QString::fromLatin1(description)); +#endif + // If the shader program's not found in the cache, create it now. cached.program = new QGLShaderProgram(ctxGuard.context(), this); - cached.program->addShader(cached.mainVertexShader); - cached.program->addShader(cached.positionVertexShader); - cached.program->addShader(cached.mainFragShader); - cached.program->addShader(cached.srcPixelFragShader); - cached.program->addShader(cached.maskFragShader); - cached.program->addShader(cached.compositionFragShader); + cached.program->addShader(vertexShader); + cached.program->addShader(fragShader); // We have to bind the vertex attribute names before the program is linked: cached.program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); @@ -294,25 +290,11 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS error = QLatin1String("Shader program failed to link,") #if defined(QT_DEBUG) + br - + QLatin1String(" Shaders Used:\n") - + QLatin1String(" mainVertexShader = ") - + (cached.mainVertexShader ? - cached.mainVertexShader->objectName() : none) + br - + QLatin1String(" positionVertexShader = ") - + (cached.positionVertexShader ? - cached.positionVertexShader->objectName() : none) + br - + QLatin1String(" mainFragShader = ") - + (cached.mainFragShader ? - cached.mainFragShader->objectName() : none) + br - + QLatin1String(" srcPixelFragShader = ") - + (cached.srcPixelFragShader ? - cached.srcPixelFragShader->objectName() : none) + br - + QLatin1String(" maskFragShader = ") - + (cached.maskFragShader ? - cached.maskFragShader->objectName() : none) + br - + QLatin1String(" compositionFragShader = ") - + (cached.compositionFragShader ? - cached.compositionFragShader->objectName() : none) + br + + QLatin1String(" Shaders Used:") + br + + QLatin1String(" ") + vertexShader->objectName() + QLatin1String(": ") + br + + QLatin1String(vertexShader->sourceCode()) + br + + QLatin1String(" ") + fragShader->objectName() + QLatin1String(": ") + br + + QLatin1String(fragShader->sourceCode()) + br #endif + QLatin1String(" Error Log:\n") + QLatin1String(" ") + cached.program->log(); @@ -327,6 +309,20 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS } } + +void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage) +{ + // Remove any shader programs which has this as the custom shader src: + for (int i = 0; i < cachedPrograms.size(); ++i) { + if (cachedPrograms.at(i).customStageSource == stage->source()) { + delete cachedPrograms.at(i).program; + cachedPrograms.removeAt(i--); + } + } +} + + + QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) : ctx(context), shaderProgNeedsChanging(true), @@ -335,8 +331,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) maskType(NoMask), compositionMode(QPainter::CompositionMode_SourceOver), customSrcStage(0), - currentShaderProg(0), - customShader(0) + currentShaderProg(0) { sharedShaders = QGLEngineSharedShaders::shadersForContext(context); connect(sharedShaders, SIGNAL(shaderProgNeedsChanging()), this, SLOT(shaderProgNeedsChangingSlot())); @@ -345,6 +340,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) QGLEngineShaderManager::~QGLEngineShaderManager() { //### + removeCustomStage(); } uint QGLEngineShaderManager::getUniformLocation(Uniform id) @@ -436,21 +432,20 @@ void QGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode) void QGLEngineShaderManager::setCustomStage(QGLCustomShaderStage* stage) { + if (customSrcStage) + removeCustomStage(); customSrcStage = stage; - customShader = 0; // Will be compiled from 'customSrcStage' later. shaderProgNeedsChanging = true; } -void QGLEngineShaderManager::removeCustomStage(QGLCustomShaderStage* stage) +void QGLEngineShaderManager::removeCustomStage() { - Q_UNUSED(stage); // Currently we only support one at a time... - + if (customSrcStage) + customSrcStage->setInactive(); customSrcStage = 0; - customShader = 0; shaderProgNeedsChanging = true; } - QGLShaderProgram* QGLEngineShaderManager::currentProgram() { return currentShaderProg->program; @@ -488,16 +483,16 @@ bool QGLEngineShaderManager::useCorrectShaderProg() // Choose vertex shader shader position function (which typically also sets // varyings) and the source pixel (srcPixel) fragment shader function: - QGLEngineSharedShaders::ShaderName positionVertexShaderName = QGLEngineSharedShaders::InvalidShaderName; - QGLEngineSharedShaders::ShaderName srcPixelFragShaderName = QGLEngineSharedShaders::InvalidShaderName; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::InvalidShaderName; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::InvalidShaderName; bool isAffine = brushTransform.isAffine(); if ( (srcPixelType >= Qt::Dense1Pattern) && (srcPixelType <= Qt::DiagCrossPattern) ) { if (isAffine) - positionVertexShaderName = QGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader; else - positionVertexShaderName = QGLEngineSharedShaders::PositionWithPatternBrushVertexShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionWithPatternBrushVertexShader; - srcPixelFragShaderName = QGLEngineSharedShaders::PatternBrushSrcFragmentShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::PatternBrushSrcFragmentShader; } else switch (srcPixelType) { default: @@ -505,172 +500,157 @@ bool QGLEngineShaderManager::useCorrectShaderProg() qFatal("QGLEngineShaderManager::useCorrectShaderProg() - Qt::NoBrush style is set"); break; case QGLEngineShaderManager::ImageSrc: - srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; texCoords = true; break; case QGLEngineShaderManager::NonPremultipliedImageSrc: - srcPixelFragShaderName = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; texCoords = true; break; case QGLEngineShaderManager::PatternSrc: - srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; texCoords = true; break; case QGLEngineShaderManager::TextureSrcWithPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader; break; case Qt::SolidPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::SolidBrushSrcFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::SolidBrushSrcFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; break; case Qt::LinearGradientPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader : QGLEngineSharedShaders::PositionWithLinearGradientBrushVertexShader; break; case Qt::ConicalGradientPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader : QGLEngineSharedShaders::PositionWithConicalGradientBrushVertexShader; break; case Qt::RadialGradientPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader : QGLEngineSharedShaders::PositionWithRadialGradientBrushVertexShader; break; case Qt::TexturePattern: - srcPixelFragShaderName = QGLEngineSharedShaders::TextureBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader; break; }; - requiredProgram.positionVertexShader = sharedShaders->compileNamedShader(positionVertexShaderName, QGLShader::PartialVertexShader); + if (useCustomSrc) { - if (!customShader) - customShader = sharedShaders->compileCustomShader(customSrcStage, QGLShader::PartialFragmentShader); - requiredProgram.srcPixelFragShader = customShader; - } else { - requiredProgram.srcPixelFragShader = sharedShaders->compileNamedShader(srcPixelFragShaderName, QGLShader::PartialFragmentShader); + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::CustomImageSrcFragmentShader; + requiredProgram.customStageSource = customSrcStage->source(); } const bool hasCompose = compositionMode > QPainter::CompositionMode_Plus; const bool hasMask = maskType != QGLEngineShaderManager::NoMask; // Choose fragment shader main function: - QGLEngineSharedShaders::ShaderName mainFragShaderName; - if (opacityMode == AttributeOpacity) { Q_ASSERT(!hasCompose && !hasMask); - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_ImageArrays; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_ImageArrays; } else { bool useGlobalOpacity = (opacityMode == UniformOpacity); if (hasCompose && hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CMO; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CMO; if (hasCompose && hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CM; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CM; if (!hasCompose && hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_MO; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_MO; if (!hasCompose && hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_M; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_M; if (hasCompose && !hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CO; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CO; if (hasCompose && !hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_C; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_C; if (!hasCompose && !hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_O; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_O; if (!hasCompose && !hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader; } - requiredProgram.mainFragShader = sharedShaders->compileNamedShader(mainFragShaderName, QGLShader::PartialFragmentShader); - if (hasMask) { - QGLEngineSharedShaders::ShaderName maskShaderName = QGLEngineSharedShaders::InvalidShaderName; if (maskType == PixelMask) { - maskShaderName = QGLEngineSharedShaders::MaskFragmentShader; + requiredProgram.maskFragShader = QGLEngineSharedShaders::MaskFragmentShader; texCoords = true; } else if (maskType == SubPixelMaskPass1) { - maskShaderName = QGLEngineSharedShaders::RgbMaskFragmentShaderPass1; + requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass1; texCoords = true; } else if (maskType == SubPixelMaskPass2) { - maskShaderName = QGLEngineSharedShaders::RgbMaskFragmentShaderPass2; + requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass2; texCoords = true; } else if (maskType == SubPixelWithGammaMask) { - maskShaderName = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader; + requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader; texCoords = true; } else { qCritical("QGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type"); } - - requiredProgram.maskFragShader = sharedShaders->compileNamedShader(maskShaderName, QGLShader::PartialFragmentShader); } else { requiredProgram.maskFragShader = 0; } if (hasCompose) { - QGLEngineSharedShaders::ShaderName compositionShaderName = QGLEngineSharedShaders::InvalidShaderName; switch (compositionMode) { case QPainter::CompositionMode_Multiply: - compositionShaderName = QGLEngineSharedShaders::MultiplyCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::MultiplyCompositionModeFragmentShader; break; case QPainter::CompositionMode_Screen: - compositionShaderName = QGLEngineSharedShaders::ScreenCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ScreenCompositionModeFragmentShader; break; case QPainter::CompositionMode_Overlay: - compositionShaderName = QGLEngineSharedShaders::OverlayCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::OverlayCompositionModeFragmentShader; break; case QPainter::CompositionMode_Darken: - compositionShaderName = QGLEngineSharedShaders::DarkenCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::DarkenCompositionModeFragmentShader; break; case QPainter::CompositionMode_Lighten: - compositionShaderName = QGLEngineSharedShaders::LightenCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::LightenCompositionModeFragmentShader; break; case QPainter::CompositionMode_ColorDodge: - compositionShaderName = QGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader; break; case QPainter::CompositionMode_ColorBurn: - compositionShaderName = QGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader; break; case QPainter::CompositionMode_HardLight: - compositionShaderName = QGLEngineSharedShaders::HardLightCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::HardLightCompositionModeFragmentShader; break; case QPainter::CompositionMode_SoftLight: - compositionShaderName = QGLEngineSharedShaders::SoftLightCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::SoftLightCompositionModeFragmentShader; break; case QPainter::CompositionMode_Difference: - compositionShaderName = QGLEngineSharedShaders::DifferenceCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::DifferenceCompositionModeFragmentShader; break; case QPainter::CompositionMode_Exclusion: - compositionShaderName = QGLEngineSharedShaders::ExclusionCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ExclusionCompositionModeFragmentShader; break; default: qWarning("QGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode"); } - requiredProgram.compositionFragShader = sharedShaders->compileNamedShader(compositionShaderName, QGLShader::PartialFragmentShader); } else { requiredProgram.compositionFragShader = 0; } - // Choose vertex shader main function - QGLEngineSharedShaders::ShaderName mainVertexShaderName = QGLEngineSharedShaders::InvalidShaderName; + // Choose vertex shader main function if (opacityMode == AttributeOpacity) { Q_ASSERT(texCoords); - mainVertexShaderName = QGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader; + requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader; } else if (texCoords) { - mainVertexShaderName = QGLEngineSharedShaders::MainWithTexCoordsVertexShader; + requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsVertexShader; } else { - mainVertexShaderName = QGLEngineSharedShaders::MainVertexShader; + requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainVertexShader; } - requiredProgram.mainVertexShader = sharedShaders->compileNamedShader(mainVertexShaderName, QGLShader::PartialVertexShader); requiredProgram.useTextureCoords = texCoords; requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity); - // At this point, requiredProgram is fully populated so try to find the program in the cache currentShaderProg = sharedShaders->findProgramInCache(requiredProgram); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 291d24c..e4f7aa6 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -234,14 +234,16 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) + struct QGLEngineShaderProg { - QGLShader* mainVertexShader; - QGLShader* positionVertexShader; - QGLShader* mainFragShader; - QGLShader* srcPixelFragShader; - QGLShader* maskFragShader; // Can be null for no mask - QGLShader* compositionFragShader; // Can be null for GL-handled mode + int mainVertexShader; + int positionVertexShader; + int mainFragShader; + int srcPixelFragShader; + int maskFragShader; + int compositionFragShader; + QByteArray customStageSource; //TODO: Decent cache key for custom stages QGLShaderProgram* program; QVector uniformLocations; @@ -256,7 +258,8 @@ struct QGLEngineShaderProg mainFragShader == other.mainFragShader && srcPixelFragShader == other.srcPixelFragShader && maskFragShader == other.maskFragShader && - compositionFragShader == other.compositionFragShader + compositionFragShader == other.compositionFragShader && + customStageSource == other.customStageSource ); } }; @@ -344,33 +347,44 @@ public: TotalShaderCount, InvalidShaderName }; +#if defined (QT_DEBUG) + Q_ENUMS(ShaderName) +#endif - QGLEngineSharedShaders(const QGLContext *context); +/* + // These allow the ShaderName enum to be used as a cache key + const int mainVertexOffset = 0; + const int positionVertexOffset = (1<<2) - PositionOnlyVertexShader; + const int mainFragOffset = (1<<6) - MainFragmentShader_CMO; + const int srcPixelOffset = (1<<10) - ImageSrcFragmentShader; + const int maskOffset = (1<<14) - NoMaskShader; + const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader; +*/ - QGLShader *compileNamedShader(ShaderName name, QGLShader::ShaderType type); + QGLEngineSharedShaders(const QGLContext *context); QGLShaderProgram *simpleProgram() { return simpleShaderProg; } QGLShaderProgram *blitProgram() { return blitShaderProg; } // Compile the program if it's not already in the cache, return the item in the cache. QGLEngineShaderProg *findProgramInCache(const QGLEngineShaderProg &prog); // Compile the custom shader if it's not already in the cache, return the item in the cache. - QGLShader *compileCustomShader(QGLCustomShaderStage *stage, QGLShader::ShaderType type); static QGLEngineSharedShaders *shadersForContext(const QGLContext *context); + // Ideally, this would be static and cleanup all programs in all contexts which + // contain the custom code. Currently it is just a hint and we rely on deleted + // custom shaders being cleaned up by being kicked out of the cache when it's + // full. + void cleanupCustomStage(QGLCustomShaderStage* stage); + signals: void shaderProgNeedsChanging(); -private slots: - void shaderDestroyed(QObject *shader); - private: QGLSharedResourceGuard ctxGuard; QGLShaderProgram *blitShaderProg; QGLShaderProgram *simpleShaderProg; QList cachedPrograms; - QCache customShaderCache; - QGLShader* compiledShaders[TotalShaderCount]; static const char* qglEngineShaderSourceCode[TotalShaderCount]; }; @@ -426,7 +440,7 @@ public: void setMaskType(MaskType); void setCompositionMode(QPainter::CompositionMode); void setCustomStage(QGLCustomShaderStage* stage); - void removeCustomStage(QGLCustomShaderStage* stage); + void removeCustomStage(); uint getUniformLocation(Uniform id); @@ -437,19 +451,7 @@ public: QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers QGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer -/* - // These allow the ShaderName enum to be used as a cache key - const int mainVertexOffset = 0; - const int positionVertexOffset = (1<<2) - PositionOnlyVertexShader; - const int mainFragOffset = (1<<6) - MainFragmentShader_CMO; - const int srcPixelOffset = (1<<10) - ImageSrcFragmentShader; - const int maskOffset = (1<<14) - NoMaskShader; - const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader; -*/ - -#if defined (QT_DEBUG) - Q_ENUMS(ShaderName) -#endif + QGLEngineSharedShaders* sharedShaders; private slots: void shaderProgNeedsChangingSlot() { shaderProgNeedsChanging = true; } @@ -466,9 +468,7 @@ private: QPainter::CompositionMode compositionMode; QGLCustomShaderStage* customSrcStage; - QGLEngineShaderProg* currentShaderProg; - QGLEngineSharedShaders *sharedShaders; - QGLShader *customShader; + QGLEngineShaderProg* currentShaderProg; }; QT_END_NAMESPACE -- cgit v0.12 From 4e60cdcf222f607ccc49138035fb3d17140fee51 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 30 Oct 2009 13:54:24 +0200 Subject: Fixed keypad navigation in QFileDialog details view Made it possible to navigate out of QFileDialog details view using keypad navigation. Task-number: QTBUG-4793 Reviewed-by: Alessandro Portale --- src/gui/dialogs/qfiledialog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index eab842f..50823cd 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3187,7 +3187,17 @@ void QFileDialogTreeView::keyPressEvent(QKeyEvent *e) if (!d_ptr->itemViewKeyboardEvent(e)) { QTreeView::keyPressEvent(e); } +#ifdef QT_KEYPAD_NAVIGATION + else if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder + || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) + && !hasEditFocus()) { + e->ignore(); + } else { + e->accept(); + } +#else e->accept(); +#endif } QSize QFileDialogTreeView::sizeHint() const -- cgit v0.12 From 3a7804813d9dd4162e088bc19746abd20aaa7827 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 30 Oct 2009 13:23:27 +0100 Subject: Removed the margin in assistant on Mac. Change 9551b8c349ce4e15a57c24a2408ee1b73c2b7510 enabled documentMode on the tabbar in Assistant. To make it look more native we also remove the margin around the tabwidget. Reviewed-by: Prasanth --- tools/assistant/tools/assistant/centralwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 2722b2f..62b4736 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -222,8 +222,8 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent) QVBoxLayout *vboxLayout = new QVBoxLayout(this); QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); -#ifndef Q_OS_MAC vboxLayout->setMargin(0); +#ifndef Q_OS_MAC resourcePath.append(QLatin1String("win")); #else resourcePath.append(QLatin1String("mac")); -- cgit v0.12 From a8d1c0a7137b2d1f7ca74a24321cea41428ce0bd Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 26 Oct 2009 15:57:22 +0100 Subject: Rename qglEngineShaderSourceCode to qShaderSnippets This patch also adds a "snippetNameStr" helper for debugging. --- .../gl2paintengineex/qglengineshadermanager.cpp | 86 ++++++++++++---------- .../gl2paintengineex/qglengineshadermanager_p.h | 78 +++++++++++--------- 2 files changed, 93 insertions(+), 71 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 9dc2b53..be0e98a 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -66,7 +66,7 @@ QGLEngineSharedShaders *QGLEngineSharedShaders::shadersForContext(const QGLConte return p; } -const char* QGLEngineSharedShaders::qglEngineShaderSourceCode[] = { +const char* QGLEngineSharedShaders::qShaderSnippets[] = { 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, @@ -85,10 +85,10 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) around without having to change the order of the glsl strings. It is hoped this will make future hard-to-find runtime bugs more obvious and generally give more solid code. */ - static bool qglEngineShaderSourceCodePopulated = false; - if (!qglEngineShaderSourceCodePopulated) { + static bool snippetsPopulated = false; + if (!snippetsPopulated) { - const char** code = qglEngineShaderSourceCode; // shortcut + const char** code = qShaderSnippets; // shortcut code[MainVertexShader] = qglslMainVertexShader; code[MainWithTexCoordsVertexShader] = qglslMainWithTexCoordsVertexShader; @@ -130,11 +130,13 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) code[ConicalGradientBrushSrcFragmentShader] = qglslConicalGradientBrushSrcFragmentShader; code[ShockingPinkSrcFragmentShader] = qglslShockingPinkSrcFragmentShader; + code[NoMaskFragmentShader] = ""; code[MaskFragmentShader] = qglslMaskFragmentShader; code[RgbMaskFragmentShaderPass1] = qglslRgbMaskFragmentShaderPass1; code[RgbMaskFragmentShaderPass2] = qglslRgbMaskFragmentShaderPass2; code[RgbMaskWithGammaFragmentShader] = ""; //### + code[NoCompositionModeFragmentShader] = ""; code[MultiplyCompositionModeFragmentShader] = ""; //### code[ScreenCompositionModeFragmentShader] = ""; //### code[OverlayCompositionModeFragmentShader] = ""; //### @@ -149,17 +151,19 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) #if defined(QT_DEBUG) // Check that all the elements have been filled: - for (int i = 0; i < TotalShaderCount; ++i) { - if (qglEngineShaderSourceCode[i] == 0) { - int enumIndex = staticMetaObject.indexOfEnumerator("ShaderName"); - QMetaEnum m = staticMetaObject.enumerator(enumIndex); - - qCritical() << "qglEngineShaderSourceCode: Source for" << m.valueToKey(i) - << "(shader" << i << ") missing!"; + for (int i = 0; i < TotalSnippetCount; ++i) { + if (qShaderSnippets[i] == 0) { + QByteArray msg; + msg.append("Fatal: Shader Snippet for "); + msg.append(snippetNameStr(SnippetName(i))); + msg.append(" ("); + msg.append(QByteArray::number(i)); + msg.append(") is missing!"); + qFatal(msg.constData()); } } #endif - qglEngineShaderSourceCodePopulated = true; + snippetsPopulated = true; } QGLShader* fragShader; @@ -168,14 +172,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) // Compile up the simple shader: source.clear(); - source.append(qglEngineShaderSourceCode[MainVertexShader]); - source.append(qglEngineShaderSourceCode[PositionOnlyVertexShader]); + source.append(qShaderSnippets[MainVertexShader]); + source.append(qShaderSnippets[PositionOnlyVertexShader]); vertexShader = new QGLShader(QGLShader::VertexShader, context, this); vertexShader->compile(source); source.clear(); - source.append(qglEngineShaderSourceCode[MainFragmentShader]); - source.append(qglEngineShaderSourceCode[ShockingPinkSrcFragmentShader]); + source.append(qShaderSnippets[MainFragmentShader]); + source.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); fragShader = new QGLShader(QGLShader::FragmentShader, context, this); fragShader->compile(source); @@ -191,14 +195,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) // Compile the blit shader: source.clear(); - source.append(qglEngineShaderSourceCode[MainWithTexCoordsVertexShader]); - source.append(qglEngineShaderSourceCode[UntransformedPositionVertexShader]); + source.append(qShaderSnippets[MainWithTexCoordsVertexShader]); + source.append(qShaderSnippets[UntransformedPositionVertexShader]); vertexShader = new QGLShader(QGLShader::VertexShader, context, this); vertexShader->compile(source); source.clear(); - source.append(qglEngineShaderSourceCode[MainFragmentShader]); - source.append(qglEngineShaderSourceCode[ImageSrcFragmentShader]); + source.append(qShaderSnippets[MainFragmentShader]); + source.append(qShaderSnippets[ImageSrcFragmentShader]); fragShader = new QGLShader(QGLShader::FragmentShader, context, this); fragShader->compile(source); @@ -215,6 +219,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) } +#if defined (QT_DEBUG) +QByteArray QGLEngineSharedShaders::snippetNameStr(SnippetName name) +{ + QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("SnippetName")); + return QByteArray(m.valueToKey(name)); +} +#endif + // The address returned here will only be valid until next time this function is called. QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog) { @@ -225,48 +237,46 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS cachedPrograms.append(prog); QGLEngineShaderProg &cached = cachedPrograms.last(); - QByteArray source; - source.append(qglEngineShaderSourceCode[prog.mainFragShader]); - source.append(qglEngineShaderSourceCode[prog.srcPixelFragShader]); + source.append(qShaderSnippets[prog.mainFragShader]); + source.append(qShaderSnippets[prog.srcPixelFragShader]); if (prog.srcPixelFragShader == CustomImageSrcFragmentShader) source.append(prog.customStageSource); if (prog.compositionFragShader) - source.append(qglEngineShaderSourceCode[prog.compositionFragShader]); + source.append(qShaderSnippets[prog.compositionFragShader]); if (prog.maskFragShader) - source.append(qglEngineShaderSourceCode[prog.maskFragShader]); + source.append(qShaderSnippets[prog.maskFragShader]); QGLShader* fragShader = new QGLShader(QGLShader::FragmentShader, ctxGuard.context(), this); fragShader->compile(source); source.clear(); - source.append(qglEngineShaderSourceCode[prog.mainVertexShader]); - source.append(qglEngineShaderSourceCode[prog.positionVertexShader]); + source.append(qShaderSnippets[prog.mainVertexShader]); + source.append(qShaderSnippets[prog.positionVertexShader]); QGLShader* vertexShader = new QGLShader(QGLShader::VertexShader, ctxGuard.context(), this); vertexShader->compile(source); #if defined(QT_DEBUG) // Name the shaders for easier debugging - QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); QByteArray description; description.append("Fragment shader: main="); - description.append(m.valueToKey(prog.mainFragShader)); + description.append(snippetNameStr(prog.mainFragShader)); description.append(", srcPixel="); - description.append(m.valueToKey(prog.srcPixelFragShader)); + description.append(snippetNameStr(prog.srcPixelFragShader)); if (prog.compositionFragShader) { description.append(", composition="); - description.append(m.valueToKey(prog.compositionFragShader)); + description.append(snippetNameStr(prog.compositionFragShader)); } if (prog.maskFragShader) { description.append(", mask="); - description.append(m.valueToKey(prog.maskFragShader)); + description.append(snippetNameStr(prog.maskFragShader)); } fragShader->setObjectName(QString::fromLatin1(description)); description.clear(); description.append("Vertex shader: main="); - description.append(m.valueToKey(prog.mainVertexShader)); + description.append(snippetNameStr(prog.mainVertexShader)); description.append(", position="); - description.append(m.valueToKey(prog.positionVertexShader)); + description.append(snippetNameStr(prog.positionVertexShader)); vertexShader->setObjectName(QString::fromLatin1(description)); #endif @@ -483,8 +493,8 @@ bool QGLEngineShaderManager::useCorrectShaderProg() // Choose vertex shader shader position function (which typically also sets // varyings) and the source pixel (srcPixel) fragment shader function: - requiredProgram.positionVertexShader = QGLEngineSharedShaders::InvalidShaderName; - requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::InvalidShaderName; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::InvalidSnippetName; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::InvalidSnippetName; bool isAffine = brushTransform.isAffine(); if ( (srcPixelType >= Qt::Dense1Pattern) && (srcPixelType <= Qt::DiagCrossPattern) ) { if (isAffine) @@ -594,7 +604,7 @@ bool QGLEngineShaderManager::useCorrectShaderProg() qCritical("QGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type"); } } else { - requiredProgram.maskFragShader = 0; + requiredProgram.maskFragShader = QGLEngineSharedShaders::NoMaskFragmentShader; } if (hasCompose) { @@ -636,7 +646,7 @@ bool QGLEngineShaderManager::useCorrectShaderProg() qWarning("QGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode"); } } else { - requiredProgram.compositionFragShader = 0; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::NoCompositionModeFragmentShader; } // Choose vertex shader main function diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index e4f7aa6..fd73b44 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -235,35 +235,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) -struct QGLEngineShaderProg -{ - int mainVertexShader; - int positionVertexShader; - int mainFragShader; - int srcPixelFragShader; - int maskFragShader; - int compositionFragShader; - QByteArray customStageSource; //TODO: Decent cache key for custom stages - QGLShaderProgram* program; - - QVector uniformLocations; - - bool useTextureCoords; - bool useOpacityAttribute; - - bool operator==(const QGLEngineShaderProg& other) { - // We don't care about the program - return ( mainVertexShader == other.mainVertexShader && - positionVertexShader == other.positionVertexShader && - mainFragShader == other.mainFragShader && - srcPixelFragShader == other.srcPixelFragShader && - maskFragShader == other.maskFragShader && - compositionFragShader == other.compositionFragShader && - customStageSource == other.customStageSource - ); - } -}; - /* struct QGLEngineCachedShaderProg { @@ -283,15 +254,19 @@ static const GLuint QT_VERTEX_COORDS_ATTR = 0; static const GLuint QT_TEXTURE_COORDS_ATTR = 1; static const GLuint QT_OPACITY_ATTR = 2; +struct QGLEngineShaderProg; + class QGLEngineSharedShaders : public QObject { Q_OBJECT public: - enum ShaderName { + + enum SnippetName { MainVertexShader, MainWithTexCoordsVertexShader, MainWithTexCoordsAndOpacityVertexShader, + // UntransformedPositionVertexShader must be first in the list: UntransformedPositionVertexShader, PositionOnlyVertexShader, PositionWithPatternBrushVertexShader, @@ -305,6 +280,7 @@ public: AffinePositionWithRadialGradientBrushVertexShader, AffinePositionWithTextureBrushVertexShader, + // MainFragmentShader_CMO must be first in the list: MainFragmentShader_CMO, MainFragmentShader_CM, MainFragmentShader_MO, @@ -315,6 +291,7 @@ public: MainFragmentShader, MainFragmentShader_ImageArrays, + // ImageSrcFragmentShader must be first in the list:: ImageSrcFragmentShader, ImageSrcWithPatternFragmentShader, NonPremultipliedImageSrcFragmentShader, @@ -328,11 +305,15 @@ public: ConicalGradientBrushSrcFragmentShader, ShockingPinkSrcFragmentShader, + // NoMaskFragmentShader must be first in the list: + NoMaskFragmentShader, MaskFragmentShader, RgbMaskFragmentShaderPass1, RgbMaskFragmentShaderPass2, RgbMaskWithGammaFragmentShader, + // NoCompositionModeFragmentShader must be first in the list: + NoCompositionModeFragmentShader, MultiplyCompositionModeFragmentShader, ScreenCompositionModeFragmentShader, OverlayCompositionModeFragmentShader, @@ -345,10 +326,11 @@ public: DifferenceCompositionModeFragmentShader, ExclusionCompositionModeFragmentShader, - TotalShaderCount, InvalidShaderName + TotalSnippetCount, InvalidSnippetName }; #if defined (QT_DEBUG) - Q_ENUMS(ShaderName) + Q_ENUMS(SnippetName) + static QByteArray snippetNameStr(SnippetName snippetName); #endif /* @@ -386,7 +368,37 @@ private: QGLShaderProgram *simpleShaderProg; QList cachedPrograms; - static const char* qglEngineShaderSourceCode[TotalShaderCount]; + static const char* qShaderSnippets[TotalSnippetCount]; +}; + +struct QGLEngineShaderProg +{ + QGLEngineSharedShaders::SnippetName mainVertexShader; + QGLEngineSharedShaders::SnippetName positionVertexShader; + QGLEngineSharedShaders::SnippetName mainFragShader; + QGLEngineSharedShaders::SnippetName srcPixelFragShader; + QGLEngineSharedShaders::SnippetName maskFragShader; + QGLEngineSharedShaders::SnippetName compositionFragShader; + + QByteArray customStageSource; //TODO: Decent cache key for custom stages + QGLShaderProgram* program; + + QVector uniformLocations; + + bool useTextureCoords; + bool useOpacityAttribute; + + bool operator==(const QGLEngineShaderProg& other) { + // We don't care about the program + return ( mainVertexShader == other.mainVertexShader && + positionVertexShader == other.positionVertexShader && + mainFragShader == other.mainFragShader && + srcPixelFragShader == other.srcPixelFragShader && + maskFragShader == other.maskFragShader && + compositionFragShader == other.compositionFragShader && + customStageSource == other.customStageSource + ); + } }; class Q_OPENGL_EXPORT QGLEngineShaderManager : public QObject -- cgit v0.12 From 90567274b900b22ab6b1c016ee66b7915aa994c8 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 30 Oct 2009 12:38:00 +0100 Subject: Implement a simple caching algorithm for shader programs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the number of programs held in the cache exceeds a threshold, the least frequantly used programs get deleted. This also covers programs with custom snippets of code. As a conequence, when a QGLCustomShaderStage gets deleted, any programs using that code will (eventually) be freed. Reviewed-By: Samuel Rødal --- .../gl2paintengineex/qglengineshadermanager.cpp | 71 +++++++++++++--------- .../gl2paintengineex/qglengineshadermanager_p.h | 13 +++- 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index be0e98a..34c448f 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -231,12 +231,14 @@ QByteArray QGLEngineSharedShaders::snippetNameStr(SnippetName name) QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog) { for (int i = 0; i < cachedPrograms.size(); ++i) { - if (cachedPrograms[i] == prog) - return &cachedPrograms[i]; + QGLEngineShaderProg *cachedProg = cachedPrograms[i]; + if (*cachedProg == prog) { + // Move the program to the top of the list as a poor-man's cache algo + cachedPrograms.move(i, 0); + return cachedProg; + } } - cachedPrograms.append(prog); - QGLEngineShaderProg &cached = cachedPrograms.last(); QByteArray source; source.append(qShaderSnippets[prog.mainFragShader]); source.append(qShaderSnippets[prog.srcPixelFragShader]); @@ -280,20 +282,22 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS vertexShader->setObjectName(QString::fromLatin1(description)); #endif + QGLEngineShaderProg* newProg = new QGLEngineShaderProg(prog); + // If the shader program's not found in the cache, create it now. - cached.program = new QGLShaderProgram(ctxGuard.context(), this); - cached.program->addShader(vertexShader); - cached.program->addShader(fragShader); + newProg->program = new QGLShaderProgram(ctxGuard.context(), this); + newProg->program->addShader(vertexShader); + newProg->program->addShader(fragShader); // We have to bind the vertex attribute names before the program is linked: - cached.program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); - if (cached.useTextureCoords) - cached.program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); - if (cached.useOpacityAttribute) - cached.program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); - - cached.program->link(); - if (!cached.program->isLinked()) { + newProg->program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); + if (newProg->useTextureCoords) + newProg->program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); + if (newProg->useOpacityAttribute) + newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); + + newProg->program->link(); + if (!newProg->program->isLinked()) { QLatin1String none("none"); QLatin1String br("\n"); QString error; @@ -307,32 +311,42 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS + QLatin1String(fragShader->sourceCode()) + br #endif + QLatin1String(" Error Log:\n") - + QLatin1String(" ") + cached.program->log(); + + QLatin1String(" ") + newProg->program->log(); qWarning() << error; - delete cached.program; - cachedPrograms.removeLast(); - return 0; - } else { - // taking the address here is safe since - // cachePrograms isn't resized anywhere else - return &cached; + delete newProg; // Deletes the QGLShaderProgram in it's destructor + newProg = 0; } -} + else { + if (cachedPrograms.count() > 30) { + // The cache is full, so delete the last 5 programs in the list. + // These programs will be least used, as a program us bumped to + // the top of the list when it's used. + for (int i = 0; i < 5; ++i) { + delete cachedPrograms.last(); + cachedPrograms.removeLast(); + } + } + cachedPrograms.insert(0, newProg); + } + + return newProg; +} void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage) { // Remove any shader programs which has this as the custom shader src: for (int i = 0; i < cachedPrograms.size(); ++i) { - if (cachedPrograms.at(i).customStageSource == stage->source()) { - delete cachedPrograms.at(i).program; - cachedPrograms.removeAt(i--); + QGLEngineShaderProg *cachedProg = cachedPrograms[i]; + if (cachedProg->customStageSource == stage->source()) { + delete cachedProg; + cachedPrograms.removeAt(i); + i--; } } } - QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) : ctx(context), shaderProgNeedsChanging(true), @@ -487,7 +501,6 @@ bool QGLEngineShaderManager::useCorrectShaderProg() } QGLEngineShaderProg requiredProgram; - requiredProgram.program = 0; bool texCoords = false; diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index fd73b44..59e50d0 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -366,13 +366,22 @@ private: QGLSharedResourceGuard ctxGuard; QGLShaderProgram *blitShaderProg; QGLShaderProgram *simpleShaderProg; - QList cachedPrograms; + QList cachedPrograms; static const char* qShaderSnippets[TotalSnippetCount]; }; -struct QGLEngineShaderProg + +class QGLEngineShaderProg { +public: + QGLEngineShaderProg() : program(0) {} + + ~QGLEngineShaderProg() { + if (program) + delete program; + } + QGLEngineSharedShaders::SnippetName mainVertexShader; QGLEngineSharedShaders::SnippetName positionVertexShader; QGLEngineSharedShaders::SnippetName mainFragShader; -- cgit v0.12 From 1c44377d84976afa10b5ebae7d6ede5f226a2b3e Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 30 Oct 2009 11:55:56 +0100 Subject: Fixed namespacing in qatomic_symbian.h The namespace needs to be there, even if empty, to avoid warnings. Also, the header declaration was moved to avoid nested header declarations. RevBy: hjk --- src/corelib/arch/qatomic_symbian.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h index 5880120..3721aca 100644 --- a/src/corelib/arch/qatomic_symbian.h +++ b/src/corelib/arch/qatomic_symbian.h @@ -42,8 +42,6 @@ #ifndef QATOMIC_SYMBIAN_H #define QATOMIC_SYMBIAN_H -QT_BEGIN_HEADER - #if defined(Q_CC_RVCT) # define QT_NO_ARM_EABI # include @@ -51,6 +49,16 @@ QT_BEGIN_HEADER # include #endif +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +// Empty, but needed to avoid warnings + +QT_END_NAMESPACE + QT_END_HEADER #endif // QATOMIC_SYMBIAN_H -- cgit v0.12 From fab1697ff467e6c9ec02ffe6eccf65a6e779fd6b Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 30 Oct 2009 13:50:04 +0100 Subject: Moved a resource file from the static wrapper app to QtGui. It's more appropriate to have it in QtGui after the framework classes were moved there. This also means that the rsgfix needed earlier is not necessary anymore, since QtGui is not a static library. RevBy: Janne Anttila --- src/gui/s60framework/s60framework.pri | 11 +++++ src/gui/s60framework/s60main.rss | 85 +++++++++++++++++++++++++++++++++++ src/s60main/s60main.pro | 20 --------- src/s60main/s60main.rss | 85 ----------------------------------- 4 files changed, 96 insertions(+), 105 deletions(-) create mode 100644 src/gui/s60framework/s60main.rss delete mode 100644 src/s60main/s60main.rss diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index fea74fe..5884b68 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -1,3 +1,14 @@ +# This block serves the minimalistic resource file for S60 3.1 platforms. +# Note there is no way to ifdef S60 version in mmp file, that is why the resource +# file is always compiled for WINSCW +minimalAppResource31 = \ + "SOURCEPATH s60framework" \ + "START RESOURCE s60main.rss" \ + "HEADER" \ + "TARGETPATH resource\apps" \ + "END" +MMP_RULES += minimalAppResource31 + SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60mainappui.cpp \ s60framework/qs60maindocument.cpp diff --git a/src/gui/s60framework/s60main.rss b/src/gui/s60framework/s60main.rss new file mode 100644 index 0000000..07dc6a1 --- /dev/null +++ b/src/gui/s60framework/s60main.rss @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +// Even S60 application have ENoAppResourceFile and ENonStandardResourceFile +// flags set, the S60 3rd Edition FP1 emulator requires applications to have +// very minimalistic application resource file, otherwise apps refures to start +// This file serves the minimalistic resource file for S60 3.1 platforms. + +// RESOURCE IDENTIFIER +NAME QTMA // 4 letter ID + +// INCLUDES +//#include +#include +#include +#include +#include +#include + +// RESOURCE DEFINITIONS +RESOURCE RSS_SIGNATURE + { + } + +RESOURCE TBUF r_default_document_name + { + buf="QTMA"; + } + +RESOURCE EIK_APP_INFO + { + menubar = r_qt_wrapperapp_menubar; + cba = R_AVKON_SOFTKEYS_EXIT; + } + +RESOURCE MENU_BAR r_qt_wrapperapp_menubar + { + titles = + { + MENU_TITLE { menu_pane = r_qt_wrapperapp_menu; } + }; + } + +RESOURCE MENU_PANE r_qt_wrapperapp_menu + { + } +// End of File diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro index cc3c547..47cf020 100644 --- a/src/s60main/s60main.pro +++ b/src/s60main/s60main.pro @@ -16,16 +16,6 @@ symbian { SOURCES = qts60main.cpp \ qts60main_mcrt0.cpp - # This block serves the minimalistic resource file for S60 3.1 platforms. - # Note there is no way to ifdef S60 version in mmp file, that is why the resource - # file is always compiled for WINSCW - minimalAppResource31 = \ - "START RESOURCE s60main.rss" \ - "HEADER" \ - "TARGETPATH resource\apps" \ - "END" - MMP_RULES += minimalAppResource31 - # s60main needs to be built in ARM mode for GCCE to work. MMP_RULES+="ALWAYS_BUILD_AS_ARM" @@ -36,14 +26,4 @@ symbian { error("$$_FILE_ is intended only for Symbian!") } -symbian-abld: { - # abld build commands generated resources after the static library is built, and - # we have dependency to resource from static lib -> resources need to be generated - # explicitly before library - rsgFix2.commands = "-$(DEL_FILE) $(EPOCROOT)Epoc32\Data\z\resource\apps\s60main.rsc >NUL 2>&1" - rsgFix.commands = "-$(ABLD) resource $(PLATFORM) $(CFG) 2>NUL" - QMAKE_EXTRA_TARGETS += rsgFix rsgFix2 - PRE_TARGETDEPS += rsgFix rsgFix2 -} - include(../qbase.pri) diff --git a/src/s60main/s60main.rss b/src/s60main/s60main.rss deleted file mode 100644 index 07dc6a1..0000000 --- a/src/s60main/s60main.rss +++ /dev/null @@ -1,85 +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$ -** -****************************************************************************/ - -// Even S60 application have ENoAppResourceFile and ENonStandardResourceFile -// flags set, the S60 3rd Edition FP1 emulator requires applications to have -// very minimalistic application resource file, otherwise apps refures to start -// This file serves the minimalistic resource file for S60 3.1 platforms. - -// RESOURCE IDENTIFIER -NAME QTMA // 4 letter ID - -// INCLUDES -//#include -#include -#include -#include -#include -#include - -// RESOURCE DEFINITIONS -RESOURCE RSS_SIGNATURE - { - } - -RESOURCE TBUF r_default_document_name - { - buf="QTMA"; - } - -RESOURCE EIK_APP_INFO - { - menubar = r_qt_wrapperapp_menubar; - cba = R_AVKON_SOFTKEYS_EXIT; - } - -RESOURCE MENU_BAR r_qt_wrapperapp_menubar - { - titles = - { - MENU_TITLE { menu_pane = r_qt_wrapperapp_menu; } - }; - } - -RESOURCE MENU_PANE r_qt_wrapperapp_menu - { - } -// End of File -- cgit v0.12 From fad40eb6261ca72cda438c06dccebfc49e8d0a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 30 Oct 2009 14:34:18 +0100 Subject: Fix some test failures in the qgl test on 16 bit servers. These tests are designed to run in 24 or 32 bit mode, and won't work unless they do.. Reviewed-by: Samuel --- tests/auto/qgl/tst_qgl.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index e036e4b..e9f0476 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -118,6 +118,16 @@ public: void setAutoBufferSwap(bool on) { QGLWidget::setAutoBufferSwap(on); } }; +static int appDefaultDepth() +{ + static int depth = 0; + if (depth == 0) { + QPixmap pm(1, 1); + depth = pm.depth(); + } + return depth; +} + // Using INT_MIN and INT_MAX will cause failures on systems // where "int" is 64-bit, so use the explicit values instead. #define TEST_INT_MIN (-2147483647 - 1) @@ -714,6 +724,8 @@ public: void tst_QGL::graphicsViewClipping() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); const int size = 64; UnclippedWidget *widget = new UnclippedWidget; widget->setFixedSize(size, size); @@ -866,6 +878,8 @@ public: void tst_QGL::glWidgetRendering() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); GLWidget w; w.show(); @@ -1089,6 +1103,8 @@ protected: void tst_QGL::glFBOUseInGLWidget() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle); @@ -1116,6 +1132,8 @@ void tst_QGL::glFBOUseInGLWidget() void tst_QGL::glWidgetReparent() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); // Try it as a top-level first: GLWidget *widget = new GLWidget; widget->setGeometry(0, 0, 200, 30); @@ -1582,6 +1600,8 @@ protected: void tst_QGL::replaceClipping() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); ReplaceClippingGLWidget glw; glw.resize(300, 300); glw.show(); @@ -1707,6 +1727,8 @@ protected: void tst_QGL::clipTest() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); ClipTestGLWidget glw; glw.resize(220, 220); glw.show(); -- cgit v0.12 From acb10eefab985a32a619e2a1d590c93659732c00 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Fri, 30 Oct 2009 12:42:23 +0100 Subject: Fix unit test and add autoCancel test for graphicsview --- tests/auto/gestures/tst_gestures.cpp | 98 ++++++++++++++++++++++++++---------- 1 file changed, 72 insertions(+), 26 deletions(-) diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 02c8232..79de823 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -116,7 +116,7 @@ public: return new CustomGesture; } - QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event) + QGestureRecognizer::Result filterEvent(QGesture *state, QObject*o , QEvent *event) { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result = 0; @@ -332,6 +332,7 @@ private slots: void consumeEventHint(); void unregisterRecognizer(); void autoCancelGestures(); + void autoCancelGestures2(); }; tst_Gestures::tst_Gestures() @@ -1295,20 +1296,6 @@ void tst_Gestures::unregisterRecognizer() // a method on QApplication void tst_Gestures::autoCancelGestures() { - class MockRecognizer : public QGestureRecognizer { - public: - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event) - { - Q_UNUSED(gesture); - Q_UNUSED(watched); - if (event->type() == QEvent::MouseButtonPress) - return QGestureRecognizer::GestureTriggered; - if (event->type() == QEvent::MouseButtonRelease) - return QGestureRecognizer::GestureFinished; - return QGestureRecognizer::Ignore; - } - }; - class MockWidget : public GestureWidget { public: MockWidget(const char *name) : GestureWidget(name) { } @@ -1324,14 +1311,18 @@ void tst_Gestures::autoCancelGestures() } }; + const Qt::GestureType secondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + MockWidget parent("parent"); // this one sets the cancel policy to CancelAllInContext parent.resize(300, 100); + parent.setWindowFlags(Qt::X11BypassWindowManagerHint); GestureWidget *child = new GestureWidget("child", &parent); child->setGeometry(10, 10, 100, 80); - Qt::GestureType type = QApplication::registerGestureRecognizer(new MockRecognizer()); - parent.grabGesture(type, Qt::WidgetWithChildrenGesture); - child->grabGesture(type, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + child->grabGesture(secondGesture, Qt::WidgetWithChildrenGesture); + parent.show(); + QTest::qWaitForWindowShown(&parent); /* An event is send to both the child and the parent, when the child gets it a gesture is triggered @@ -1340,18 +1331,73 @@ void tst_Gestures::autoCancelGestures() parent gets it he accepts it and that causes the cancel policy to activate. The cause of that is the gesture for the child is cancelled and send to the child as such. */ - QMouseEvent event(QEvent::MouseButtonPress, QPoint(20,20), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + CustomEvent event; + event.serial = CustomGesture::SerialStartedThreshold; QApplication::sendEvent(child, &event); + QCOMPARE(child->events.all.count(), 2); QCOMPARE(child->events.started.count(), 1); - QCOMPARE(child->events.all.count(), 1); - QCOMPARE(parent.events.all.count(), 0); - child->reset(); - QApplication::sendEvent(&parent, &event); + QCOMPARE(child->events.canceled.count(), 1); QCOMPARE(parent.events.all.count(), 1); - QCOMPARE(parent.events.started.count(), 1); - QCOMPARE(child->events.started.count(), 0); - QCOMPARE(child->events.all.count(), 1); + + // clean up, make the parent gesture finish + event.serial = CustomGesture::SerialFinishedThreshold; + QApplication::sendEvent(child, &event); + QCOMPARE(parent.events.all.count(), 2); +} + +void tst_Gestures::autoCancelGestures2() +{ + class MockItem : public GestureItem { + public: + MockItem(const char *name) : GestureItem(name) { } + + bool event(QEvent *event) { + if (event->type() == QEvent::Gesture) { + QGestureEvent *ge = static_cast(event); + Q_ASSERT(ge->allGestures().count() == 1); // can't use QCOMPARE here... + ge->allGestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); + } + return GestureItem::event(event); + } + }; + + const Qt::GestureType secondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + MockItem *parent = new MockItem("parent"); + GestureItem *child = new GestureItem("child"); + child->setParentItem(parent); + parent->setPos(0, 0); + child->setPos(10, 10); + scene.addItem(parent); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(secondGesture, Qt::WidgetGesture); + parent->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + child->grabGesture(secondGesture, Qt::WidgetWithChildrenGesture); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + CustomEvent event; + event.serial = CustomGesture::SerialStartedThreshold; + event.hasHotSpot = true; + event.hotSpot = mapToGlobal(QPointF(5, 5), child, &view); + // qDebug() << event.hotSpot; + scene.sendEvent(child, &event); + //QEventLoop().exec(); + QCOMPARE(parent->events.all.count(), 1); + QCOMPARE(child->events.started.count(), 1); QCOMPARE(child->events.canceled.count(), 1); + QCOMPARE(child->events.all.count(), 2); + + // clean up, make the parent gesture finish + event.serial = CustomGesture::SerialFinishedThreshold; + scene.sendEvent(child, &event); + QCOMPARE(parent->events.all.count(), 2); } QTEST_MAIN(tst_Gestures) -- cgit v0.12 From da83365fbf7ff393f7dc99d28eda61b902081bb2 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Fri, 30 Oct 2009 12:42:49 +0100 Subject: Make GestureCancelPolicy work for graphicsview Reviewed-By: Denis --- src/gui/graphicsview/qgraphicsscene.cpp | 90 +++++++++++++++++++++++++++++++++ src/gui/graphicsview/qgraphicsscene_p.h | 1 + src/gui/kernel/qgesture.h | 1 + src/gui/kernel/qgesturemanager.cpp | 37 ++++++-------- src/gui/kernel/qgesturemanager_p.h | 2 + 5 files changed, 109 insertions(+), 22 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index c459d21..9279fe3 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5941,6 +5941,13 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) continue; } } + foreach (QGesture *g, startedGestures) { + if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) { + DEBUG() << "lets try to cancel some"; + // find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them + cancelGesturesForChildren(g, event->widget()); + } + } // forget about targets for gestures that have ended foreach (QGesture *g, allGestures) { @@ -5955,6 +5962,89 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) } } +void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidget *viewport) +{ + Q_ASSERT(original); + QGraphicsItem *originalItem = gestureTargets.value(original); + Q_ASSERT(originalItem); + + // iterate over all active gestures and for each find the owner + // if the owner is part of our sub-hierarchy, cancel it. + + QSet canceledGestures; + QHash::Iterator iter = gestureTargets.begin(); + while (iter != gestureTargets.end()) { + QGraphicsObject *item = iter.value(); + // note that we don't touch the gestures for our originalItem + if (item != originalItem && originalItem->isAncestorOf(item)) { + DEBUG() << " found a gesture to cancel" << iter.key(); + iter.key()->d_func()->state = Qt::GestureCanceled; + canceledGestures << iter.key(); + } + ++iter; + } + + // sort them per target item by cherry picking from almostCanceledGestures and delivering + QSet almostCanceledGestures = canceledGestures; + QSet::Iterator setIter; + while (!almostCanceledGestures.isEmpty()) { + QGraphicsObject *target = 0; + QSet gestures; + setIter = almostCanceledGestures.begin(); + // sort per target item + while (setIter != almostCanceledGestures.end()) { + QGraphicsObject *item = gestureTargets.value(*setIter); + if (target == 0) + target = item; + if (target == item) { + gestures << *setIter; + setIter = almostCanceledGestures.erase(setIter); + } else { + ++setIter; + } + } + Q_ASSERT(target); + + QList list = gestures.toList(); + QGestureEvent ev(list); + sendEvent(target, &ev); + + foreach (QGesture *g, list) { + if (ev.isAccepted() || ev.isAccepted(g)) + gestures.remove(g); + } + + foreach (QGesture *g, gestures) { + if (!g->hasHotSpot()) + continue; + + QPoint screenPos = g->hotSpot().toPoint(); + QList items = itemsAtPosition(screenPos, QPointF(), viewport); + for (int j = 0; j < items.size(); ++j) { + QGraphicsObject *item = items.at(j)->toGraphicsObject(); + if (!item) + continue; + QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); + if (d->gestureContext.contains(g->gestureType())) { + QList list; + list << g; + QGestureEvent ev(list); + sendEvent(item, &ev); + if (ev.isAccepted() || ev.isAccepted(g)) + break; // successfully delivered + } + } + } + } + + QGestureManager *gm = QApplicationPrivate::instance()->gestureManager; + Q_ASSERT(gm); // it would be very odd if we got called without a manager. + for (setIter = canceledGestures.begin(); setIter != canceledGestures.end(); ++setIter) { + gm->recycle(*setIter); + gestureTargets.remove(*setIter); + } +} + QT_END_NAMESPACE #include "moc_qgraphicsscene.cpp" diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index cd20fd0..f8db084 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -288,6 +288,7 @@ public: QMap *conflictedGestures, QList > *conflictedItems, QHash *normalGestures); + void cancelGesturesForChildren(QGesture *original, QWidget *viewport); void updateInputMethodSensitivityInViews(); diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 524d26e..8614ecb 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -97,6 +97,7 @@ private: friend class QGestureEvent; friend class QGestureRecognizer; friend class QGestureManager; + friend class QGraphicsScenePrivate; }; class QPanGesturePrivate; diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index f1abc89..1d33c84 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -346,12 +346,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash endedGestures = finishedGestures + canceledGestures + undeliveredGestures; foreach (QGesture *gesture, endedGestures) { - if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0)) { - gesture->setGestureCancelPolicy(QGesture::CancelNone); - recognizer->reset(gesture); - } else { - cleanupGesturesForRemovedRecognizer(gesture); - } + recycle(gesture); m_gestureTargets.remove(gesture); } return ret; @@ -409,15 +404,8 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original) deliverEvents(gestures, &undeliveredGestures); } - for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter) { - QGestureRecognizer *recognizer = m_gestureToRecognizer.value(*iter, 0); - if (recognizer) { - (*iter)->setGestureCancelPolicy(QGesture::CancelNone); - recognizer->reset(*iter); - } else { - cleanupGesturesForRemovedRecognizer(*iter); - } - } + for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter) + recycle(*iter); } void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture) @@ -667,19 +655,24 @@ void QGestureManager::timerEvent(QTimerEvent *event) it = m_maybeGestures.erase(it); DEBUG() << "QGestureManager::timerEvent: gesture stopped due to timeout:" << gesture; - QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0); - if (recognizer) { - gesture->setGestureCancelPolicy(QGesture::CancelNone); - recognizer->reset(gesture); - } else { - cleanupGesturesForRemovedRecognizer(gesture); - } + recycle(gesture); } else { ++it; } } } +void QGestureManager::recycle(QGesture *gesture) +{ + QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0); + if (recognizer) { + gesture->setGestureCancelPolicy(QGesture::CancelNone); + recognizer->reset(gesture); + } else { + cleanupGesturesForRemovedRecognizer(gesture); + } +} + QT_END_NAMESPACE #include "moc_qgesturemanager_p.cpp" diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index 4958cdb..d60aedc 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -81,6 +81,8 @@ public: void cleanupCachedGestures(QObject *target, Qt::GestureType type); + void recycle(QGesture *gesture); + protected: void timerEvent(QTimerEvent *event); bool filterEventThroughContexts(const QMultiHash &contexts, -- cgit v0.12 From 157e218d90ba832b2846889e9f7c94c95ed2cfbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 30 Oct 2009 14:18:43 +0100 Subject: Fix issue with wrong QMessagebox icons on Mac. Task: QTBUG-4988 68c0e6a8ba1e92bf0152adcaa86eebb83dcfd1d8 introduced a regression preventing the mac-spesific standardIcon code form being called. Call the Mac code if desktopSettingsAware is set. (QIcon::themeName() is only set on X11) --- src/gui/styles/qcommonstyle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 70d130a..1564a3f 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5657,10 +5657,11 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons default: break; } - + } // if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) if (!icon.isNull()) return icon; #if defined(Q_WS_MAC) + if (QApplication::desktopSettingsAware()) { OSType iconType = 0; switch (standardIcon) { case QStyle::SP_MessageBoxQuestion: @@ -5751,8 +5752,8 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons ReleaseIconRef(overlayIcon); return retIcon; } + } // if (QApplication::desktopSettingsAware()) #endif // Q_WS_MAC - } switch (standardIcon) { #ifndef QT_NO_IMAGEFORMAT_PNG -- cgit v0.12 From 5cca60ad593cc5b8778d7be0b8137ffecd34b247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 30 Oct 2009 14:22:06 +0100 Subject: Fix indentation. --- src/gui/styles/qcommonstyle.cpp | 178 ++++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 1564a3f..84e046f 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5662,96 +5662,96 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons return icon; #if defined(Q_WS_MAC) if (QApplication::desktopSettingsAware()) { - OSType iconType = 0; - switch (standardIcon) { - case QStyle::SP_MessageBoxQuestion: - case QStyle::SP_MessageBoxInformation: - case QStyle::SP_MessageBoxWarning: - case QStyle::SP_MessageBoxCritical: - iconType = kGenericApplicationIcon; - break; - case SP_DesktopIcon: - iconType = kDesktopIcon; - break; - case SP_TrashIcon: - iconType = kTrashIcon; - break; - case SP_ComputerIcon: - iconType = kComputerIcon; - break; - case SP_DriveFDIcon: - iconType = kGenericFloppyIcon; - break; - case SP_DriveHDIcon: - iconType = kGenericHardDiskIcon; - break; - case SP_DriveCDIcon: - case SP_DriveDVDIcon: - iconType = kGenericCDROMIcon; - break; - case SP_DriveNetIcon: - iconType = kGenericNetworkIcon; - break; - case SP_DirOpenIcon: - iconType = kOpenFolderIcon; - break; - case SP_DirClosedIcon: - case SP_DirLinkIcon: - iconType = kGenericFolderIcon; - break; - case SP_FileLinkIcon: - case SP_FileIcon: - iconType = kGenericDocumentIcon; - break; - case SP_DirIcon: { - // A rather special case - QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget); - QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget); - closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On); - closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On); - closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On); - closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On); - return closeIcon; - } - case SP_TitleBarNormalButton: - case SP_TitleBarCloseButton: { - QIcon titleBarIcon; - if (standardIcon == SP_TitleBarCloseButton) { - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png")); - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); - } else { - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png")); - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); + OSType iconType = 0; + switch (standardIcon) { + case QStyle::SP_MessageBoxQuestion: + case QStyle::SP_MessageBoxInformation: + case QStyle::SP_MessageBoxWarning: + case QStyle::SP_MessageBoxCritical: + iconType = kGenericApplicationIcon; + break; + case SP_DesktopIcon: + iconType = kDesktopIcon; + break; + case SP_TrashIcon: + iconType = kTrashIcon; + break; + case SP_ComputerIcon: + iconType = kComputerIcon; + break; + case SP_DriveFDIcon: + iconType = kGenericFloppyIcon; + break; + case SP_DriveHDIcon: + iconType = kGenericHardDiskIcon; + break; + case SP_DriveCDIcon: + case SP_DriveDVDIcon: + iconType = kGenericCDROMIcon; + break; + case SP_DriveNetIcon: + iconType = kGenericNetworkIcon; + break; + case SP_DirOpenIcon: + iconType = kOpenFolderIcon; + break; + case SP_DirClosedIcon: + case SP_DirLinkIcon: + iconType = kGenericFolderIcon; + break; + case SP_FileLinkIcon: + case SP_FileIcon: + iconType = kGenericDocumentIcon; + break; + case SP_DirIcon: { + // A rather special case + QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget); + QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget); + closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On); + closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On); + closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On); + closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On); + return closeIcon; + } + case SP_TitleBarNormalButton: + case SP_TitleBarCloseButton: { + QIcon titleBarIcon; + if (standardIcon == SP_TitleBarCloseButton) { + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png")); + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); + } else { + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png")); + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); + } + return titleBarIcon; + } + default: + break; + } + if (iconType != 0) { + QIcon retIcon; + IconRef icon; + IconRef overlayIcon = 0; + if (iconType != kGenericApplicationIcon) { + GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon); + } else { + FSRef fsRef; + ProcessSerialNumber psn = { 0, kCurrentProcess }; + GetProcessBundleLocation(&psn, &fsRef); + GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0); + if (standardIcon == SP_MessageBoxCritical) { + overlayIcon = icon; + GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon); + } + } + if (icon) { + qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon); + ReleaseIconRef(icon); + } + if (overlayIcon) + ReleaseIconRef(overlayIcon); + return retIcon; } - return titleBarIcon; - } - default: - break; - } - if (iconType != 0) { - QIcon retIcon; - IconRef icon; - IconRef overlayIcon = 0; - if (iconType != kGenericApplicationIcon) { - GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon); - } else { - FSRef fsRef; - ProcessSerialNumber psn = { 0, kCurrentProcess }; - GetProcessBundleLocation(&psn, &fsRef); - GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0); - if (standardIcon == SP_MessageBoxCritical) { - overlayIcon = icon; - GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon); - } - } - if (icon) { - qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon); - ReleaseIconRef(icon); - } - if (overlayIcon) - ReleaseIconRef(overlayIcon); - return retIcon; - } } // if (QApplication::desktopSettingsAware()) #endif // Q_WS_MAC -- cgit v0.12 From 4510c18ed3ffd2c01d11159fc2d2ec7f0eb48e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 30 Oct 2009 14:49:05 +0100 Subject: Fix QDesktopServices::DataLocation on Mac. DataLocation now behaves as on the other platforms, QCoreApplication::organizationName() and applicationName() is included in the returned path. --- dist/changes-4.6.0 | 4 ++++ src/gui/util/qdesktopservices.cpp | 9 --------- src/gui/util/qdesktopservices_mac.cpp | 9 ++++++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 7f723da..abe4427 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -143,3 +143,7 @@ information about a particular change. function setFloatingPointPrecision(). Set Qt_4_5 as the version of the QDataStream to get the behavior of previous versions. + - On Mac OS X, QDesktopServices::storageLocation(DataLocation) now includes + QCoreApplication::organizationName() and QCoreApplication::applicationName() + if those are set. This matches the behavior on the other platforms. + \ No newline at end of file diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 1690d87..85b539f 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -294,15 +294,6 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) Rest of the standard locations point to folder on same drive with executable, except that if executable is in ROM the folder from C drive is returned. - \note On Mac OS X, DataLocation does not include QCoreApplication::organizationName. - Use code like this to add it: - - \code - QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - #ifdef Q_WS_MAC - location.insert(location.count() - QCoreApplication::applicationName().count(), - QCoreApplication::organizationName() + "/"); - #endif \endcode */ diff --git a/src/gui/util/qdesktopservices_mac.cpp b/src/gui/util/qdesktopservices_mac.cpp index 0626e0a..23f9e60 100644 --- a/src/gui/util/qdesktopservices_mac.cpp +++ b/src/gui/util/qdesktopservices_mac.cpp @@ -153,9 +153,12 @@ QString QDesktopServices::storageLocation(StandardLocation type) QString path = getFullPath(ref); - QString appName = QCoreApplication::applicationName(); - if (!appName.isEmpty() && (type == DataLocation || type == CacheLocation)) - path += QLatin1Char('/') + appName; + if (type == DataLocation || type == CacheLocation) { + if (QCoreApplication::organizationName().isEmpty() == false) + path += QLatin1Char('/') + QCoreApplication::organizationName(); + if (QCoreApplication::applicationName().isEmpty() == false) + path += QLatin1Char('/') + QCoreApplication::applicationName(); + } return path; } -- cgit v0.12 From 4f10520a2a931ed0cccba3d36d9c196902049282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Fri, 30 Oct 2009 15:53:28 +0200 Subject: S60Style: User set header view palettes are ignored QS60Style ignores user defined palettes for QHeaderViews. With this fix, style takes palette changes into account and also draws QTableCornerButton correctly. Task-number: QTBUG-4522 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index dc38397..10a63a8 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1752,7 +1752,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, #endif //QT_NO_MENUBAR case CE_HeaderSection: - if ( const QStyleOptionHeader *header = qstyleoption_cast(option)) { + if (const QStyleOptionHeader *header = qstyleoption_cast(option)) { painter->save(); QPen linePen = QPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 1, header)); const int penWidth = (header->orientation == Qt::Horizontal) ? @@ -1770,6 +1770,25 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } } painter->restore(); + + //Draw corner button as normal pushButton. + if (qobject_cast(widget)) { + //Make cornerButton slightly smaller so that it is not on top of table border graphic. + QStyleOptionHeader subopt = *header; + const int borderTweak = + QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1; + if (subopt.direction == Qt::LeftToRight) + subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak); + else + subopt.rect.adjust(0, borderTweak, -borderTweak, -borderTweak); + drawPrimitive(PE_PanelButtonBevel, &subopt, painter, widget); + } else if ((header->palette.brush(QPalette::Button) != Qt::transparent)) { + //Draw non-themed background. Background for theme is drawn in CE_ShapedFrame + //to get continuous theme graphic across all the header cells. + qDrawShadePanel(painter, header->rect, header->palette, + header->state & (State_Sunken | State_On), penWidth, + &header->palette.brush(QPalette::Button)); + } } break; case CE_HeaderEmptyArea: // no need to draw this @@ -1840,15 +1859,24 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else if (qobject_cast(widget)) { QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableItem, painter, option->rect, flags); } else if (const QHeaderView *header = qobject_cast(widget)) { - if (header->orientation() == Qt::Horizontal) { - QRect headerRect = option->rect; - const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); - headerRect.adjust(0,frameWidth,-2*frameWidth,0); - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, flags); - } else { + //QS60style draws header background here instead of in each headersection, to get + //continuous graphic from section to section. + QS60StylePrivate::SkinElementFlags adjustableFlags = flags; + QRect headerRect = option->rect; + if (header->orientation() != Qt::Horizontal) { //todo: update to horizontal table graphic - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, option->rect, flags | QS60StylePrivate::SF_PointWest); + adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest); + } else { + const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + if (option->direction == Qt::LeftToRight) + headerRect.adjust(-2*frameWidth, 0, 0, 0); + else + headerRect.adjust(0, 0, 2*frameWidth, 0); } + if (option->palette.brush(QPalette::Button).color() == Qt::transparent) + QS60StylePrivate::drawSkinElement( + QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, adjustableFlags); + } else if (qobject_cast(widget)) { QCommonStyle::drawControl(element, option, painter, widget); } -- cgit v0.12 From 8910b449dafcb3475ab8c6f90213cd632412da68 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 30 Oct 2009 16:08:46 +0200 Subject: Fixed statuspane visibility after dialog closed from fullsreen widget. - Comparing TBool == bool did not work correctly since TBool is effectively int. For example statusPane->IsVisible() in this particular case returns 2, which compared to true as an int fails. Casting to bool seems to solve the problem. Another possibility would be to use Symbian COMPARE_BOOLS macro. - Changing statuspane visibility now affects to widget size also - Some tab/space fixes Task-number: QTBUG-4876 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_s60.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 30bf99a..e5ee2f1 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -836,7 +836,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const if (qwidget->d_func()->isOpaque) gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect); - } + } } else { surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint()); } @@ -910,9 +910,9 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) CEikStatusPane* statusPane = S60->statusPane(); CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; - if (statusPane && (statusPane->IsVisible() == isFullscreen)) + if (statusPane && (bool)statusPane->IsVisible() == isFullscreen) statusPane->MakeVisible(!isFullscreen); - if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen)) + if (buttonGroup && (bool)buttonGroup->IsVisible() == isFullscreen) buttonGroup->MakeVisible(!isFullscreen); #endif } else if (QApplication::activeWindow() == qwidget->window()) { @@ -925,6 +925,12 @@ void QSymbianControl::HandleResourceChange(int resourceType) { switch (resourceType) { case KInternalStatusPaneChange: + if (qwidget->isFullScreen()) { + SetExtentToWholeScreen(); + } else if (qwidget->isMaximized()) { + TRect r = static_cast(S60->appUi())->ClientRect(); + SetExtent(r.iTl, r.Size()); + } qwidget->d_func()->setWindowIcon_sys(true); break; case KUidValueCoeFontChangeEvent: @@ -1080,9 +1086,9 @@ void qt_init(QApplicationPrivate * /* priv */, int) // enable focus events - used to re-enable mouse after focus changed between mouse and non mouse app, // and for dimming behind modal windows - S60->windowGroup().EnableFocusChangeEvents(); + S60->windowGroup().EnableFocusChangeEvents(); - //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this) + //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this) const TInt KMachineUidSamsungI8510 = 0x2000C51E; // HAL::Get(HALData::EPen, TInt& result) may set 'result' to 1 on some 3.1 systems (e.g. N95). // But we know that S60 systems below 5.0 did not support touch. @@ -1560,7 +1566,7 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event) } #endif break; - default: + default: break; } -- cgit v0.12 From 0e02c54e7e56ee091aeeb6342faa2df163fbbd74 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 07:51:09 +1000 Subject: Remove partial shader support from QGLShader/QGLShaderProgram Reviewed-by: trustme --- src/opengl/qglshaderprogram.cpp | 182 ++-------------------------------------- src/opengl/qglshaderprogram.h | 9 +- 2 files changed, 6 insertions(+), 185 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 90b496e..080c3b2 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -106,30 +106,6 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 2 - \section1 Partial shaders - - Desktop GLSL can attach an arbitrary number of vertex and fragment - shaders to a shader program. Embedded GLSL/ES on the other hand - supports only a single shader of each type on a shader program. - - Multiple shaders of the same type can be useful when large libraries - of shaders are needed. Common functions can be factored out into - library shaders that can be reused in multiple shader programs. - - To support this use of shaders, the application programmer can - create shaders with the QGLShader::PartialVertexShader and - QGLShader::PartialFragmentShader types. These types direct - QGLShader and QGLShaderProgram to delay shader compilation until - link time. - - When link() is called, the sources for the partial shaders are - concatenated, and a single vertex or fragment shader is compiled - and linked into the shader program. - - It is more efficient to use the QGLShader::VertexShader and - QGLShader::FragmentShader when there is only one shader of that - type in the program. - \sa QGLShader */ @@ -154,11 +130,6 @@ QT_BEGIN_NAMESPACE \value VertexShader Vertex shader written in the OpenGL Shading Language (GLSL). \value FragmentShader Fragment shader written in the OpenGL Shading Language (GLSL). - - \value PartialVertexShader Partial vertex shader that will be concatenated with all other partial vertex shaders at link time. - \value PartialFragmentShader Partial fragment shader that will be concatenated with all other partial fragment shaders at link time. - - \omitvalue PartialShader */ #ifndef GL_FRAGMENT_SHADER @@ -209,8 +180,6 @@ public: : shaderGuard(context) , shaderType(type) , compiled(false) - , isPartial((type & QGLShader::PartialShader) != 0) - , hasPartialSource(false) { } ~QGLShaderPrivate(); @@ -218,10 +187,7 @@ public: QGLSharedResourceGuard shaderGuard; QGLShader::ShaderType shaderType; bool compiled; - bool isPartial; - bool hasPartialSource; QString log; - QByteArray partialSource; bool create(); bool compile(QGLShader *q); @@ -243,8 +209,6 @@ bool QGLShaderPrivate::create() const QGLContext *context = shaderGuard.context(); if (!context) return false; - if (isPartial) - return true; if (qt_resolve_glsl_extensions(const_cast(context))) { GLuint shader; if (shaderType == QGLShader::VertexShader) @@ -264,11 +228,6 @@ bool QGLShaderPrivate::create() bool QGLShaderPrivate::compile(QGLShader *q) { - // Partial shaders are compiled during QGLShaderProgram::link(). - if (isPartial && hasPartialSource) { - compiled = true; - return true; - } GLuint shader = shaderGuard.id(); if (!shader) return false; @@ -441,21 +400,12 @@ static const char redefineHighp[] = Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compileFile() */ bool QGLShader::compile(const char *source) { Q_D(QGLShader); - if (d->isPartial) { - d->partialSource = QByteArray(source); - d->hasPartialSource = true; - return d->compile(this); - } else if (d->shaderGuard.id()) { + if (d->shaderGuard.id()) { QVarLengthArray src; QVarLengthArray srclen; int headerLen = 0; @@ -481,8 +431,7 @@ bool QGLShader::compile(const char *source) srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP - if (d->shaderType == FragmentShader || - d->shaderType == PartialFragmentShader) { + if (d->shaderType == FragmentShader) { src.append(redefineHighp); srclen.append(GLint(sizeof(redefineHighp) - 1)); } @@ -497,71 +446,11 @@ bool QGLShader::compile(const char *source) } /*! - \internal -*/ -bool QGLShader::compile - (const QList& shaders, QGLShader::ShaderType type) -{ - Q_D(QGLShader); - QVarLengthArray src; - QVarLengthArray srclen; - if (!d->shaderGuard.id()) - return false; - foreach (QGLShader *shader, shaders) { - if (shader->shaderType() != type) - continue; - const char *source = shader->d_func()->partialSource.constData(); - int headerLen = 0; - if (src.isEmpty()) { - // First shader: handle the #version and #extension tags - // plus the precision qualifiers. - while (source && source[headerLen] == '#') { - // Skip #version and #extension directives at the start of - // the shader code. We need to insert the qualifierDefines - // and redefineHighp just after them. - if (qstrncmp(source + headerLen, "#version", 8) != 0 && - qstrncmp(source + headerLen, "#extension", 10) != 0) { - break; - } - while (source[headerLen] != '\0' && source[headerLen] != '\n') - ++headerLen; - if (source[headerLen] == '\n') - ++headerLen; - } - if (headerLen > 0) { - src.append(source); - srclen.append(GLint(headerLen)); - } -#ifdef QGL_DEFINE_QUALIFIERS - src.append(qualifierDefines); - srclen.append(GLint(sizeof(qualifierDefines) - 1)); -#endif -#ifdef QGL_REDEFINE_HIGHP - if (d->shaderType == FragmentShader || - d->shaderType == PartialFragmentShader) { - src.append(redefineHighp); - srclen.append(GLint(sizeof(redefineHighp) - 1)); - } -#endif - } - src.append(source + headerLen); - srclen.append(GLint(qstrlen(source + headerLen))); - } - glShaderSource(d->shaderGuard.id(), src.size(), src.data(), srclen.data()); - return d->compile(this); -} - -/*! \overload Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compileFile() */ bool QGLShader::compile(const QByteArray& source) @@ -575,11 +464,6 @@ bool QGLShader::compile(const QByteArray& source) Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compileFile() */ bool QGLShader::compile(const QString& source) @@ -592,11 +476,6 @@ bool QGLShader::compile(const QString& source) and compiles it. Returns true if the file could be opened and the source compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compile() */ bool QGLShader::compileFile(const QString& fileName) @@ -619,8 +498,6 @@ bool QGLShader::compileFile(const QString& fileName) QByteArray QGLShader::sourceCode() const { Q_D(const QGLShader); - if (d->isPartial) - return d->partialSource; GLuint shader = d->shaderGuard.id(); if (!shader) return QByteArray(); @@ -661,10 +538,6 @@ QString QGLShader::log() const /*! Returns the OpenGL identifier associated with this shader. - If shaderType() is PartialVertexShader or PartialFragmentShader, - this function will always return zero. Partial shaders are - created and compiled when QGLShaderProgram::link() is called. - \sa QGLShaderProgram::programId() */ GLuint QGLShader::shaderId() const @@ -684,7 +557,6 @@ public: : programGuard(context) , linked(false) , inited(false) - , hasPartialShaders(false) , removingShaders(false) , vertexShader(0) , fragmentShader(0) @@ -695,7 +567,6 @@ public: QGLSharedResourceGuard programGuard; bool linked; bool inited; - bool hasPartialShaders; bool removingShaders; QString log; QList shaders; @@ -812,13 +683,9 @@ bool QGLShaderProgram::addShader(QGLShader *shader) } if (!shader->d_func()->compiled) return false; - if (!shader->d_func()->isPartial) { - if (!shader->d_func()->shaderGuard.id()) - return false; - glAttachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); - } else { - d->hasPartialShaders = true; - } + if (!shader->d_func()->shaderGuard.id()) + return false; + glAttachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); d->linked = false; // Program needs to be relinked. d->shaders.append(shader); connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); @@ -999,45 +866,6 @@ bool QGLShaderProgram::link() GLuint program = d->programGuard.id(); if (!program) return false; - if (d->hasPartialShaders) { - // Compile the partial vertex and fragment shaders. - if (d->hasShader(QGLShader::PartialVertexShader)) { - if (!d->vertexShader) { - d->vertexShader = - new QGLShader(QGLShader::VertexShader, this); - } - if (!d->vertexShader->compile - (d->shaders, QGLShader::PartialVertexShader)) { - d->log = d->vertexShader->log(); - return false; - } - glAttachShader(program, d->vertexShader->d_func()->shaderGuard.id()); - } else { - if (d->vertexShader) { - glDetachShader(program, d->vertexShader->d_func()->shaderGuard.id()); - delete d->vertexShader; - d->vertexShader = 0; - } - } - if (d->hasShader(QGLShader::PartialFragmentShader)) { - if (!d->fragmentShader) { - d->fragmentShader = - new QGLShader(QGLShader::FragmentShader, this); - } - if (!d->fragmentShader->compile - (d->shaders, QGLShader::PartialFragmentShader)) { - d->log = d->fragmentShader->log(); - return false; - } - glAttachShader(program, d->fragmentShader->d_func()->shaderGuard.id()); - } else { - if (d->fragmentShader) { - glDetachShader(program, d->fragmentShader->d_func()->shaderGuard.id()); - delete d->fragmentShader; - d->fragmentShader = 0; - } - } - } glLinkProgram(program); GLint value = 0; glGetProgramiv(program, GL_LINK_STATUS, &value); diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index 708cf09..b7bd2d7 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -66,12 +66,7 @@ public: enum ShaderTypeBits { VertexShader = 0x0001, - FragmentShader = 0x0002, - - PartialShader = 0x1000, - - PartialVertexShader = PartialShader | VertexShader, - PartialFragmentShader = PartialShader | FragmentShader + FragmentShader = 0x0002 }; Q_DECLARE_FLAGS(ShaderType, ShaderTypeBits) @@ -100,8 +95,6 @@ private: Q_DISABLE_COPY(QGLShader) Q_DECLARE_PRIVATE(QGLShader) - - bool compile(const QList& shaders, QGLShader::ShaderType type); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGLShader::ShaderType) -- cgit v0.12 From 9f2a0c09a90daa46b7432037595b750406bbd506 Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Mon, 2 Nov 2009 11:44:21 +1000 Subject: Added documentation of RPATH defines. --- doc/src/development/qmake-manual.qdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 6c53242..352db75 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -2342,6 +2342,8 @@ For example: \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_RPATH + + \e {This is used on Unix platforms only.} Library paths in this definition are added to the executable at link time so that the added paths will be preferentially searched at runtime. @@ -2673,11 +2675,15 @@ For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 45 \section1 QMAKE_RPATH + + \e {This is used on Unix platforms only.} Is equivalent to \l QMAKE_LFLAGS_RPATH. \section1 QMAKE_RPATHDIR + \e {This is used on Unix platforms only.} + A list of library directory paths, these paths are added to the executable at link time so that the paths will be preferentially searched at runtime. -- cgit v0.12 From fc6822cb2c1a09b018189168965a8ade23cf1074 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 2 Nov 2009 10:23:12 +0200 Subject: Fix for static QSound::play in Symbian and code style fixes. Static QSound::play(const QString& filename) API did work for Symbian, since local stack variable was deleted before asynchronous play completed. This happened with the following seqeunce: - void QAuServer::play() is called and creates a QSound on the stack - QAuBucketS60::play() is called - m_prepared is false, so the actual play will happen a bit later - The QSound created on the stack is deleted -> Silence This scenario is now fixed by making copy of QSound object to internal list, and temp object is being deleted when play is completed either successfully or unsuccessfully. Added also manual test case for static play. Task-number: QTBUG-5217 Reviewed-by: Miikka Heikkinen --- src/gui/kernel/qsound_s60.cpp | 94 ++++++++++++++++++++++++---------------- tests/auto/qsound/tst_qsound.cpp | 26 ++++++++--- 2 files changed, 75 insertions(+), 45 deletions(-) diff --git a/src/gui/kernel/qsound_s60.cpp b/src/gui/kernel/qsound_s60.cpp index 352580e..e4b7cec 100644 --- a/src/gui/kernel/qsound_s60.cpp +++ b/src/gui/kernel/qsound_s60.cpp @@ -60,13 +60,13 @@ class QAuServerS60; class QAuBucketS60 : public QAuBucket, public MMdaAudioPlayerCallback { public: - QAuBucketS60( QAuServerS60 *server, QSound *sound); + QAuBucketS60(QAuServerS60 *server, QSound *sound); ~QAuBucketS60(); void play(); void stop(); - inline QSound* sound() const { return m_sound; } + inline QSound *sound() const { return m_sound; } public: // from MMdaAudioPlayerCallback void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); @@ -77,88 +77,106 @@ private: QAuServerS60 *m_server; bool m_prepared; bool m_playCalled; - CMdaAudioPlayerUtility* m_playUtility; + CMdaAudioPlayerUtility *m_playUtility; }; class QAuServerS60 : public QAuServer { public: - QAuServerS60( QObject* parent ); + QAuServerS60(QObject *parent); - void init( QSound* s ) + void init(QSound *s) { - QAuBucketS60 *bucket = new QAuBucketS60( this, s ); - setBucket( s, bucket ); + QAuBucketS60 *bucket = new QAuBucketS60(this, s); + setBucket(s, bucket); } - void play( QSound* s ) + void play(QSound *s) { - bucket( s )->play(); + bucket(s)->play(); } - void stop( QSound* s ) + void stop(QSound *s) { - bucket( s )->stop(); + bucket(s)->stop(); } bool okay() { return true; } + void play(const QString& filename); + protected: - void playCompleted(QAuBucketS60* bucket, int error) - { - QSound *sound = bucket->sound(); - if(!error) { - // We need to handle repeats by ourselves, since with Symbian API we don't - // know how many loops have been played when user asks it - if( decLoop( sound ) ) { - play( sound ); - } - } else { - // We don't have a way to inform about errors -> just decrement loops - // in order that QSound::isFinished will return true; - while(decLoop(sound)) {} - } - } + void playCompleted(QAuBucketS60 *bucket, int error); protected: - QAuBucketS60* bucket( QSound *s ) + QAuBucketS60 *bucket(QSound *s) { - return (QAuBucketS60*)QAuServer::bucket( s ); + return (QAuBucketS60 *)QAuServer::bucket( s ); } friend class QAuBucketS60; + // static QSound::play(filename) cannot be stopped, meaning that playCompleted + // will get always called and QSound gets removed form this list. + QList staticPlayingSounds; }; -QAuServerS60::QAuServerS60(QObject* parent) : +QAuServerS60::QAuServerS60(QObject *parent) : QAuServer(parent) { setObjectName(QLatin1String("QAuServerS60")); } +void QAuServerS60::play(const QString& filename) +{ + QSound *s = new QSound(filename); + staticPlayingSounds.append(s); + play(s); +} + +void QAuServerS60::playCompleted(QAuBucketS60 *bucket, int error) +{ + QSound *sound = bucket->sound(); + if (!error) { + // We need to handle repeats by ourselves, since with Symbian API we don't + // know how many loops have been played when user asks it + if (decLoop(sound)) { + play(sound); + } else { + if (staticPlayingSounds.removeAll(sound)) + delete sound; + } + } else { + // We don't have a way to inform about errors -> just decrement loops + // in order that QSound::isFinished will return true; + while (decLoop(sound)) {} + if (staticPlayingSounds.removeAll(sound)) + delete sound; + } +} -QAuServer* qt_new_audio_server() +QAuServer *qt_new_audio_server() { return new QAuServerS60(qApp); } -QAuBucketS60::QAuBucketS60( QAuServerS60 *server, QSound *sound ) - : m_sound( sound ), m_server( server ), m_prepared(false), m_playCalled(false) +QAuBucketS60::QAuBucketS60(QAuServerS60 *server, QSound *sound) + : m_sound(sound), m_server(server), m_prepared(false), m_playCalled(false) { - QString filepath = QFileInfo( m_sound->fileName() ).absoluteFilePath(); + QString filepath = QFileInfo(m_sound->fileName()).absoluteFilePath(); filepath = QDir::toNativeSeparators(filepath); TPtrC filepathPtr(qt_QString2TPtrC(filepath)); TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this); m_playUtility->OpenFileL(filepathPtr)); - if(err){ + if (err) { m_server->playCompleted(this, err); } } void QAuBucketS60::play() { - if(m_prepared) { + if (m_prepared) { // OpenFileL call is completed we can start playing immediately m_playUtility->Play(); } else { @@ -180,11 +198,11 @@ void QAuBucketS60::MapcPlayComplete(TInt aError) void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) { - if(aError) { + if (aError) { m_server->playCompleted(this, aError); } else { m_prepared = true; - if(m_playCalled){ + if (m_playCalled){ play(); } } @@ -192,7 +210,7 @@ void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds QAuBucketS60::~QAuBucketS60() { - if(m_playUtility){ + if (m_playUtility){ m_playUtility->Stop(); m_playUtility->Close(); } diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index 56a330b..73eca98 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -55,20 +55,32 @@ public: tst_QSound( QObject* parent=0) : QObject(parent) {} private slots: - void checkFinished(); + void checkFinished(); + + // Manual tests + void staticPlay(); }; void tst_QSound::checkFinished() { - QSound sound(SRCDIR"4.wav"); - sound.setLoops(3); - sound.play(); - QTest::qWait(5000); + QSound sound(SRCDIR"4.wav"); + sound.setLoops(3); + sound.play(); + QTest::qWait(5000); #if defined(Q_WS_QWS) - QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort); + QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort); #endif - QVERIFY(sound.isFinished() ); + QVERIFY(sound.isFinished() ); +} + +void tst_QSound::staticPlay() +{ + QSKIP("Test disabled -- only for manual purposes", SkipAll); + + // Check that you hear sound with static play also. + QSound::play(SRCDIR"4.wav"); + QTest::qWait(2000); } QTEST_MAIN(tst_QSound); -- cgit v0.12 From 17cda5c55273813cbedcced3a511f1c222978182 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 2 Nov 2009 10:51:08 +0100 Subject: Check for null pixmap Reviewed-by: Trond --- src/gui/painting/qwindowsurface_x11.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index 46c4c42..77e019c 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -94,6 +94,8 @@ QPaintDevice *QX11WindowSurface::paintDevice() void QX11WindowSurface::beginPaint(const QRegion &rgn) { #ifndef QT_NO_XRENDER + Q_ASSERT(!d_ptr->device.isNull()); + if (d_ptr->translucentBackground) { if (d_ptr->device.depth() != 32) static_cast(d_ptr->device.data_ptr().data())->convertToARGB32(); @@ -157,8 +159,8 @@ void QX11WindowSurface::setGeometry(const QRect &rect) QPixmap::x11SetDefaultScreen(d_ptr->widget->x11Info().screen()); QX11PixmapData *oldData = static_cast(d_ptr->device.pixmapData()); - Q_ASSERT(oldData); - if (!(oldData->flags & QX11PixmapData::Uninitialized) && hasStaticContents()) { + + if (oldData && !(oldData->flags & QX11PixmapData::Uninitialized) && hasStaticContents()) { // Copy the content of the old pixmap into the new one. QX11PixmapData *newData = new QX11PixmapData(QPixmapData::PixmapType); newData->resize(size.width(), size.height()); -- cgit v0.12 From a80e58335e69c8ce96d1596e0ed2d14e424a0d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Mon, 2 Nov 2009 12:03:52 +0200 Subject: Style's theme palette hash is lost after orientation switch Currently, after orientation switch when new theme background is applied, it is done using QApplication::setPalette(). This unfortunately tosses away the palette hash. So instead directly calling QApplication::setPalette(), the fix is to call the style's internal setThemePalette(), which copies the hash also to QApplication palette. This is related to bug QT-1478 in Private JIRA. Task-number: QT-1478 Reviewed-by: Shane Kearns --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 10a63a8..48f7042 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -499,7 +499,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const Q_UNUSED(app) QPalette applicationPalette = QApplication::palette(); applicationPalette.setBrush(QPalette::Window, backgroundTexture()); - QApplication::setPalette(applicationPalette); + setThemePalette(app); } void QS60StylePrivate::deleteBackground() -- cgit v0.12 From 85e41590732f15cec16909bf1121d944ae684373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 13:37:05 +0100 Subject: Optimized graphics effects to not needlessly invalidate cache. When the effect rect changes we only need to invalidate the cache if the mode is ExpandToEffectRectPadMode. Reviewed-by: Gunnar Sletta --- src/gui/effects/qgraphicseffect.cpp | 9 ++++++++- src/gui/effects/qgraphicseffect_p.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 3a6bab5..c8e39da 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -279,6 +279,13 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse return pm; } +void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const +{ + if (effectRectChanged && m_cachedMode != QGraphicsEffectSource::ExpandToEffectRectPadMode) + return; + QPixmapCache::remove(m_cacheKey); +} + /*! Constructs a new QGraphicsEffect instance having the specified \a parent. @@ -418,7 +425,7 @@ void QGraphicsEffect::updateBoundingRect() Q_D(QGraphicsEffect); if (d->source) { d->source->d_func()->effectBoundingRectChanged(); - d->source->d_func()->invalidateCache(); + d->source->d_func()->invalidateCache(true); } } diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 1ed7103..0ff5794 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -85,7 +85,7 @@ public: virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0, QGraphicsEffectSource::PixmapPadMode mode = QGraphicsEffectSource::ExpandToTransparentBorderPadMode) const = 0; virtual void effectBoundingRectChanged() = 0; - void invalidateCache() const { QPixmapCache::remove(m_cacheKey); } + void invalidateCache(bool effectRectChanged = false) const; friend class QGraphicsScenePrivate; friend class QGraphicsItem; -- cgit v0.12 From 70b7f26c3155e83d59cae7b89ed1af3b57797a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 13:59:41 +0100 Subject: Added strict size parameter to QGLFramebufferObject pool. The strict size parameter can be used when it's critical that we get the exact size we ask for. Reviewed-by: Gunnar Sletta --- src/opengl/qpixmapdata_gl.cpp | 19 ++++++++++++++++--- src/opengl/qpixmapdata_gl_p.h | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index c965947..5ca37ef 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -89,13 +89,22 @@ static inline QSize maybeRoundToNextPowerOfTwo(const QSize &sz) } -QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat) +QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat, bool strictSize) { QGLFramebufferObject *chosen = 0; QGLFramebufferObject *candidate = 0; for (int i = 0; !chosen && i < m_fbos.size(); ++i) { QGLFramebufferObject *fbo = m_fbos.at(i); + if (strictSize) { + if (fbo->size() == requestSize && fbo->format() == requestFormat) { + chosen = fbo; + break; + } else { + continue; + } + } + if (fbo->format() == requestFormat) { // choose the fbo with a matching format and the closest size if (!candidate || areaDiff(requestSize, candidate) > areaDiff(requestSize, fbo)) @@ -127,7 +136,10 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize } if (!chosen) { - chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat); + if (strictSize) + chosen = new QGLFramebufferObject(requestSize, requestFormat); + else + chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat); } if (!chosen->isValid()) { @@ -140,7 +152,8 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize void QGLFramebufferObjectPool::release(QGLFramebufferObject *fbo) { - m_fbos << fbo; + if (fbo) + m_fbos << fbo; } diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index 6190d38..8a13e03 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -69,7 +69,7 @@ class QGLPixmapData; class QGLFramebufferObjectPool { public: - QGLFramebufferObject *acquire(const QSize &size, const QGLFramebufferObjectFormat &format); + QGLFramebufferObject *acquire(const QSize &size, const QGLFramebufferObjectFormat &format, bool strictSize = false); void release(QGLFramebufferObject *fbo); private: -- cgit v0.12 From 2a902676b74d0aa3482e722602879f7a02be1103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 14:26:55 +0100 Subject: Moved Qt::RenderHint back into QGraphicsBlurEffect and added a hint. Added AnimationHint, which didn't make too much sense in a generic enum, so Qt::RenderHint was moved back into QGraphicsBlurEffect as QGraphicsBlurEffect::BlurHint. Reviewed-by: Gunnar Sletta --- dist/changes-4.6.0 | 4 ++++ src/corelib/global/qnamespace.h | 5 ----- src/corelib/global/qnamespace.qdoc | 15 --------------- src/gui/effects/qgraphicseffect.cpp | 37 ++++++++++++++++++++++++++++--------- src/gui/effects/qgraphicseffect.h | 14 ++++++++++---- src/gui/image/qpixmapfilter.cpp | 18 ++++++++++++------ src/gui/image/qpixmapfilter_p.h | 5 +++-- src/opengl/qglpixmapfilter.cpp | 28 ++++++++++++++-------------- 8 files changed, 71 insertions(+), 55 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 7f723da..c7f9ad7 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -30,6 +30,10 @@ information about a particular change. * [245219] Added QXmlQuery::setFocus(const QString &focus); + - QGraphicsBlurEffect + * Since the 4.6 beta Qt::RenderHint has been moved to + QGraphicsBlurEffect::BlurHint. + - QVariant * Many optimisations * Added QVariant::toFloat() and QVariant::toReal() diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 2b62c6b..42dd3a2 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1645,11 +1645,6 @@ public: NavigationModeCursorAuto, NavigationModeCursorForceVisible }; - - enum RenderHint { - QualityHint, - PerformanceHint - }; } #ifdef Q_MOC_RUN ; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 5f9d01d..e3e881d 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2873,18 +2873,3 @@ \sa QApplication::setNavigationMode() \sa QApplication::navigationMode() */ - -/*! - \enum Qt::RenderHint - \since 4.6 - - This enum describes the possible hints that can be used to control various - rendering operations. - - \value QualityHint Indicates that rendering quality is the most important factor, - at the potential cost of lower performance. - - \value PerformanceHint Indicates that rendering performance is the most important factor, - at the potential cost of lower quality. -*/ - diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index c8e39da..e181b18 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -613,6 +613,26 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou */ /*! + \enum QGraphicsBlurEffect::BlurHint + \since 4.6 + + This enum describes the possible hints that can be used to control how + blur effects are applied. The hints might not have an effect in all the + paint engines. + + \value QualityHint Indicates that rendering quality is the most important factor, + at the potential cost of lower performance. + + \value PerformanceHint Indicates that rendering performance is the most important factor, + at the potential cost of lower quality. + + \value AnimationHint Indicates that the blur radius is going to be animated, hinting + that the implementation can keep a cache of blurred verisons of the source pixmap. + Do not use this hint if the source item is going to be dynamically changing. +*/ + + +/*! Constructs a new QGraphicsBlurEffect instance. The \a parent parameter is passed to QGraphicsEffect's constructor. */ @@ -620,7 +640,7 @@ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) { Q_D(QGraphicsBlurEffect); - d->filter->setBlurHint(Qt::PerformanceHint); + d->filter->setBlurHint(QGraphicsBlurEffect::PerformanceHint); } /*! @@ -667,20 +687,19 @@ void QGraphicsBlurEffect::setBlurRadius(qreal radius) \property QGraphicsBlurEffect::blurHint \brief the blur hint of the effect. - Use the Qt::PerformanceHint hint to say that you want a faster blur, - and the Qt::QualityHint hint to say that you prefer a higher quality blur. - - When animating the blur radius it's recommended to use Qt::PerformanceHint. + Use the PerformanceHint hint to say that you want a faster blur, + the QualityHint hint to say that you prefer a higher quality blur, + or the AnimationHint when you want to animate the blur radius. - By default, the blur hint is Qt::PerformanceHint. + By default, the blur hint is PerformanceHint. */ -Qt::RenderHint QGraphicsBlurEffect::blurHint() const +QGraphicsBlurEffect::BlurHint QGraphicsBlurEffect::blurHint() const { Q_D(const QGraphicsBlurEffect); return d->filter->blurHint(); } -void QGraphicsBlurEffect::setBlurHint(Qt::RenderHint hint) +void QGraphicsBlurEffect::setBlurHint(QGraphicsBlurEffect::BlurHint hint) { Q_D(QGraphicsBlurEffect); if (d->filter->blurHint() == hint) @@ -691,7 +710,7 @@ void QGraphicsBlurEffect::setBlurHint(Qt::RenderHint hint) } /*! - \fn void QGraphicsBlurEffect::blurHintChanged(Qt::RenderHint hint) + \fn void QGraphicsBlurEffect::blurHintChanged(Qt::BlurHint hint) This signal is emitted whenever the effect's blur hint changes. The \a hint parameter holds the effect's new blur hint. diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index bf18581..7335a25 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -183,22 +183,28 @@ class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) - Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged) + Q_PROPERTY(BlurHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged) public: + enum BlurHint { + QualityHint, + PerformanceHint, + AnimationHint + }; + QGraphicsBlurEffect(QObject *parent = 0); ~QGraphicsBlurEffect(); QRectF boundingRectFor(const QRectF &rect) const; qreal blurRadius() const; - Qt::RenderHint blurHint() const; + BlurHint blurHint() const; public Q_SLOTS: void setBlurRadius(qreal blurRadius); - void setBlurHint(Qt::RenderHint hint); + void setBlurHint(BlurHint hint); Q_SIGNALS: void blurRadiusChanged(qreal blurRadius); - void blurHintChanged(Qt::RenderHint hint); + void blurHintChanged(BlurHint hint); protected: void draw(QPainter *painter, QGraphicsEffectSource *source); diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index d0de03e..e50cc8b 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -504,10 +504,10 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q class QPixmapBlurFilterPrivate : public QPixmapFilterPrivate { public: - QPixmapBlurFilterPrivate() : radius(5), hint(Qt::PerformanceHint) {} + QPixmapBlurFilterPrivate() : radius(5), hint(QGraphicsBlurEffect::PerformanceHint) {} qreal radius; - Qt::RenderHint hint; + QGraphicsBlurEffect::BlurHint hint; }; @@ -556,12 +556,18 @@ qreal QPixmapBlurFilter::radius() const Setting the blur hint to PerformanceHint causes the implementation to trade off visual quality to blur the image faster. Setting the blur hint to QualityHint causes the implementation to improve - visual quality at the expense of speed. The implementation is free - to ignore this value if it only has a single blur algorithm. + visual quality at the expense of speed. + + AnimationHint causes the implementation to optimize for animating + the blur radius, possibly by caching blurred versions of the source + pixmap. + + The implementation is free to ignore this value if it only has a single + blur algorithm. \internal */ -void QPixmapBlurFilter::setBlurHint(Qt::RenderHint hint) +void QPixmapBlurFilter::setBlurHint(QGraphicsBlurEffect::BlurHint hint) { Q_D(QPixmapBlurFilter); d->hint = hint; @@ -572,7 +578,7 @@ void QPixmapBlurFilter::setBlurHint(Qt::RenderHint hint) \internal */ -Qt::RenderHint QPixmapBlurFilter::blurHint() const +QGraphicsBlurEffect::BlurHint QPixmapBlurFilter::blurHint() const { Q_D(const QPixmapBlurFilter); return d->hint; diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h index fc70795..6a96676 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/gui/image/qpixmapfilter_p.h @@ -55,6 +55,7 @@ #include #include +#include QT_BEGIN_HEADER @@ -130,10 +131,10 @@ public: ~QPixmapBlurFilter(); void setRadius(qreal radius); - void setBlurHint(Qt::RenderHint hint); + void setBlurHint(QGraphicsBlurEffect::BlurHint hint); qreal radius() const; - Qt::RenderHint blurHint() const; + QGraphicsBlurEffect::BlurHint blurHint() const; QRectF boundingRectFor(const QRectF &rect) const; void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const; diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 2af69e0..3b94ad3 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -100,7 +100,7 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapBlurFilter(Qt::RenderHint hint); + QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint); void setUniforms(QGLShaderProgram *program); @@ -117,13 +117,13 @@ private: mutable bool m_haveCached; mutable int m_cachedRadius; - mutable Qt::RenderHint m_hint; + mutable QGraphicsBlurEffect::BlurHint m_hint; }; class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapDropShadowFilter(Qt::RenderHint hint); + QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint); void setUniforms(QGLShaderProgram *program); @@ -137,7 +137,7 @@ private: mutable bool m_haveCached; mutable int m_cachedRadius; - mutable Qt::RenderHint m_hint; + mutable QGraphicsBlurEffect::BlurHint m_hint; }; extern QGLWidget *qt_gl_share_widget(); @@ -153,13 +153,13 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr case QPixmapFilter::BlurFilter: { const QPixmapBlurFilter *proto = static_cast(prototype); - if (proto->blurHint() == Qt::PerformanceHint || proto->radius() <= 5) { + if (proto->blurHint() == QGraphicsBlurEffect::PerformanceHint || proto->radius() <= 5) { if (!d->fastBlurFilter) - d->fastBlurFilter.reset(new QGLPixmapBlurFilter(Qt::PerformanceHint)); + d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); return d->fastBlurFilter.data(); } if (!d->blurFilter) - d->blurFilter.reset(new QGLPixmapBlurFilter(Qt::QualityHint)); + d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint)); return d->blurFilter.data(); } @@ -167,11 +167,11 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr const QPixmapDropShadowFilter *proto = static_cast(prototype); if (proto->blurRadius() <= 5) { if (!d->fastDropShadowFilter) - d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(Qt::PerformanceHint)); + d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::PerformanceHint)); return d->fastDropShadowFilter.data(); } if (!d->dropShadowFilter) - d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(Qt::QualityHint)); + d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::QualityHint)); return d->dropShadowFilter.data(); } @@ -327,7 +327,7 @@ static QByteArray qt_gl_convertToClamped(const QByteArray &source) return result; } -QGLPixmapBlurFilter::QGLPixmapBlurFilter(Qt::RenderHint hint) +QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint) : m_haveCached(false) , m_cachedRadius(0) , m_hint(hint) @@ -341,7 +341,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const int actualRadius = qRound(radius()); int filterRadius = actualRadius; int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 }; - if (m_hint == Qt::PerformanceHint) { + if (m_hint == QGraphicsBlurEffect::PerformanceHint) { uint i = 0; for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) { if (fastRadii[i+1] > filterRadius) @@ -428,7 +428,7 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - if (m_hint == Qt::QualityHint) { + if (m_hint == QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) @@ -578,7 +578,7 @@ QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius, bool singlePa return source; } -QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(Qt::RenderHint hint) +QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint) : m_haveCached(false) , m_cachedRadius(0) , m_hint(hint) @@ -685,7 +685,7 @@ void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program) alpha); } - if (m_hint == Qt::QualityHint) { + if (m_hint == QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) -- cgit v0.12 From 64fbefa605d976ab752149bb39880893c82ad8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 14:00:35 +0100 Subject: Optimized animated blur radii in the GL 2 paint engine. We add an internal cache which keeps four half-scaled versions of the source pixmap at different blur radii, then we simply interpolate between the two pixmaps around the desired blur radius, or between the base source pixmap and the first blurred version. Reviewed-by: Gunnar Sletta --- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 1 + src/opengl/qgl.h | 1 + src/opengl/qglpixmapfilter.cpp | 379 ++++++++++++++++++++- 3 files changed, 369 insertions(+), 12 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 209cd36..4cf2a83 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -289,6 +289,7 @@ public: QScopedPointer convolutionFilter; QScopedPointer colorizeFilter; QScopedPointer blurFilter; + QScopedPointer animationBlurFilter; QScopedPointer fastBlurFilter; QScopedPointer dropShadowFilter; QScopedPointer fastDropShadowFilter; diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index e14e7fb..079953f 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -399,6 +399,7 @@ private: friend class QGLTextureGlyphCache; friend class QGLShareRegister; friend class QGLSharedResourceGuard; + friend class QGLPixmapBlurFilter; friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags(); #ifdef Q_WS_MAC public: diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 3b94ad3..ff19e06 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -43,6 +43,8 @@ #include "private/qpixmapdata_gl_p.h" #include "private/qpaintengineex_opengl2_p.h" #include "private/qglengineshadermanager_p.h" +#include "private/qpixmapdata_p.h" +#include "private/qimagepixmapcleanuphooks_p.h" #include "qglpixmapfilter_p.h" #include "qgraphicssystem_gl_p.h" #include "qpaintengine_opengl_p.h" @@ -54,7 +56,7 @@ #include "private/qapplication_p.h" #include "private/qmath_p.h" - +#include "qmath.h" QT_BEGIN_NAMESPACE @@ -114,6 +116,10 @@ private: mutable QSize m_textureSize; mutable bool m_horizontalBlur; mutable bool m_singlePass; + mutable bool m_animatedBlur; + + mutable qreal m_t; + mutable QSize m_targetSize; mutable bool m_haveCached; mutable int m_cachedRadius; @@ -153,6 +159,11 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr case QPixmapFilter::BlurFilter: { const QPixmapBlurFilter *proto = static_cast(prototype); + if (proto->blurHint() == QGraphicsBlurEffect::AnimationHint) { + if (!d->animationBlurFilter) + d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHint())); + return d->animationBlurFilter.data(); + } if (proto->blurHint() == QGraphicsBlurEffect::PerformanceHint || proto->radius() <= 5) { if (!d->fastBlurFilter) d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); @@ -328,20 +339,343 @@ static QByteArray qt_gl_convertToClamped(const QByteArray &source) } QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint) - : m_haveCached(false) + : m_animatedBlur(false) + , m_haveCached(false) , m_cachedRadius(0) , m_hint(hint) { } +// should be even numbers as they will be divided by two +static const int qCachedBlurLevels[] = { 6, 14, 30 }; +static const int qNumCachedBlurTextures = sizeof(qCachedBlurLevels) / sizeof(*qCachedBlurLevels); +static const int qMaxCachedBlurLevel = qCachedBlurLevels[qNumCachedBlurTextures - 1]; + +static qreal qLogBlurLevel(int level) +{ + static bool initialized = false; + static qreal logBlurLevelCache[qNumCachedBlurTextures]; + if (!initialized) { + for (int i = 0; i < qNumCachedBlurTextures; ++i) + logBlurLevelCache[i] = qLn(qCachedBlurLevels[i]); + initialized = true; + } + return logBlurLevelCache[level]; +} + +class QGLBlurTextureInfo +{ +public: + QGLBlurTextureInfo(QSize size, GLuint textureIds[]) + : m_size(size) + { + for (int i = 0; i < qNumCachedBlurTextures; ++i) + m_textureIds[i] = textureIds[i]; + } + + ~QGLBlurTextureInfo() + { + glDeleteTextures(qNumCachedBlurTextures, m_textureIds); + } + + QSize size() const { return m_size; } + GLuint textureId(int i) const { return m_textureIds[i]; } + +private: + GLuint m_textureIds[qNumCachedBlurTextures]; + QSize m_size; +}; + +class QGLBlurTextureCache : public QObject +{ +public: + static QGLBlurTextureCache *cacheForContext(const QGLContext *context); + + QGLBlurTextureCache(); + ~QGLBlurTextureCache(); + + QGLBlurTextureInfo *takeBlurTextureInfo(const QPixmap &pixmap); + bool fitsInCache(const QPixmap &pixmap) const; + bool hasBlurTextureInfo(const QPixmap &pixmap) const; + void insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info); + void clearBlurTextureInfo(const QPixmap &pixmap); + + void timerEvent(QTimerEvent *event); + +private: + static void pixmapDestroyed(QPixmap *pixmap); + + QCache cache; + + static QList blurTextureCaches; + + int timerId; +}; + +QList QGLBlurTextureCache::blurTextureCaches; + +static void QGLBlurTextureCache_free(void *ptr) +{ + delete reinterpret_cast(ptr); +} + +Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_blur_texture_caches, (QGLBlurTextureCache_free)) + +QGLBlurTextureCache::QGLBlurTextureCache() + : timerId(0) +{ + cache.setMaxCost(4 * 1024 * 1024); + blurTextureCaches.append(this); +} + +QGLBlurTextureCache::~QGLBlurTextureCache() +{ + blurTextureCaches.removeAt(blurTextureCaches.indexOf(this)); +} + +void QGLBlurTextureCache::timerEvent(QTimerEvent *event) +{ + killTimer(timerId); + timerId = 0; + + cache.clear(); +} + +QGLBlurTextureCache *QGLBlurTextureCache::cacheForContext(const QGLContext *context) +{ + QGLBlurTextureCache *p = reinterpret_cast(qt_blur_texture_caches()->value(context)); + if (!p) { + p = new QGLBlurTextureCache; + qt_blur_texture_caches()->insert(context, p); + } + return p; +} + +QGLBlurTextureInfo *QGLBlurTextureCache::takeBlurTextureInfo(const QPixmap &pixmap) +{ + return cache.take(pixmap.cacheKey()); +} + +void QGLBlurTextureCache::clearBlurTextureInfo(const QPixmap &pixmap) +{ + cache.remove(pixmap.cacheKey()); +} + +bool QGLBlurTextureCache::hasBlurTextureInfo(const QPixmap &pixmap) const +{ + return cache.contains(pixmap.cacheKey()); +} + +void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info) +{ + static bool hookAdded = false; + if (!hookAdded) { + QImagePixmapCleanupHooks::instance()->addPixmapDestructionHook(pixmapDestroyed); + hookAdded = true; + } + + QImagePixmapCleanupHooks::enableCleanupHooks(pixmap); + cache.insert(pixmap.cacheKey(), info, pixmap.width() * pixmap.height()); + + if (timerId) + killTimer(timerId); + + timerId = startTimer(1000); +} + +bool QGLBlurTextureCache::fitsInCache(const QPixmap &pixmap) const +{ + return pixmap.width() * pixmap.height() <= cache.maxCost(); +} + +void QGLBlurTextureCache::pixmapDestroyed(QPixmap *pixmap) +{ + foreach (QGLBlurTextureCache *cache, blurTextureCaches) { + if (cache->hasBlurTextureInfo(*pixmap)) + cache->clearBlurTextureInfo(*pixmap); + } +} + +static const char *qt_gl_interpolate_filter = + "uniform lowp float interpolationValue;" + "uniform lowp sampler2D interpolateTarget;" + "uniform highp vec4 interpolateMapping;" + "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" + "{" + " return mix(texture2D(interpolateTarget, interpolateMapping.xy + interpolateMapping.zw * srcCoords)," + " texture2D(src, srcCoords), interpolationValue);" + "}"; + +static void initializeTexture(GLuint id, int width, int height) +{ + glBindTexture(GL_TEXTURE_2D, id); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D, 0); +} + bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { QGLPixmapBlurFilter *filter = const_cast(this); + QGLContext *ctx = const_cast(QGLContext::currentContext()); + QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); + + if (m_hint == QGraphicsBlurEffect::AnimationHint && blurTextureCache->fitsInCache(src)) { + QRect targetRect = src.rect().adjusted(-qMaxCachedBlurLevel, -qMaxCachedBlurLevel, qMaxCachedBlurLevel, qMaxCachedBlurLevel); + // ensure even dimensions (going to divide by two) + targetRect.setWidth((targetRect.width() + 1) & ~1); + targetRect.setHeight((targetRect.height() + 1) & ~1); + + QGLBlurTextureInfo *info = 0; + if (blurTextureCache->hasBlurTextureInfo(src)) { + info = blurTextureCache->takeBlurTextureInfo(src); + } else { + m_animatedBlur = false; + m_hint = QGraphicsBlurEffect::QualityHint; + m_singlePass = false; + + QGLFramebufferObjectFormat format; + format.setInternalTextureFormat(GL_RGBA); + QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size() / 2, format, true); + + if (!fbo) + return false; + + QPainter fboPainter(fbo); + QGL2PaintEngineEx *engine = static_cast(fboPainter.paintEngine()); + + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + + // ensure GL_LINEAR filtering is used for scaling down to half the size + fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + fboPainter.setCompositionMode(QPainter::CompositionMode_Source); + fboPainter.drawPixmap(qMaxCachedBlurLevel / 2, qMaxCachedBlurLevel / 2, + targetRect.width() / 2 - qMaxCachedBlurLevel, targetRect.height() / 2 - qMaxCachedBlurLevel, src); + + GLuint textures[qNumCachedBlurTextures]; // blur textures + glGenTextures(qNumCachedBlurTextures, textures); + GLuint temp; // temp texture + glGenTextures(1, &temp); + + initializeTexture(temp, fbo->width(), fbo->height()); + m_textureSize = fbo->size(); + + int currentBlur = 0; + + QRect fboRect(0, 0, fbo->width(), fbo->height()); + GLuint sourceTexture = fbo->texture(); + for (int i = 0; i < qNumCachedBlurTextures; ++i) { + int targetBlur = qCachedBlurLevels[i] / 2; + + int blurDelta = qRound(qSqrt(targetBlur * targetBlur - currentBlur * currentBlur)); + QByteArray source = generateGaussianShader(blurDelta); + filter->setSource(source); + + currentBlur = targetBlur; + + // now we're going to be nasty and keep using the same FBO with different textures + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, temp, 0); + + m_horizontalBlur = true; + filter->setOnPainter(&fboPainter); + engine->drawTexture(fboRect, sourceTexture, fbo->size(), fboRect); + filter->removeFromPainter(&fboPainter); + + sourceTexture = textures[i]; + initializeTexture(sourceTexture, fbo->width(), fbo->height()); + + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, textures[i], 0); + + m_horizontalBlur = false; + filter->setOnPainter(&fboPainter); + engine->drawTexture(fboRect, temp, fbo->size(), fboRect); + filter->removeFromPainter(&fboPainter); + } + + glDeleteTextures(1, &temp); + + // reattach the original FBO texture + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, fbo->texture(), 0); + + fboPainter.end(); + + qgl_fbo_pool()->release(fbo); + + info = new QGLBlurTextureInfo(fboRect.size(), textures); + } + + if (!m_haveCached || !m_animatedBlur) { + m_haveCached = true; + m_animatedBlur = true; + m_hint = QGraphicsBlurEffect::AnimationHint; + filter->setSource(qt_gl_interpolate_filter); + } + + QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); + painter->setRenderHint(QPainter::SmoothPixmapTransform); + filter->setOnPainter(painter); + + qreal logRadius = qLn(radius()); + + int t; + for (t = -1; t < qNumCachedBlurTextures - 2; ++t) { + if (logRadius < qLogBlurLevel(t+1)) + break; + } + + qreal logBase = t >= 0 ? qLogBlurLevel(t) : 0; + m_t = qBound(qreal(0), (logRadius - logBase) / (qLogBlurLevel(t+1) - logBase), qreal(1)); + + m_textureSize = info->size(); + + glActiveTexture(GL_TEXTURE0 + 3); + if (t >= 0) { + glBindTexture(GL_TEXTURE_2D, info->textureId(t)); + m_targetSize = info->size(); + } else { + QGLTexture *texture = + ctx->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption + | QGLContext::CanFlipNativePixmapBindOption); + m_targetSize = src.size(); + if (!(texture->options & QGLContext::InvertedYBindOption)) + m_targetSize.setHeight(-m_targetSize.height()); + } + + // restrict the target rect to the max of the radii we are interpolating between + int radiusDelta = qMaxCachedBlurLevel - qCachedBlurLevels[t+1]; + targetRect = targetRect.translated(pos.toPoint()).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta); + + radiusDelta /= 2; + QRect sourceRect = QRect(QPoint(), m_textureSize).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta); + + engine->drawTexture(targetRect, info->textureId(t+1), m_textureSize, sourceRect); + + glActiveTexture(GL_TEXTURE0 + 3); + glBindTexture(GL_TEXTURE_2D, 0); + + filter->removeFromPainter(painter); + blurTextureCache->insertBlurTextureInfo(src, info); + + return true; + } + + if (blurTextureCache->hasBlurTextureInfo(src)) + blurTextureCache->clearBlurTextureInfo(src); + int actualRadius = qRound(radius()); int filterRadius = actualRadius; int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 }; - if (m_hint == QGraphicsBlurEffect::PerformanceHint) { + if (m_hint != QGraphicsBlurEffect::QualityHint) { uint i = 0; for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) { if (fastRadii[i+1] > filterRadius) @@ -352,9 +686,10 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const m_singlePass = filterRadius <= 3; - if (!m_haveCached || filterRadius != m_cachedRadius) { + if (!m_haveCached || m_animatedBlur || filterRadius != m_cachedRadius) { // Only regenerate the shader from source if parameters have changed. m_haveCached = true; + m_animatedBlur = false; m_cachedRadius = filterRadius; QByteArray source = generateGaussianShader(filterRadius, m_singlePass); filter->setSource(source); @@ -389,13 +724,12 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPainter fboPainter(fbo); - if (src.hasAlphaChannel()) { - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - } + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); // ensure GL_LINEAR filtering is used fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + fboPainter.setCompositionMode(QPainter::CompositionMode_Source); filter->setOnPainter(&fboPainter); QBrush pixmapBrush = src; pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius)); @@ -428,6 +762,28 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + if (m_animatedBlur) { + program->setUniformValue("interpolateTarget", 3); + program->setUniformValue("interpolationValue", GLfloat(m_t)); + + if (m_textureSize == m_targetSize) { + program->setUniformValue("interpolateMapping", 0.0f, 0.0f, 1.0f, 1.0f); + } else { + float offsetX = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.width()); + float offsetY = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.height()); + + if (m_targetSize.height() < 0) + offsetY = 1 + offsetY; + + float scaleX = 2.0f * qreal(m_textureSize.width()) / qreal(m_targetSize.width()); + float scaleY = 2.0f * qreal(m_textureSize.height()) / qreal(m_targetSize.height()); + + program->setUniformValue("interpolateMapping", offsetX, offsetY, scaleX, scaleY); + } + + return; + } + if (m_hint == QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); @@ -632,13 +988,12 @@ bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, QPainter fboPainter(fbo); - if (src.hasAlphaChannel()) { - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - } + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); // ensure GL_LINEAR filtering is used fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + fboPainter.setCompositionMode(QPainter::CompositionMode_Source); filter->setOnPainter(&fboPainter); QBrush pixmapBrush = src; pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius)); -- cgit v0.12 From cb357aad0f26c36eb1f942ae37647f9de071c948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 19:28:43 +0100 Subject: Made QGraphicsEffectSource::draw() use cached pixmap if possible. Small optimization for the case where the source pixmap is cached. Reviewed-by: Gunnar Sletta --- src/gui/effects/qgraphicseffect.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index e181b18..78a18d3 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -210,7 +210,23 @@ const QStyleOption *QGraphicsEffectSource::styleOption() const */ void QGraphicsEffectSource::draw(QPainter *painter) { - d_func()->draw(painter); + Q_D(const QGraphicsEffectSource); + + QPixmap pm; + if (QPixmapCache::find(d->m_cacheKey, &pm)) { + QTransform restoreTransform; + if (d->m_cachedSystem == Qt::DeviceCoordinates) { + restoreTransform = painter->worldTransform(); + painter->setWorldTransform(QTransform()); + } + + painter->drawPixmap(d->m_cachedOffset, pm); + + if (d->m_cachedSystem == Qt::DeviceCoordinates) + painter->setWorldTransform(restoreTransform); + } else { + d_func()->draw(painter); + } } /*! -- cgit v0.12 From 7f9c446f53ba89fb5add8ff6a62088eaa93d3460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 2 Nov 2009 10:14:34 +0100 Subject: Fixed compiler warning on GCC about empty while statement. --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 3fec1f0..2a57468 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2158,7 +2158,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #ifndef QT_NO_DEBUG // Reset the gl error stack...git - while (glGetError() != GL_NO_ERROR); + while (glGetError() != GL_NO_ERROR) ; #endif // Scale the pixmap if needed. GL textures needs to have the -- cgit v0.12 From d4ea57ff9022305437fb371802b41120074d3467 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 2 Nov 2009 13:56:40 +0100 Subject: Safeguard isNull() pixmaps in bindTexture and remove a compile warning Reviewed-by: TrustMe --- .../gl2paintengineex/qglengineshadermanager_p.h | 2 +- src/opengl/qgl.cpp | 39 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 59e50d0..50c1432 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -254,7 +254,7 @@ static const GLuint QT_VERTEX_COORDS_ATTR = 0; static const GLuint QT_TEXTURE_COORDS_ATTR = 1; static const GLuint QT_OPACITY_ATTR = 2; -struct QGLEngineShaderProg; +class QGLEngineShaderProg; class QGLEngineSharedShaders : public QObject { diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 3fec1f0..621d926 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2445,6 +2445,9 @@ int QGLContextPrivate::maxTextureSize() */ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, target, format, false, DefaultBindOption); return texture->id; @@ -2477,6 +2480,9 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) */ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, target, format, false, options); return texture->id; @@ -2486,6 +2492,9 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, /*! \internal */ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, DefaultBindOption); return texture->id; @@ -2495,6 +2504,9 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, options); return texture->id; @@ -2507,6 +2519,9 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, target, format, DefaultBindOption); return texture->id; @@ -2521,6 +2536,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, BindOptions options) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, target, format, options); return texture->id; @@ -2530,6 +2548,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma /*! \internal */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), DefaultBindOption); return texture->id; @@ -2538,6 +2559,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, Q GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format, BindOptions options) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), options); return texture->id; @@ -4595,6 +4619,9 @@ bool QGLWidget::autoBufferSwap() const */ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption); } @@ -4608,6 +4635,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format) */ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, target, format, options); } @@ -4617,6 +4647,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, /*! \internal */ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, GLenum(target), GLint(format), QGLContext::DefaultBindOption); } @@ -4624,6 +4657,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, QGLContext::BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, GLenum(target), GLint(format), options); } @@ -4637,6 +4673,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac */ GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { + if (pixmap.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption); } -- cgit v0.12 From 99bbe6fa6c2322449bb8ab7dda09c53b18cde68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 2 Nov 2009 14:13:05 +0100 Subject: Minor doc fixes for QGLContext::BindOption. Reviewed-by: Gunnar Sletta --- src/opengl/qgl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 2a57468..6370afd 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1773,10 +1773,12 @@ Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg() /*! \enum QGLContext::BindOption + \since 4.6 + A set of options to decide how to bind a texture using bindTexture(). \value NoBindOption Don't do anything, pass the texture straight - thru. + through. \value InvertedYBindOption Specifies that the texture should be flipped over the X axis so that the texture coordinate 0,0 corresponds to -- cgit v0.12 From 56da3aca1fc8a7c269acf3cf1d4c3586ea8cdfd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Mon, 2 Nov 2009 15:37:17 +0200 Subject: QS60Style - TabWidget text changes color when widget becomes dimmed Style sets the tabWidget palette hash only for QPalette::Active. So, when widget becomes disabled, text color changes back to default. Task-number: QTBUG-4625 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 48f7042..949dfcb 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -743,7 +743,7 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const const QColor mainAreaTextColor = s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0); - widgetPalette.setColor(QPalette::All, QPalette::WindowText, + widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); QApplication::setPalette(widgetPalette, "QSlider"); // return to original palette after each widget @@ -767,34 +767,34 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const QApplication::setPalette(widgetPalette, "QHeaderView"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::ButtonText, + widgetPalette.setColor(QPalette::ButtonText, s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); QApplication::setPalette(widgetPalette, "QMenuBar"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::Active, QPalette::WindowText, + widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); QApplication::setPalette(widgetPalette, "QTabBar"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::Text, + widgetPalette.setColor(QPalette::Text, s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); QApplication::setPalette(widgetPalette, "QTableView"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + widgetPalette.setColor(QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QLineEdit"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::Text, + widgetPalette.setColor(QPalette::Text, s60Color(QS60StyleEnums::CL_QsnTextColors, 34, 0)); - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + widgetPalette.setColor(QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QTextEdit"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + widgetPalette.setColor(QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QComboBox"); widgetPalette = *palette; -- cgit v0.12 From 298e0d28106fd7ef3fe7232c71dd05a57b5d1d90 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 2 Nov 2009 15:35:56 +0200 Subject: Re-added checking for existence of sqlite3 binaries to Symbian builds Always adding export for sqlite3 binaries will cause cleanup of platform provided versions on platforms that provide them. Fixed by adding check for existence of sqlite3.dso before adding the export statement to bld.inf. Task-number: QT-2419 Reviewed-by: Janne Koskinen --- src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro index 4734144..158633d 100644 --- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro +++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro @@ -1,5 +1,7 @@ # Use subdirs template to suppress generation of unnecessary files TEMPLATE = subdirs -# We just want to extract the zip file containing sqlite binaries for Symbian -BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" +# We just want to export the sqlite3 binaries for Symbian for platforms that do not have them. +!exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) { + BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" +} -- cgit v0.12 From c55c08b38dd902765f476f62369378813c8e804f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 2 Nov 2009 15:27:59 +0100 Subject: Doc: i18n overhaul for QObject::tr() and the Qt Linguist manual. Reviewed-by: Trust Me --- doc/src/internationalization/i18n.qdoc | 267 ++++++++++++++- doc/src/internationalization/linguist-manual.qdoc | 368 ++------------------- doc/src/snippets/code/doc_src_i18n.qdoc | 2 +- .../snippets/code/src_corelib_kernel_qobject.cpp | 3 +- examples/mainwindows/sdi/mainwindow.h | 2 + src/corelib/kernel/qobject.cpp | 146 +------- 6 files changed, 310 insertions(+), 478 deletions(-) diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc index e873f4e..1a2839d 100644 --- a/doc/src/internationalization/i18n.qdoc +++ b/doc/src/internationalization/i18n.qdoc @@ -51,6 +51,7 @@ \page internationalization.html \title Internationalization with Qt \brief Information about Qt's support for internationalization and multiple languages. + \nextpage Writing Source Code for Translation \keyword internationalization \keyword i18n @@ -59,11 +60,11 @@ the application usable by people in countries other than one's own. \tableofcontents - + \section1 Relevant Qt Classes and APIs These classes support internationalizing of Qt applications. - + \annotatedlist i18n \section1 Languages and Writing Systems @@ -516,3 +517,265 @@ For details on Mac-specific translation, refer to the Qt/Mac Specific Issues document \l{Qt for Mac OS X - Specific Issues#Translating the Application Menu and Native Dialogs}{here}. */ + +/*! + \page i18n-source-translation.html + \title Writing Source Code for Translation + \ingroup i18n + \previouspage Internationalization with Qt + \contentspage Internationalization with Qt + \nextpage Translation Rules for Plurals + \brief How to write source code in a way that makes it possible for user-visible text to be translated. + + \tableofcontents + + \section1 The Basics + + Developers use the \l{QObject::}{tr()} function to obtain translated text + for their classes, typically for display purposes. This function is also + used to indicate which text strings in an application are translatable. + + Qt indexes each translatable string by the \e{translation context} it is + associated with; this is generally the name of the QObject subclass it is + used in. + + Translation contexts are defined for new QObject-based classes by the use + of the Q_OBJECT macro in each new class definition. + + When tr() is called, it looks up the translatable string using a QTranslator + object. For translation to work, one or more of these must have been + installed on the application object in the way described in the + \l{#Enabling Translation}{Enabling Translation} section below. + + \section1 Defining a Translation Context + + The translation context for QObject and each QObject subclass is the + class name itself. Developers subclassing QObject must use the + Q_OBJECT macro in their class definition to override the translation + context. This macro sets the context to the name of the subclass. + + For example, the following class definition includes the Q_OBJECT macro, + implementing a new tr() that uses the \c MainWindow context: + + \snippet mainwindows/sdi/mainwindow.h class definition with macro + \dots + + If Q_OBJECT is not used in a class definition, the context will be + inherited from the base class. For example, since all QObject-based + classes in Qt provide a context, a new QWidget subclass defined without + a Q_OBJECT macro will use the \c QWidget context if its tr() function + is invoked. + + \section1 Using tr() to Obtain a Translation + + The following example shows how a translation is obtained for the + class shown in the previous section: + + \snippet mainwindows/sdi/mainwindow.cpp implicit tr context + \dots + + Here, the translation context is \c MainWindow because it is the + \c MainWindow::tr() function that is invoked. The text returned + by the tr() function is a translation of "&File" obtained from + the \c MainWindow context. + + When Qt's translation tool, \l lupdate, is used to process a set of source + files, the text wrapped in tr() calls is stored in a section of the translation + file that corresponds to its translation context. + + In some situations, it is useful to give a translation context explicitly + by fully qualifying the call to tr(); for example: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp explicit tr context + + This call obtains the translated text for "Page up" from the \c QScrollBar + context. Developers can also use the QCoreApplication::translate() function + to obtain a translation for a particular translation context. + + \section1 Translator Comments + + Developers can include information about each translatable string to + help translators with the translation process. These are extracted + when \l lupdate is used to process the source files. The recommended + way to add comments is to annotate the tr() calls in your code with + comments of the form: + + \tt{//: ...} + + or + + \tt{\begincomment: ... \endcomment} + + Examples: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 40 + + In these examples, the comments will be associated with the strings + passed to tr() in the context of each call. + + \section1 Adding Meta-Data to Strings + + Additional data can be attached to each translatable message. These are + extracted when \l lupdate is used to process the source files. The + recommended way to add meta-data is to annotate the tr() calls in your code + with comments of the form: + + \tt{//= } + + This can be used to give the message a unique identifier to support tools + which need it. + + An alternative way to attach meta-data is to use the following syntax: + + \tt{//~ } + + This can be used to attach meta-data to the message. The field name should + consist of a domain prefix (possibly the conventional file extension of the + file format the field is inspired by), a hyphen and the actual field name + in underscore-delimited notation. For storage in TS files, the field name + together with the prefix "extra-" will form an XML element name. The field + contents will be XML-escaped, but otherwise appear verbatim as the + element's contents. Any number of unique fields can be added to each + message. + + Example: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp meta data + + Meta-data appearing right in front of a magic TRANSLATOR comment applies to + the whole TS file. + + \section1 Disambiguation + + If the same translatable string is used in different roles within the same + translation context, an additional identifying string may be passed in + the call to \l{QObject::}{tr()}. This optional disambiguation argument + is used to distinguish between otherwise identical strings. + + Example: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 17 + \dots + + In Qt 4.4 and earlier, this disambiguation parameter was the preferred + way to specify comments to translators. + + \section1 Character Encodings + + You can set the encoding for the source text by calling QTextCodec::setCodecForTr(). + By default, the source text is assumed to be in Latin-1 encoding. + + \section1 Handling Plurals + + Some translatable strings contain placeholders for integer values and need + to be translated differently depending on the values in use. + + To help with this problem, developers pass an additional integer argument + to the \l{QObject::}{tr()} function, and typically use a special notation + for plurals in each translatable string. + + If this argument is equal or greater than zero, all occurrences of + \c %n in the resulting string are replaced with a decimal representation + of the value supplied. In addition, the translation used will adapt to the + value according to the rules for each language. + + Example: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 18 + + The table below shows what string is returned depending on the + active translation: + + \table + \header \o \o{3,1} Active Translation + \header \o \a n \o No Translation \o French \o English + \row \o 0 \o "0 message(s) saved" \o "0 message sauvegard\unicode{0xE9}" \o "0 message\bold{s} saved" + \row \o 1 \o "1 message(s) saved" \o "1 message sauvegard\unicode{0xE9}" \o "1 message saved" + \row \o 2 \o "2 message(s) saved" \o "2 message\bold{s} sauvegard\unicode{0xE9}\bold{s}" \o "2 message\bold{s} saved" + \row \o 37 \o "37 message(s) saved" \o "37 message\bold{s} sauvegard\unicode{0xE9}\bold{s}" \o "37 message\bold{s} saved" + \endtable + + This idiom is more flexible than the traditional approach; e.g., + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 19 + + because it also works with target languages that have several + plural forms (e.g., Irish has a special "dual" form that should + be used when \c n is 2), and it handles the \e n == 0 case + correctly for languages such as French that require the singular. + See the \l{Qt Linguist Manual} for details. + + Instead of \c %n, you can use \c %Ln to produce a localized + representation of \a n. The conversion uses the default locale, + set using QLocale::setDefault(). (If no default locale was + specified, the "C" locale is used.) + + A summary of the rules used to translate strings containing plurals can be + found in the \l{Translation Rules for Plurals} document. + + \section1 Enabling Translation + + Typically, your application's \c main() function will look like + this: + + \snippet doc/src/snippets/code/doc_src_i18n.qdoc 8 + + Note the use of QLibraryInfo::location() to locate the Qt translations. + Developers should request the path to the translations at run-time by + passing QLibraryInfo::TranslationsPath to this function instead of + using the \c QTDIR environment variable in their applications. + + \section1 Further Reading + + \l{Qt Linguist Manual}, \l{Hello tr Example}, \l{Translation Rules for Plurals} +*/ + +/*! + \page i18n-plural-rules.html + \title Translation Rules for Plurals + \ingroup i18n + \previouspage Writing Source Code for Translation + \contentspage Internationalization with Qt + \brief A summary of the translation rules for plurals produced by Qt's i18n tools. + + The table below shows the specific rules that are produced by Qt Linguist + and \c lrelease for a selection of languages. Cells marked \e otherwise + indicate the form used when none of the other rules are appropriate for a + specific language. + + \table 80% + \header \o Language \o Rule 1 \o Rule 2 \o Rule 3 + \row \o English \o \c{n == 1} + \o \e{otherwise} \o N/A + \row \o French \o \c{n < 2} + \o \e{otherwise} \o N/A + \row \o Czech \o \c{n % 100 == 1} + \o \c{n % 100 >= 2 && n % 100 <= 4} + \o \e{otherwise} + \row \o Irish \o \c{n == 1} + \o \c{n == 2} \o \e{otherwise} + \row \o Latvian \o \c{n % 10 == 1&& n % 100 != 11} + \o \c{n != 0} \o \e{otherwise} + \row \o Lithuanian \o \c{n % 10 == 1&& n % 100 != 11} + \o \c{n % 100 != 12 && n % 10 == 2} + \o \e{otherwise} + \row \o Macedonian \o \c{n % 10 == 1} + \o \c{n % 10 == 2} \o \e{otherwise} + \row \o Polish \o \c{n == 1} + \o \c{n % 10 >= 2 && n % 10 <= 4 + && (n % 100 < 10 || n % 100 > 20)} + \o \e{otherwise} + \row \o Romanian \o \c{n == 1} + \o \c{n == 0|| (n % 100 >= 1 && n % 100 <= 20)} + \o \e{otherwise} + \row \o Russian \o \c{n % 10 == 1&& n % 100 != 11} + \o \c{n % 10 >= 2 && n % 10 <= 4 + && (n % 100 < 10 || n % 100 > 20)} + \o \e{otherwise} + \row \o Slovak \o \c{n == 1} \o \c{n >= 2 && n <= 4} + \o \e{otherwise} + \row \o Japanese \o \e{otherwise} \o N/A \o N/A + \endtable + + The rules themselves are not documented and are internal to Qt Linguist and \c lrelease. +*/ diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc index 5d388f1..3e06a2f 100644 --- a/doc/src/internationalization/linguist-manual.qdoc +++ b/doc/src/internationalization/linguist-manual.qdoc @@ -62,7 +62,7 @@ software engineers and the translator. The chapter describes the use of two tools. The \l{lupdate} tool is used to synchronize source code and translations. The \l{lrelease} tool is used to - create runtime translation files for use by the released + create run-time translation files for use by the released application. The \l{linguist-translators.html}{Translators} chapter is for @@ -119,7 +119,7 @@ \o Phrases that contain variables, for example, "The 25 files selected will take 63 seconds to process", where the two numbers - are inserted programmatically at runtime may need to be reworded + are inserted programmatically at run-time may need to be reworded because in a different language the word order and therefore the placement of the variables may have to change. @@ -147,7 +147,7 @@ \row \o{1,2} \inlineimage wVista-Cert-border-small.png \o \e{Qt Linguist 4.3 is Certified for Windows Vista} - + \row \o Windows Vista and the Windows Vista Start button are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. @@ -508,7 +508,7 @@ translation. The state is reset to \inlineimage linguist-danger.png , and the number of accepted translations in the \e{Items} column of the \l{Context Window} {context list} is decremented by 1. - + \row \o Not Accepted \o \inlineimage linguist-check-off.png @@ -781,7 +781,7 @@ changed. Whichever character (alpha or digit) is chosen, the translation must be in the form "Ctrl+" followed by the upper case character. \e{Qt} will automatically display the correct name at - runtime. As with Alt key accelerators, if the translator changes + run-time. As with Alt key accelerators, if the translator changes the character, the new character must not conflict with any other Ctrl key accelerator. @@ -790,14 +790,14 @@ supported languages, \e {Qt} automatically translates these strings. - \section2 Handling Numbered Arguments + \section2 Handling Numbered Arguments and Plurals Some phrases contain numbered arguments. A numbered argument is a - placeholder that will be replaced with text at runtime. A numbered + placeholder that will be replaced with text at run-time. A numbered argument appears in a source string as a percent sign followed by a digit. Consider an example: \c{After processing file %1, file %2 is next in line}. In this string to be translated, \c{%1} and - \c{%2} are numbered arguments. At runtime, \c{%1} and \c{%2} will + \c{%2} are numbered arguments. At run-time, \c{%1} and \c{%2} will be replaced with the first and next file names respectively. The same numbered arguments must appear in the translation, but not necessarily in the same order. A German translation of the string @@ -808,336 +808,14 @@ of where argument \e{i} appears in the argument sequence in the source string. - \section2 Plurals - - The problem of plurals in output is resolved by using an overload of - the \c tr() function with the signature - \code - QString tr(const char *text, const char *comment, int n); - \endcode - Using built in comparisons for the value of \c n the tr() function will - translate the phrase to the plural form for the target language. - - Different languages have various forms for plurals beyond simply - \e singular and \e plural. The rules for determining which form of the - plural to use are encoded as conditional tests. Below is a table - representing the numbers associated with the forms rather than the - conditional tests themselves. - - - - \table 90% - \header - \o Language - \o Form 1 - \o Form 2 - \o Form 3 - \o Form 4 - \row - \o Arabic - \o 0, 1, 11-102, 111-202... - \o 2 - \o 3-10, 103-110, 203-210... - \o - \row - \o Basque - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Bulgarian - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Catalan - \o 1 - \o 11, 11 000-11 999, 11 000 000-11 999 999... - \o 0, 2-10, 12-10 999, 12-10 999 999... - \o - \row - \o Chinese-CN - \o 0- - \o - \o - \o - \row - \o Chinese-HK - \o 0- - \o - \o - \o - \row - \o Chinese-TW - \o 0- - \o - \o - \o - \row - \o Croation - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101... - \o 2-4, 22-24, 32-34, 42-44... - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Czech - \o 1 - \o 2-4 - \o 0, 5- - \o - \row - \o Danish - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Dutch - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o English - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o English-US - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Estonian - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Finnish - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o French-CA - \o 0, 1 - \o 2-100, 101- - \o - \o - \row - \o French-FR - \o 0, 1 - \o 2-100, 101- - \o - \o - \row - \o Galician - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o German - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Greek - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Hebrew - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Hungarian - \o 0- - \o - \o - \o - \row - \o Icelandic - \o 1, 21, 31, 41, 51....101, 121, 131... - \o 0, 2-20, 22-30, 32-40...102-120... - \o - \o - \row - \o Indonesian - \o 0- - \o - \o - \o - \row - \o Italian - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Japanese - \o 0- - \o - \o - \o - \row - \o Korean - \o 0- - \o - \o - \o - \row - \o Latvian - \o 0 - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 131, 141... - \o 2-20, 22-30, 32-40, 42-50...202-220, 222-230... - \o - \row - \o Lithuanian - \o 1, 21, 31, 41, 51...101, 121, 131... - \o 2-9, 22-29, 32-39...102-109, 122-129, 132-139... - \o 0, 10-20, 30, 40, 50...110-120, 130, 140... - \o - \row - \o Malay - \o 0- - \o - \o - \o - \row - \o Norwegian - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Persian - \o 0- - \o - \o - \o - \row - \o Polish - \o 1 - \o 2-4, 22-24, 32-34... - \o 5-21, 25-31, 35-41... - \o - \row - \o Portugese-BR - \o 0, 1 - \o 2-100, 101- - \o - \o - \row - \o Portugese-PT - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Romanian - \o 1 - \o 0, 2-19, 101-119, 201-219... - \o 20-100, 120-200, 220-300... - \o - \row - \o Russian - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101... - \o 2-4, 22-24, 32-34... - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Serbian - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101... - \o 2-4, 22-24, 32-34... - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Slovak - \o 1 - \o 2-4 - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Slovene - \o 1, 101, 201, 301... - \o 2, 102, 202, 302... - \o 3, 4, 103, 104, 203, 204, 303, 304... - \o 0, 5-100, 105-200, 205-300... - \row - \o Spanish-US - \o 1 - \o 0, 2- - \o - \o - \row - \o Spanish-ES - \o 1 - \o 0, 2- - \o - \o - \row - \o Swedish - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Tagalog - \o 0, 1 - \o 2, 3, 5, 7-8, 10-13, 15, 17-18, 20-23...101...1001 - \o 4, 6, 9, 14, 16, 19, 24, 26, 29...104, 106, 109... - \o - \row - \o Thai - \o 0- - \o - \o - \o - \row - \o Turkish - \o 0- - \o - \o - \o - \row - \o Ukrainian - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101... - \o 2-4, 22-24, 32-34... - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Urdu - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Vietnamese - \o 0- - \o - \o - \o - \endtable - - These rules are embedded within the Qt libraries, there is no need for - the developer to know them. Merely to use the correct \c tr() call. - + The use of numbered arguments is often accompanied by the use of + plurals in the source text. In many languages, the form of the + text will depend on the value shown, and more than one translation + is required. If the developers have marked up the source text in + correct way, fields for each of the possible plural forms will be + available in the translation area. (The + \l{Writing Source Code for Translation#Handling Plurals}{Writing Source Code for Translation} + document contains details about this feature for developers.) \section2 Reusing Translations @@ -1157,7 +835,7 @@ {translation area}, and adapts the number of input fields for plural forms accordingly. If not explicitly set, \QL guesses the target language and country by evaluating the translation source - file name: E.g. \c app_de.ts sets the target language to German, + file name. For example, \c app_de.ts sets the target language to German, and \c app_de_ch.ts sets the target language to German and the target country to Switzerland (this also helps loading translations for the current locale automatically; see @@ -1287,7 +965,7 @@ can be used to edit XLIFF files generated by other programs. For standard Qt projects, however, only the TS file format is used. \o QM \e {Qt message files} \BR are binary files that contain - translations used by an application at runtime. These files are + translations used by an application at run-time. These files are generated by \l lrelease, but can also be generated by \QL. \o \c .qph \e {Qt phrase book files} \BR are human-readable XML files containing standard phrases and their translations. These files @@ -1416,7 +1094,7 @@ \endlist - \o \gui {Tools} + \o \gui {Tools} \list \o \gui {Batch Translation...} \BR Opens a \l{Batch @@ -1427,7 +1105,7 @@ Preview}. This window let you instantly see translations for forms created with \QD. \endlist - \o \gui {View} + \o \gui {View} \list \o \gui {Revert Sorting} \BR puts the items in the \l{Context @@ -1449,7 +1127,7 @@ \endlist - \o \gui {Help} + \o \gui {Help} \list \o \gui {Manual F1} \BR opens this manual. \o \gui {About Qt Linguist} \BR Shows information about \QL. @@ -1621,7 +1299,7 @@ \code CODECFORTR = UTF-8 \endcode - + See the \l lupdate and \l lrelease sections. \section2 Loading Translations @@ -1683,7 +1361,7 @@ \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 9 - \section2 Distinguishing Identical Strings That Require Different Translations + \section2 Distinguishing Between Identical Translatable Strings The \l lupdate program automatically provides a \e context for every source text. This context is the class name of the class that contains diff --git a/doc/src/snippets/code/doc_src_i18n.qdoc b/doc/src/snippets/code/doc_src_i18n.qdoc index eca2868..80faabc 100644 --- a/doc/src/snippets/code/doc_src_i18n.qdoc +++ b/doc/src/snippets/code/doc_src_i18n.qdoc @@ -184,7 +184,7 @@ void Clock::setTime(const QTime &time) //! [12] -void QWidget::changeEvent(QEvent *event) +void MyWidget::changeEvent(QEvent *event) { if (e->type() == QEvent::LanguageChange) { titleLabel->setText(tr("Document Title")); diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp index 4c64374..88d8025 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp @@ -235,9 +235,8 @@ MyWindow::MyWindow() { QLabel *senderLabel = new QLabel(tr("Name:")); QLabel *recipientLabel = new QLabel(tr("Name:", "recipient")); - ... -} //! [17] +} //! [18] diff --git a/examples/mainwindows/sdi/mainwindow.h b/examples/mainwindows/sdi/mainwindow.h index ca478df..a925e2f 100644 --- a/examples/mainwindows/sdi/mainwindow.h +++ b/examples/mainwindows/sdi/mainwindow.h @@ -50,12 +50,14 @@ class QMenu; class QTextEdit; QT_END_NAMESPACE +//! [class definition with macro] class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(); +//! [class definition with macro] MainWindow(const QString &fileName); protected: diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 7be19b3..7031957 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -582,7 +582,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object) QObjects organize themselves in object trees. When you create a QObject with another object as parent, the object will automatically add itself to the parent's children() list. The - parent takes ownership of the object i.e. it will automatically + parent takes ownership of the object; i.e., it will automatically delete its children in its destructor. You can look for an object by name and optionally type using findChild() or findChildren(). @@ -646,7 +646,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object) to be stored in one of the container classes. You must store pointers. - \section2 Auto-Connection + \section1 Auto-Connection Qt's meta-object system provides a mechanism to automatically connect signals and slots between QObject subclasses and their children. As long @@ -660,7 +660,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object) given in the \l{Using a Designer UI File in Your Application} section of the \QD manual. - \section2 Dynamic Properties + \section1 Dynamic Properties From Qt 4.2, dynamic properties can be added to and removed from QObject instances at run-time. Dynamic properties do not need to be declared at @@ -673,6 +673,15 @@ int QMetaCallEvent::placeMetaCall(QObject *object) and both standard Qt widgets and user-created forms can be given dynamic properties. + \section1 Internationalization (i18n) + + All QObject subclasses support Qt's translation features, making it possible + to translate an application's user interface into different languages. + + To make user-visible text translatable, it must be wrapped in calls to + the tr() function. This is explained in detail in the + \l{Writing Source Code for Translation} document. + \sa QMetaObject, QPointer, QObjectCleanupHandler, Q_DISABLE_COPY() {Object Trees and Object Ownership} */ @@ -2157,65 +2166,10 @@ void QObject::deleteLater() otherwise returns \a sourceText itself if no appropriate translated string is available. - See the sections below on Disambiguation and Handling Plurals for more - information about the optional \a disambiguation and \a n parameters. - - QObject and its subclasses obtain translated strings from any translator - objects that have been installed on the application object; see the - QTranslator documentation for details about this mechanism. - - A translatable string is referenced by its translation context; - this is the name of the QObject subclass whose tr() function is invoked, - as in the following example: - + Example: \snippet mainwindows/sdi/mainwindow.cpp implicit tr context \dots - Here, the context is \c MainWindow because it is the \c MainWindow::tr() - function that is invoked. Translation contexts can be given explicitly - by fully qualifying the call to tr(); for example: - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp explicit tr context - - This call obtains the translated text for "Page up" from the \c QScrollBar - context. - - \section1 Defining Translation Contexts - - The translation context for QObject and each QObject subclass is the - class name itself. Developers subclassing QObject must use the - Q_OBJECT macro in their class definition to override the translation - context. This macro sets the context to the name of the subclass. - - If Q_OBJECT is not used in a class definition, the context will be - inherited from the base class. For example, since all QObject-based - classes in Qt provide a context, a new QWidget subclass defined without - a Q_OBJECT macro will use the "QWidget" context if its tr() function - is invoked. - - \section1 Translator Comments - - Developers can include information about each translatable string to - help translators with the translation process. These are extracted - when \l lupdate is used to process the source files. The recommended - way to add comments is to annotate the tr() calls in your code with - comments of the form: - - \tt{//: ...} - - or - - \tt{\begincomment: ... \endcomment} - - Examples: - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 40 - - In these examples, the comments will be associated with the strings - passed to tr() in the context of each call. - - \section1 Disambiguation - If the same \a sourceText is used in different roles within the same context, an additional identifying string may be passed in \a disambiguation (0 by default). In Qt 4.4 and earlier, this was @@ -2224,76 +2178,12 @@ void QObject::deleteLater() Example: \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 17 + \dots - \section1 Meta Data - - Additional data can be attached to each translatable message. - The syntax: - - \tt{//= } - - can be used to give the message a unique identifier to support tools - which need it. - The syntax: - - \tt{//~ } - - can be used to attach meta data to the message. The field name should consist - of a domain prefix (possibly the conventional file extension of the file format - the field is inspired by), a hyphen and the actual field name in - underscore-delimited notation. For storage in TS files, the field name together - with the prefix "extra-" will form an XML element name. The field contents will - be XML-escaped, but otherwise appear verbatim as the element's contents. - Any number of unique fields can be added to each message. - - Example: - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp meta data - - Meta data appearing right in front of a magic TRANSLATOR comment applies to the - whole TS file. - - \section1 Character Encodings - - You can set the encoding for \a sourceText by calling QTextCodec::setCodecForTr(). - By default \a sourceText is assumed to be in Latin-1 encoding. - - \section1 Handling Plurals - - If \a n >= 0, all occurrences of \c %n in the resulting string - are replaced with a decimal representation of \a n. In addition, - depending on \a n's value, the translation text may vary. - - Example: - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 18 - - The table below shows what string is returned depending on the - active translation: - - \table - \header \o \o{3,1} Active Translation - \header \o \a n \o No Translation \o French \o English - \row \o 0 \o "0 message(s) saved" \o "0 message sauvegard\unicode{0xE9}" \o "0 message\bold{s} saved" - \row \o 1 \o "1 message(s) saved" \o "1 message sauvegard\unicode{0xE9}" \o "1 message saved" - \row \o 2 \o "2 message(s) saved" \o "2 message\bold{s} sauvegard\unicode{0xE9}\bold{s}" \o "2 message\bold{s} saved" - \row \o 37 \o "37 message(s) saved" \o "37 message\bold{s} sauvegard\unicode{0xE9}\bold{s}" \o "37 message\bold{s} saved" - \endtable - - This idiom is more flexible than the traditional approach; e.g., - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 19 - - because it also works with target languages that have several - plural forms (e.g., Irish has a special "dual" form that should - be used when \c n is 2), and it handles the \e n == 0 case - correctly for languages such as French that require the singular. - See the \l{Qt Linguist Manual} for details. - - Instead of \c %n, you can use \c %Ln to produce a localized - representation of \a n. The conversion uses the default locale, - set using QLocale::setDefault(). (If no default locale was - specified, the "C" locale is used.) + See \l{Writing Source Code for Translation} for a detailed description of + Qt's translation mechanisms in general, and the + \l{Writing Source Code for Translation#Disambiguation}{Disambiguation} + section for information on disambiguation. \warning This method is reentrant only if all translators are installed \e before calling this method. Installing or removing -- cgit v0.12 From 50a745d31e348c113d42444d527b4286b7064e3e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 2 Nov 2009 15:30:15 +0100 Subject: Doc: Fixed qdoc warnings. Reviewed-by: Trust Me --- src/gui/kernel/qevent.cpp | 2 +- src/gui/symbian/qsymbianevent.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 065bd09..617d016 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4330,7 +4330,7 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const } /*! - Sets the widget for this event. + Sets the widget for this event to the \a widget specified. */ void QGestureEvent::setWidget(QWidget *widget) { diff --git a/src/gui/symbian/qsymbianevent.cpp b/src/gui/symbian/qsymbianevent.cpp index af2c861..2799e6f 100644 --- a/src/gui/symbian/qsymbianevent.cpp +++ b/src/gui/symbian/qsymbianevent.cpp @@ -66,13 +66,13 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QSymbianEvent::type() + \fn QSymbianEvent::type() const Returns the event type contained in the QSymbianEvent instance. */ /*! - \fn QSymbianEvent::isValid() + \fn QSymbianEvent::isValid() const Returns whether this QSymbianEvent instance contains a valid event. */ -- cgit v0.12 From f1132e60e0759d8be043a2c4312915b3103004ff Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Mon, 2 Nov 2009 15:34:15 +0100 Subject: Titlebar icon (for e.g. Assistant) not visible in Cocoa. standardWindowButton:NSWindowDocumentIconButton will not return a valid NSButton unless you call setRepresentedURL or setRepresentedFilename for the NSWindow. This patch makes sure that setWindowIcon_sys() sets the icon using a valid NSButton. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoawindowdelegate_mac.mm | 23 +++++++++++++++++++++++ src/gui/kernel/qcocoawindowdelegate_mac_p.h | 2 ++ src/gui/kernel/qwidget_mac.mm | 6 ++++++ 3 files changed, 31 insertions(+) diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 95c89e5..803a1b1 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -346,5 +346,28 @@ static void cleanupCocoaWindowDelegate() m_drawerHash->remove(drawer); } +- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu +{ + Q_UNUSED(menu); + QWidget *qwidget = m_windowHash->value(window); + if (qwidget && !qwidget->windowFilePath().isEmpty()) { + return YES; + } + return NO; +} + +- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event + from:(NSPoint)dragImageLocation + withPasteboard:(NSPasteboard *)pasteboard +{ + Q_UNUSED(event); + Q_UNUSED(dragImageLocation); + Q_UNUSED(pasteboard); + QWidget *qwidget = m_windowHash->value(window); + if (qwidget && !qwidget->windowFilePath().isEmpty()) { + return YES; + } + return NO; +} @end #endif// QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/gui/kernel/qcocoawindowdelegate_mac_p.h index a06c516..3728002 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h +++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h @@ -76,6 +76,8 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData) - (void)windowDidResignMain:(NSNotification*)notification; - (void)windowDidBecomeKey:(NSNotification*)notification; - (void)windowDidResignKey:(NSNotification*)notification; +- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu; +- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard; @end @protocol NSDrawerDelegate diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 58252ca..79f55a1 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3017,6 +3017,12 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) #else QMacCocoaAutoReleasePool pool; NSButton *iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton]; + if (iconButton == nil) { + QCFString string(q->windowTitle()); + const NSString *tmpString = reinterpret_cast((CFStringRef)string); + [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:tmpString]]; + iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton]; + } if (icon.isNull()) { [iconButton setImage:nil]; } else { -- cgit v0.12 From ab473d6a8e4fa619537c4cdaaf1b6a9d8544b30a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 2 Nov 2009 15:30:55 +0100 Subject: Fixed holes in thick strokes. When stroking small paths with a thick pen, it looked like the winding fill rule was ignored. The bug was in the stroke generator which generated paths where the winding number could incorrectly become zero. Task-number: QTBUG-1537 Reviewed-by: Gunnar --- src/gui/painting/qstroker.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index c57b3c1..228a6b1 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -452,6 +452,17 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine #endif if (join == FlatJoin) { + QLineF prevLine(qt_fixed_to_real(m_back2X), qt_fixed_to_real(m_back2Y), + qt_fixed_to_real(m_back1X), qt_fixed_to_real(m_back1Y)); + QPointF isect; + QLineF::IntersectType type = prevLine.intersect(nextLine, &isect); + QLineF shortCut(prevLine.p2(), nextLine.p1()); + qreal angle = shortCut.angleTo(prevLine); + if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); + emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); + return; + } emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); @@ -468,8 +479,8 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine // If we are on the inside, do the short cut... QLineF shortCut(prevLine.p2(), nextLine.p1()); qreal angle = shortCut.angleTo(prevLine); - if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); return; } @@ -509,8 +520,9 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine qfixed offset = m_strokeWidth / 2; QLineF shortCut(prevLine.p2(), nextLine.p1()); - qreal angle = prevLine.angle(shortCut); + qreal angle = shortCut.angleTo(prevLine); if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); return; } @@ -581,6 +593,13 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine qt_real_to_fixed(l1.x1()), qt_real_to_fixed(l1.y1())); } else if (join == SvgMiterJoin) { + QLineF shortCut(prevLine.p2(), nextLine.p1()); + qreal angle = shortCut.angleTo(prevLine); + if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); + emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); + return; + } QLineF miterLine(QPointF(qt_fixed_to_real(focal_x), qt_fixed_to_real(focal_y)), isect); if (miterLine.length() > qt_fixed_to_real(m_strokeWidth * m_miterLimit) / 2) { -- cgit v0.12 From 243163c3f61c79146c37da0a4da4bacafa8e1321 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 2 Nov 2009 16:06:06 +0100 Subject: Fixed test, QGraphicsSourceEffect::pixmap(), caching caused failure. Reviewed-by: Samuel --- src/gui/effects/qgraphicseffect.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 3a6bab5..f24d424 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -97,6 +97,8 @@ */ #include "qgraphicseffect_p.h" +#include "private/qgraphicsitem_p.h" + #include #include @@ -260,6 +262,12 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse return ((QGraphicsPixmapItem *) item)->pixmap(); } + if (system == Qt::DeviceCoordinates && item + && !static_cast(d_func())->info) { + qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); + return QPixmap(); + } + QPixmap pm; if (d->m_cachedSystem == system && d->m_cachedMode == mode) QPixmapCache::find(d->m_cacheKey, &pm); -- cgit v0.12 From c4ce16e1eaa4504787f4cc739f3af7d1fdea8351 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 2 Nov 2009 16:11:49 +0100 Subject: Fixed main window closing when subwindows cancel their close events. Reviewed-by: Trust Me Reported-here: http://lists.trolltech.com/pipermail/qt4-preview-feedback /2009-October/001023.html --- examples/mainwindows/mdi/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mainwindows/mdi/mainwindow.cpp b/examples/mainwindows/mdi/mainwindow.cpp index 712d91f..edb33b7 100644 --- a/examples/mainwindows/mdi/mainwindow.cpp +++ b/examples/mainwindows/mdi/mainwindow.cpp @@ -71,7 +71,7 @@ MainWindow::MainWindow() void MainWindow::closeEvent(QCloseEvent *event) { mdiArea->closeAllSubWindows(); - if (activeMdiChild()) { + if (mdiArea->currentSubWindow()) { event->ignore(); } else { writeSettings(); -- cgit v0.12 From 915f20bb167aa09ca8c8db478a2a78d5e357b67e Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 2 Nov 2009 16:58:56 +0100 Subject: Better cosmetic pen scaling for beziers in tristroker. Reviewed-By: Samuel --- src/opengl/gl2paintengineex/qtriangulatingstroker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index ad18a51..1163eba 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -114,7 +114,7 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen) if (m_join_style == Qt::RoundJoin) m_join_style = Qt::MiterJoin; m_curvyness_add = 0.5; - m_curvyness_mul = CURVE_FLATNESS; + m_curvyness_mul = CURVE_FLATNESS / m_inv_scale; m_roundness = 1; } else if (cosmetic) { m_curvyness_add = realWidth / 2; -- cgit v0.12 From 803fb60b1e98beddf4ebb8ea1a9224889c392e4e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 2 Nov 2009 17:34:41 +0100 Subject: Doc: Added a note about QApplication::installTranslator(). Reviewed-by: Alessandro Portale --- doc/src/internationalization/i18n.qdoc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc index 1a2839d..2d1b8cc 100644 --- a/doc/src/internationalization/i18n.qdoc +++ b/doc/src/internationalization/i18n.qdoc @@ -439,9 +439,13 @@ application language. The default event handler for QWidget subclasses responds to the - QEvent::LanguageChange event, and will call this function when necessary; - other application components can also force widgets to update themselves - by posting the \l{QEvent::LanguageChange}{LanguageChange} event to them. + QEvent::LanguageChange event, and will call this function when necessary. + + \l{QEvent::LanguageChange}{LanguageChange} events are posted when a new + translation is installed using the QCoreApplication::installTranslator() + function. Additionally, other application components can also force + widgets to update themselves by posting LanguageChange events to them. + \section1 Translating Non-Qt Classes -- cgit v0.12 From b72d41cf30f82c74c10c31808907cc990c86efe6 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 3 Nov 2009 08:23:18 +1000 Subject: Protect the OpenVG engine from null QPixmapData objects Reviewed-by: Sarah Smith --- src/openvg/qpaintengine_vg.cpp | 10 ++++++++++ src/openvg/qpixmapdata_vg.cpp | 2 ++ src/openvg/qpixmapfilter_vg.cpp | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 8a485a0..047d9d8 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1178,6 +1178,8 @@ VGPaintType QVGPaintEnginePrivate::setBrush case Qt::TexturePattern: { // The brush is a texture specified by a QPixmap/QImage. QPixmapData *pd = brush.texture().pixmapData(); + if (!pd) + break; // null QPixmap VGImage vgImg; bool deref = false; if (pd->pixelType() == QPixmapData::BitmapType) { @@ -2893,6 +2895,8 @@ void qt_vg_drawVGImageStencil void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { QPixmapData *pd = pm.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { Q_D(QVGPaintEngine); QVGPixmapData *vgpd = static_cast(pd); @@ -2910,6 +2914,8 @@ void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF void QVGPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) { QPixmapData *pd = pm.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { Q_D(QVGPaintEngine); QVGPixmapData *vgpd = static_cast(pd); @@ -2985,6 +2991,8 @@ void QVGPaintEngine::drawPixmaps // If the pixmap is not VG, or the transformation is projective, // then fall back to the default implementation. QPixmapData *pd = pixmap.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) { QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints); return; @@ -3581,6 +3589,8 @@ void QVGCompositionHelper::drawCursorPixmap // Fetch the VGImage from the pixmap if possible. QPixmapData *pd = pixmap.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast(pd); if (vgpd->isValid()) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index f86e116..3254aa3 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -369,6 +369,8 @@ QImage::Format QVGPixmapData::sourceFormat() const Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap) { QPixmapData *pd = pixmap.pixmapData(); + if (!pd) + return VG_INVALID_HANDLE; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast(pd); if (vgpd->isValid()) diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp index 8e104db..e17c728 100644 --- a/src/openvg/qpixmapfilter_vg.cpp +++ b/src/openvg/qpixmapfilter_vg.cpp @@ -65,6 +65,9 @@ void QVGPixmapConvolutionFilter::draw (QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default convolution filter implementation. @@ -135,6 +138,9 @@ QVGPixmapColorizeFilter::~QVGPixmapColorizeFilter() void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default colorize filter implementation. @@ -225,6 +231,9 @@ QVGPixmapDropShadowFilter::~QVGPixmapDropShadowFilter() void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default drop shadow filter implementation. @@ -290,6 +299,9 @@ QVGPixmapBlurFilter::~QVGPixmapBlurFilter() void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default blur filter implementation. -- cgit v0.12 From f72c2d50b6ab7fc4a8ea3524e22de63ca8a366f7 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Tue, 3 Nov 2009 12:47:48 +1000 Subject: Fixed qrand global static related problem. qrand() uses global static seed storage, but if used from destructors of other global static objects (directly or via ~QSettings() or QMap::insert()) the global static seed storage can be already deleted. Fallback to plain rand() in this case. Task-number: QTBUG-5218 Reviewed-by: Justin McPherson --- src/corelib/global/qglobal.cpp | 59 ++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 7d47944..36e15b9 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2513,10 +2513,19 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value void qsrand(uint seed) { #if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) - SeedStorageType *pseed = randTLS()->localData(); - if (!pseed) - randTLS()->setLocalData(pseed = new SeedStorageType); - *pseed = seed; + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (!pseed) + seedStorage->setLocalData(pseed = new SeedStorageType); + *pseed = seed; + } else { + //golbal static seed storage should always exist, + //except after being deleted by QGlobalStaticDeleter. + //But since it still can be called from destructor of another + //global static object, fallback to sqrand(seed) + srand(seed); + } #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls @@ -2536,17 +2545,20 @@ void qsrand(uint seed) void qsrand() { #if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) - SeedStorageType *pseed = randTLS()->localData(); - if (pseed) { - // already seeded - return; + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (pseed) { + // already seeded + return; + } + seedStorage->setLocalData(pseed = new SeedStorageType); + // start beyond 1 to avoid the sequence reset + static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); + *pseed = QDateTime::currentDateTime().toTime_t() + + quintptr(&pseed) + + serial.fetchAndAddRelaxed(1); } - randTLS()->setLocalData(pseed = new SeedStorageType); - // start beyond 1 to avoid the sequence reset - static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); - *pseed = QDateTime::currentDateTime().toTime_t() - + quintptr(&pseed) - + serial.fetchAndAddRelaxed(1); #if defined(Q_OS_WIN) // for Windows the srand function must still be called. srand(*pseed); @@ -2584,12 +2596,21 @@ void qsrand() int qrand() { #if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) - SeedStorageType *pseed = randTLS()->localData(); - if (!pseed) { - randTLS()->setLocalData(pseed = new SeedStorageType); - *pseed = 1; + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (!pseed) { + seedStorage->setLocalData(pseed = new SeedStorageType); + *pseed = 1; + } + return rand_r(pseed); + } else { + //golbal static seed storage should always exist, + //except after being deleted by QGlobalStaticDeleter. + //But since it still can be called from destructor of another + //global static object, fallback to qrand() + return rand(); } - return rand_r(pseed); #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls -- cgit v0.12 From 88f668430023acd3fbad3543a57198a4cf0255c2 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Tue, 3 Nov 2009 17:22:01 +1000 Subject: Fixed compilation on windows. Reviewed-by: trustme --- src/corelib/global/qglobal.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 36e15b9..33c6a34 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2558,11 +2558,11 @@ void qsrand() *pseed = QDateTime::currentDateTime().toTime_t() + quintptr(&pseed) + serial.fetchAndAddRelaxed(1); - } #if defined(Q_OS_WIN) - // for Windows the srand function must still be called. - srand(*pseed); + // for Windows the srand function must still be called. + srand(*pseed); #endif + } #elif defined(Q_OS_WIN) static unsigned int seed = 0; -- cgit v0.12 From 02b16c259cf268903823304e02d308cbbd043194 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 2 Nov 2009 15:46:53 +0100 Subject: Cocoa: fix double emit bug from file dialog For some reason, Cocoa tells us twize whenever a selection change occurs in the native file dialog. This patch inserts a check that the selection actually changed before emitting any signals Rev-By: Prasanth --- src/gui/dialogs/qfiledialog_mac.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index d9bec27..4af5688 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -399,9 +399,13 @@ QT_USE_NAMESPACE - (void)panelSelectionDidChange:(id)sender { Q_UNUSED(sender); - *mCurrentSelection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename])); - if (mPriv) - mPriv->QNSOpenSavePanelDelegate_selectionChanged(*mCurrentSelection); + if (mPriv) { + QString selection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename])); + if (selection != mCurrentSelection) { + *mCurrentSelection = selection; + mPriv->QNSOpenSavePanelDelegate_selectionChanged(selection); + } + } } - (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo -- cgit v0.12 From 5dddf56e703bca59b874e46d3cabd2eba6fbb55e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 13 Aug 2009 15:08:24 +0200 Subject: qdoc: Disabled reporting the NOTIFY signal until I know what it broke. Task-number: 259071 --- tools/qdoc3/cppcodeparser.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 84ec3f4..843bec8 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -1759,7 +1759,6 @@ bool CppCodeParser::matchProperty(InnerNode *parent) property->setDesignable(value.toLower() == "true"); else if (key == "RESET") tre->addPropertyFunction(property, value, PropertyNode::Resetter); - else if (key == "NOTIFY") { tre->addPropertyFunction(property, value, PropertyNode::Notifier); } -- cgit v0.12 From 4eff66941486568cd25dc9aaa372f9d36b84dad8 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 10:05:11 +0100 Subject: doc: Polish documentation for state machine framework Fix some examples and wording, and add some clarification based on comments in documentation review session. Reviewed-by: Kent Hansen --- doc/src/frameworks-technologies/statemachine.qdoc | 104 +++++++++++----------- doc/src/snippets/statemachine/main2.cpp | 11 +-- doc/src/snippets/statemachine/main5.cpp | 44 +++++++-- 3 files changed, 93 insertions(+), 66 deletions(-) diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index ed8bc85..ac10314 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -75,6 +75,11 @@ states can be configured to set properties and invoke methods on QObjects. Qt's event system is used to drive the state machines. + The state graph in the State Machine framework is hierarchical. States can be nested inside of + other states, and the current configuration of the state machine consists of the set of states + which are currently active. All the states in a valid configuration of the state machine will + have a common ancestor. + \section1 Classes in the State Machine Framework These classes are provided by qt for creating event-driven state machines. @@ -269,9 +274,17 @@ When a parallel state group is entered, all its child states will be simultaneously entered. Transitions within the individual child states - operate normally. However, any of the child states may take a transition - outside the parent state. When this happens, the parent state and all of its - child states are exited. + operate normally. However, any of the child states may take a transition which exits the parent + state. When this happens, the parent state and all of its child states are exited. + + The parallelism in the State Machine framework follows an interleaved semantics. All parallel + operations will be executed in a single, atomic step of the event processing, so no event can + interrupt the parallel operations. However, events will still be processed sequentially, since + the machine itself is single threaded. As an example: Consider the situation where there are two + transitions that exit the same parallel state group, and their conditions become true + simultaneously. In this case, the event that is processed last of the two will not have any + effect, since the first event will already have caused the machine to exit from the parallel + state. \section1 Detecting that a Composite State has Finished @@ -414,16 +427,7 @@ Take the following code: \code - QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); - - QState *s1 = new QState(); - s1->assignProperty(object, "fooBar", 1.0); - machine.addState(s1); - machine.setInitialState(s1); - - QState *s2 = new QState(); - machine.addState(s2); + \snippet doc/src/snippets/statemachine/main5.cpp 0 \endcode Lets say the property \c fooBar is 0.0 when the machine starts. When the machine is in state @@ -434,19 +438,7 @@ If we are using nested states, the parent defines a value for the property which is inherited by all descendants that do not explicitly assign a value to the property. \code - QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); - - QState *s1 = new QState(); - s1->assignProperty(object, "fooBar", 1.0); - machine.addState(s1); - machine.setInitialState(s1); - - QState *s2 = new QState(s1); - s2->assignProperty(object, "fooBar", 2.0); - s1->setInitialState(s2); - - QState *s3 = new QState(s1); + \snippet doc/src/snippets/statemachine/main5.cpp 2 \endcode Here \c s1 has two children: \c s2 and \c s3. When \c s2 is entered, the property \c fooBar @@ -461,13 +453,7 @@ Say we have the following code: \code - QState *s1 = new QState(); - QState *s2 = new QState(); - - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); - s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); - - s1->addTransition(button, SIGNAL(clicked()), s2); + \snippet doc/src/snippets/statemachine/main5.cpp 3 \endcode Here we define two states of a user interface. In \c s1 the \c button is small, and in \c s2 @@ -477,14 +463,7 @@ object. \code - QState *s1 = new QState(); - QState *s2 = new QState(); - - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); - s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); - - QSignalTransition *transition = s1->addTransition(button, SIGNAL(clicked()), s2); - transition->addAnimation(new QPropertyAnimation(button, "geometry")); + \snippet doc/src/snippets/statemachine/main5.cpp 4 \endcode Adding an animation for the property in question means that the property assignment will no @@ -504,28 +483,45 @@ property can potentially have any value, depending on the animation. In some cases, it can be useful to be able to detect when the property has actually been assigned - the value defined by a state. For this, we can use the state's polished() signal. + the value defined by a state. + + Say we have the following code: \code - QState *s1 = new QState(); - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + \snippet doc/src/snippets/statemachine/main5.cpp 5 + \endcode - QState *s2 = new QState(); + When \c button is clicked, the machine will transition into state \c s2, which will set the + geometry of the button, and then pop up a message box to alert the user that the geometry has + been changed. + + In the normal case, where animations are not used, this will operate as expected. However, if + an animation for the \c geometry of \c button is set on the transition between \c s1 and \c s2, + the animation will be started when \c s2 is entered, but the \c geometry property will not + actually reach its defined value before the animation is finished running. In this case, the + message box will pop up before the geometry of the button has actually been set. - s1->addTransition(s1, SIGNAL(polished()), s2); + To ensure that the message box does not pop up until the geometry actually reaches its final + value, we can use the state's polished() signal. The polished() signal will be emitted when the + the property is assigned its final value, whether this is done immediately or after the animation + has finished playing. + \code + \snippet doc/src/snippets/statemachine/main5.cpp 6 \endcode - The machine will be in state \c s1 until the \c geometry property has been set. Then it will - immediately transition into \c s2. If the transition into \c s1 has an animation for the \c - geometry property, then the machine will stay in \c s1 until the animation has finished. If there - is no animation, it will simply set the property and immediately enter state \c s2. + In this example, when \c button is clicked, the machine will enter \c s2. It will remain in state + \c s2 until the \c geometry property has been set to \c QRect(0, 0, 50, 50). Then it will + transition into \c s3. When \c s3 is entered, the message box will pop up. If the transition into + \c s2 has an animation for the \c geometry property, then the machine will stay in \c s2 until the + animation has finished playing. If there is no such animation, it will simply set the property and + immediately enter state \c s3. - Either way, when the machine is in state \c s2, the property \c geometry has been assigned the - defined value. + Either way, when the machine is in state \c s3, you are guaranteed that the property \c geometry + has been assigned the defined value. If the global restore policy is set to QStateMachine::RestoreProperties, the state will not emit the polished() signal until these have been executed as well. - \section1 What happens if a state is exited before the animation has finished + \section1 What Happens If A State Is Exited Before The Animation Has Finished If a state has property assignments, and the transition into the state has animations for the properties, the state can potentially be exited before the properties have been assigned to the @@ -545,7 +541,7 @@ If the target state does not assign any value to the property, there are two options: By default, the property will be assigned the value defined by the state it is leaving - (the value it would have been assigned if the animation had been permitted to finish playing.) If + (the value it would have been assigned if the animation had been permitted to finish playing). If a global restore policy is set, however, this will take precedence, and the property will be restored as usual. diff --git a/doc/src/snippets/statemachine/main2.cpp b/doc/src/snippets/statemachine/main2.cpp index 2419dc2..9a2890f 100644 --- a/doc/src/snippets/statemachine/main2.cpp +++ b/doc/src/snippets/statemachine/main2.cpp @@ -69,17 +69,18 @@ int main(int argv, char **args) //![1] QButton *interruptButton = new QPushButton("Interrupt Button"); + QWidget *mainWindow = new QWidget(); //![3] QHistoryState *s1h = new QHistoryState(s1); QState *s3 = new QState(); s3->assignProperty(label, "text", "In s3"); - QMessageBox mbox; - mbox.addButton(QMessageBox::Ok); - mbox.setText("Interrupted!"); - mbox.setIcon(QMessageBox::Information); - QObject::connect(s3, SIGNAL(entered()), &mbox, SLOT(exec())); + QMessageBox *mbox = new QMessageBox(mainWindow); + mbox->addButton(QMessageBox::Ok); + mbox->setText("Interrupted!"); + mbox->setIcon(QMessageBox::Information); + QObject::connect(s3, SIGNAL(entered()), mbox, SLOT(exec())); s3->addTransition(s1h); machine.addState(s3); diff --git a/doc/src/snippets/statemachine/main5.cpp b/doc/src/snippets/statemachine/main5.cpp index a9d4091..346cbce 100644 --- a/doc/src/snippets/statemachine/main5.cpp +++ b/doc/src/snippets/statemachine/main5.cpp @@ -44,14 +44,13 @@ int main(int argv, char **args) { QApplication app(argv, args); + QWidget *button; { //![0] QStateMachine machine; machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); -//![0] -//![1] QState *s1 = new QState(); s1->assignProperty(object, "fooBar", 1.0); machine.addState(s1); @@ -59,7 +58,7 @@ int main(int argv, char **args) QState *s2 = new QState(); machine.addState(s2); -//![1] +//![0] } { @@ -110,21 +109,50 @@ int main(int argv, char **args) } { + QMainWindow *mainWindow = 0; //![5] + QMessageBox *messageBox = new QMessageBox(mainWindow); + messageBox->addButton(QMessageBox::Ok); + messageBox->setText("Button geometry has been set!"); + messageBox->setIcon(QMessageBox::Information); + QState *s1 = new QState(); - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); QState *s2 = new QState(); + s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + connect(s2, SIGNAL(entered()), messageBox, SLOT(exec())); - s1->addTransition(s1, SIGNAL(polished()), s2); + s1->addTransition(button, SIGNAL(clicked()), s2); //![5] - } { + QMainWindow *mainWindow = 0; + +//![6] + QMessageBox *messageBox = new QMessageBox(mainWindow); + messageBox->addButton(QMessageBox::Ok); + messageBox->setText("Button geometry has been set!"); + messageBox->setIcon(QMessageBox::Information); + + QState *s1 = new QState(); + + QState *s2 = new QState(); + s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + + QState *s3 = new QState(); + connect(s3, SIGNAL(entered()), messageBox, SLOT(exec())); + s1->addTransition(button, SIGNAL(clicked()), s2); + s2->addTransition(s2, SIGNAL(polished()), s3); //![6] + + } + + { + +//![7] QState *s1 = new QState(); QState *s2 = new QState(); @@ -134,10 +162,12 @@ int main(int argv, char **args) QStateMachine machine; machine.setInitialState(s1); machine.addDefaultAnimation(new QPropertyAnimation(object, "fooBar")); -//![6] +//![7] } + + return app.exec(); } -- cgit v0.12 From d54a1241a4470c73ccdac4b1a90264a9eaa28478 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 26 Oct 2009 12:22:13 +0100 Subject: disable link time code generation by default on Windows CE To be consistent with desktop Windows Qt, we also disable LTCG by default. To turn it on, use the -ltcg configure switch. Reviewed-by: mauricek --- tools/configure/configureapp.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index dd3823b..28645a0 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1412,7 +1412,6 @@ void Configure::applySpecSpecifics() dictionary[ "WEBKIT" ] = "no"; dictionary[ "PHONON" ] = "yes"; dictionary[ "DIRECTSHOW" ] = "no"; - dictionary[ "LTCG" ] = "yes"; // We only apply MMX/IWMMXT for mkspecs we know they work if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) { dictionary[ "MMX" ] = "yes"; -- cgit v0.12 From 0aade44ed9a2f223c603984a84ab012eadc5c388 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 26 Oct 2009 14:05:16 +0100 Subject: document the -no-ltcg default for Windows CE in changes-4.6.0 --- dist/changes-4.6.0 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index ba2b051..5a15cdb 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -58,6 +58,9 @@ information about a particular change. - The reading code of QLocalSocket on Windows has been rewritten to improve reading performance. + - On Windows CE the link time code geration has been disabled by default to + be consistent with win32-msvc200x. + **************************************************************************** * Important Behavior Changes * **************************************************************************** -- cgit v0.12 From fa1856bcb2eff41dadf0900202dd43f44ddb2343 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 27 Oct 2009 16:19:19 +0100 Subject: WebKit compile fix for Windows CE Not sure if this is right fix. We could also disable PLUGIN_PACKAGE_SIMPLE_HASH. But this is automatically enabled when NETSCAPE_PLUGIN_API is disabled. Reviewed-by: thartman --- src/3rdparty/webkit/WebCore/platform/FileSystem.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/3rdparty/webkit/WebCore/platform/FileSystem.h b/src/3rdparty/webkit/WebCore/platform/FileSystem.h index 958eb73..d144990 100644 --- a/src/3rdparty/webkit/WebCore/platform/FileSystem.h +++ b/src/3rdparty/webkit/WebCore/platform/FileSystem.h @@ -90,6 +90,17 @@ struct PlatformModuleVersion { { } + bool operator != (const PlatformModuleVersion& rhs) const + { + return mostSig != rhs.mostSig && leastSig != rhs.leastSig; + } + + + bool operator > (const PlatformModuleVersion& rhs) const + { + return mostSig > rhs.mostSig && leastSig > rhs.leastSig; + } + }; #else typedef QLibrary* PlatformModule; -- cgit v0.12 From 9fab0ede200960f0dbec1457757a6ba3214c3ce6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 28 Oct 2009 10:03:12 +0100 Subject: fix font height calculation on QWS fontDef.pixelSize is a qreal now and we should round it after multiplication to avoid an accuracy loss. Reviewed-by: mae --- src/gui/text/qfontengine_qpf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 6ff0fbd..94974fc 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -819,7 +819,7 @@ FT_Face QFontEngineQPF::lockFace() const FT_Face face = freetype->face; // ### not perfect - const int ysize = int(fontDef.pixelSize) << 6; + const int ysize = qRound(fontDef.pixelSize * qreal(64)); const int xsize = ysize; if (freetype->xsize != xsize || freetype->ysize != ysize) { -- cgit v0.12 From 2a0d6bf8d3f7c92667512d2222cf2304e06130b4 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 10:56:06 +0100 Subject: Adapt testcase to cosmetic pen workarounds in code Reviewed-by: Samuel --- tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index fbeb425..55294d5 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -357,7 +357,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data() QTest::newRow("log,transparent") << int(Qt::LogicalCoordinates) << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) - << QSize(12, 12) << QPoint(-1, -1) + << QSize(14, 14) << QPoint(-2, -2) << 0x00000000u; QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates) @@ -372,7 +372,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data() QTest::newRow("dev,transparent") << int(Qt::DeviceCoordinates) << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) - << QSize(22, 22) << QPoint(39, 39) + << QSize(24, 24) << QPoint(38, 38) << 0x00000000u; QTest::newRow("dev,effectrect") << int(Qt::DeviceCoordinates) -- cgit v0.12 From 83b069307781f138394d29540a35c62d1dc584c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 3 Nov 2009 11:58:53 +0200 Subject: Build break fix for S60Simulated style S60Simulated style broke down after change SHA da9880eaed0d09338717db1a73db01e6b0ab080d, because part()-method call in simulated style was not updated to have additional parameter. Task-number: None Reviewed-by: Shane Kearns --- src/gui/styles/qs60style_simulated.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 14f0424..706b4e9 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -322,7 +322,7 @@ QPixmap QS60StylePrivate::backgroundTexture() { if (!m_background) { const QSize size = QApplication::desktop()->screen()->size(); - QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size); + QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size, 0); m_background = new QPixmap(background); } return *m_background; -- cgit v0.12 From 1ef5dddf91c666664911686ca77cb6c1b2cde828 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 3 Nov 2009 12:06:35 +0200 Subject: Force Qt libs to install on phone memory in Symbian. Starting Qt apps when Qt libs are installed on a memory card takes ages (15-20 seconds), because Symbian recalculates hash of the dll every time it loads it from a non-system drive. Worked around this issue by forcing installation of Qt libs to the C-drive. Task-number: QT-690 Reviewed-by: Janne Koskinen --- src/s60installs/s60installs.pro | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 022a072..9c53167 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -12,7 +12,7 @@ symbian: { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} qtresources.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/s60main.rsc - qtresources.path = $$APP_RESOURCE_DIR + qtresources.path = c:$$APP_RESOURCE_DIR qtlibraries.sources = \ QtCore.dll \ @@ -24,24 +24,24 @@ symbian: { qts60plugindeployment = \ "IF package(0x1028315F)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"!:\\sys\\bin\\qts60plugin_5_0.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \ "ELSEIF package(0x102752AE)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_2.dll\" - \"!:\\sys\\bin\\qts60plugin_3_2.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_2.dll\" - \"c:\\sys\\bin\\qts60plugin_3_2.dll\"" \ "ELSEIF package(0x102032BE)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"!:\\sys\\bin\\qts60plugin_3_1.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"c:\\sys\\bin\\qts60plugin_3_1.dll\"" \ "ELSE" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"!:\\sys\\bin\\qts60plugin_5_0.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \ "ENDIF" qtlibraries.pkg_postrules += qts60plugindeployment sqlitedeployment = \ "; Deploy sqlite onto phone that does not have it (this should be replaced with embedded sis file when available)" \ "IF NOT package(0x2002533b) " \ - "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"!:\\sys\\bin\\sqlite3.dll\"" \ + "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"c:\\sys\\bin\\sqlite3.dll\"" \ "ENDIF" qtlibraries.pkg_postrules += sqlitedeployment - qtlibraries.path = /sys/bin + qtlibraries.path = c:/sys/bin vendorinfo = \ "; Localised Vendor name" \ @@ -67,15 +67,15 @@ symbian: { !contains(QT_CONFIG, no-mng): imageformats_plugins.sources += qmng.dll !contains(QT_CONFIG, no-tiff): imageformats_plugins.sources += qtiff.dll !contains(QT_CONFIG, no-ico): imageformats_plugins.sources += qico.dll - imageformats_plugins.path = $$QT_PLUGINS_BASE_DIR/imageformats + imageformats_plugins.path = c:$$QT_PLUGINS_BASE_DIR/imageformats codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll - codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs + codecs_plugins.path = c:$$QT_PLUGINS_BASE_DIR/codecs contains(QT_CONFIG, phonon-backend) { phonon_backend_plugins.sources += phonon_mmf.dll - phonon_backend_plugins.path = $$QT_PLUGINS_BASE_DIR/phonon_backend + phonon_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/phonon_backend DEPLOYMENT += phonon_backend_plugins } @@ -85,7 +85,7 @@ symbian: { qtlibraries.sources += QtSvg.dll imageformats_plugins.sources += qsvg.dll iconengines_plugins.sources = qsvgicon.dll - iconengines_plugins.path = $$QT_PLUGINS_BASE_DIR/iconengines + iconengines_plugins.path = c:$$QT_PLUGINS_BASE_DIR/iconengines DEPLOYMENT += iconengines_plugins } @@ -105,7 +105,7 @@ symbian: { qtlibraries.sources += QtWebKit.dll } - graphicssystems_plugins.path = $$QT_PLUGINS_BASE_DIR/graphicssystems + graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems contains(QT_CONFIG, openvg) { qtlibraries.sources = QtOpenVG.dll graphicssystems_plugins.sources += qvggraphicssystem.dll -- cgit v0.12 From 29ddc44a11e16347212fccd3d81c4e0c91bf61a1 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 2 Nov 2009 12:37:41 +0100 Subject: Documentation fixes related to gestures doc. Reviewed-by: David Boddie --- doc/src/frameworks-technologies/gestures.qdoc | 4 ++-- src/gui/kernel/qevent.cpp | 5 +++-- src/gui/kernel/qgesture.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index a619fe8..f64e301 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -168,6 +168,6 @@ \section1 Further Reading - The \l{Image Gestures Example} shows how to enable gestures for a widget in - a simple image viewer application. + The \l{gestures/imagegestures}{Image Gestures Example} shows how to enable + gestures for a widget in a simple image viewer application. */ diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ab43e79..6757fa2 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4344,8 +4344,9 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const Sets the accept flag of the given \a gestureType object to the specified \a value. - Setting the accept flag indicates that the event receiver wants the \a gesture. - Unwanted gestures may be propagated to the parent widget. + Setting the accept flag indicates that the event receiver wants the gesture + of type \a gestureType. Unwanted gestures may be propagated to the parent + widget. By default, gestures in events of type QEvent::Gesture are accepted, and gestures in QEvent::GestureOverride events are ignored. diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 850f22c..df99746 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -217,7 +217,7 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const */ /*! - \property QGesture::GestureCancelPolicy + \property QGesture::gestureCancelPolicy \brief the policy for deciding what happens on accepting a gesture On accepting one gesture Qt can automatically cancel other gestures -- cgit v0.12 From b112af4614dffcb230956bfa319c37fc00e6a13c Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 2 Nov 2009 14:13:17 +0100 Subject: Added QGraphicsObject::ungrabGesture() Oops, apparently we forgot to add a function for unsubscribing a graphics object from a gesture. Fixing it now. Reviewed-by: trustme --- src/gui/graphicsview/qgraphicsitem.cpp | 17 +++++++++++++++-- src/gui/graphicsview/qgraphicsitem.h | 1 + src/gui/kernel/qwidget.cpp | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 738c6e3..58d7e7d 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7322,9 +7322,8 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent /*! Subscribes the graphics object to the given \a gesture for the specified \a context. - \sa QGestureEvent + \sa ungrabGesture(), QGestureEvent */ - void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) { QGraphicsItemPrivate * const d = QGraphicsItem::d_func(); @@ -7333,6 +7332,20 @@ void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext co } /*! + Unsubscribes the graphics object from the given \a gesture. + + \sa grabGesture(), QGestureEvent +*/ +void QGraphicsObject::ungrabGesture(Qt::GestureType gesture) +{ + QGraphicsItemPrivate * const d = QGraphicsItem::d_func(); + if (d->gestureContext.remove(gesture)) { + QGestureManager *manager = QGestureManager::instance(); + manager->cleanupCachedGestures(this, gesture); + } +} + +/*! \property QGraphicsObject::parent \brief the parent of the item diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index f3fe99c..fc180f3 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -556,6 +556,7 @@ public: #endif void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::ItemWithChildrenGesture); + void ungrabGesture(Qt::GestureType type); Q_SIGNALS: void parentChanged(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 14f3bfe..ac2808c 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11712,7 +11712,7 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const /*! Subscribes the widget to a given \a gesture with a \a context. - \sa QGestureEvent + \sa ungrabGesture(), QGestureEvent \since 4.6 */ void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) @@ -11725,7 +11725,7 @@ void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) /*! Unsubscribes the widget to a given \a gesture type - \sa QGestureEvent + \sa grabGesture(), QGestureEvent \since 4.6 */ void QWidget::ungrabGesture(Qt::GestureType gesture) -- cgit v0.12 From 0222f4f55d6af9ad4f4ca1ee07ae9810ff9256a2 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 30 Oct 2009 13:57:34 +0100 Subject: Improved gesture scrollarea manualtest. Reviewed-by: trustme --- tests/manual/gestures/scrollarea/main.cpp | 30 +++++++++++++++------- .../scrollarea/mousepangesturerecognizer.cpp | 14 ++++++++-- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp index f90f6c6..9a5eb02 100644 --- a/tests/manual/gestures/scrollarea/main.cpp +++ b/tests/manual/gestures/scrollarea/main.cpp @@ -73,11 +73,11 @@ protected: QPanGesture *pan = static_cast(event->gesture(Qt::PanGesture)); if (pan) { switch(pan->state()) { - case Qt::GestureStarted: qDebug("area: Pan: started"); break; - case Qt::GestureFinished: qDebug("area: Pan: finished"); break; - case Qt::GestureCanceled: qDebug("area: Pan: canceled"); break; + case Qt::GestureStarted: qDebug() << this << "Pan: started"; break; + case Qt::GestureFinished: qDebug() << this << "Pan: finished"; break; + case Qt::GestureCanceled: qDebug() << this << "Pan: canceled"; break; case Qt::GestureUpdated: break; - default: qDebug("area: Pan: "); break; + default: qDebug() << this << "Pan: "; break; } if (pan->state() == Qt::GestureStarted) @@ -134,11 +134,11 @@ protected: QPanGesture *pan = static_cast(event->gesture(Qt::PanGesture)); if (pan) { switch (pan->state()) { - case Qt::GestureStarted: qDebug("slider: Pan: started"); break; - case Qt::GestureFinished: qDebug("slider: Pan: finished"); break; - case Qt::GestureCanceled: qDebug("slider: Pan: canceled"); break; + case Qt::GestureStarted: qDebug() << this << "Pan: started"; break; + case Qt::GestureFinished: qDebug() << this << "Pan: finished"; break; + case Qt::GestureCanceled: qDebug() << this << "Pan: canceled"; break; case Qt::GestureUpdated: break; - default: qDebug("slider: Pan: "); break; + default: qDebug() << this << "Pan: "; break; } if (pan->state() == Qt::GestureStarted) @@ -186,6 +186,7 @@ public: MainWindow() { rootScrollArea = new ScrollArea; + rootScrollArea->setObjectName(QLatin1String("rootScrollArea")); setCentralWidget(rootScrollArea); QWidget *root = new QWidget; @@ -193,14 +194,17 @@ public: rootScrollArea->setWidget(root); Slider *verticalSlider = new Slider(Qt::Vertical, root); + verticalSlider->setObjectName(QLatin1String("verticalSlider")); verticalSlider ->move(650, 1100); Slider *horizontalSlider = new Slider(Qt::Horizontal, root); + horizontalSlider->setObjectName(QLatin1String("horizontalSlider")); horizontalSlider ->move(600, 1000); childScrollArea = new ScrollArea(root); + childScrollArea->setObjectName(QLatin1String("childScrollArea")); childScrollArea->move(500, 500); QWidget *w = new QWidget; - w->setMinimumWidth(400); + w->setMinimumWidth(700); QVBoxLayout *l = new QVBoxLayout(w); l->setMargin(20); for (int i = 0; i < 100; ++i) { @@ -211,6 +215,14 @@ public: l->addWidget(w); } childScrollArea->setWidget(w); +#if defined(Q_OS_WIN) + // Windows can force Qt to create a native window handle for an + // intermediate widget and that will block gesture to get touch events. + // So this hack to make sure gestures get all touch events they need. + foreach (QObject *w, children()) + if (w->isWidgetType()) + static_cast(w)->setAttribute(Qt::WA_AcceptTouchEvents); +#endif } private: ScrollArea *rootScrollArea; diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp index 63d3e76..ce5ef57 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp @@ -57,8 +57,16 @@ QGesture* MousePanGestureRecognizer::createGesture(QObject *) QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) { QPanGesture *g = static_cast(state); + if (event->type() == QEvent::TouchBegin) { + // ignore the following mousepress event + g->setProperty("ignoreMousePress", QVariant::fromValue(true)); + } else if (event->type() == QEvent::TouchEnd) { + g->setProperty("ignoreMousePress", QVariant::fromValue(false)); + } QMouseEvent *me = static_cast(event); - if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick) { + if (event->type() == QEvent::MouseButtonPress) { + if (g->property("ignoreMousePress").toBool()) + return QGestureRecognizer::Ignore; g->setHotSpot(me->globalPos()); g->setProperty("lastPos", me->globalPos()); g->setProperty("pressed", QVariant::fromValue(true)); @@ -76,7 +84,8 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat } return QGestureRecognizer::NotGesture; } else if (event->type() == QEvent::MouseButtonRelease) { - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + if (g->property("pressed").toBool()) + return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; } return QGestureRecognizer::Ignore; } @@ -90,5 +99,6 @@ void MousePanGestureRecognizer::reset(QGesture *state) g->setAcceleration(0); g->setProperty("lastPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); + g->setProperty("ignoreMousePress", QVariant::fromValue(false)); QGestureRecognizer::reset(state); } -- cgit v0.12 From b7b4df9c87805be372fa6f74422e0f4648a5d520 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 30 Oct 2009 14:01:41 +0100 Subject: Fixed the imagegestures project file. Reviewed-by: trustme --- examples/gestures/imagegestures/imagegestures.pro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro index 7780ad9..8c947e4 100644 --- a/examples/gestures/imagegestures/imagegestures.pro +++ b/examples/gestures/imagegestures/imagegestures.pro @@ -5,12 +5,12 @@ SOURCES = imagewidget.cpp \ mainwidget.cpp # install -target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer +target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures sources.files = $$SOURCES \ $$HEADERS \ $$RESOURCES \ $$FORMS \ - imageviewer.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer + imagegestures.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures INSTALLS += target \ sources -- cgit v0.12 From 54db3afc9797a3adf5a38f35f6338960924e9e1a Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 30 Oct 2009 17:14:53 +0100 Subject: Implemented pinch gesture recognizer. Reviewed-by: trustme --- examples/gestures/imagegestures/imagewidget.cpp | 18 +-- src/gui/kernel/qgesture_p.h | 3 + src/gui/kernel/qgesturemanager.cpp | 1 + src/gui/kernel/qstandardgestures.cpp | 177 ++++++++++++--------- src/gui/kernel/qstandardgestures_p.h | 11 ++ src/gui/kernel/qwidget.cpp | 1 + src/gui/kernel/qwidget_win.cpp | 11 -- .../kernel/qwinnativepangesturerecognizer_win.cpp | 8 +- .../kernel/qwinnativepangesturerecognizer_win_p.h | 2 +- 9 files changed, 130 insertions(+), 102 deletions(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index 28de6da..c798fcc 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -102,17 +102,13 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) //! [gesture event handler] bool ImageWidget::gestureEvent(QGestureEvent *event) { - if (QGesture *pan = event->gesture(Qt::PanGesture)) { - panTriggered(static_cast(pan)); - return true; - } else if (QGesture *pinch = event->gesture(Qt::PinchGesture)) { - pinchTriggered(static_cast(pinch)); - return true; - } else if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) { - swipeTriggered(static_cast(swipe)); - return true; - } - return false; + if (QGesture *pan = event->gesture(Qt::PanGesture)) + panTriggered(static_cast(pan)); + if (QGesture *pinch = event->gesture(Qt::PinchGesture)) + pinchTriggered(static_cast(pinch)); + if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) + swipeTriggered(static_cast(swipe)); + return true; } //! [gesture event handler] diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 34fbb26..73a6bcf 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -121,6 +121,9 @@ public: qreal totalRotationAngle; qreal lastRotationAngle; qreal rotationAngle; + + bool isNewSequence; + QPointF startPosition[2]; }; class QSwipeGesturePrivate : public QGesturePrivate diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 1d33c84..6ea350b 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -77,6 +77,7 @@ QGestureManager::QGestureManager(QObject *parent) #endif #else registerGestureRecognizer(new QPanGestureRecognizer); + registerGestureRecognizer(new QPinchGestureRecognizer); #endif } diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index dec2311..57cf12d 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -44,6 +44,7 @@ #include "qgesture_p.h" #include "qevent.h" #include "qwidget.h" +#include "qabstractscrollarea.h" QT_BEGIN_NAMESPACE @@ -54,7 +55,13 @@ QPanGestureRecognizer::QPanGestureRecognizer() QGesture *QPanGestureRecognizer::createGesture(QObject *target) { if (target && target->isWidgetType()) { +#if defined(Q_OS_WIN) + // for scroll areas on Windows we want to use native gestures instead + if (!qobject_cast(target->parent())) + static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); +#else static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); +#endif } return new QPanGesture; } @@ -132,104 +139,124 @@ void QPanGestureRecognizer::reset(QGesture *state) d->lastPosition = QPoint(); d->acceleration = 0; -//#if defined(QT_MAC_USE_COCOA) -// d->singleTouchPanTimer.stop(); -// d->prevMousePos = QPointF(0, 0); -//#endif - QGestureRecognizer::reset(state); } -/* -bool QPanGestureRecognizer::event(QEvent *event) + +// +// QPinchGestureRecognizer +// + +QPinchGestureRecognizer::QPinchGestureRecognizer() { -#if defined(QT_MAC_USE_COCOA) - Q_D(QPanGesture); - if (event->type() == QEvent::Timer) { - const QTimerEvent *te = static_cast(event); - if (te->timerId() == d->singleTouchPanTimer.timerId()) { - d->singleTouchPanTimer.stop(); - updateState(Qt::GestureStarted); - } +} + +QGesture *QPinchGestureRecognizer::createGesture(QObject *target) +{ + if (target && target->isWidgetType()) { + static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); } -#endif + return new QPinchGesture; +} - bool consume = false; +QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +{ + QPinchGesture *q = static_cast(state); + QPinchGesturePrivate *d = q->d_func(); -#if defined(Q_WS_WIN) -#elif defined(QT_MAC_USE_COCOA) - // The following implements single touch - // panning on Mac: - const int panBeginDelay = 300; - const int panBeginRadius = 3; - const QTouchEvent *ev = static_cast(event); + const QTouchEvent *ev = static_cast(event); + + QGestureRecognizer::Result result; switch (event->type()) { case QEvent::TouchBegin: { - if (ev->touchPoints().size() == 1) { - d->delayManager->setEnabled(true); - consume = d->delayManager->append(d->gestureTarget, *event); - d->lastPosition = QCursor::pos(); - d->singleTouchPanTimer.start(panBeginDelay, this); - } - break;} + result = QGestureRecognizer::MaybeGesture; + break; + } case QEvent::TouchEnd: { - d->delayManager->setEnabled(false); - if (state() != Qt::NoGesture) { - updateState(Qt::GestureFinished); - consume = true; - d->delayManager->clear(); + if (q->state() != Qt::NoGesture) { + result = QGestureRecognizer::GestureFinished; } else { - d->delayManager->replay(); + result = QGestureRecognizer::NotGesture; } - reset(); - break;} + break; + } case QEvent::TouchUpdate: { - consume = d->delayManager->append(d->gestureTarget, *event); - if (ev->touchPoints().size() == 1) { - if (state() == Qt::NoGesture) { - // INVARIANT: The singleTouchTimer has still not fired. - // Lets check if the user moved his finger so much from - // the starting point that it makes sense to cancel: - const QPointF startPos = ev->touchPoints().at(0).startPos().toPoint(); - const QPointF p = ev->touchPoints().at(0).pos().toPoint(); - if ((startPos - p).manhattanLength() > panBeginRadius) { - d->delayManager->replay(); - consume = false; - reset(); - } else { - d->lastPosition = QCursor::pos(); - } + d->whatChanged = 0; + if (ev->touchPoints().size() == 2) { + QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0); + QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); + + d->hotSpot = p1.screenPos(); + d->isHotSpotSet = true; + + if (d->isNewSequence) { + d->startPosition[0] = p1.screenPos(); + d->startPosition[1] = p2.screenPos(); + } + QLineF line(p1.screenPos(), p2.screenPos()); + QLineF tmp(line); + tmp.setLength(line.length() / 2.); + QPointF centerPoint = tmp.p2(); + + d->lastCenterPoint = d->centerPoint; + d->centerPoint = centerPoint; + d->whatChanged |= QPinchGesture::CenterPointChanged; + + const qreal scaleFactor = QLineF(p1.pos(), p2.pos()).length() + / QLineF(d->startPosition[0], d->startPosition[1]).length(); + if (d->isNewSequence) { + d->lastScaleFactor = scaleFactor; } else { - d->delayManager->clear(); - QPointF mousePos = QCursor::pos(); - QPointF dist = mousePos - d->lastPosition; - d->lastPosition = mousePos; - d->lastOffset = d->offset; - d->offset = QSizeF(dist.x(), dist.y()); - d->totalOffset += d->offset; - updateState(Qt::GestureUpdated); + d->lastScaleFactor = d->scaleFactor; } - } else if (state() == Qt::NoGesture) { - d->delayManager->replay(); - consume = false; - reset(); + d->scaleFactor = scaleFactor; + d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor; + d->whatChanged |= QPinchGesture::ScaleFactorChanged; + + const qreal rotationAngle = -line.angle(); + if (d->isNewSequence) + d->lastRotationAngle = rotationAngle; + else + d->lastRotationAngle = d->rotationAngle; + d->rotationAngle = rotationAngle; + d->totalRotationAngle += d->rotationAngle - d->lastRotationAngle; + d->whatChanged |= QPinchGesture::RotationAngleChanged; + + d->isNewSequence = false; + result = QGestureRecognizer::GestureTriggered; + } else { + d->isNewSequence = true; + result = QGestureRecognizer::MaybeGesture; } - break;} + break; + } case QEvent::MouseButtonPress: case QEvent::MouseMove: case QEvent::MouseButtonRelease: - if (d->delayManager->isEnabled()) - consume = d->delayManager->append(d->gestureTarget, *event); + result = QGestureRecognizer::Ignore; break; default: - return false; + result = QGestureRecognizer::Ignore; + break; } -#else - Q_UNUSED(event); -#endif - return QGestureRecognizer::Ignore; + return result; +} + +void QPinchGestureRecognizer::reset(QGesture *state) +{ + QPinchGesture *pinch = static_cast(state); + QPinchGesturePrivate *d = pinch->d_func(); + + d->whatChanged = 0; + + d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF(); + d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 0; + d->totalRotationAngle = d->lastRotationAngle = d->rotationAngle = 0; + + d->isNewSequence = true; + + QGestureRecognizer::reset(state); } - */ QT_END_NAMESPACE diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index fec5c2f..827b2a2 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -69,6 +69,17 @@ public: void reset(QGesture *state); }; +class QPinchGestureRecognizer : public QGestureRecognizer +{ +public: + QPinchGestureRecognizer(); + + QGesture *createGesture(QObject *target); + + QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + QT_END_NAMESPACE #endif // QSTANDARDGESTURES_P_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index ac2808c..00d9a99 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -197,6 +197,7 @@ QWidgetPrivate::QWidgetPrivate(int version) , picture(0) #elif defined(Q_WS_WIN) , noPaintOnScreen(0) + , nativeGesturePanEnabled(0) #elif defined(Q_WS_MAC) , needWindowChange(0) , isGLWidget(0) diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 5bf7649..3a92735 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2071,17 +2071,6 @@ void QWidgetPrivate::winSetupGestures() gc[0].dwBlock = GC_PAN; } -// gc[1].dwID = GID_ZOOM; -// if (gestures.pinch) -// gc[1].dwWant = GC_ZOOM; -// else -// gc[1].dwBlock = GC_ZOOM; -// gc[2].dwID = GID_ROTATE; -// if (gestures.pinch) -// gc[2].dwWant = GC_ROTATE; -// else -// gc[2].dwBlock = GC_ROTATE; - qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); } } diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp index 12d3058..c3c8a28 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp @@ -56,16 +56,16 @@ QWinNativePanGestureRecognizer::QWinNativePanGestureRecognizer() { } -QGesture* QWinNativePanGestureRecognizer::createGesture(QObject *target) const +QGesture *QWinNativePanGestureRecognizer::createGesture(QObject *target) { if (!target) return new QPanGesture; // a special case - if (qobject_cast(target)) - return 0; if (!target->isWidgetType()) return 0; + if (qobject_cast(target)) + return 0; - QWidget *q = static_cast(target); + QWidget *q = static_cast(target); QWidgetPrivate *d = q->d_func(); d->nativeGesturePanEnabled = true; d->winSetupGestures(); diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h index a1e8511..1d723da 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h @@ -62,7 +62,7 @@ class QWinNativePanGestureRecognizer : public QGestureRecognizer public: QWinNativePanGestureRecognizer(); - QGesture* createGesture(QObject *target) const; + QGesture *createGesture(QObject *target); QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); -- cgit v0.12 From 4843b437b90800d238f14e7a4558045ddc37cd4b Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 2 Nov 2009 11:13:39 +0100 Subject: Made native Pan gesture work on Windows. Reviewed-by: trustme --- src/gui/kernel/qapplication.cpp | 1 + src/gui/kernel/qapplication_p.h | 1 + src/gui/kernel/qapplication_win.cpp | 36 ++++++++++----------- src/gui/kernel/qgesturemanager.cpp | 6 ++++ src/gui/kernel/qwidget_win.cpp | 4 ++- src/gui/widgets/qabstractscrollarea.cpp | 55 +++++++++++++++++++-------------- src/gui/widgets/qplaintextedit.cpp | 53 ++++++++++++++++--------------- src/gui/widgets/qtextedit.cpp | 6 ++-- 8 files changed, 90 insertions(+), 72 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 1ec51da..06787eb 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -186,6 +186,7 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T #endif gestureManager = 0; + gestureWidget = 0; if (!self) self = this; diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 0fa7269..2c57238 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -511,6 +511,7 @@ public: #endif QGestureManager *gestureManager; + QWidget *gestureWidget; QMap widgetForTouchPointId; QMap appCurrentTouchPoints; diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index d98ecbb..387c29b 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -2499,24 +2499,24 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam if (qAppPriv->GetGestureInfo) bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); if (bResult) { -// if (gi.dwID == GID_BEGIN) { -// // find the alien widget for the gesture position. -// // This might not be accurate as the position is the center -// // point of two fingers for multi-finger gestures. -// QPoint pt(gi.ptsLocation.x, gi.ptsLocation.y); -// QWidget *w = widget->childAt(widget->mapFromGlobal(pt)); -// qAppPriv->gestureWidget = w ? w : widget; -// } -// if (qAppPriv->gestureWidget) -// static_cast(qAppPriv->gestureWidget)->translateGestureEvent(msg, gi); -// if (qAppPriv->CloseGestureInfoHandle) -// qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); -// if (gi.dwID == GID_END) -// qAppPriv->gestureWidget = 0; -// } else { -// DWORD dwErr = GetLastError(); -// if (dwErr > 0) -// qWarning() << "translateGestureEvent: error = " << dwErr; + if (gi.dwID == GID_BEGIN) { + // find the alien widget for the gesture position. + // This might not be accurate as the position is the center + // point of two fingers for multi-finger gestures. + QPoint pt(gi.ptsLocation.x, gi.ptsLocation.y); + QWidget *w = widget->childAt(widget->mapFromGlobal(pt)); + qAppPriv->gestureWidget = w ? w : widget; + } + if (qAppPriv->gestureWidget) + static_cast(qAppPriv->gestureWidget)->translateGestureEvent(msg, gi); + if (qAppPriv->CloseGestureInfoHandle) + qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); + if (gi.dwID == GID_END) + qAppPriv->gestureWidget = 0; + } else { + DWORD dwErr = GetLastError(); + if (dwErr > 0) + qWarning() << "translateGestureEvent: error = " << dwErr; } result = true; break; diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 6ea350b..318d4b5 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -52,6 +52,9 @@ #ifdef Q_WS_MAC #include "qmacgesturerecognizer_mac_p.h" #endif +#if defined(Q_OS_WIN) +#include "qwinnativepangesturerecognizer_win_p.h" +#endif #include "qdebug.h" @@ -78,6 +81,9 @@ QGestureManager::QGestureManager(QObject *parent) #else registerGestureRecognizer(new QPanGestureRecognizer); registerGestureRecognizer(new QPinchGestureRecognizer); +#if defined(Q_OS_WIN) + registerGestureRecognizer(new QWinNativePanGestureRecognizer); +#endif #endif } diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 3a92735..22a94b9 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2036,7 +2036,7 @@ void QWidgetPrivate::winSetupGestures() if (!q || !q->isVisible()) return; QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - WId winid = q->effectiveWinId(); + WId winid = q->internalWinId(); bool needh = false; bool needv = false; @@ -2052,6 +2052,8 @@ void QWidgetPrivate::winSetupGestures() needv = (vbarpolicy == Qt::ScrollBarAlwaysOn || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; + if (!winid) + winid = q->winId(); // enforces the native winid on the viewport } if (winid && qAppPriv->SetGestureConfig) { GESTURECONFIG gc[1]; diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 0896256..7d81d5a 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -293,13 +293,16 @@ void QAbstractScrollAreaPrivate::init() q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); layoutChildren(); + viewport->grabGesture(Qt::PanGesture); } #ifdef Q_WS_WIN void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on) { singleFingerPanEnabled = on; - winSetupGestures(); + QWidgetPrivate *dd = static_cast(QObjectPrivate::get(viewport)); + if (dd) + dd->winSetupGestures(); } #endif // Q_WS_WIN @@ -539,6 +542,7 @@ void QAbstractScrollArea::setViewport(QWidget *widget) d->viewport->setParent(this); d->viewport->setFocusProxy(this); d->viewport->installEventFilter(d->viewportFilter.data()); + d->viewport->grabGesture(Qt::PanGesture); d->layoutChildren(); if (isVisible()) d->viewport->show(); @@ -935,6 +939,26 @@ bool QAbstractScrollArea::event(QEvent *e) case QEvent::TouchUpdate: case QEvent::TouchEnd: return false; + case QEvent::Gesture: + { + QGestureEvent *ge = static_cast(e); + QPanGesture *g = static_cast(ge->gesture(Qt::PanGesture)); + if (g) { + QScrollBar *hBar = horizontalScrollBar(); + QScrollBar *vBar = verticalScrollBar(); + QPointF delta = g->lastOffset(); + if (!delta.isNull()) { + if (QApplication::isRightToLeft()) + delta.rx() *= -1; + int newX = hBar->value() - delta.x(); + int newY = vBar->value() - delta.y(); + hBar->setValue(newX); + vBar->setValue(newY); + } + return true; + } + return false; + } case QEvent::StyleChange: case QEvent::LayoutDirectionChange: case QEvent::ApplicationLayoutDirectionChange: @@ -990,6 +1014,8 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e) #endif return QFrame::event(e); case QEvent::LayoutRequest: + case QEvent::Gesture: + case QEvent::GestureOverride: return event(e); default: break; @@ -1266,11 +1292,13 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y) void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() { layoutChildren(); -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN // Need to re-subscribe to gestures as the content changes to make sure we // enable/disable panning when needed. - winSetupGestures(); -#endif // Q_OS_WIN + QWidgetPrivate *dd = static_cast(QObjectPrivate::get(viewport)); + if (dd) + dd->winSetupGestures(); +#endif // Q_WS_WIN } QPoint QAbstractScrollAreaPrivate::contentsOffset() const @@ -1335,25 +1363,6 @@ void QAbstractScrollArea::setupViewport(QWidget *viewport) Q_UNUSED(viewport); } -//void QAbstractScrollAreaPrivate::_q_gestureTriggered() -//{ -// Q_Q(QAbstractScrollArea); -// QPanGesture *g = qobject_cast(q->sender()); -// if (!g) -// return; -// QScrollBar *hBar = q->horizontalScrollBar(); -// QScrollBar *vBar = q->verticalScrollBar(); -// QSizeF delta = g->lastOffset(); -// if (!delta.isNull()) { -// if (QApplication::isRightToLeft()) -// delta.rwidth() *= -1; -// int newX = hBar->value() - delta.width(); -// int newY = vBar->value() - delta.height(); -// hbar->setValue(newX); -// vbar->setValue(newY); -// } -//} - QT_END_NAMESPACE #include "moc_qabstractscrollarea.cpp" diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index fc61889..0e5ee46 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -730,9 +730,6 @@ QPlainTextEditPrivate::QPlainTextEditPrivate() backgroundVisible = false; centerOnScroll = false; inDrag = false; -#ifdef Q_WS_WIN - singleFingerPanEnabled = true; -#endif } @@ -789,6 +786,9 @@ void QPlainTextEditPrivate::init(const QString &txt) viewport->setCursor(Qt::IBeamCursor); #endif originalOffsetY = 0; +#ifdef Q_WS_WIN + setSingleFingerPanEnabled(true); +#endif } void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) @@ -1450,6 +1450,29 @@ bool QPlainTextEdit::event(QEvent *e) d->sendControlEvent(e); } #endif + else if (e->type() == QEvent::Gesture) { + QGestureEvent *ge = static_cast(e); + QPanGesture *g = static_cast(ge->gesture(Qt::PanGesture)); + if (g) { + QScrollBar *hBar = horizontalScrollBar(); + QScrollBar *vBar = verticalScrollBar(); + if (g->state() == Qt::GestureStarted) + d->originalOffsetY = vBar->value(); + QPointF totalOffset = g->totalOffset(); + if (!totalOffset.isNull()) { + if (QApplication::isRightToLeft()) + totalOffset.rx() *= -1; + // QPlainTextEdit scrolls by lines only in vertical direction + QFontMetrics fm(document()->defaultFont()); + int lineHeight = fm.height(); + int newX = hBar->value() - g->lastOffset().x(); + int newY = d->originalOffsetY - totalOffset.y()/lineHeight; + hBar->setValue(newX); + vBar->setValue(newY); + } + } + return true; + } return QAbstractScrollArea::event(e); } @@ -2929,30 +2952,6 @@ QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() cons (\a available is true) or unavailable (\a available is false). */ -//void QPlainTextEditPrivate::_q_gestureTriggered() -//{ -// Q_Q(QPlainTextEdit); -// QPanGesture *g = qobject_cast(q->sender()); -// if (!g) -// return; -// QScrollBar *hBar = q->horizontalScrollBar(); -// QScrollBar *vBar = q->verticalScrollBar(); -// if (g->state() == Qt::GestureStarted) -// originalOffsetY = vBar->value(); -// QSizeF totalOffset = g->totalOffset(); -// if (!totalOffset.isNull()) { -// if (QApplication::isRightToLeft()) -// totalOffset.rwidth() *= -1; -// // QPlainTextEdit scrolls by lines only in vertical direction -// QFontMetrics fm(q->document()->defaultFont()); -// int lineHeight = fm.height(); -// int newX = hBar->value() - g->lastOffset().width(); -// int newY = originalOffsetY - totalOffset.height()/lineHeight; -// hbar->setValue(newX); -// vbar->setValue(newY); -// } -//} - QT_END_NAMESPACE #include "moc_qplaintextedit.cpp" diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index f477fee..355b678 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -116,9 +116,6 @@ QTextEditPrivate::QTextEditPrivate() preferRichText = false; showCursorOnInitialShow = true; inDrag = false; -#ifdef Q_WS_WIN - setSingleFingerPanEnabled(true); -#endif } void QTextEditPrivate::createAutoBulletList() @@ -186,6 +183,9 @@ void QTextEditPrivate::init(const QString &html) #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); #endif +#ifdef Q_WS_WIN + setSingleFingerPanEnabled(true); +#endif } void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) -- cgit v0.12 From cfcfae65778f2e1e7fc3936c66689e3685f1cc77 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 28 Oct 2009 21:40:14 +0100 Subject: Modified gesture events propagation. By default if the gesture is ignored, only gestures in the started state are propagated, and accepting a gesture in the started state adds an implicit grab meaning all the following events in the gesture sequence will be delivered to that widget. This is similar to the way QTouchEvent is propagated. Also added a hint, which specifies if gestures in any state can be propagated to the widget which has enabled the hint. Reviewed-by: Thomas Zander --- src/corelib/global/qnamespace.h | 12 +++- src/corelib/global/qnamespace.qdoc | 18 ++++- src/gui/graphicsview/qgraphicsscene.cpp | 13 +++- src/gui/kernel/qapplication.cpp | 7 +- src/gui/kernel/qgesturemanager.cpp | 16 ++++- tests/auto/gestures/tst_gestures.cpp | 121 +++++++++++++++++++++++++------- 6 files changed, 150 insertions(+), 37 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index aeaca54..561ffc1 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1715,14 +1715,19 @@ public: LastGestureType = ~0u }; - enum GestureContext + enum GestureContextFlag { WidgetGesture = 0, WidgetWithChildrenGesture = 3, - ItemGesture = WidgetGesture, - ItemWithChildrenGesture = WidgetWithChildrenGesture + ItemGesture = WidgetGesture, + ItemWithChildrenGesture = WidgetWithChildrenGesture, + + GestureContext_Mask = 0x00ff, + AcceptPartialGesturesHint = 0x0100, + GestureContextHint_Mask = 0xff00 }; + Q_DECLARE_FLAGS(GestureContext, GestureContextFlag) enum NavigationMode { @@ -1757,6 +1762,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MatchFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TextInteractionFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodHints) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TouchPointStates) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureContext) typedef bool (*qInternalCallback)(void **); diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 3fcbe57..f2a8882 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2917,11 +2917,11 @@ QApplication::registerGestureRecognizer() function which generates a custom gesture ID in the range of values from CustomGesture to LastGestureType. - \sa QGesture, QWidget::grabGesture() + \sa QGesture, QWidget::grabGesture(), QGraphicsObject::grabGesture() */ /*! - \enum Qt::GestureContext + \enum Qt::GestureContextFlag \since 4.6 This enum type describes the context of a gesture. @@ -2937,7 +2937,19 @@ \value ItemWithChildrenGesture Gestures can start on the item or over any of its children. - \sa QWidget::grabGesture() + \value AcceptPartialGesturesHint Allows any ignored gesture events to be + propagated to parent widgets which have specified this hint. By default + only gestures that are in the Qt::GestureStarted state are propagated and + the widget only gets the full gesture sequence starting with a gesture in + the Qt::GestureStarted state and ending with a gesture in the + Qt::GestureFinished or Qt::GestureCanceled states. + + \value GestureContext_Mask A mask for extracting the context type of the + context flags. + \value GestureContextHint_Mask A mask for extracting additional hints for + the context. + + \sa QWidget::grabGesture(), QGraphicsObject::grabGesture() */ /*! diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 9279fe3..f5bb408 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5900,7 +5900,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func(); foreach(QGesture *g, alreadyIgnoredGestures) { - if (gid->gestureContext.contains(g->gestureType())) + QMap::iterator contextit = + gid->gestureContext.find(g->gestureType()); + bool deliver = contextit != gid->gestureContext.end() && + (g->state() == Qt::GestureStarted || + (contextit.value() & Qt::GestureContextHint_Mask) & Qt::AcceptPartialGesturesHint); + if (deliver) gestures += g; } if (gestures.isEmpty()) @@ -5913,8 +5918,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) sendEvent(item, &ev); QSet ignoredGestures; foreach (QGesture *g, gestures) { - if (!ev.isAccepted() && !ev.isAccepted(g)) + if (!ev.isAccepted() && !ev.isAccepted(g)) { ignoredGestures.insert(g); + } else { + if (g->state() == Qt::GestureStarted) + gestureTargets[g] = item; + } } if (!ignoredGestures.isEmpty()) { // get a list of items under the (current) hotspot of each ignored diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 06787eb..b9e7d52 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4161,7 +4161,12 @@ bool QApplication::notify(QObject *receiver, QEvent *e) for (int i = 0; i < allGestures.size();) { QGesture *g = allGestures.at(i); Qt::GestureType type = g->gestureType(); - if (wd->gestureContext.contains(type)) { + QMap::iterator contextit = + wd->gestureContext.find(type); + bool deliver = contextit != wd->gestureContext.end() && + (g->state() == Qt::GestureStarted || w == receiver || + (contextit.value() & Qt::GestureContextHint_Mask) & Qt::AcceptPartialGesturesHint); + if (deliver) { allGestures.removeAt(i); gestures.append(g); } else { diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 318d4b5..e4a1eb4 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -448,7 +448,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) { for (ContextIterator it = w->d_func()->gestureContext.begin(), e = w->d_func()->gestureContext.end(); it != e; ++it) { - if (it.value() == Qt::WidgetWithChildrenGesture) { + if ((it.value() & Qt::GestureContext_Mask) == Qt::WidgetWithChildrenGesture) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(w, it.key()); @@ -482,7 +482,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) typedef QMap::const_iterator ContextIterator; for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { - if (it.value() == Qt::ItemWithChildrenGesture) { + if ((it.value() & Qt::GestureContext_Mask) == Qt::ItemWithChildrenGesture) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(item, it.key()); @@ -525,7 +525,7 @@ void QGestureManager::getGestureTargets(const QSet &gestures, = w->d_func()->gestureContext.find(type); if (it != w->d_func()->gestureContext.end()) { // i.e. 'w' listens to gesture 'type' - Qt::GestureContext context = it.value(); + Qt::GestureContext context = it.value() & Qt::GestureContext_Mask; if (context == Qt::WidgetWithChildrenGesture && w != widget) { // conflicting gesture! (*conflicts)[widget].append(gestures[widget]); @@ -645,6 +645,16 @@ void QGestureManager::deliverEvents(const QSet &gestures, << "gestures:" << it.value(); QGestureEvent event(it.value()); QApplication::sendEvent(it.key(), &event); + bool eventAccepted = event.isAccepted(); + foreach (QGesture *gesture, event.allGestures()) { + if (gesture->state() == Qt::GestureStarted && + (eventAccepted || event.isAccepted(gesture))) { + QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0); + Q_ASSERT(w); + DEBUG() << "started gesture was delivered and accepted by" << w; + m_gestureTargets[gesture] = w; + } + } } } } diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 79de823..9b2bc57 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -543,7 +543,9 @@ void tst_Gestures::conflictingGestures() parent.reset(); child->reset(); - // nobody accepts the override, we will send normal events to the closest context (to the child) + // nobody accepts the override, we will send normal events to the closest + // context (i.e. to the child widget) and it will be propagated and + // accepted by the parent widget parent.acceptGestureOverride = false; child->acceptGestureOverride = false; child->ignoredGestures << CustomGesture::GestureType; @@ -552,6 +554,41 @@ void tst_Gestures::conflictingGestures() sendCustomGesture(&event, child); QCOMPARE(child->gestureOverrideEventsReceived, 1); + QCOMPARE(child->gestureEventsReceived, 1); + QCOMPARE(parent.gestureOverrideEventsReceived, 1); + QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); + + parent.reset(); + child->reset(); + + // nobody accepts the override, and nobody accepts the gesture event + parent.acceptGestureOverride = false; + child->acceptGestureOverride = false; + parent.ignoredGestures << CustomGesture::GestureType; + child->ignoredGestures << CustomGesture::GestureType; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(&event, child); + + QCOMPARE(child->gestureOverrideEventsReceived, 1); + QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureOverrideEventsReceived, 1); + QCOMPARE(parent.gestureEventsReceived, 1); + + parent.reset(); + child->reset(); + + // we set an attribute to make sure all gesture events are propagated + parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint); + parent.acceptGestureOverride = false; + child->acceptGestureOverride = false; + parent.ignoredGestures << CustomGesture::GestureType; + child->ignoredGestures << CustomGesture::GestureType; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(&event, child); + + QCOMPARE(child->gestureOverrideEventsReceived, 1); QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(parent.gestureOverrideEventsReceived, 1); QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); @@ -851,7 +888,7 @@ void tst_Gestures::graphicsItemTreeGesture() QCOMPARE(item1_child2->gestureEventsReceived, 0); QCOMPARE(item1_child2->gestureOverrideEventsReceived, 0); QCOMPARE(item1->gestureOverrideEventsReceived, 1); - QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureEventsReceived, 1); } void tst_Gestures::explicitGraphicsObjectTarget() @@ -966,7 +1003,39 @@ void tst_Gestures::gestureOverChildGraphicsItem() event.hasHotSpot = true; sendCustomGesture(&event, item0, &scene); - QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item2_child1->gestureEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item2->gestureEventsReceived, 1); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + + item0->reset(); item1->reset(); item2->reset(); item2_child1->reset(); + item2->grabGesture(CustomGesture::GestureType); + item2->ignoredGestures << CustomGesture::GestureType; + item1->ignoredGestures << CustomGesture::GestureType; + + event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + + QCOMPARE(item2_child1->gestureEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, 1); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + + item0->reset(); item1->reset(); item2->reset(); item2_child1->reset(); + item2->grabGesture(CustomGesture::GestureType); + item2->ignoredGestures << CustomGesture::GestureType; + item1->ignoredGestures << CustomGesture::GestureType; + item1->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint); + + event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + QCOMPARE(item2_child1->gestureEventsReceived, 0); QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); @@ -1025,15 +1094,16 @@ void tst_Gestures::multipleGesturesInTree() Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1 3] - A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | - B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // B [ 2 3] - B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | - C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // C [1 2 3] - C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // | - C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // D [1 3] - D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); + Qt::GestureContext context = Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint; + A->grabGesture(FirstGesture, context); // A [1 3] + A->grabGesture(ThirdGesture, context); // | + B->grabGesture(SecondGesture, context); // B [ 2 3] + B->grabGesture(ThirdGesture, context); // | + C->grabGesture(FirstGesture, context); // C [1 2 3] + C->grabGesture(SecondGesture, context); // | + C->grabGesture(ThirdGesture, context); // D [1 3] + D->grabGesture(FirstGesture, context); + D->grabGesture(ThirdGesture, context); // make sure all widgets ignore events, so they get propagated. A->ignoredGestures << FirstGesture << ThirdGesture; @@ -1100,19 +1170,20 @@ void tst_Gestures::multipleGesturesInComplexTree() Qt::GestureType SixthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); Qt::GestureType SeventhGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1,3,4] - A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | - A->grabGesture(FourthGesture, Qt::WidgetWithChildrenGesture); // B [2,3,5] - B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // | - B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // C [1,2,3,6] - B->grabGesture(FifthGesture, Qt::WidgetWithChildrenGesture); // | - C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // D [1,3,7] - C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); - C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); - C->grabGesture(SixthGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(SeventhGesture, Qt::WidgetWithChildrenGesture); + Qt::GestureContext context = Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint; + A->grabGesture(FirstGesture, context); // A [1,3,4] + A->grabGesture(ThirdGesture, context); // | + A->grabGesture(FourthGesture, context); // B [2,3,5] + B->grabGesture(SecondGesture, context); // | + B->grabGesture(ThirdGesture, context); // C [1,2,3,6] + B->grabGesture(FifthGesture, context); // | + C->grabGesture(FirstGesture, context); // D [1,3,7] + C->grabGesture(SecondGesture, context); + C->grabGesture(ThirdGesture, context); + C->grabGesture(SixthGesture, context); + D->grabGesture(FirstGesture, context); + D->grabGesture(ThirdGesture, context); + D->grabGesture(SeventhGesture, context); // make sure all widgets ignore events, so they get propagated. QSet allGestureTypes; -- cgit v0.12 From 93e9bc06427c6a8e1b6d6f939cf53ae5c95e0827 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 2 Nov 2009 19:26:44 +0100 Subject: Gesture api review. Changes to the gesture api after the review. Reviewed-by: Jasmin Blanchette --- doc/src/frameworks-technologies/gestures.qdoc | 14 +- examples/gestures/imagegestures/imagewidget.cpp | 6 +- src/corelib/global/qnamespace.h | 17 +- src/corelib/global/qnamespace.qdoc | 36 ++-- src/gui/graphicsview/qgraphicsitem.cpp | 6 +- src/gui/graphicsview/qgraphicsitem.h | 2 +- src/gui/graphicsview/qgraphicsitem_p.h | 2 +- src/gui/graphicsview/qgraphicsscene.cpp | 16 +- src/gui/kernel/qapplication.cpp | 54 +----- src/gui/kernel/qapplication.h | 4 - src/gui/kernel/qapplication_p.h | 2 - src/gui/kernel/qevent.cpp | 22 ++- src/gui/kernel/qevent.h | 4 +- src/gui/kernel/qgesture.cpp | 89 +++++---- src/gui/kernel/qgesture.h | 21 +- src/gui/kernel/qgesture_p.h | 10 +- src/gui/kernel/qgesturemanager.cpp | 44 +++-- src/gui/kernel/qgesturemanager_p.h | 3 +- src/gui/kernel/qgesturerecognizer.cpp | 86 ++++++--- src/gui/kernel/qgesturerecognizer.h | 25 ++- src/gui/kernel/qstandardgestures.cpp | 63 +++--- src/gui/kernel/qstandardgestures_p.h | 9 +- src/gui/kernel/qwidget.cpp | 8 +- src/gui/kernel/qwidget.h | 2 +- src/gui/kernel/qwidget_p.h | 2 +- src/gui/widgets/qplaintextedit.cpp | 8 +- tests/auto/gestures/tst_gestures.cpp | 212 ++++++++++----------- tests/manual/gestures/graphicsview/gestures.cpp | 24 +-- tests/manual/gestures/graphicsview/gestures.h | 8 +- tests/manual/gestures/graphicsview/main.cpp | 10 +- .../graphicsview/mousepangesturerecognizer.cpp | 25 +-- .../graphicsview/mousepangesturerecognizer.h | 4 +- tests/manual/gestures/scrollarea/main.cpp | 20 +- .../scrollarea/mousepangesturerecognizer.cpp | 25 +-- .../scrollarea/mousepangesturerecognizer.h | 4 +- 35 files changed, 441 insertions(+), 446 deletions(-) diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index f64e301..2fa8dab 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -122,7 +122,7 @@ \section2 Filtering Input Events - The \l{QGestureRecognizer::}{filterEvent()} function must be reimplemented. + The \l{QGestureRecognizer::}{recognize()} function must be reimplemented. This function handles and filters the incoming input events for the target objects and determines whether or not they correspond to the gesture the recognizer is looking for. @@ -132,15 +132,15 @@ persistent information about the state of the recognition process in the QGesture object supplied. - Your \l{QGestureRecognizer::}{filterEvent()} function must return a value of - Qt::GestureState that indicates the state of recognition for a given gesture and + Your \l{QGestureRecognizer::}{recognize()} function must return a value of + QGestureRecognizer::Result that indicates the state of recognition for a given gesture and target object. This determines whether or not a gesture event will be delivered to a target object. \section2 Custom Gestures If you choose to represent a gesture by a custom QGesture subclass, you will need to - reimplement the \l{QGestureRecognizer::}{createGesture()} function to construct + reimplement the \l{QGestureRecognizer::}{create()} function to construct instances of your gesture class instead of standard QGesture instances. Alternatively, you may want to use standard QGesture instances, but add additional dynamic properties to them to express specific details of the gesture you want to handle. @@ -152,7 +152,7 @@ \l{QGestureRecognizer::}{reset()} function to perform these special tasks. Note that QGesture objects are only created once for each combination of target object - and gesture type, and they are reused every time the user attempts to perform the + and gesture type, and they might be reused every time the user attempts to perform the same gesture type on the target object. As a result, it can be useful to reimplement the \l{QGestureRecognizer::}{reset()} function to clean up after each previous attempt at recognizing a gesture. @@ -162,8 +162,8 @@ To use a gesture recognizer, construct an instance of your QGestureRecognizer subclass, and register it with the application with - QApplication::registerGestureRecognizer(). A recognizer for a given type of - gesture can be removed with QApplication::unregisterGestureRecognizer(). + QGestureRecognizer::registerRecognizer(). A recognizer for a given type of + gesture can be removed with QGestureRecognizer::unregisterRecognizer(). \section1 Further Reading diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index c798fcc..da9daae 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -132,13 +132,13 @@ void ImageWidget::panTriggered(QPanGesture *gesture) void ImageWidget::pinchTriggered(QPinchGesture *gesture) { - QPinchGesture::WhatChanged whatChanged = gesture->whatChanged(); - if (whatChanged & QPinchGesture::RotationAngleChanged) { + QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags(); + if (changeFlags & QPinchGesture::RotationAngleChanged) { qreal value = gesture->property("rotationAngle").toReal(); qreal lastValue = gesture->property("lastRotationAngle").toReal(); rotationAngle += value - lastValue; } - if (whatChanged & QPinchGesture::ScaleFactorChanged) { + if (changeFlags & QPinchGesture::ScaleFactorChanged) { qreal value = gesture->property("scaleFactor").toReal(); qreal lastValue = gesture->property("lastScaleFactor").toReal(); scaleFactor += value - lastValue; diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 561ffc1..efa6cc7 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1715,19 +1715,12 @@ public: LastGestureType = ~0u }; - enum GestureContextFlag + enum GestureFlag { - WidgetGesture = 0, - WidgetWithChildrenGesture = 3, - - ItemGesture = WidgetGesture, - ItemWithChildrenGesture = WidgetWithChildrenGesture, - - GestureContext_Mask = 0x00ff, - AcceptPartialGesturesHint = 0x0100, - GestureContextHint_Mask = 0xff00 + DontStartGestureOnChildren = 0x01, + ReceivePartialGestures = 0x02 }; - Q_DECLARE_FLAGS(GestureContext, GestureContextFlag) + Q_DECLARE_FLAGS(GestureFlags, GestureFlag) enum NavigationMode { @@ -1762,7 +1755,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MatchFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TextInteractionFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodHints) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TouchPointStates) -Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureContext) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureFlags) typedef bool (*qInternalCallback)(void **); diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f2a8882..a00a72b 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2910,45 +2910,35 @@ \value PanGesture A Pan gesture. \value PinchGesture A Pinch gesture. \value SwipeGesture A Swipe gesture. - \value CustomGesture User-defined gesture ID. - \value LastGestureType Last user gesture ID. + \value CustomGesture A flag that can be used to test if the gesture is a + user-defined gesture ID. + \omitvalue LastGestureType User-defined gestures are registered with the - QApplication::registerGestureRecognizer() function which generates a custom gesture ID - in the range of values from CustomGesture to LastGestureType. + QGestureRecognizer::registerRecognizer() function which generates a custom + gesture ID with the Qt::CustomGesture flag set. \sa QGesture, QWidget::grabGesture(), QGraphicsObject::grabGesture() */ /*! - \enum Qt::GestureContextFlag + \enum Qt::GestureFlag \since 4.6 - This enum type describes the context of a gesture. + This enum type describes additional flags that can be used when subscribing + to a gesture. - For a QGesture to trigger, the gesture recognizer should filter events for - a widget tree. This enum describes for which widget the gesture recognizer - should filter events: + \value DontStartGestureOnChildren By default gestures can start on the + widget or over any of its children. Use this flag to disable this and allow + a gesture to start on the widget only. - \value WidgetGesture Gestures can only start over the widget itself. - \value WidgetWithChildrenGesture Gestures can start on the widget or over - any of its children. - \value ItemGesture Gestures can only start over the item itself. - \value ItemWithChildrenGesture Gestures can start on the item or over - any of its children. - - \value AcceptPartialGesturesHint Allows any ignored gesture events to be + \value ReceivePartialGestures Allows any ignored gesture events to be propagated to parent widgets which have specified this hint. By default only gestures that are in the Qt::GestureStarted state are propagated and - the widget only gets the full gesture sequence starting with a gesture in + the widget always gets the full gesture sequence starting with a gesture in the Qt::GestureStarted state and ending with a gesture in the Qt::GestureFinished or Qt::GestureCanceled states. - \value GestureContext_Mask A mask for extracting the context type of the - context flags. - \value GestureContextHint_Mask A mask for extracting additional hints for - the context. - \sa QWidget::grabGesture(), QGraphicsObject::grabGesture() */ diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 58d7e7d..72f08d5 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7320,14 +7320,14 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent } /*! - Subscribes the graphics object to the given \a gesture for the specified \a context. + Subscribes the graphics object to the given \a gesture with specific \a flags. \sa ungrabGesture(), QGestureEvent */ -void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) +void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) { QGraphicsItemPrivate * const d = QGraphicsItem::d_func(); - d->gestureContext.insert(gesture, context); + d->gestureContext.insert(gesture, flags); (void)QGestureManager::instance(); // create a gesture manager } diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index fc180f3..f091e34 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -555,7 +555,7 @@ public: using QObject::children; #endif - void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::ItemWithChildrenGesture); + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); void ungrabGesture(Qt::GestureType type); Q_SIGNALS: diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 183e95b..90e4631 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -453,7 +453,7 @@ public: QGraphicsItem *focusScopeItem; Qt::InputMethodHints imHints; QGraphicsItem::PanelModality panelModality; - QMap gestureContext; + QMap gestureContext; // Packed 32 bits quint32 acceptedMouseButtons : 5; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index f5bb408..aed2837 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1060,9 +1060,8 @@ bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event) bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event) { if (QGraphicsObject *object = item->toGraphicsObject()) { - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - if (qAppPriv->gestureManager) { - if (qAppPriv->gestureManager->filterEvent(object, event)) + if (qt_gestureManager) { + if (qt_gestureManager->filterEvent(object, event)) return true; } } @@ -5761,7 +5760,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QWidget *viewport = event->widget(); if (!viewport) return; - QList allGestures = event->allGestures(); + QList allGestures = event->gestures(); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" << "Delivering gestures:" << allGestures; @@ -5900,11 +5899,11 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func(); foreach(QGesture *g, alreadyIgnoredGestures) { - QMap::iterator contextit = + QMap::iterator contextit = gid->gestureContext.find(g->gestureType()); bool deliver = contextit != gid->gestureContext.end() && (g->state() == Qt::GestureStarted || - (contextit.value() & Qt::GestureContextHint_Mask) & Qt::AcceptPartialGesturesHint); + (contextit.value() & Qt::ReceivePartialGestures)); if (deliver) gestures += g; } @@ -6046,10 +6045,9 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidge } } - QGestureManager *gm = QApplicationPrivate::instance()->gestureManager; - Q_ASSERT(gm); // it would be very odd if we got called without a manager. + Q_ASSERT(qt_gestureManager); // it would be very odd if we got called without a manager. for (setIter = canceledGestures.begin(); setIter != canceledGestures.end(); ++setIter) { - gm->recycle(*setIter); + qt_gestureManager->recycle(*setIter); gestureTargets.remove(*setIter); } } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index b9e7d52..60ab05a 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -154,14 +154,6 @@ bool QApplicationPrivate::autoSipEnabled = false; bool QApplicationPrivate::autoSipEnabled = true; #endif -QGestureManager* QGestureManager::instance() -{ - QApplicationPrivate *d = qApp->d_func(); - if (!d->gestureManager) - d->gestureManager = new QGestureManager(qApp); - return d->gestureManager; -} - QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type) : QCoreApplicationPrivate(argc, argv) { @@ -185,7 +177,6 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T directPainters = 0; #endif - gestureManager = 0; gestureWidget = 0; if (!self) @@ -3632,12 +3623,12 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } // walk through parents and check for gestures - if (d->gestureManager) { + if (qt_gestureManager) { if (receiver->isWidgetType()) { - if (d->gestureManager->filterEvent(static_cast(receiver), e)) + if (qt_gestureManager->filterEvent(static_cast(receiver), e)) return true; } else if (QGesture *gesture = qobject_cast(receiver)) { - if (d->gestureManager->filterEvent(gesture, e)) + if (qt_gestureManager->filterEvent(gesture, e)) return true; } } @@ -4150,7 +4141,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) if (receiver->isWidgetType()) { QWidget *w = static_cast(receiver); QGestureEvent *gestureEvent = static_cast(e); - QList allGestures = gestureEvent->allGestures(); + QList allGestures = gestureEvent->gestures(); bool eventAccepted = gestureEvent->isAccepted(); bool wasAccepted = eventAccepted; @@ -4161,11 +4152,11 @@ bool QApplication::notify(QObject *receiver, QEvent *e) for (int i = 0; i < allGestures.size();) { QGesture *g = allGestures.at(i); Qt::GestureType type = g->gestureType(); - QMap::iterator contextit = + QMap::iterator contextit = wd->gestureContext.find(type); bool deliver = contextit != wd->gestureContext.end() && (g->state() == Qt::GestureStarted || w == receiver || - (contextit.value() & Qt::GestureContextHint_Mask) & Qt::AcceptPartialGesturesHint); + (contextit.value() & Qt::ReceivePartialGestures)); if (deliver) { allGestures.removeAt(i); gestures.append(g); @@ -5616,39 +5607,6 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints); } -/*! - \since 4.6 - - Registers the given \a recognizer in the gesture framework and returns a gesture ID - for it. - - The application takes ownership of the \a recognizer and returns the gesture type - ID associated with it. For gesture recognizers which handle custom QGesture - objects (i.e., those which return Qt::CustomGesture in a QGesture::gestureType() - function) the return value is a gesture ID between Qt::CustomGesture and - Qt::LastGestureType, inclusive. - - \sa unregisterGestureRecognizer(), QGestureRecognizer::createGesture(), QGesture -*/ -Qt::GestureType QApplication::registerGestureRecognizer(QGestureRecognizer *recognizer) -{ - return QGestureManager::instance()->registerGestureRecognizer(recognizer); -} - -/*! - \since 4.6 - - Unregisters all gesture recognizers of the specified \a type. - - \sa registerGestureRecognizer() -*/ -void QApplication::unregisterGestureRecognizer(Qt::GestureType type) -{ - QApplicationPrivate *d = qApp->d_func(); - if (d->gestureManager) - d->gestureManager->unregisterGestureRecognizer(type); -} - QT_END_NAMESPACE #include "moc_qapplication.cpp" diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 5877ba4..e8c1281 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -86,7 +86,6 @@ class QSymbianEvent; class QApplication; class QApplicationPrivate; -class QGestureRecognizer; #if defined(qApp) #undef qApp #endif @@ -288,9 +287,6 @@ public: static Qt::NavigationMode navigationMode(); #endif - static Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer); - static void unregisterGestureRecognizer(Qt::GestureType type); - Q_SIGNALS: void lastWindowClosed(); void focusChanged(QWidget *old, QWidget *now); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 2c57238..8df4d08 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -84,7 +84,6 @@ class QInputContext; class QObject; class QWidget; class QSocketNotifier; -class QGestureManager; extern bool qt_is_gui_used; #ifndef QT_NO_CLIPBOARD @@ -510,7 +509,6 @@ public: void sendSyntheticEnterLeave(QWidget *widget); #endif - QGestureManager *gestureManager; QWidget *gestureWidget; QMap widgetForTouchPointId; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 6757fa2..763b681 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4202,7 +4202,7 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T \brief The QGestureEvent class provides the description of triggered gestures. The QGestureEvent class contains a list of gestures, which can be obtained using the - allGestures() function. + gestures() function. The gestures are either active or canceled. A list of those that are currently being executed can be obtained using the activeGestures() function. A list of those which @@ -4211,10 +4211,11 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T focus, for example, or because of a timeout, or for other reasons. If the event handler does not accept the event by calling the generic - QEvent::accept() function, all individual QGesture object that were not accepted - will be propagated up the parent widget chain until a widget accepts them - individually, by calling QGestureEvent::accept() for each of them, or an event - filter consumes the event. + QEvent::accept() function, all individual QGesture object that were not + accepted and in the Qt::GestureStarted state will be propagated up the + parent widget chain until a widget accepts them individually, by calling + QGestureEvent::accept() for each of them, or an event filter consumes the + event. \sa QGesture, QGestureRecognizer, QWidget::grabGesture(), QGraphicsObject::grabGesture() @@ -4240,7 +4241,7 @@ QGestureEvent::~QGestureEvent() /*! Returns all gestures that are delivered in the event. */ -QList QGestureEvent::allGestures() const +QList QGestureEvent::gestures() const { return d_func()->gestures; } @@ -4417,11 +4418,16 @@ QWidget *QGestureEvent::widget() const } /*! - Returns the scene-local coordinates if the \a gesturePoint is inside a graphics view. + Returns the scene-local coordinates if the \a gesturePoint is inside a + graphics view. + + This functional might be useful when the gesture event is delivered to a + QGraphicsObject to translate a point in screen coordinates to scene-local + coordinates. \sa QPointF::isNull(). */ -QPointF QGestureEvent::mapToScene(const QPointF &gesturePoint) const +QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const { QWidget *w = widget(); if (w) // we get the viewport as widget, not the graphics view diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index fb245c0..dfd0f33 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -827,7 +827,7 @@ public: QGestureEvent(const QList &gestures); ~QGestureEvent(); - QList allGestures() const; + QList gestures() const; QGesture *gesture(Qt::GestureType type) const; QList activeGestures() const; @@ -859,7 +859,7 @@ public: void setWidget(QWidget *widget); QWidget *widget() const; - QPointF mapToScene(const QPointF &gesturePoint) const; + QPointF mapToGraphicsScene(const QPointF &gesturePoint) const; private: QGestureEventPrivate *d_func(); diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index df99746..e322af2 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE Gesture objects are not constructed directly by developers. They are created by the QGestureRecognizer object that is registered with the application; see - QApplication::registerGestureRecognizer(). + QGestureRecognizer::registerRecognizer(). \section1 Gesture Properties @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE destroy particular instances of them and create new ones to replace them. The registered gesture recognizer monitors the input events for the target - object via its \l{QGestureRecognizer::}{filterEvent()} function, updating the + object via its \l{QGestureRecognizer::}{recognize()} function, updating the properties of the gesture object as required. The gesture object may be delivered to the target object in a QGestureEvent if @@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE Constructs a new gesture object with the given \a parent. QGesture objects are created by gesture recognizers in the - QGestureRecognizer::createGesture() function. + QGestureRecognizer::create() function. */ QGesture::QGesture(QObject *parent) : QObject(*new QGesturePrivate, parent) @@ -129,7 +129,7 @@ QGesture::~QGesture() \brief The point that is used to find the receiver for the gesture event. The hot-spot is a point in the global coordinate system, use - QWidget::mapFromGlobal() or QGestureEvent::mapToScene() to get a + QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a local hot-spot. The hot-spot should be set by the gesture recognizer to allow gesture event @@ -180,8 +180,10 @@ void QGesture::unsetHotSpot() automatically. \value CancelNone On accepting this gesture no other gestures will be affected. - \value CancelAllInContext On accepting this gesture all gestures that are active - in the context (Qt::GestureContext) will be cancelled. + + \value CancelAllInContext On accepting this gesture all gestures that are + active in the context (respecting the Qt::GestureFlag that were specified + when subscribed to the gesture) will be cancelled. */ void QGesture::setGestureCancelPolicy(GestureCancelPolicy policy) @@ -208,15 +210,6 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const */ /*! - \property QPanGesture::totalOffset - \brief the total offset from the first input position to the current input - position - - The total offset measures the total change in position of the user's input - covered by the gesture on the input device. -*/ - -/*! \property QGesture::gestureCancelPolicy \brief the policy for deciding what happens on accepting a gesture @@ -241,11 +234,19 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const /*! \property QPanGesture::offset - \brief the offset from the previous input position to the current input + \brief the total offset from the first input position to the current input position - The offset measures the change in position of the user's input on the - input device. + The offset measures the total change in position of the user's input + covered by the gesture on the input device. +*/ + +/*! + \property QPanGesture::delta + \brief the offset from the previous input position to the current input + + This is essentially the same as the difference between offset() and + lastOffset(). */ /*! @@ -261,10 +262,6 @@ QPanGesture::QPanGesture(QObject *parent) d_func()->gestureType = Qt::PanGesture; } -QPointF QPanGesture::totalOffset() const -{ - return d_func()->totalOffset; -} QPointF QPanGesture::lastOffset() const { @@ -276,15 +273,15 @@ QPointF QPanGesture::offset() const return d_func()->offset; } -qreal QPanGesture::acceleration() const +QPointF QPanGesture::delta() const { - return d_func()->acceleration; + Q_D(const QPanGesture); + return d->offset - d->lastOffset; } - -void QPanGesture::setTotalOffset(const QPointF &value) +qreal QPanGesture::acceleration() const { - d_func()->totalOffset = value; + return d_func()->acceleration; } void QPanGesture::setLastOffset(const QPointF &value) @@ -326,7 +323,7 @@ void QPanGesture::setAcceleration(qreal value) */ /*! - \enum QPinchGesture::WhatChange + \enum QPinchGesture::ChangeFlag This enum describes the changes that can occur to the properties of the gesture object. @@ -335,19 +332,30 @@ void QPanGesture::setAcceleration(qreal value) \value RotationAngleChanged The rotation angle held by rotationAngle changed. \value CenterPointChanged The center point held by centerPoint changed. - \sa whatChanged + \sa changeFlags, totalChangeFlags +*/ + +/*! + \property QPinchGesture::totalChangeFlags + \brief the property of the gesture that has change + + This property indicates which of the other properties has changed since the + gesture has started. You can use this information to determine which aspect + of your user interface needs to be updated. + + \sa changeFlags, scaleFactor, rotationAngle, centerPoint */ /*! - \property QPinchGesture::whatChanged - \brief the property of the gesture that has changed + \property QPinchGesture::changeFlags + \brief the property of the gesture that has changed in the current step This property indicates which of the other properties has changed since the previous gesture event included information about this gesture. You can use this information to determine which aspect of your user interface needs to be updated. - \sa scaleFactor, rotationAngle, centerPoint + \sa totalChangeFlags, scaleFactor, rotationAngle, centerPoint */ /*! @@ -441,16 +449,25 @@ QPinchGesture::QPinchGesture(QObject *parent) d_func()->gestureType = Qt::PinchGesture; } -QPinchGesture::WhatChanged QPinchGesture::whatChanged() const +QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const +{ + return d_func()->totalChangeFlags; +} + +void QPinchGesture::setTotalChangeFlags(QPinchGesture::ChangeFlags value) { - return d_func()->whatChanged; + d_func()->totalChangeFlags = value; } -void QPinchGesture::setWhatChanged(QPinchGesture::WhatChanged value) +QPinchGesture::ChangeFlags QPinchGesture::changeFlags() const { - d_func()->whatChanged = value; + return d_func()->changeFlags; } +void QPinchGesture::setChangeFlags(QPinchGesture::ChangeFlags value) +{ + d_func()->changeFlags = value; +} QPointF QPinchGesture::startCenterPoint() const { diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 8614ecb..dd322ad 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -106,20 +106,19 @@ class Q_GUI_EXPORT QPanGesture : public QGesture Q_OBJECT Q_DECLARE_PRIVATE(QPanGesture) - Q_PROPERTY(QPointF totalOffset READ totalOffset WRITE setTotalOffset) Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset) Q_PROPERTY(QPointF offset READ offset WRITE setOffset) + Q_PROPERTY(QPointF delta READ delta STORED false) Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration) public: QPanGesture(QObject *parent = 0); - QPointF totalOffset() const; QPointF lastOffset() const; QPointF offset() const; + QPointF delta() const; qreal acceleration() const; - void setTotalOffset(const QPointF &value); void setLastOffset(const QPointF &value); void setOffset(const QPointF &value); void setAcceleration(qreal value); @@ -135,14 +134,15 @@ class Q_GUI_EXPORT QPinchGesture : public QGesture Q_DECLARE_PRIVATE(QPinchGesture) public: - enum WhatChange { + enum ChangeFlag { ScaleFactorChanged = 0x1, RotationAngleChanged = 0x2, CenterPointChanged = 0x4 }; - Q_DECLARE_FLAGS(WhatChanged, WhatChange) + Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) - Q_PROPERTY(WhatChanged whatChanged READ whatChanged WRITE setWhatChanged) + Q_PROPERTY(ChangeFlags totalChangeFlags READ totalChangeFlags WRITE setTotalChangeFlags) + Q_PROPERTY(ChangeFlags changeFlags READ changeFlags WRITE setChangeFlags) Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor) Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor) @@ -159,8 +159,11 @@ public: public: QPinchGesture(QObject *parent = 0); - WhatChanged whatChanged() const; - void setWhatChanged(WhatChanged value); + ChangeFlags totalChangeFlags() const; + void setTotalChangeFlags(ChangeFlags value); + + ChangeFlags changeFlags() const; + void setChangeFlags(ChangeFlags value); QPointF startCenterPoint() const; QPointF lastCenterPoint() const; @@ -188,7 +191,7 @@ public: QT_END_NAMESPACE -Q_DECLARE_METATYPE(QPinchGesture::WhatChanged) +Q_DECLARE_METATYPE(QPinchGesture::ChangeFlags) QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 73a6bcf..96fd64d 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -90,7 +90,6 @@ public: { } - QPointF totalOffset; QPointF lastOffset; QPointF offset; QPoint lastPosition; @@ -103,12 +102,15 @@ class QPinchGesturePrivate : public QGesturePrivate public: QPinchGesturePrivate() - : whatChanged(0), totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0), - totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0) + : totalChangeFlags(0), changeFlags(0), + totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0), + totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0), + isNewSequence(true) { } - QPinchGesture::WhatChanged whatChanged; + QPinchGesture::ChangeFlags totalChangeFlags; + QPinchGesture::ChangeFlags changeFlags; QPointF startCenterPoint; QPointF lastCenterPoint; diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index e4a1eb4..d2939f0 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -67,6 +67,15 @@ QT_BEGIN_NAMESPACE +QGestureManager *qt_gestureManager = 0; + +QGestureManager* QGestureManager::instance() +{ + if (!qt_gestureManager) + qt_gestureManager = new QGestureManager(qApp); + return qt_gestureManager; +} + QGestureManager::QGestureManager(QObject *parent) : QObject(parent), state(NotGesture), m_lastCustomGestureId(0) { @@ -99,7 +108,7 @@ QGestureManager::~QGestureManager() Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer) { - QGesture *dummy = recognizer->createGesture(0); + QGesture *dummy = recognizer->create(0); if (!dummy) { qWarning("QGestureManager::registerGestureRecognizer: " "the recognizer fails to create a gesture object, skipping registration."); @@ -179,7 +188,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni } Q_ASSERT(recognizer); - QGesture *state = recognizer->createGesture(object); + QGesture *state = recognizer->create(object); if (!state) return 0; state->setParent(this); @@ -226,18 +235,19 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHashfilterEvent(state, target, event); + QGestureRecognizer::Result result = recognizer->recognize(state, target, event); QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask; - if (type == QGestureRecognizer::GestureTriggered) { + result &= QGestureRecognizer::ResultHint_Mask; + if (type == QGestureRecognizer::TriggerGesture) { DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state; triggeredGestures << state; - } else if (type == QGestureRecognizer::GestureFinished) { + } else if (type == QGestureRecognizer::FinishGesture) { DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state; finishedGestures << state; - } else if (type == QGestureRecognizer::MaybeGesture) { + } else if (type == QGestureRecognizer::MayBeGesture) { DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state; newMaybeGestures << state; - } else if (type == QGestureRecognizer::NotGesture) { + } else if (type == QGestureRecognizer::CancelGesture) { DEBUG() << "QGestureManager:Recognizer: not gesture: " << state; notGestures << state; } else if (type == QGestureRecognizer::Ignore) { @@ -434,7 +444,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) QSet types; QMultiHash contexts; QWidget *w = receiver; - typedef QMap::const_iterator ContextIterator; + typedef QMap::const_iterator ContextIterator; if (!w->d_func()->gestureContext.isEmpty()) { for(ContextIterator it = w->d_func()->gestureContext.begin(), e = w->d_func()->gestureContext.end(); it != e; ++it) { @@ -448,7 +458,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) { for (ContextIterator it = w->d_func()->gestureContext.begin(), e = w->d_func()->gestureContext.end(); it != e; ++it) { - if ((it.value() & Qt::GestureContext_Mask) == Qt::WidgetWithChildrenGesture) { + if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(w, it.key()); @@ -468,7 +478,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) QMultiHash contexts; QGraphicsObject *item = receiver; if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) { - typedef QMap::const_iterator ContextIterator; + typedef QMap::const_iterator ContextIterator; for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { types.insert(it.key()); @@ -479,10 +489,10 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) item = item->parentObject(); while (item) { - typedef QMap::const_iterator ContextIterator; + typedef QMap::const_iterator ContextIterator; for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { - if ((it.value() & Qt::GestureContext_Mask) == Qt::ItemWithChildrenGesture) { + if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(item, it.key()); @@ -521,12 +531,12 @@ void QGestureManager::getGestureTargets(const QSet &gestures, foreach (QWidget *widget, gestures.keys()) { QWidget *w = widget->parentWidget(); while (w) { - QMap::const_iterator it + QMap::const_iterator it = w->d_func()->gestureContext.find(type); if (it != w->d_func()->gestureContext.end()) { // i.e. 'w' listens to gesture 'type' - Qt::GestureContext context = it.value() & Qt::GestureContext_Mask; - if (context == Qt::WidgetWithChildrenGesture && w != widget) { + Qt::GestureFlags flags = it.value(); + if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) { // conflicting gesture! (*conflicts)[widget].append(gestures[widget]); break; @@ -620,7 +630,7 @@ void QGestureManager::deliverEvents(const QSet &gestures, QApplication::sendEvent(receiver, &event); bool eventAccepted = event.isAccepted(); - foreach(QGesture *gesture, event.allGestures()) { + foreach(QGesture *gesture, event.gestures()) { if (eventAccepted || event.isAccepted(gesture)) { QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0); Q_ASSERT(w); @@ -646,7 +656,7 @@ void QGestureManager::deliverEvents(const QSet &gestures, QGestureEvent event(it.value()); QApplication::sendEvent(it.key(), &event); bool eventAccepted = event.isAccepted(); - foreach (QGesture *gesture, event.allGestures()) { + foreach (QGesture *gesture, event.gestures()) { if (gesture->state() == Qt::GestureStarted && (eventAccepted || event.isAccepted(gesture))) { QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0); diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index d60aedc..27cc8fc 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -76,7 +76,6 @@ public: bool filterEvent(QGesture *receiver, QEvent *event); bool filterEvent(QGraphicsObject *receiver, QEvent *event); - // declared in qapplication.cpp static QGestureManager* instance(); void cleanupCachedGestures(QObject *target, Qt::GestureType type); @@ -141,6 +140,8 @@ private: void cancelGesturesForChildren(QGesture *originatingGesture); }; +extern QGestureManager *qt_gestureManager; + QT_END_NAMESPACE #endif // QGESTUREMANAGER_P_H diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 2673be3..ed0bdcc 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -42,6 +42,7 @@ #include "qgesturerecognizer.h" #include "private/qgesture_p.h" +#include "private/qgesturemanager_p.h" QT_BEGIN_NAMESPACE @@ -65,12 +66,12 @@ QT_BEGIN_NAMESPACE objects, and modifying the associated QGesture objects to include relevant information about the user's input. - Gestures are created when the framework calls createGesture() to handle user input + Gestures are created when the framework calls create() to handle user input for a particular instance of a QWidget or QGraphicsObject subclass. A QGesture object is created for each widget or item that is configured to use gestures. Once a QGesture has been created for a target object, the gesture recognizer will - receive events for it in its filterEvent() handler function. + receive events for it in its recognize() handler function. When a gesture is canceled, the reset() function is called, giving the recognizer the chance to update the appropriate properties in the corresponding QGesture object. @@ -79,20 +80,22 @@ QT_BEGIN_NAMESPACE To add support for new gestures, you need to derive from QGestureRecognizer to create a custom recognizer class, construct an instance of this class, and register it with - the application by calling QApplication::registerGestureRecognizer(). You can also + the application by calling QGestureRecognizer::registerRecognizer(). You can also subclass QGesture to create a custom gesture class, or rely on dynamic properties to express specific details of the gesture you want to handle. - Your custom QGestureRecognizer subclass needs to reimplement the filterEvent() function - to handle and filter the incoming input events for QWidget and QGraphicsObject subclasses. - Although the logic for gesture recognition is implemented in this function, you can - store persistent information about the state of the recognition process in the QGesture - object supplied. The filterEvent() function must return a value of Qt::GestureState that - indicates the state of recognition for a given gesture and target object. This determines - whether or not a gesture event will be delivered to a target object. + Your custom QGestureRecognizer subclass needs to reimplement the recognize() + function to handle and filter the incoming input events for QWidget and + QGraphicsObject subclasses. Although the logic for gesture recognition is + implemented in this function, you can store persistent information about the + state of the recognition process in the QGesture object supplied. The + recognize() function must return a value of QGestureRecognizer::Result that + indicates the state of recognition for a given gesture and target object. + This determines whether or not a gesture event will be delivered to a target + object. If you choose to represent a gesture by a custom QGesture subclass, you will need to - reimplement the createGesture() function to construct instances of your gesture class. + reimplement the create() function to construct instances of your gesture class. Similarly, you may need to reimplement the reset() function if your custom gesture objects need to be specially handled when a gesture is canceled. @@ -105,37 +108,37 @@ QT_BEGIN_NAMESPACE This enum describes the result of the current event filtering step in a gesture recognizer state machine. - The result consists of a state value (one of Ignore, NotGesture, - MaybeGesture, GestureTriggered, GestureFinished) and an optional hint + The result consists of a state value (one of Ignore, MayBeGesture, + TriggerGesture, FinishGesture, CancelGesture) and an optional hint (ConsumeEventHint). \value Ignore The event does not change the state of the recognizer. - \value NotGesture The event made it clear that it is not a gesture. If the - gesture recognizer was in GestureTriggered state before, then the gesture - is canceled and the appropriate QGesture object will be delivered to the - target as a part of a QGestureEvent. - - \value MaybeGesture The event changed the internal state of the recognizer, + \value MayBeGesture The event changed the internal state of the recognizer, but it isn't clear yet if it is a gesture or not. The recognizer needs to - filter more events to decide. Gesture recognizers in the MaybeGesture state + filter more events to decide. Gesture recognizers in the MayBeGesture state may be reset automatically if they take too long to recognize gestures. - \value GestureTriggered The gesture has been triggered and the appropriate + \value TriggerGesture The gesture has been triggered and the appropriate QGesture object will be delivered to the target as a part of a QGestureEvent. - \value GestureFinished The gesture has been finished successfully and the + \value FinishGesture The gesture has been finished successfully and the appropriate QGesture object will be delivered to the target as a part of a QGestureEvent. - \value ConsumeEventHint This hint specifies that the gesture framework should - consume the filtered event and not deliver it to the receiver. + \value CancelGesture The event made it clear that it is not a gesture. If + the gesture recognizer was in GestureTriggered state before, then the + gesture is canceled and the appropriate QGesture object will be delivered + to the target as a part of a QGestureEvent. + + \value ConsumeEventHint This hint specifies that the gesture framework + should consume the filtered event and not deliver it to the receiver. \omitvalue ResultState_Mask \omitvalue ResultHint_Mask - \sa QGestureRecognizer::filterEvent() + \sa QGestureRecognizer::recognize() */ /*! @@ -159,7 +162,7 @@ QGestureRecognizer::~QGestureRecognizer() Reimplement this function to create a custom QGesture-derived gesture object if necessary. */ -QGesture *QGestureRecognizer::createGesture(QObject *target) +QGesture *QGestureRecognizer::create(QObject *target) { Q_UNUSED(target); return new QGesture; @@ -183,7 +186,7 @@ void QGestureRecognizer::reset(QGesture *gesture) } /*! - \fn QGestureRecognizer::filterEvent(QGesture *gesture, QObject *watched, QEvent *event) + \fn QGestureRecognizer::recognize(QGesture *gesture, QObject *watched, QEvent *event) Handles the given \a event for the \a watched object, updating the state of the \a gesture object as required, and returns a suitable result for the current recognition step. @@ -194,7 +197,34 @@ void QGestureRecognizer::reset(QGesture *gesture) The result reflects how much of the gesture has been recognized. The state of the \a gesture object is set depending on the result. - \sa Qt::GestureState + \sa QGestureRecognizer::Result +*/ + +/*! + Registers the given \a recognizer in the gesture framework and returns a gesture ID + for it. + + The application takes ownership of the \a recognizer and returns the gesture type + ID associated with it. For gesture recognizers which handle custom QGesture + objects (i.e., those which return Qt::CustomGesture in a QGesture::gestureType() + function) the return value is a generated gesture ID with the Qt::CustomGesture + flag set. + + \sa unregisterRecognizer(), QGestureRecognizer::create(), QGesture */ +Qt::GestureType QGestureRecognizer::registerRecognizer(QGestureRecognizer *recognizer) +{ + return QGestureManager::instance()->registerGestureRecognizer(recognizer); +} + +/*! + Unregisters all gesture recognizers of the specified \a type. + + \sa registerRecognizer() +*/ +void QGestureRecognizer::unregisterRecognizer(Qt::GestureType type) +{ + QGestureManager::instance()->unregisterGestureRecognizer(type); +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h index a3c990d..4eebf7c 100644 --- a/src/gui/kernel/qgesturerecognizer.h +++ b/src/gui/kernel/qgesturerecognizer.h @@ -43,6 +43,7 @@ #define QGESTURERECOGNIZER_H #include +#include QT_BEGIN_HEADER @@ -58,30 +59,34 @@ class Q_GUI_EXPORT QGestureRecognizer public: enum ResultFlag { - Ignore = 0x0001, - NotGesture = 0x0002, - MaybeGesture = 0x0004, - GestureTriggered = 0x0008, // Gesture started or updated - GestureFinished = 0x0010, + Ignore = 0x0001, - ResultState_Mask = 0x00ff, + MayBeGesture = 0x0002, + TriggerGesture = 0x0004, + FinishGesture = 0x0008, + CancelGesture = 0x0010, + + ResultState_Mask = 0x00ff, ConsumeEventHint = 0x0100, // StoreEventHint = 0x0200, // ReplayStoredEventsHint = 0x0400, // DiscardStoredEventsHint = 0x0800, - ResultHint_Mask = 0xff00 + ResultHint_Mask = 0xff00 }; Q_DECLARE_FLAGS(Result, ResultFlag) QGestureRecognizer(); virtual ~QGestureRecognizer(); - virtual QGesture *createGesture(QObject *target); - virtual QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event) = 0; - + virtual QGesture *create(QObject *target); + virtual Result recognize(QGesture *state, QObject *watched, + QEvent *event) = 0; virtual void reset(QGesture *state); + + static Qt::GestureType registerRecognizer(QGestureRecognizer *recognizer); + static void unregisterRecognizer(Qt::GestureType type); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGestureRecognizer::Result) diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 57cf12d..ba00a90 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -52,7 +52,7 @@ QPanGestureRecognizer::QPanGestureRecognizer() { } -QGesture *QPanGestureRecognizer::createGesture(QObject *target) +QGesture *QPanGestureRecognizer::create(QObject *target) { if (target && target->isWidgetType()) { #if defined(Q_OS_WIN) @@ -66,21 +66,21 @@ QGesture *QPanGestureRecognizer::createGesture(QObject *target) return new QPanGesture; } -QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { - QPanGesture *q = static_cast(state); + QPanGesture *q = static_cast(state); QPanGesturePrivate *d = q->d_func(); - const QTouchEvent *ev = static_cast(event); + const QTouchEvent *ev = static_cast(event); QGestureRecognizer::Result result; switch (event->type()) { case QEvent::TouchBegin: { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; QTouchEvent::TouchPoint p = ev->touchPoints().at(0); d->lastPosition = p.pos().toPoint(); - d->lastOffset = d->totalOffset = d->offset = QPointF(); + d->lastOffset = d->offset = QPointF(); break; } case QEvent::TouchEnd: { @@ -90,13 +90,12 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); d->lastOffset = d->offset; d->offset = - QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), - p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2; - d->totalOffset += d->offset; + QPointF(p1.pos().x() - p1.startPos().x() + p2.pos().x() - p2.startPos().x(), + p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2; } - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; } else { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } break; } @@ -106,14 +105,13 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); d->lastOffset = d->offset; d->offset = - QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), - p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2; - d->totalOffset += d->offset; - if (d->totalOffset.x() > 10 || d->totalOffset.y() > 10 || - d->totalOffset.x() < -10 || d->totalOffset.y() < -10) { - result = QGestureRecognizer::GestureTriggered; + QPointF(p1.pos().x() - p1.startPos().x() + p2.pos().x() - p2.startPos().x(), + p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2; + if (d->offset.x() > 10 || d->offset.y() > 10 || + d->offset.x() < -10 || d->offset.y() < -10) { + result = QGestureRecognizer::TriggerGesture; } else { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; } } break; @@ -135,7 +133,7 @@ void QPanGestureRecognizer::reset(QGesture *state) QPanGesture *pan = static_cast(state); QPanGesturePrivate *d = pan->d_func(); - d->totalOffset = d->lastOffset = d->offset = QPointF(); + d->lastOffset = d->offset = QPointF(); d->lastPosition = QPoint(); d->acceleration = 0; @@ -151,7 +149,7 @@ QPinchGestureRecognizer::QPinchGestureRecognizer() { } -QGesture *QPinchGestureRecognizer::createGesture(QObject *target) +QGesture *QPinchGestureRecognizer::create(QObject *target) { if (target && target->isWidgetType()) { static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); @@ -159,7 +157,7 @@ QGesture *QPinchGestureRecognizer::createGesture(QObject *target) return new QPinchGesture; } -QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { QPinchGesture *q = static_cast(state); QPinchGesturePrivate *d = q->d_func(); @@ -170,19 +168,19 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, switch (event->type()) { case QEvent::TouchBegin: { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; break; } case QEvent::TouchEnd: { if (q->state() != Qt::NoGesture) { - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; } else { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } break; } case QEvent::TouchUpdate: { - d->whatChanged = 0; + d->changeFlags = 0; if (ev->touchPoints().size() == 2) { QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0); QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); @@ -201,7 +199,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, d->lastCenterPoint = d->centerPoint; d->centerPoint = centerPoint; - d->whatChanged |= QPinchGesture::CenterPointChanged; + d->changeFlags |= QPinchGesture::CenterPointChanged; const qreal scaleFactor = QLineF(p1.pos(), p2.pos()).length() / QLineF(d->startPosition[0], d->startPosition[1]).length(); @@ -212,7 +210,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, } d->scaleFactor = scaleFactor; d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor; - d->whatChanged |= QPinchGesture::ScaleFactorChanged; + d->changeFlags |= QPinchGesture::ScaleFactorChanged; const qreal rotationAngle = -line.angle(); if (d->isNewSequence) @@ -221,13 +219,14 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, d->lastRotationAngle = d->rotationAngle; d->rotationAngle = rotationAngle; d->totalRotationAngle += d->rotationAngle - d->lastRotationAngle; - d->whatChanged |= QPinchGesture::RotationAngleChanged; + d->changeFlags |= QPinchGesture::RotationAngleChanged; + d->totalChangeFlags |= d->changeFlags; d->isNewSequence = false; - result = QGestureRecognizer::GestureTriggered; + result = QGestureRecognizer::TriggerGesture; } else { d->isNewSequence = true; - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; } break; } @@ -245,10 +244,10 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, void QPinchGestureRecognizer::reset(QGesture *state) { - QPinchGesture *pinch = static_cast(state); + QPinchGesture *pinch = static_cast(state); QPinchGesturePrivate *d = pinch->d_func(); - d->whatChanged = 0; + d->totalChangeFlags = d->changeFlags = 0; d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF(); d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 0; diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index 827b2a2..e6f346c 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -63,9 +63,8 @@ class QPanGestureRecognizer : public QGestureRecognizer public: QPanGestureRecognizer(); - QGesture *createGesture(QObject *target); - - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; @@ -74,9 +73,9 @@ class QPinchGestureRecognizer : public QGestureRecognizer public: QPinchGestureRecognizer(); - QGesture *createGesture(QObject *target); + QGesture *create(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 00d9a99..25284e4 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11711,20 +11711,20 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const */ /*! - Subscribes the widget to a given \a gesture with a \a context. + Subscribes the widget to a given \a gesture with specific \a flags. \sa ungrabGesture(), QGestureEvent \since 4.6 */ -void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) +void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) { Q_D(QWidget); - d->gestureContext.insert(gesture, context); + d->gestureContext.insert(gesture, flags); (void)QGestureManager::instance(); // create a gesture manager } /*! - Unsubscribes the widget to a given \a gesture type + Unsubscribes the widget from a given \a gesture type \sa grabGesture(), QGestureEvent \since 4.6 diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index fce3f09..05f0069 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -354,7 +354,7 @@ public: QGraphicsEffect *graphicsEffect() const; void setGraphicsEffect(QGraphicsEffect *effect); - void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::WidgetWithChildrenGesture); + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); void ungrabGesture(Qt::GestureType type); public Q_SLOTS: diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 616a972..dd859a7 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -631,7 +631,7 @@ public: #ifndef QT_NO_ACTION QList actions; #endif - QMap gestureContext; + QMap gestureContext; // Bit fields. uint high_attributes[3]; // the low ones are in QWidget::widget_attributes diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 0e5ee46..44feaaf 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -1458,15 +1458,15 @@ bool QPlainTextEdit::event(QEvent *e) QScrollBar *vBar = verticalScrollBar(); if (g->state() == Qt::GestureStarted) d->originalOffsetY = vBar->value(); - QPointF totalOffset = g->totalOffset(); - if (!totalOffset.isNull()) { + QPointF offset = g->offset(); + if (!offset.isNull()) { if (QApplication::isRightToLeft()) - totalOffset.rx() *= -1; + offset.rx() *= -1; // QPlainTextEdit scrolls by lines only in vertical direction QFontMetrics fm(document()->defaultFont()); int lineHeight = fm.height(); int newX = hBar->value() - g->lastOffset().x(); - int newY = d->originalOffsetY - totalOffset.y()/lineHeight; + int newY = d->originalOffsetY - offset.y()/lineHeight; hBar->setValue(newX); vBar->setValue(newY); } diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 9b2bc57..20b53f2 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -111,12 +111,12 @@ public: CustomEvent::EventType = QEvent::registerEventType(); } - QGesture* createGesture(QObject *) + QGesture* create(QObject *) { return new CustomGesture; } - QGestureRecognizer::Result filterEvent(QGesture *state, QObject*o , QEvent *event) + QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result = 0; @@ -128,13 +128,13 @@ public: if (e->hasHotSpot) g->setHotSpot(e->hotSpot); if (g->serial >= CustomGesture::SerialFinishedThreshold) - result |= QGestureRecognizer::GestureFinished; + result |= QGestureRecognizer::FinishGesture; else if (g->serial >= CustomGesture::SerialStartedThreshold) - result |= QGestureRecognizer::GestureTriggered; + result |= QGestureRecognizer::TriggerGesture; else if (g->serial >= CustomGesture::SerialMaybeThreshold) - result |= QGestureRecognizer::MaybeGesture; + result |= QGestureRecognizer::MayBeGesture; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; return result; } return QGestureRecognizer::Ignore; @@ -142,7 +142,7 @@ public: void reset(QGesture *state) { - CustomGesture *g = static_cast(state); + CustomGesture *g = static_cast(state); g->serial = 0; QGestureRecognizer::reset(state); } @@ -159,26 +159,26 @@ public: CustomEvent::EventType = QEvent::registerEventType(); } - QGesture* createGesture(QObject *) + QGesture* create(QObject *) { return new CustomGesture; } - QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event) + QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result = QGestureRecognizer::ConsumeEventHint; - CustomGesture *g = static_cast(state); - CustomEvent *e = static_cast(event); + CustomGesture *g = static_cast(state); + CustomEvent *e = static_cast(event); g->serial = e->serial; if (e->hasHotSpot) g->setHotSpot(e->hotSpot); if (g->serial >= CustomGesture::SerialFinishedThreshold) - result |= QGestureRecognizer::GestureFinished; + result |= QGestureRecognizer::FinishGesture; else if (g->serial >= CustomGesture::SerialMaybeThreshold) - result |= QGestureRecognizer::GestureTriggered; + result |= QGestureRecognizer::TriggerGesture; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; return result; } return QGestureRecognizer::Ignore; @@ -186,7 +186,7 @@ public: void reset(QGesture *state) { - CustomGesture *g = static_cast(state); + CustomGesture *g = static_cast(state); g->serial = 0; QGestureRecognizer::reset(state); } @@ -256,7 +256,7 @@ protected: } if (eventsPtr) { QGestureEvent *e = static_cast(event); - QList gestures = e->allGestures(); + QList gestures = e->gestures(); foreach(QGesture *g, gestures) { eventsPtr->all << g->gestureType(); switch(g->state()) { @@ -345,14 +345,14 @@ tst_Gestures::~tst_Gestures() void tst_Gestures::initTestCase() { - CustomGesture::GestureType = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + CustomGesture::GestureType = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); QVERIFY(CustomGesture::GestureType != Qt::GestureType(0)); QVERIFY(CustomGesture::GestureType != Qt::CustomGesture); } void tst_Gestures::cleanupTestCase() { - QApplication::unregisterGestureRecognizer(CustomGesture::GestureType); + QGestureRecognizer::unregisterRecognizer(CustomGesture::GestureType); } void tst_Gestures::init() @@ -366,7 +366,7 @@ void tst_Gestures::cleanup() void tst_Gestures::customGesture() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); CustomEvent event; sendCustomGesture(&event, &widget); @@ -387,7 +387,7 @@ void tst_Gestures::customGesture() void tst_Gestures::consumeEventHint() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); CustomGestureRecognizer::ConsumeEvents = true; CustomEvent event; @@ -400,7 +400,7 @@ void tst_Gestures::consumeEventHint() void tst_Gestures::autoCancelingGestures() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); // send partial gesture. The gesture will be in the "maybe" state, but will // never get enough events to fire, so Qt will have to kill it. CustomEvent ev; @@ -424,7 +424,7 @@ void tst_Gestures::gestureOverChild() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); CustomEvent event; sendCustomGesture(&event, child); @@ -440,7 +440,7 @@ void tst_Gestures::gestureOverChild() QCOMPARE(widget.gestureOverrideEventsReceived, 0); // enable gestures over the children - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + widget.grabGesture(CustomGesture::GestureType); widget.reset(); child->reset(); @@ -469,8 +469,8 @@ void tst_Gestures::multipleWidgetOnlyGestureInTree() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - child->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + parent.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + child->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; @@ -507,8 +507,8 @@ void tst_Gestures::conflictingGestures() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType); + child->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -579,7 +579,7 @@ void tst_Gestures::conflictingGestures() child->reset(); // we set an attribute to make sure all gesture events are propagated - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint); + parent.grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); parent.acceptGestureOverride = false; child->acceptGestureOverride = false; parent.ignoredGestures << CustomGesture::GestureType; @@ -596,7 +596,7 @@ void tst_Gestures::conflictingGestures() parent.reset(); child->reset(); - Qt::GestureType ContinuousGesture = QApplication::registerGestureRecognizer(new CustomContinuousGestureRecognizer); + Qt::GestureType ContinuousGesture = QGestureRecognizer::registerRecognizer(new CustomContinuousGestureRecognizer); static const int ContinuousGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; child->grabGesture(ContinuousGesture); // child accepts override. And it also receives another custom gesture. @@ -610,13 +610,13 @@ void tst_Gestures::conflictingGestures() QCOMPARE(parent.gestureOverrideEventsReceived, 0); QCOMPARE(parent.gestureEventsReceived, 0); - QApplication::unregisterGestureRecognizer(ContinuousGesture); + QGestureRecognizer::unregisterRecognizer(ContinuousGesture); } void tst_Gestures::finishedWithoutStarted() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); // the gesture will claim it finished, but it was never started. CustomEvent ev; @@ -636,9 +636,9 @@ void tst_Gestures::finishedWithoutStarted() void tst_Gestures::unknownGesture() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - widget.grabGesture(Qt::CustomGesture, Qt::WidgetGesture); - widget.grabGesture(Qt::GestureType(Qt::PanGesture+512), Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + widget.grabGesture(Qt::CustomGesture, Qt::DontStartGestureOnChildren); + widget.grabGesture(Qt::GestureType(Qt::PanGesture+512), Qt::DontStartGestureOnChildren); CustomEvent event; sendCustomGesture(&event, &widget); @@ -740,7 +740,7 @@ protected: } if (eventsPtr) { QGestureEvent *e = static_cast(event); - QList gestures = e->allGestures(); + QList gestures = e->gestures(); foreach(QGesture *g, gestures) { eventsPtr->all << g->gestureType(); switch(g->state()) { @@ -784,7 +784,7 @@ void tst_Gestures::graphicsItemGesture() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -858,7 +858,7 @@ void tst_Gestures::graphicsItemTreeGesture() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item1->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -916,10 +916,10 @@ void tst_Gestures::explicitGraphicsObjectTarget() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - item1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); - item2->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); - item2_child1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item2->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item2_child1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -976,7 +976,7 @@ void tst_Gestures::gestureOverChildGraphicsItem() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item1->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -1030,7 +1030,7 @@ void tst_Gestures::gestureOverChildGraphicsItem() item2->grabGesture(CustomGesture::GestureType); item2->ignoredGestures << CustomGesture::GestureType; item1->ignoredGestures << CustomGesture::GestureType; - item1->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint); + item1->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); event.hasHotSpot = true; @@ -1051,10 +1051,10 @@ void tst_Gestures::twoGesturesOnDifferentLevel() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType); + child->grabGesture(SecondGesture); CustomEvent event; // sending events that form a gesture to one widget, but they will be @@ -1079,7 +1079,7 @@ void tst_Gestures::twoGesturesOnDifferentLevel() for(int i = 0; i < child->events.all.size(); ++i) QCOMPARE(parent.events.all.at(i), CustomGesture::GestureType); - QApplication::unregisterGestureRecognizer(SecondGesture); + QGestureRecognizer::unregisterRecognizer(SecondGesture); } void tst_Gestures::multipleGesturesInTree() @@ -1091,19 +1091,19 @@ void tst_Gestures::multipleGesturesInTree() GestureWidget *D = new GestureWidget("D", C); Qt::GestureType FirstGesture = CustomGesture::GestureType; - Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - - Qt::GestureContext context = Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint; - A->grabGesture(FirstGesture, context); // A [1 3] - A->grabGesture(ThirdGesture, context); // | - B->grabGesture(SecondGesture, context); // B [ 2 3] - B->grabGesture(ThirdGesture, context); // | - C->grabGesture(FirstGesture, context); // C [1 2 3] - C->grabGesture(SecondGesture, context); // | - C->grabGesture(ThirdGesture, context); // D [1 3] - D->grabGesture(FirstGesture, context); - D->grabGesture(ThirdGesture, context); + Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType ThirdGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + + Qt::GestureFlags flags = Qt::ReceivePartialGestures; + A->grabGesture(FirstGesture, flags); // A [1 3] + A->grabGesture(ThirdGesture, flags); // | + B->grabGesture(SecondGesture, flags); // B [ 2 3] + B->grabGesture(ThirdGesture, flags); // | + C->grabGesture(FirstGesture, flags); // C [1 2 3] + C->grabGesture(SecondGesture, flags); // | + C->grabGesture(ThirdGesture, flags); // D [1 3] + D->grabGesture(FirstGesture, flags); + D->grabGesture(ThirdGesture, flags); // make sure all widgets ignore events, so they get propagated. A->ignoredGestures << FirstGesture << ThirdGesture; @@ -1150,8 +1150,8 @@ void tst_Gestures::multipleGesturesInTree() QCOMPARE(A->events.all.count(SecondGesture), 0); QCOMPARE(A->events.all.count(ThirdGesture), TotalGestureEventsCount); - QApplication::unregisterGestureRecognizer(SecondGesture); - QApplication::unregisterGestureRecognizer(ThirdGesture); + QGestureRecognizer::unregisterRecognizer(SecondGesture); + QGestureRecognizer::unregisterRecognizer(ThirdGesture); } void tst_Gestures::multipleGesturesInComplexTree() @@ -1163,27 +1163,27 @@ void tst_Gestures::multipleGesturesInComplexTree() GestureWidget *D = new GestureWidget("D", C); Qt::GestureType FirstGesture = CustomGesture::GestureType; - Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType FourthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType FifthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType SixthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType SeventhGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - - Qt::GestureContext context = Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint; - A->grabGesture(FirstGesture, context); // A [1,3,4] - A->grabGesture(ThirdGesture, context); // | - A->grabGesture(FourthGesture, context); // B [2,3,5] - B->grabGesture(SecondGesture, context); // | - B->grabGesture(ThirdGesture, context); // C [1,2,3,6] - B->grabGesture(FifthGesture, context); // | - C->grabGesture(FirstGesture, context); // D [1,3,7] - C->grabGesture(SecondGesture, context); - C->grabGesture(ThirdGesture, context); - C->grabGesture(SixthGesture, context); - D->grabGesture(FirstGesture, context); - D->grabGesture(ThirdGesture, context); - D->grabGesture(SeventhGesture, context); + Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType ThirdGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType FourthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType FifthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType SixthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType SeventhGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + + Qt::GestureFlags flags = Qt::ReceivePartialGestures; + A->grabGesture(FirstGesture, flags); // A [1,3,4] + A->grabGesture(ThirdGesture, flags); // | + A->grabGesture(FourthGesture, flags); // B [2,3,5] + B->grabGesture(SecondGesture, flags); // | + B->grabGesture(ThirdGesture, flags); // C [1,2,3,6] + B->grabGesture(FifthGesture, flags); // | + C->grabGesture(FirstGesture, flags); // D [1,3,7] + C->grabGesture(SecondGesture, flags); + C->grabGesture(ThirdGesture, flags); + C->grabGesture(SixthGesture, flags); + D->grabGesture(FirstGesture, flags); + D->grabGesture(ThirdGesture, flags); + D->grabGesture(SeventhGesture, flags); // make sure all widgets ignore events, so they get propagated. QSet allGestureTypes; @@ -1247,12 +1247,12 @@ void tst_Gestures::multipleGesturesInComplexTree() QCOMPARE(A->events.all.count(SixthGesture), 0); QCOMPARE(A->events.all.count(SeventhGesture), 0); - QApplication::unregisterGestureRecognizer(SecondGesture); - QApplication::unregisterGestureRecognizer(ThirdGesture); - QApplication::unregisterGestureRecognizer(FourthGesture); - QApplication::unregisterGestureRecognizer(FifthGesture); - QApplication::unregisterGestureRecognizer(SixthGesture); - QApplication::unregisterGestureRecognizer(SeventhGesture); + QGestureRecognizer::unregisterRecognizer(SecondGesture); + QGestureRecognizer::unregisterRecognizer(ThirdGesture); + QGestureRecognizer::unregisterRecognizer(FourthGesture); + QGestureRecognizer::unregisterRecognizer(FifthGesture); + QGestureRecognizer::unregisterRecognizer(SixthGesture); + QGestureRecognizer::unregisterRecognizer(SeventhGesture); } void tst_Gestures::testMapToScene() @@ -1261,7 +1261,7 @@ void tst_Gestures::testMapToScene() QList list; list << &gesture; QGestureEvent event(list); - QCOMPARE(event.mapToScene(gesture.hotSpot()), QPointF()); // not set, can't do much + QCOMPARE(event.mapToGraphicsScene(gesture.hotSpot()), QPointF()); // not set, can't do much QGraphicsScene scene; QGraphicsView view(&scene); @@ -1278,7 +1278,7 @@ void tst_Gestures::testMapToScene() QPoint origin = view.mapToGlobal(QPoint()); event.setWidget(view.viewport()); - QCOMPARE(event.mapToScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200))); + QCOMPARE(event.mapToGraphicsScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200))); } void tst_Gestures::ungrabGesture() // a method on QWidget @@ -1296,7 +1296,7 @@ void tst_Gestures::ungrabGesture() // a method on QWidget if (event->type() == QEvent::Gesture) { QGestureEvent *gestureEvent = static_cast(event); if (gestureEvent) - foreach (QGesture *g, gestureEvent->allGestures()) + foreach (QGesture *g, gestureEvent->gestures()) gestures.insert(g); } return GestureWidget::event(event); @@ -1307,8 +1307,8 @@ void tst_Gestures::ungrabGesture() // a method on QWidget MockGestureWidget *a = &parent; MockGestureWidget *b = new MockGestureWidget("B", a); - a->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - b->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + a->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + b->grabGesture(CustomGesture::GestureType); b->ignoredGestures << CustomGesture::GestureType; CustomEvent event; @@ -1375,14 +1375,14 @@ void tst_Gestures::autoCancelGestures() { if (event->type() == QEvent::Gesture) { QGestureEvent *ge = static_cast(event); - Q_ASSERT(ge->allGestures().count() == 1); // can't use QCOMPARE here... - ge->allGestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); + Q_ASSERT(ge->gestures().count() == 1); // can't use QCOMPARE here... + ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); } return GestureWidget::event(event); } }; - const Qt::GestureType secondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + const Qt::GestureType secondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); MockWidget parent("parent"); // this one sets the cancel policy to CancelAllInContext parent.resize(300, 100); @@ -1390,8 +1390,8 @@ void tst_Gestures::autoCancelGestures() GestureWidget *child = new GestureWidget("child", &parent); child->setGeometry(10, 10, 100, 80); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(secondGesture, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType); + child->grabGesture(secondGesture); parent.show(); QTest::qWaitForWindowShown(&parent); @@ -1425,14 +1425,14 @@ void tst_Gestures::autoCancelGestures2() bool event(QEvent *event) { if (event->type() == QEvent::Gesture) { QGestureEvent *ge = static_cast(event); - Q_ASSERT(ge->allGestures().count() == 1); // can't use QCOMPARE here... - ge->allGestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); + Q_ASSERT(ge->gestures().count() == 1); // can't use QCOMPARE here... + ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); } return GestureItem::event(event); } }; - const Qt::GestureType secondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + const Qt::GestureType secondGesture = QGestureRecognizer ::registerRecognizer(new CustomGestureRecognizer); QGraphicsScene scene; QGraphicsView view(&scene); @@ -1444,10 +1444,10 @@ void tst_Gestures::autoCancelGestures2() parent->setPos(0, 0); child->setPos(10, 10); scene.addItem(parent); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - view.viewport()->grabGesture(secondGesture, Qt::WidgetGesture); - parent->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(secondGesture, Qt::WidgetWithChildrenGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + view.viewport()->grabGesture(secondGesture, Qt::DontStartGestureOnChildren); + parent->grabGesture(CustomGesture::GestureType); + child->grabGesture(secondGesture); view.show(); QTest::qWaitForWindowShown(&view); diff --git a/tests/manual/gestures/graphicsview/gestures.cpp b/tests/manual/gestures/graphicsview/gestures.cpp index 5416457..4c21712 100644 --- a/tests/manual/gestures/graphicsview/gestures.cpp +++ b/tests/manual/gestures/graphicsview/gestures.cpp @@ -45,41 +45,41 @@ Qt::GestureType ThreeFingerSlideGesture::Type = Qt::CustomGesture; -QGesture *ThreeFingerSlideGestureRecognizer::createGesture(QObject *) +QGesture *ThreeFingerSlideGestureRecognizer::create(QObject *) { return new ThreeFingerSlideGesture; } -QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { ThreeFingerSlideGesture *d = static_cast(state); QGestureRecognizer::Result result; switch (event->type()) { case QEvent::TouchBegin: - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; case QEvent::TouchEnd: if (d->gestureFired) - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; case QEvent::TouchUpdate: if (d->state() != Qt::NoGesture) { QTouchEvent *ev = static_cast(event); if (ev->touchPoints().size() == 3) { d->gestureFired = true; - result = QGestureRecognizer::GestureTriggered; + result = QGestureRecognizer::TriggerGesture; } else { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; for (int i = 0; i < ev->touchPoints().size(); ++i) { const QTouchEvent::TouchPoint &pt = ev->touchPoints().at(i); const int distance = (pt.pos().toPoint() - pt.startPos().toPoint()).manhattanLength(); if (distance > 20) { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } } } } else { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } break; @@ -89,7 +89,7 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::filterEvent(QGestu if (d->state() != Qt::NoGesture) result = QGestureRecognizer::Ignore; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; break; default: result = QGestureRecognizer::Ignore; @@ -105,12 +105,12 @@ void ThreeFingerSlideGestureRecognizer::reset(QGesture *state) } -QGesture *RotateGestureRecognizer::createGesture(QObject *) +QGesture *RotateGestureRecognizer::create(QObject *) { return new QGesture; } -QGestureRecognizer::Result RotateGestureRecognizer::filterEvent(QGesture *, QObject *, QEvent *event) +QGestureRecognizer::Result RotateGestureRecognizer::recognize(QGesture *, QObject *, QEvent *event) { switch (event->type()) { case QEvent::TouchBegin: diff --git a/tests/manual/gestures/graphicsview/gestures.h b/tests/manual/gestures/graphicsview/gestures.h index 6140b12..8a31b71 100644 --- a/tests/manual/gestures/graphicsview/gestures.h +++ b/tests/manual/gestures/graphicsview/gestures.h @@ -59,8 +59,8 @@ public: class ThreeFingerSlideGestureRecognizer : public QGestureRecognizer { private: - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; @@ -70,8 +70,8 @@ public: RotateGestureRecognizer(); private: - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp index de92afe..f8433b5 100644 --- a/tests/manual/gestures/graphicsview/main.cpp +++ b/tests/manual/gestures/graphicsview/main.cpp @@ -66,11 +66,11 @@ protected: default: qDebug("view: Pan: "); break; } - const QPointF offset = pan->offset(); + const QPointF delta = pan->delta(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); - vbar->setValue(vbar->value() - offset.y()); - hbar->setValue(hbar->value() - offset.x()); + vbar->setValue(vbar->value() - delta.y()); + hbar->setValue(hbar->value() - delta.x()); ge->accept(pan); return true; } @@ -152,8 +152,8 @@ private: MainWindow::MainWindow() { - (void)QApplication::registerGestureRecognizer(new MousePanGestureRecognizer); - ThreeFingerSlideGesture::Type = QApplication::registerGestureRecognizer(new ThreeFingerSlideGestureRecognizer); + (void)QGestureRecognizer::registerRecognizer(new MousePanGestureRecognizer); + ThreeFingerSlideGesture::Type = QGestureRecognizer::registerRecognizer(new ThreeFingerSlideGestureRecognizer); tabWidget = new QTabWidget; diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp index 6cdbe12..82adfbd 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp @@ -51,12 +51,12 @@ MousePanGestureRecognizer::MousePanGestureRecognizer() { } -QGesture* MousePanGestureRecognizer::createGesture(QObject *) +QGesture* MousePanGestureRecognizer::create(QObject *) { return new QPanGesture; } -QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result MousePanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { QPanGesture *g = static_cast(state); QPoint globalPos; @@ -78,23 +78,19 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick || event->type() == QEvent::GraphicsSceneMousePress || event->type() == QEvent::GraphicsSceneMouseDoubleClick) { g->setHotSpot(globalPos); - g->setProperty("lastPos", globalPos); + g->setProperty("startPos", globalPos); g->setProperty("pressed", QVariant::fromValue(true)); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } else if (event->type() == QEvent::MouseMove || event->type() == QEvent::GraphicsSceneMouseMove) { if (g->property("pressed").toBool()) { - QPoint pos = globalPos; - QPoint lastPos = g->property("lastPos").toPoint(); + QPoint offset = globalPos - g->property("startPos").toPoint(); g->setLastOffset(g->offset()); - lastPos = pos - lastPos; - g->setOffset(QPointF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); - g->setProperty("lastPos", pos); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + g->setOffset(QPointF(offset.x(), offset.y())); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } else if (event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::GraphicsSceneMouseRelease) { - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; } return QGestureRecognizer::Ignore; } @@ -102,11 +98,10 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast(state); - g->setTotalOffset(QPointF()); g->setLastOffset(QPointF()); g->setOffset(QPointF()); g->setAcceleration(0); - g->setProperty("lastPos", QVariant()); + g->setProperty("startPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); QGestureRecognizer::reset(state); } diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h index b062fd0..6e04621 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h @@ -49,8 +49,8 @@ class MousePanGestureRecognizer : public QGestureRecognizer public: MousePanGestureRecognizer(); - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture* create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp index 9a5eb02..4f33b28 100644 --- a/tests/manual/gestures/scrollarea/main.cpp +++ b/tests/manual/gestures/scrollarea/main.cpp @@ -50,7 +50,7 @@ public: ScrollArea(QWidget *parent = 0) : QScrollArea(parent), outside(false) { - viewport()->grabGesture(Qt::PanGesture); + viewport()->grabGesture(Qt::PanGesture, Qt::ReceivePartialGestures); } protected: @@ -87,8 +87,8 @@ protected: if (outside) return; - const QPointF offset = pan->offset(); - const QPointF totalOffset = pan->totalOffset(); + const QPointF delta = pan->delta(); + const QPointF totalOffset = pan->offset(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); @@ -102,8 +102,8 @@ protected: outside = true; return; } - vbar->setValue(vbar->value() - offset.y()); - hbar->setValue(hbar->value() - offset.x()); + vbar->setValue(vbar->value() - delta.y()); + hbar->setValue(hbar->value() - delta.x()); event->accept(pan); } } @@ -147,8 +147,8 @@ protected: event->ignore(pan); if (outside) return; - const QPointF offset = pan->offset(); - const QPointF totalOffset = pan->totalOffset(); + const QPointF delta = pan->delta(); + const QPointF totalOffset = pan->offset(); if (orientation() == Qt::Horizontal) { if ((value() == minimum() && totalOffset.x() < -10) || (value() == maximum() && totalOffset.x() > 10)) { @@ -156,7 +156,7 @@ protected: return; } if (totalOffset.y() < 40 && totalOffset.y() > -40) { - setValue(value() + offset.x()); + setValue(value() + delta.x()); event->accept(pan); } else { outside = true; @@ -168,7 +168,7 @@ protected: return; } if (totalOffset.x() < 40 && totalOffset.x() > -40) { - setValue(value() - offset.y()); + setValue(value() - delta.y()); event->accept(pan); } else { outside = true; @@ -232,7 +232,7 @@ private: int main(int argc, char **argv) { QApplication app(argc, argv); - app.registerGestureRecognizer(new MousePanGestureRecognizer); + QGestureRecognizer::registerRecognizer(new MousePanGestureRecognizer); MainWindow w; w.show(); return app.exec(); diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp index ce5ef57..66fcf18 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp @@ -49,12 +49,12 @@ MousePanGestureRecognizer::MousePanGestureRecognizer() { } -QGesture* MousePanGestureRecognizer::createGesture(QObject *) +QGesture *MousePanGestureRecognizer::create(QObject *) { return new QPanGesture; } -QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result MousePanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { QPanGesture *g = static_cast(state); if (event->type() == QEvent::TouchBegin) { @@ -68,24 +68,20 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat if (g->property("ignoreMousePress").toBool()) return QGestureRecognizer::Ignore; g->setHotSpot(me->globalPos()); - g->setProperty("lastPos", me->globalPos()); + g->setProperty("startPos", me->globalPos()); g->setProperty("pressed", QVariant::fromValue(true)); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } else if (event->type() == QEvent::MouseMove) { if (g->property("pressed").toBool()) { - QPoint pos = me->globalPos(); - QPoint lastPos = g->property("lastPos").toPoint(); + QPoint offset = me->globalPos() - g->property("startPos").toPoint(); g->setLastOffset(g->offset()); - lastPos = pos - lastPos; - g->setOffset(QPointF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); - g->setProperty("lastPos", pos); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + g->setOffset(QPointF(offset.x(), offset.y())); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } else if (event->type() == QEvent::MouseButtonRelease) { if (g->property("pressed").toBool()) - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; } return QGestureRecognizer::Ignore; } @@ -93,11 +89,10 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast(state); - g->setTotalOffset(QPointF()); g->setLastOffset(QPointF()); g->setOffset(QPointF()); g->setAcceleration(0); - g->setProperty("lastPos", QVariant()); + g->setProperty("startPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); g->setProperty("ignoreMousePress", QVariant::fromValue(false)); QGestureRecognizer::reset(state); diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h index b062fd0..6e04621 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h @@ -49,8 +49,8 @@ class MousePanGestureRecognizer : public QGestureRecognizer public: MousePanGestureRecognizer(); - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture* create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; -- cgit v0.12 From c8a7b0430120b391e356a821390aaaebacbbb006 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 3 Nov 2009 11:15:38 +0100 Subject: Toolbar Icons are clipped on Leopard in Cocoa port. Scale the pixmap to correct size (16,16) before setting as the image for the Document Icon button. Reviewed-by: Denis --- src/gui/kernel/qwidget_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 79f55a1..9270220 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3026,7 +3026,8 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) if (icon.isNull()) { [iconButton setImage:nil]; } else { - NSImage *image = static_cast(qt_mac_create_nsimage(*pm)); + QPixmap scaled = pm->scaled(QSize(16,16), Qt::KeepAspectRatio, Qt::SmoothTransformation); + NSImage *image = static_cast(qt_mac_create_nsimage(scaled)); [iconButton setImage:image]; [image release]; } -- cgit v0.12 From 14a1a9af8ae1b3d2379e6f8c24536afb20b39509 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 3 Nov 2009 11:16:39 +0100 Subject: Cocoa: fix q3filedialog autotest Q3FileDialog does not exist in the cocoa port. Do ifdef this test out on cocoa Rev-by: prasanth --- tests/auto/q3filedialog/tst_q3filedialog.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/q3filedialog/tst_q3filedialog.cpp b/tests/auto/q3filedialog/tst_q3filedialog.cpp index 2585f60..e2686eb 100644 --- a/tests/auto/q3filedialog/tst_q3filedialog.cpp +++ b/tests/auto/q3filedialog/tst_q3filedialog.cpp @@ -59,7 +59,9 @@ public: virtual ~tst_Q3FileDialog(); private slots: +#ifndef QT_MAC_USE_COCOA void getSetCheck(); +#endif }; tst_Q3FileDialog::tst_Q3FileDialog() @@ -70,6 +72,7 @@ tst_Q3FileDialog::~tst_Q3FileDialog() { } +#ifndef QT_MAC_USE_COCOA class Preview : public QLabel, public Q3FilePreview { public: @@ -125,6 +128,7 @@ void tst_Q3FileDialog::getSetCheck() obj1.setPreviewMode(Q3FileDialog::PreviewMode(Q3FileDialog::Info)); QCOMPARE(obj1.previewMode(), Q3FileDialog::PreviewMode(Q3FileDialog::Info)); } +#endif QTEST_MAIN(tst_Q3FileDialog) #include "tst_q3filedialog.moc" -- cgit v0.12 From 1fd46b4495241ed03371fb5c86965b788791b363 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 11:45:16 +0100 Subject: Embed code examples in state machine overview If you put \snippet inside \code tags, it's interpreted as code, not as a tag. Reviewed-by: Trust me --- doc/src/frameworks-technologies/statemachine.qdoc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index ac10314..9614dd3 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -426,9 +426,8 @@ value of the property before any property assignments in states were executed.) Take the following code: - \code - \snippet doc/src/snippets/statemachine/main5.cpp 0 - \endcode + + \snippet doc/src/snippets/statemachine/main5.cpp 0 Lets say the property \c fooBar is 0.0 when the machine starts. When the machine is in state \c s1, the property will be 1.0, since the state explicitly assigns this value to it. When the @@ -437,9 +436,8 @@ If we are using nested states, the parent defines a value for the property which is inherited by all descendants that do not explicitly assign a value to the property. - \code + \snippet doc/src/snippets/statemachine/main5.cpp 2 - \endcode Here \c s1 has two children: \c s2 and \c s3. When \c s2 is entered, the property \c fooBar will have the value 2.0, since this is explicitly defined for the state. When the machine is in @@ -452,9 +450,8 @@ properties as they are assigned in states. Say we have the following code: - \code + \snippet doc/src/snippets/statemachine/main5.cpp 3 - \endcode Here we define two states of a user interface. In \c s1 the \c button is small, and in \c s2 it is bigger. If we click the button to transition from \c s1 to \c s2, the geometry of the button @@ -462,9 +459,7 @@ smooth, however, all we need to do is make a QPropertyAnimation and add this to the transition object. - \code \snippet doc/src/snippets/statemachine/main5.cpp 4 - \endcode Adding an animation for the property in question means that the property assignment will no longer take immediate effect when the state has been entered. Instead, the animation will start @@ -486,9 +481,8 @@ the value defined by a state. Say we have the following code: - \code + \snippet doc/src/snippets/statemachine/main5.cpp 5 - \endcode When \c button is clicked, the machine will transition into state \c s2, which will set the geometry of the button, and then pop up a message box to alert the user that the geometry has @@ -504,9 +498,8 @@ value, we can use the state's polished() signal. The polished() signal will be emitted when the the property is assigned its final value, whether this is done immediately or after the animation has finished playing. - \code + \snippet doc/src/snippets/statemachine/main5.cpp 6 - \endcode In this example, when \c button is clicked, the machine will enter \c s2. It will remain in state \c s2 until the \c geometry property has been set to \c QRect(0, 0, 50, 50). Then it will -- cgit v0.12 From 04d5735a608aeeab259463b1bc80842b5134ede6 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Mon, 2 Nov 2009 16:36:41 +0100 Subject: Prepend qt_instdate when using configure.exe as well. Rebuilt configure.exe Rebuilt using VS2008. Reviewed-By: Alessandro Portale --- configure.exe | Bin 1169408 -> 1171968 bytes tools/configure/configureapp.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.exe b/configure.exe index f433888..7c11fec 100755 Binary files a/configure.exe and b/configure.exe differ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 28645a0..3f891f6 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3032,7 +3032,7 @@ void Configure::generateConfigfiles() << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl << endl << "/* Build date */" << endl - << "static const char qt_configure_installation [11 + 12] = \"" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl + << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl << endl; if(!dictionary[ "QT_HOST_PREFIX" ].isNull()) tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl; -- cgit v0.12 From 1db4a133a9d35e00bad50541fb8d64079a7debea Mon Sep 17 00:00:00 2001 From: Liang QI Date: Tue, 3 Nov 2009 12:05:50 +0100 Subject: Fix tst_qwebpage and tst_qwebframe compilation on Symbian. RevBy: TrustMe --- src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro | 2 +- src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 4 ++++ src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro | 2 +- src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index 4c92e91..df447d8 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -5,6 +5,6 @@ SOURCES += tst_qwebframe.cpp RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/resources\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/resources\\\" symbian:TARGET.UID3 = 0xA000E53D diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 100f272..f8c3440 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -38,6 +38,10 @@ #endif #include "../util.h" +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + //TESTED_CLASS= //TESTED_FILES= diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index 101837a..7d581cd 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -5,6 +5,6 @@ SOURCES += tst_qwebpage.cpp RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian:TARGET.UID3 = 0xA000E53E diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 21b3bc7..51611b0 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -37,6 +37,10 @@ #include #include +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + // Will try to wait for the condition while allowing event processing #define QTRY_COMPARE(__expr, __expected) \ do { \ -- cgit v0.12 From 93ec4104781d7f9929b8b8a05dee3d94f8cd4b17 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Tue, 3 Nov 2009 12:06:00 +0100 Subject: Revert "Compile fix until configure.exe is rebuilt for Windows" since the required changes to configure.exe have been added. You will need to run configure after updating! Reviewed-By: Alessandro Portale This reverts commit 94be7bf47fe93ca4fa6ae90f5906f6ef711f558e. --- src/corelib/global/qlibraryinfo.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 32693e0..15a06d7 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -215,8 +215,7 @@ QLibraryInfo::buildKey() QDate QLibraryInfo::buildDate() { - return QDate(); - //return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate); + return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate); } /*! -- cgit v0.12 From 68be6457f6732437b485812ab2db11c147a24b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 3 Nov 2009 12:15:53 +0100 Subject: Removed usage of CompositionMode_Source in QGraphicsView for X11. Due to the rendering model in XRender ((src IN mask) OP dest) we can't support the PorterDuff composition modes natively under X11. They just behave differently than what we've defined them to do in QPainter, and there is no apparent workaround. Task-number: QTBUG-4829 Reviewed-by: Gunnar --- src/gui/graphicsview/qgraphicsview.cpp | 8 +++++++- src/gui/painting/qpainter.cpp | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 710c745..8945f51 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -281,6 +281,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < #include #include #ifdef Q_WS_X11 +#include #include #endif @@ -3294,7 +3295,12 @@ void QGraphicsView::paintEvent(QPaintEvent *event) backgroundPainter.setClipRegion(d->backgroundPixmapExposed, Qt::ReplaceClip); if (viewTransformed) backgroundPainter.setTransform(viewTransform); - backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source); +#ifdef Q_WS_X11 +#undef X11 + if (backgroundPainter.paintEngine()->type() != QPaintEngine::X11) +#define X11 qt_x11Data +#endif + backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source); drawBackground(&backgroundPainter, exposedSceneRect); d->backgroundPixmapExposed = QRegion(); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index cddad7d..8d6cad3 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2275,8 +2275,9 @@ void QPainter::setBrushOrigin(const QPointF &p) /*! Sets the composition mode to the given \a mode. - \warning You can only set the composition mode for QPainter - objects that operates on a QImage. + \warning Only a QPainter operating on a QImage fully supports all + composition modes. The RasterOp modes are supported for X11 as + described in compositionMode(). \sa compositionMode() */ -- cgit v0.12 From cb396cf4851b961fb42e21866d7467efb3642a04 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 3 Nov 2009 12:45:44 +0100 Subject: Fixed compile error on Symbian emulator. RevBy: Trust me --- src/gui/itemviews/qabstractitemview.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h index 7a0509b..ea5d259 100644 --- a/src/gui/itemviews/qabstractitemview.h +++ b/src/gui/itemviews/qabstractitemview.h @@ -363,6 +363,7 @@ private: friend class QTreeViewPrivate; // needed to compile with MSVC friend class QAccessibleItemRow; friend class QListModeViewBase; + friend class QListViewPrivate; // needed to compile for Symbian emulator }; Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractItemView::EditTriggers) -- cgit v0.12 From dc89c842779f87ce69882ba54fa8d5bb79e0edbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 3 Nov 2009 14:02:03 +0200 Subject: QS60Style: impossible to open menu from styled QToolButton QS60Style ignores toolButton's menu indicator rect. This means that the button's menu cannot be triggered by the user, as the style does not draw the indicator at all. With this fix, style calculates a rect (including margins) for menu indicator and draws that (arrow down) into toolButton (by making the button bevel larger). Task-number: QTBUG-5266 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 949dfcb..350a8e6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -994,6 +994,10 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast(option)) { const State bflags = toolBtn->state; const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget)); + QRect menuRect = QRect(); + if (toolBtn->subControls & SC_ToolButtonMenu) + menuRect = subControlRect(control, toolBtn, SC_ToolButtonMenu, widget); + QStyleOptionToolButton toolButton = *toolBtn; if (sub&SC_ToolButton) { @@ -1006,7 +1010,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom toolBar = qobject_cast(widget->parentWidget()); if (bflags & (State_Sunken | State_On | State_Raised)) { - tool.rect = button; + tool.rect = button.unite(menuRect); tool.state = bflags; // todo: I'd like to move extension button next to where last button is @@ -1061,6 +1065,12 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } else { drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); } + + if (toolButton.subControls & SC_ToolButtonMenu) { + tool.rect = menuRect; + tool.state = bflags; + drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); + } } } @@ -2232,7 +2242,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases case PE_FrameLineEdit: - case PE_IndicatorButtonDropDown: case PE_IndicatorDockWidgetResizeHandle: case PE_PanelTipLabel: case PE_PanelScrollAreaCorner: @@ -2561,6 +2570,29 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple } } break; + case CC_ToolButton: + if (const QStyleOptionToolButton *toolButton = qstyleoption_cast(option)) { + const int indicatorRect = pixelMetric(PM_MenuButtonIndicator, toolButton, widget) + + 2*pixelMetric(PM_ButtonMargin, toolButton, widget); + ret = toolButton->rect; + const bool popup = (toolButton->features & + (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay)) + == QStyleOptionToolButton::MenuButtonPopup; + switch (scontrol) { + case SC_ToolButton: + if (popup) + ret.adjust(0, 0, -indicatorRect, 0); + break; + case SC_ToolButtonMenu: + if (popup) + ret.adjust(ret.width() - indicatorRect, ret.height() - indicatorRect, 0, 0); + break; + default: + break; + } + ret = visualRect(toolButton->direction, toolButton->rect, ret); + } + break; default: ret = QCommonStyle::subControlRect(control, option, scontrol, widget); } -- cgit v0.12 From 159350b766299fee1bfa44410c19500335267fd8 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 13:04:39 +0100 Subject: Fixed crash in QPixmap::fromImage with an Indexed8 without a colortable. Reviewed-by: Trond --- src/gui/image/qpixmap_mac.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index 15350e8..9209d45 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -305,11 +305,15 @@ void QMacPixmapData::fromImage(const QImage &img, } break; } - case QImage::Format_Indexed8: - for (int x = 0; x < w; ++x) { - *(drow+x) = PREMUL(image.color(*(srow + x))); + case QImage::Format_Indexed8: { + int numColors = image.numColors(); + if (numColors > 0) { + for (int x = 0; x < w; ++x) { + int index = *(srow + x); + *(drow+x) = PREMUL(image.color(qMin(index, numColors))); + } } - break; + } break; case QImage::Format_RGB32: for (int x = 0; x < w; ++x) *(drow+x) = *(((quint32*)srow) + x) | 0xFF000000; -- cgit v0.12 From 6ec05db9b819a23ebac5a5908b8e3ca56b251e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 3 Nov 2009 12:39:46 +0100 Subject: Made QPainter::drawText() respect Qt::TextDontClip flag. The flag was not respected in the vertical direction for any text lines completely outside the bounding rect. Task-number: QTBUG-1666 Reviewed-by: Trond --- src/gui/painting/qpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 8d6cad3..e0423f3 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7604,7 +7604,7 @@ start_lengthVariant: l.setPosition(QPointF(0., height)); height += l.height(); width = qMax(width, l.naturalTextWidth()); - if (!brect && height >= r.height()) + if (!dontclip && !brect && height >= r.height()) break; } textLayout.endLayout(); -- cgit v0.12 From 0a24f29a0f53716f9c9e000f5bb55ac5d925df5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 3 Nov 2009 12:11:50 +0100 Subject: Fixed some compiler warnings. Reviewed-by: Trond --- src/gui/painting/qpainterpath_p.h | 9 ++++---- .../gl2paintengineex/qglengineshadermanager.cpp | 9 ++------ src/opengl/qglpixmapfilter.cpp | 24 +--------------------- 3 files changed, 7 insertions(+), 35 deletions(-) diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 112c2bd..54b9392 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -132,10 +132,9 @@ public: QPainterPathData() : cStart(0), fillRule(Qt::OddEvenFill), - pathConverter(0), dirtyBounds(false), - dirtyControlBounds(false) - + dirtyControlBounds(false), + pathConverter(0) { ref = 1; require_moveTo = false; @@ -146,10 +145,10 @@ public: QPainterPathPrivate(), cStart(other.cStart), fillRule(other.fillRule), bounds(other.bounds), controlBounds(other.controlBounds), - pathConverter(0), dirtyBounds(other.dirtyBounds), dirtyControlBounds(other.dirtyControlBounds), - convex(other.convex) + convex(other.convex), + pathConverter(0) { ref = 1; require_moveTo = false; diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 34c448f..40a6241 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -153,13 +153,8 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) // Check that all the elements have been filled: for (int i = 0; i < TotalSnippetCount; ++i) { if (qShaderSnippets[i] == 0) { - QByteArray msg; - msg.append("Fatal: Shader Snippet for "); - msg.append(snippetNameStr(SnippetName(i))); - msg.append(" ("); - msg.append(QByteArray::number(i)); - msg.append(") is missing!"); - qFatal(msg.constData()); + qFatal("Shader snippet for %s (#%d) is missing!", + snippetNameStr(SnippetName(i)).constData(), i); } } #endif diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index ff19e06..8768fbc 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -316,28 +316,6 @@ static const char *qt_gl_texture_sampling_helper = " return texture2D(src, srcCoords).a;\n" "}\n"; -static const char *qt_gl_clamped_texture_sampling_helper = - "highp vec4 texture_dimensions;\n" // x = width, y = height, z = 0.5/width, w = 0.5/height - "lowp float clampedTexture2DAlpha(lowp sampler2D src, highp vec2 srcCoords) {\n" - " highp vec2 clampedCoords = clamp(srcCoords, texture_dimensions.zw, vec2(1.0) - texture_dimensions.zw);\n" - " highp vec2 t = clamp(min(srcCoords, vec2(1.0) - srcCoords) * srcDim + 0.5, 0.0, 1.0);\n" - " return texture2D(src, clampedCoords).a * t.x * t.y;\n" - "}\n" - "lowp vec4 clampedTexture2D(lowp sampler2D src, highp vec2 srcCoords) {\n" - " highp vec2 clampedCoords = clamp(srcCoords, texture_dimensions.zw, vec2(1.0) - texture_dimensions.zw);\n" - " highp vec2 t = clamp(min(srcCoords, vec2(1.0) - srcCoords) * srcDim + 0.5, 0.0, 1.0);\n" - " return texture2D(src, clampedCoords) * t.x * t.y;\n" - "}\n"; - -static QByteArray qt_gl_convertToClamped(const QByteArray &source) -{ - QByteArray result; - result.append(qt_gl_clamped_texture_sampling_helper); - result.append(QByteArray(source).replace("texture2DAlpha", "clampedTexture2DAlpha") - .replace("texture2D", "clampedTexture2D")); - return result; -} - QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint) : m_animatedBlur(false) , m_haveCached(false) @@ -433,7 +411,7 @@ QGLBlurTextureCache::~QGLBlurTextureCache() blurTextureCaches.removeAt(blurTextureCaches.indexOf(this)); } -void QGLBlurTextureCache::timerEvent(QTimerEvent *event) +void QGLBlurTextureCache::timerEvent(QTimerEvent *) { killTimer(timerId); timerId = 0; -- cgit v0.12 From 51c9b68425c1d3fe64a08e6ef0357fbd6bdd8f8a Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 3 Nov 2009 12:55:19 +0100 Subject: Compile fix after the last gesture api change Reviewed-by: trustme --- examples/gestures/imagegestures/imagewidget.cpp | 6 +-- src/gui/kernel/qgesture_p.h | 2 +- src/gui/kernel/qmacgesturerecognizer_mac.mm | 57 ++++++++++------------ src/gui/kernel/qmacgesturerecognizer_mac_p.h | 13 +++-- src/gui/kernel/qstandardgestures.cpp | 2 - .../kernel/qwinnativepangesturerecognizer_win.cpp | 23 ++++----- .../kernel/qwinnativepangesturerecognizer_win_p.h | 5 +- 7 files changed, 50 insertions(+), 58 deletions(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index da9daae..f615129 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -124,9 +124,9 @@ void ImageWidget::panTriggered(QPanGesture *gesture) setCursor(Qt::ArrowCursor); } #endif - QPointF lastOffset = gesture->offset(); - horizontalOffset += lastOffset.x(); - verticalOffset += lastOffset.y(); + QPointF delta = gesture->delta(); + horizontalOffset += delta.x(); + verticalOffset += delta.y(); update(); } diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 96fd64d..ae2e287 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -92,7 +92,7 @@ public: QPointF lastOffset; QPointF offset; - QPoint lastPosition; + QPoint startPosition; qreal acceleration; }; diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm index 7019580..d842322 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac.mm +++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm @@ -53,13 +53,13 @@ QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer() { } -QGesture *QMacSwipeGestureRecognizer::createGesture(QObject * /*target*/) +QGesture *QMacSwipeGestureRecognizer::create(QObject * /*target*/) { return new QSwipeGesture; } QGestureRecognizer::Result -QMacSwipeGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent *event) +QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event) { if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) { QNativeGestureEvent *ev = static_cast(event); @@ -67,7 +67,7 @@ QMacSwipeGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent case QNativeGestureEvent::Swipe: { QSwipeGesture *g = static_cast(gesture); g->setSwipeAngle(ev->angle); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; break; } default: break; @@ -90,13 +90,13 @@ QMacPinchGestureRecognizer::QMacPinchGestureRecognizer() { } -QGesture *QMacPinchGestureRecognizer::createGesture(QObject * /*target*/) +QGesture *QMacPinchGestureRecognizer::create(QObject * /*target*/) { return new QPinchGesture; } QGestureRecognizer::Result -QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent *event) +QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event) { if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) { QPinchGesture *g = static_cast(gesture); @@ -106,26 +106,26 @@ QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent reset(gesture); g->setStartCenterPoint(static_cast(obj)->mapFromGlobal(ev->position)); g->setCenterPoint(g->startCenterPoint()); - g->setWhatChanged(QPinchGesture::CenterPointChanged); - return QGestureRecognizer::MaybeGesture | QGestureRecognizer::ConsumeEventHint; + g->setChangeFlags(QPinchGesture::CenterPointChanged); + g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags()); + return QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint; case QNativeGestureEvent::Rotate: { g->setLastScaleFactor(g->scaleFactor()); g->setLastRotationAngle(g->rotationAngle()); g->setRotationAngle(g->rotationAngle() + ev->percentage); - g->setWhatChanged(QPinchGesture::RotationAngleChanged); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; - break; + g->setChangeFlags(QPinchGesture::RotationAngleChanged); + g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags()); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } case QNativeGestureEvent::Zoom: g->setLastScaleFactor(g->scaleFactor()); g->setLastRotationAngle(g->rotationAngle()); g->setScaleFactor(g->scaleFactor() + ev->percentage); - g->setWhatChanged(QPinchGesture::ScaleFactorChanged); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; - break; + g->setChangeFlags(QPinchGesture::ScaleFactorChanged); + g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags()); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; case QNativeGestureEvent::GestureEnd: - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; - break; + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; default: break; } @@ -137,7 +137,8 @@ QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent void QMacPinchGestureRecognizer::reset(QGesture *gesture) { QPinchGesture *g = static_cast(gesture); - g->setWhatChanged(0); + g->setChangeFlags(0); + g->setTotalChangeFlags(0); g->setScaleFactor(1.0f); g->setTotalScaleFactor(1.0f); g->setLastScaleFactor(1.0f); @@ -158,7 +159,7 @@ QMacPanGestureRecognizer::QMacPanGestureRecognizer() : _panCanceled(true) { } -QGesture *QMacPanGestureRecognizer::createGesture(QObject *target) +QGesture *QMacPanGestureRecognizer::create(QObject *target) { if (!target) return new QPanGesture; @@ -172,7 +173,7 @@ QGesture *QMacPanGestureRecognizer::createGesture(QObject *target) } QGestureRecognizer::Result -QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent *event) +QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *event) { const int panBeginDelay = 300; const int panBeginRadius = 3; @@ -185,10 +186,9 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent if (ev->touchPoints().size() == 1) { reset(gesture); _startPos = QCursor::pos(); - _lastPos = _startPos; _panTimer.start(panBeginDelay, target); _panCanceled = false; - return QGestureRecognizer::MaybeGesture; + return QGestureRecognizer::MayBeGesture; } break;} case QEvent::TouchEnd: { @@ -197,7 +197,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent const QTouchEvent *ev = static_cast(event); if (ev->touchPoints().size() == 1) - return QGestureRecognizer::GestureFinished; + return QGestureRecognizer::FinishGesture; break;} case QEvent::TouchUpdate: { if (_panCanceled) @@ -212,23 +212,21 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent if ((p - _startPos).manhattanLength() > panBeginRadius) { _panCanceled = true; _panTimer.stop(); - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } } else { const QPointF p = QCursor::pos(); - const QPointF posOffset = p - _lastPos; + const QPointF posOffset = p - _startPos; g->setLastOffset(g->offset()); g->setOffset(QPointF(posOffset.x(), posOffset.y())); - g->setTotalOffset(g->lastOffset() + g->offset()); - _lastPos = p; - return QGestureRecognizer::GestureTriggered; + return QGestureRecognizer::TriggerGesture; } } else if (_panTimer.isActive()) { // I only want to cancel the pan if the user is pressing // more than one finger, and the pan hasn't started yet: _panCanceled = true; _panTimer.stop(); - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } break;} case QEvent::Timer: { @@ -239,8 +237,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent break; // Begin new pan session! _startPos = QCursor::pos(); - _lastPos = _startPos; - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } break; } default: @@ -254,11 +251,9 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture) { QPanGesture *g = static_cast(gesture); _startPos = QPointF(); - _lastPos = QPointF(); _panCanceled = true; g->setOffset(QPointF(0, 0)); g->setLastOffset(QPointF(0, 0)); - g->setTotalOffset(QPointF(0, 0)); g->setAcceleration(qreal(1)); QGestureRecognizer::reset(gesture); } diff --git a/src/gui/kernel/qmacgesturerecognizer_mac_p.h b/src/gui/kernel/qmacgesturerecognizer_mac_p.h index bdc2e08..2dac56a 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac_p.h +++ b/src/gui/kernel/qmacgesturerecognizer_mac_p.h @@ -64,8 +64,8 @@ class QMacSwipeGestureRecognizer : public QGestureRecognizer public: QMacSwipeGestureRecognizer(); - QGesture *createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event); void reset(QGesture *gesture); }; @@ -74,8 +74,8 @@ class QMacPinchGestureRecognizer : public QGestureRecognizer public: QMacPinchGestureRecognizer(); - QGesture *createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event); void reset(QGesture *gesture); }; @@ -86,12 +86,11 @@ class QMacPanGestureRecognizer : public QObject, public QGestureRecognizer public: QMacPanGestureRecognizer(); - QGesture *createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event); void reset(QGesture *gesture); private: QPointF _startPos; - QPointF _lastPos; QBasicTimer _panTimer; bool _panCanceled; }; diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index ba00a90..dfd49eb 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -79,7 +79,6 @@ QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, QOb case QEvent::TouchBegin: { result = QGestureRecognizer::MayBeGesture; QTouchEvent::TouchPoint p = ev->touchPoints().at(0); - d->lastPosition = p.pos().toPoint(); d->lastOffset = d->offset = QPointF(); break; } @@ -134,7 +133,6 @@ void QPanGestureRecognizer::reset(QGesture *state) QPanGesturePrivate *d = pan->d_func(); d->lastOffset = d->offset = QPointF(); - d->lastPosition = QPoint(); d->acceleration = 0; QGestureRecognizer::reset(state); diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp index c3c8a28..5fceb13 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp @@ -56,7 +56,7 @@ QWinNativePanGestureRecognizer::QWinNativePanGestureRecognizer() { } -QGesture *QWinNativePanGestureRecognizer::createGesture(QObject *target) +QGesture *QWinNativePanGestureRecognizer::create(QObject *target) { if (!target) return new QPanGesture; // a special case @@ -73,7 +73,9 @@ QGesture *QWinNativePanGestureRecognizer::createGesture(QObject *target) return new QPanGesture; } -QGestureRecognizer::Result QWinNativePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QWinNativePanGestureRecognizer::recognize(QGesture *state, + QObject *, + QEvent *event) { QPanGesture *q = static_cast(state); QPanGesturePrivate *d = q->d_func(); @@ -85,26 +87,25 @@ QGestureRecognizer::Result QWinNativePanGestureRecognizer::filterEvent(QGesture case QNativeGestureEvent::GestureBegin: break; case QNativeGestureEvent::Pan: - result = QGestureRecognizer::GestureTriggered; + result = QGestureRecognizer::TriggerGesture; event->accept(); break; case QNativeGestureEvent::GestureEnd: if (q->state() == Qt::NoGesture) return QGestureRecognizer::Ignore; // some other gesture has ended - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; break; default: return QGestureRecognizer::Ignore; } if (q->state() == Qt::NoGesture) { - d->lastOffset = d->totalOffset = d->offset = QPointF(); + d->lastOffset = d->offset = QPointF(); + d->startPosition = ev->position; } else { d->lastOffset = d->offset; - d->offset = QPointF(ev->position.x() - d->lastPosition.x(), - ev->position.y() - d->lastPosition.y()); - d->totalOffset += d->offset; + d->offset = QPointF(ev->position.x() - d->startPosition.x(), + ev->position.y() - d->startPosition.y()); } - d->lastPosition = ev->position; } return result; } @@ -114,8 +115,8 @@ void QWinNativePanGestureRecognizer::reset(QGesture *state) QPanGesture *pan = static_cast(state); QPanGesturePrivate *d = pan->d_func(); - d->totalOffset = d->lastOffset = d->offset = QPointF(); - d->lastPosition = QPoint(); + d->lastOffset = d->offset = QPointF(); + d->startPosition = QPoint(); d->acceleration = 0; QGestureRecognizer::reset(state); diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h index 1d723da..8fb0d50 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h @@ -62,9 +62,8 @@ class QWinNativePanGestureRecognizer : public QGestureRecognizer public: QWinNativePanGestureRecognizer(); - QGesture *createGesture(QObject *target); - - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; -- cgit v0.12 From ddbccf7f066d26d3420c9ed18d8c930200814ce1 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 30 Oct 2009 12:14:39 +0100 Subject: Add the Symbian Foundation OS versions Symbian^1 - SV_SF_1 Symbian^2 - SV_SF_2 etc. This is for the benefit of developers working with the Symbian master codelines. Reviewed-by: axis --- src/corelib/global/qglobal.cpp | 22 +++++++++++++++------- src/corelib/global/qglobal.h | 17 +++++++++++++---- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 33c6a34..5578091 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -960,7 +960,7 @@ QT_BEGIN_NAMESPACE \relates Turns the major, minor and patch numbers of a version into an - integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can + integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can be compared with another similarly processed version id. \sa QT_VERSION @@ -1795,7 +1795,7 @@ QSysInfo::S60Version QSysInfo::s60Version() TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents); if (err == KErrNone) { err = contents->Sort(EDescending|ESortByName); - if (err == KErrNone) { + if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) { TInt major = (*contents)[0].iName[9] - '0'; TInt minor = (*contents)[0].iName[11] - '0'; if (major == 3) { @@ -1808,6 +1808,12 @@ QSysInfo::S60Version QSysInfo::s60Version() if (minor == 0) { return cachedS60Version = SV_S60_5_0; } + else if (minor == 1) { + return cachedS60Version = SV_S60_5_1; + } + else if (minor == 2) { + return cachedS60Version = SV_S60_5_2; + } } } delete contents; @@ -1822,12 +1828,10 @@ QSysInfo::S60Version QSysInfo::s60Version() return cachedS60Version = SV_S60_3_2; # elif defined(__S60_50__) return cachedS60Version = SV_S60_5_0; -# else - return cachedS60Version = SV_S60_Unknown; # endif -# else - return cachedS60Version = SV_S60_Unknown; # endif + //If reaching here, it was not possible to determine the version + return cachedS60Version = SV_S60_Unknown; } QSysInfo::SymbianVersion QSysInfo::symbianVersion() { @@ -1838,6 +1842,10 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion() return SV_9_3; case SV_S60_5_0: return SV_9_4; + case SV_S60_5_1: + return SV_9_4; + case SV_S60_5_2: + return SV_9_4; default: return SV_Unknown; } @@ -2572,7 +2580,7 @@ void qsrand() seed = GetTickCount(); srand(seed); -#else +#else // Symbian? #endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index cbb8fda..95f09ea 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1478,17 +1478,26 @@ public: #ifdef Q_OS_SYMBIAN enum SymbianVersion { SV_Unknown = 0x0000, + //These are the Symbian Ltd versions 9.2-9.4 SV_9_2 = 10, SV_9_3 = 20, - SV_9_4 = 30 + SV_9_4 = 30, + //Following values are the symbian foundation versions, i.e. Symbian^1 == SV_SF_1 + SV_SF_1 = SV_9_4, + SV_SF_2 = 40, + SV_SF_3 = 50, + SV_SF_4 = 60 }; static SymbianVersion symbianVersion(); enum S60Version { SV_S60_None = 0, SV_S60_Unknown = 1, - SV_S60_3_1 = 10, - SV_S60_3_2 = 20, - SV_S60_5_0 = 30 + SV_S60_3_1 = SV_9_2, + SV_S60_3_2 = SV_9_3, + SV_S60_5_0 = SV_9_4, + //versions beyond 5.0 are to be confirmed - it is better to use symbian version + SV_S60_5_1 = SV_SF_2, + SV_S60_5_2 = SV_SF_3 }; static S60Version s60Version(); #endif -- cgit v0.12 From 92a393940d2dc3a9e2cd4f27e4ca62643c816f6f Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 30 Oct 2009 17:43:45 +0100 Subject: Fix crash in QApplication autotest introduced by native pixmaps (S60 3.1) Problem was caused by S60 closing a handle under our feet when QApplication is destroyed. To avoid this, we open our own handle for the global lock instead of using the shared one inside CFbsBitmap. Also the global unlock/relock is not needed on S60 3.2 so this can be eliminated and save a few cycles (the function call was a no-op before) Reviewed-by: Jani Hautakangas --- src/gui/image/qpixmap_s60.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 7086341..5c7e93f 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -73,27 +73,27 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, used to lock the global bitmap heap. Only used in S60 v3.1 and S60 v3.2. */ +_LIT(KFBSERVLargeBitmapAccessName,"FbsLargeBitmapAccess"); class QSymbianFbsClient { public: - QSymbianFbsClient() : heapLock(0), heapLocked(false) + QSymbianFbsClient() : heapLocked(false) { - QT_TRAP_THROWING(heapLock = new(ELeave) CFbsBitmap); - heapLock->Create(TSize(0,0), S60->screenDevice()->DisplayMode()); + heapLock.OpenGlobal(KFBSERVLargeBitmapAccessName); } ~QSymbianFbsClient() { - delete heapLock; + heapLock.Close(); } bool lockHeap() { bool wasLocked = heapLocked; - if (heapLock && !heapLocked) { - heapLock->LockHeap(ETrue); + if (heapLock.Handle() && !heapLocked) { + heapLock.Wait(); heapLocked = true; } @@ -104,8 +104,8 @@ public: { bool wasLocked = heapLocked; - if (heapLock && heapLocked) { - heapLock->UnlockHeap(ETrue); + if (heapLock.Handle() && heapLocked) { + heapLock.Signal(); heapLocked = false; } @@ -115,7 +115,7 @@ public: private: - CFbsBitmap *heapLock; + RMutex heapLock; bool heapLocked; }; @@ -169,7 +169,7 @@ public: inline void beginDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) + if (symbianVersion == QSysInfo::SV_9_2) heapWasLocked = qt_symbianFbsClient()->lockHeap(); else bitmap->LockHeap(ETrue); @@ -177,7 +177,7 @@ public: inline void endDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) { + if (symbianVersion == QSysInfo::SV_9_2) { if (!heapWasLocked) qt_symbianFbsClient()->unlockHeap(); } else { -- cgit v0.12 From 5308b1c607c1209822078d8aae329308c8017636 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 09:47:25 +0100 Subject: Fix for potential crash in S60 style Leaving function called without a TRAP Reviewed-by: Sami Merila --- src/gui/styles/qs60style_s60.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 678844c..0cd87bd 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1382,13 +1382,13 @@ QSize QS60StylePrivate::naviPaneSize() QSize QS60StyleModeSpecifics::naviPaneSize() { CAknNavigationControlContainer* naviContainer; - if (S60->statusPane()) - naviContainer = static_cast - (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); - if (naviContainer) - return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight); - else - return QSize(0,0); + if (S60->statusPane()) { + TRAPD(err, naviContainer = static_cast + (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi)))); + if (err==KErrNone) + return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight); + } + return QSize(0,0); } #endif // Q_WS_S60 -- cgit v0.12 From 3769f290ccc20ff92dd43038743f96097d9fabd0 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 13:03:11 +0100 Subject: Fix cleanupstack crash on exit in Symbian OS 9.2 Destroying the control environment also pops items from the original cleanup stack which is not owned by the control environment. This is a platform issue (and does not occur in 9.3 & 9.4). To avoid this causing a panic, the s60main is changed to not push items on the cleanup stack (instead, it TRAPs the call to main(), and deletes its allocations manually). A further 9.2 cleanup stack crash was caused when application construction fails (because of missing resource files). The resulting exception would bypass deleting the control environment, and return from main with the wrong cleanup stack active. This is resolved by doing the TRAP / cleanup / throw manually instead of using qt_trap_throwing (The control environment cannot be pushed to the cleanup stack, because it owns the cleanup stack at that time). This isn't a 9.2 specific bug, but rather is revealed by 9.2 because the missing resource file is non fatal in 9.3 and 9.4. Fixes many autotests which have crashed on S60 3.1 since the cleanup stack swapping patch. Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 11 ++++++++++- src/s60main/qts60main_mcrt0.cpp | 8 +++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e5ee2f1..1b0659a 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1052,8 +1052,17 @@ void qt_init(QApplicationPrivate * /* priv */, int) // After this construction, CEikonEnv will be available from CEikonEnv::Static(). // (much like our qApp). CEikonEnv* coe = new CEikonEnv; - QT_TRAP_THROWING(coe->ConstructAppFromCommandLineL(factory,*commandLine)); + //not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there. + if(err == KErrNone) + TRAP(err, coe->ConstructAppFromCommandLineL(factory,*commandLine)); delete commandLine; + if(err != KErrNone) { + qWarning() << "qt_init: Eikon application construct failed (" + << err + << "), maybe missing resource file on S60 3.1?"; + delete coe; + qt_symbian_throwIfError(err); + } S60->s60InstalledTrapHandler = User::SetTrapHandler(origTrapHandler); diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index d30e07a..edc2fb8 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -83,12 +83,10 @@ GLDEF_C TInt QtMainWrapper() char **envp = 0; // get args & environment __crt0(argc, argv, envp); - CleanupArrayDelete::PushL(argv); - CleanupArrayDelete::PushL(envp); //Call user(application)'s main - int ret = 0; - QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);); - CleanupStack::PopAndDestroy(2, argv); + TRAPD(ret, QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);)); + delete[] argv; + delete[] envp; return ret; } -- cgit v0.12 From 5919feba122d0e5a696a72a3d1e2eff6928824f8 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 13:49:32 +0100 Subject: Fix qclipboard autotest on s60 3.1 It launches 2 subprocesses that use QApplication. Added the resource files to deployment so that construction does not fail Reviewed-by: axis --- tests/auto/qclipboard/test/test.pro | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro index 508eba1..62a38af 100644 --- a/tests/auto/qclipboard/test/test.pro +++ b/tests/auto/qclipboard/test/test.pro @@ -13,7 +13,18 @@ win32 { wince*|symbian*: { copier.sources = ../copier/copier.exe copier.path = copier - paster.sources = ../paster/paster.exe + paster.sources = ../paster/paster.exe paster.path = paster - DEPLOYMENT = copier paster + + symbian*: { + load(data_caging_paths) + rsc.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc + rsc.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc + rsc.path = $$APP_RESOURCE_DIR + reg_resource.sources = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/copier_reg.rsc + reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc + reg_resource.path = $$REG_RESOURCE_IMPORT_DIR + } + + DEPLOYMENT = copier paster rsc reg_resource } \ No newline at end of file -- cgit v0.12 From 95f7076937065a78029fc50d506fba58f8c6199c Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 13:51:49 +0100 Subject: Fix qdatetime autotest regression My previous addition to the test case to validate local time was too strict for all platforms. Reviewed-by: Paul --- tests/auto/qdatetime/tst_qdatetime.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index c53780e..1140402 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -450,11 +450,12 @@ void tst_QDateTime::toString_enumformat() qDebug() << str3; QVERIFY(!str3.isEmpty()); //check for date/time components in any order - QVERIFY(str3.contains("1995")); + //year may be 2 or 4 digits + QVERIFY(str3.contains("95")); //day and month may be in numeric or word form QVERIFY(str3.contains("12")); QVERIFY(str3.contains("34")); - QVERIFY(str3.contains("56")); + //seconds may be absent } void tst_QDateTime::addDays() -- cgit v0.12 From 4c011468bb93a3d0b8e5cc0d9dd16e7528079119 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 14:05:00 +0100 Subject: Compile... Reviewed-by: TrustMe --- src/gui/styles/qwindowsxpstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 9fd9ce9..fe7f5d7 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -2926,10 +2926,10 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } // Draw arrow p->save(); - p->setPen(option->palette.dark()); + p->setPen(option->palette.dark().color()); p->drawLine(menuarea.left(), menuarea.top() + 3, menuarea.left(), menuarea.bottom() - 3); - p->setPen(option->palette.light()); + p->setPen(option->palette.light().color()); p->drawLine(menuarea.left() - 1, menuarea.top() + 3, menuarea.left() - 1, menuarea.bottom() - 3); -- cgit v0.12 From 4d0735b98a9bd6b440adf63725e6062b601ed442 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 14:05:31 +0100 Subject: Check for QPixmap::isNull() in QPainter::drawPixmap() Reviewed-by: Samuel --- src/gui/painting/qpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 8d6cad3..cbae5b6 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5164,7 +5164,7 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) Q_D(QPainter); - if (!d->engine) + if (!d->engine || pm.isNull()) return; #ifndef QT_NO_DEBUG -- cgit v0.12 From 381247326743888075979664f50ea804d6123c42 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 3 Nov 2009 13:56:42 +0100 Subject: Fixed an input method bug when erasing the last character. Previously we didn't update the editor contents if the new preedit string was empty. However, it could be empty because the user just erased it, so the bug was fixed by checking whether the preedit string in the event and in the editor are different. RevBy: Denis Dzyubenko --- src/gui/text/qtextcontrol.cpp | 3 ++- src/gui/widgets/qlinecontrol.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 3f6545c..9497b6f 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1831,7 +1831,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) e->ignore(); return; } - bool isGettingInput = !e->commitString().isEmpty() || !e->preeditString().isEmpty() + bool isGettingInput = !e->commitString().isEmpty() + || e->preeditString() != cursor.block().layout()->preeditAreaText() || e->replacementLength() > 0; if (isGettingInput) { diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 8f17e98..0fc94c9 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -401,7 +401,8 @@ void QLineControl::moveCursor(int pos, bool mark) void QLineControl::processInputMethodEvent(QInputMethodEvent *event) { int priorState = 0; - bool isGettingInput = !event->commitString().isEmpty() || !event->preeditString().isEmpty() + bool isGettingInput = !event->commitString().isEmpty() + || event->preeditString() != preeditAreaText() || event->replacementLength() > 0; bool cursorPositionChanged = false; -- cgit v0.12 From 53e486c0e8d23d535711debdd3a71c8ef2211c58 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 14:41:22 +0100 Subject: Fixed tst_qgraphicsitem::hitTestGraphicsEffectItem, caching makes testcase invalid... Reviewed-by: Samuel --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 684ad4f..3bc6db5 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7676,20 +7676,6 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() QCOMPARE(items.size(), 1); QCOMPARE(items.at(0), static_cast(item3)); - item1->repaints = 0; - item2->repaints = 0; - item3->repaints = 0; - - view.viewport()->update(75, 75, 20, 20); - QTest::qWait(50); - - // item1 is the effect source and must therefore be repainted. - // item2 intersects with the exposed region - // item3 is just another child outside the exposed region - QCOMPARE(item1->repaints, 1); - QCOMPARE(item2->repaints, 1); - QCOMPARE(item3->repaints, 0); - scene.setItemIndexMethod(QGraphicsScene::NoIndex); QTest::qWait(100); -- cgit v0.12 From edec363cd4dfcb01c488be7f66bdfa2ca93f48bf Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 3 Nov 2009 14:53:19 +0100 Subject: Doc: Added links to the SQL documentation and corrected license info. Reviewed-by: Trust Me --- doc/src/modules.qdoc | 5 ++++- doc/src/sql-programming/sql-programming.qdoc | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 9c92a31..ea5a9dc 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -367,6 +367,9 @@ The QtSql module is part of the \l{Qt Full Framework Edition} and the \l{Open Source Versions of Qt}. + + See the \l{SQL Programming} guide for information about using this + module in your applications. */ /*! @@ -576,7 +579,7 @@ the module under the appropriate version of the GNU LGPL; version 2.1 for applications and libraries licensed under the GNU GPL version 2, or version 3 for applications and libraries licensed under the GNU - GPL version 2. + GPL version 3. \legalese This file is part of the KDE project diff --git a/doc/src/sql-programming/sql-programming.qdoc b/doc/src/sql-programming/sql-programming.qdoc index d0b6776..3aceb17 100644 --- a/doc/src/sql-programming/sql-programming.qdoc +++ b/doc/src/sql-programming/sql-programming.qdoc @@ -49,6 +49,7 @@ /*! \page sql-programming.html \title SQL Programming + \nextpage Connecting to Databases \brief Database integration for Qt applications. @@ -95,7 +96,7 @@ and the SQL API layer. See \l{SQL Database Drivers} for more information. \section2 SQL API Layer - + These classes provide access to databases. Connections are made using the QSqlDatabase class. Database interaction is achieved by using the QSqlQuery class. @@ -119,6 +120,7 @@ \title Connecting to Databases \contentspage SQL Programming + \previouspage SQL Programming \nextpage Executing SQL Statements To access a database with QSqlQuery or QSqlQueryModel, create and -- cgit v0.12 From 03c5d276c6ffc16c43ac554aa2e22b5824c35c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 3 Nov 2009 16:03:10 +0200 Subject: Inclusion of QtOpenVg overwrites all other modules in s60install.pro The pro-file is missing '+' when it is adding QtOpenVg support for sis file. Task-number: None Reviewed-by: Janne Koskinen --- src/s60installs/s60installs.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 9c53167..90c9f27 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -107,7 +107,7 @@ symbian: { graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems contains(QT_CONFIG, openvg) { - qtlibraries.sources = QtOpenVG.dll + qtlibraries.sources += QtOpenVG.dll graphicssystems_plugins.sources += qvggraphicssystem.dll } -- cgit v0.12 From 86e074f47848955cd0ffbc78112493af46c2ed12 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 3 Nov 2009 15:45:32 +0100 Subject: Doc: Fixed license information. Reviewed-by: Trust Me --- src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 09dfae5..408478c 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -31,7 +31,7 @@ the module under the appropriate version of the GNU LGPL; version 2.1 for applications and libraries licensed under the GNU GPL version 2, or version 3 for applications and libraries licensed under the GNU - GPL version 2. + GPL version 3. \legalese WebKit is licensed under the GNU Library General Public License. -- cgit v0.12 From fc45c07c27100591750ad5c360fde535e15b9dbd Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 3 Nov 2009 16:45:10 +0200 Subject: Made xmlpatterns autotests compile for Symbian Fixed xmlpatterns autotests so that they compile for Symbian with both RVCT and NokiaX86 compilers. Reviewed-by: Janne Koskinen --- src/xmlpatterns/acceltree/qacceltree_p.h | 2 +- src/xmlpatterns/acceltree/qcompressedwhitespace_p.h | 2 +- tests/auto/checkxmlfiles/checkxmlfiles.pro | 2 +- tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp | 2 +- tests/auto/qxmlquery/tst_qxmlquery.cpp | 14 +++++++------- tests/auto/qxmlschema/tst_qxmlschema.cpp | 4 ++-- tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp | 12 ++++++------ tests/auto/qxmlserializer/tst_qxmlserializer.cpp | 4 ++-- tests/auto/xmlpatterns.pri | 5 +++-- tests/auto/xmlpatterns/tst_xmlpatterns.cpp | 10 +++++++++- tests/auto/xmlpatterns/xmlpatterns.pro | 6 +++--- tests/auto/xmlpatternsdiagnosticsts/test/test.pro | 4 ++-- tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro | 5 +++-- tests/auto/xmlpatternsxqts/lib/Global.h | 2 +- tests/auto/xmlpatternsxqts/lib/lib.pro | 6 ++++++ 15 files changed, 48 insertions(+), 32 deletions(-) diff --git a/src/xmlpatterns/acceltree/qacceltree_p.h b/src/xmlpatterns/acceltree/qacceltree_p.h index 8da61c9..ee7d6f6 100644 --- a/src/xmlpatterns/acceltree/qacceltree_p.h +++ b/src/xmlpatterns/acceltree/qacceltree_p.h @@ -89,7 +89,7 @@ namespace QPatternist * @see Accelerating * XPath Evaluation in Any RDBMS, Torsten Grust */ - class AccelTree : public QAbstractXmlNodeModel + class Q_AUTOTEST_EXPORT AccelTree : public QAbstractXmlNodeModel { friend class AccelTreePrivate; public: diff --git a/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h b/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h index bb547bd..27e3c22 100644 --- a/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h +++ b/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h @@ -84,7 +84,7 @@ namespace QPatternist * * @author Frans Englich */ - class CompressedWhitespace + class Q_AUTOTEST_EXPORT CompressedWhitespace { public: /** diff --git a/tests/auto/checkxmlfiles/checkxmlfiles.pro b/tests/auto/checkxmlfiles/checkxmlfiles.pro index c368c02..d53c11c 100644 --- a/tests/auto/checkxmlfiles/checkxmlfiles.pro +++ b/tests/auto/checkxmlfiles/checkxmlfiles.pro @@ -12,7 +12,7 @@ addFiles.sources = \ $$QT_SOURCE_TREE/examples/sql/masterdetail/albumdetails.xml \ $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/globalVariables/globals.gccxml \ $$QT_SOURCE_TREE/doc/src/diagrams/stylesheet/treeview.svg \ - $$QT_SOURCE_TREE/doc/src/diagrams/designer-mainwindow-actions.ui \ + $$QT_SOURCE_TREE/doc/src/diagrams/designer-manual/designer-mainwindow-actions.ui \ $$QT_SOURCE_TREE/demos/undo/undo.qrc addFiles.path = xmlfiles DEPLOYMENT += addFiles diff --git a/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp b/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp index cb6bd4d..c19deb6 100644 --- a/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp +++ b/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp @@ -178,7 +178,7 @@ void tst_QXmlNodeModelIndex::model() const /* Check default value. */ { const QXmlNodeModelIndex index; - QCOMPARE(index.model(), static_cast(0)); + QCOMPARE(index.model(), static_cast(0)); } } diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index 8a9d4ef..49f2b08 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -345,8 +345,8 @@ void tst_QXmlQuery::copyConstructor() const query1.setInitialTemplateName(name); const QXmlQuery query2(query1); - QCOMPARE(query2.messageHandler(), &silencer); - QCOMPARE(query2.uriResolver(), &resolver); + QCOMPARE(query2.messageHandler(), static_cast(&silencer)); + QCOMPARE(query2.uriResolver(), static_cast(&resolver)); QCOMPARE(query2.queryLanguage(), QXmlQuery::XSLT20); QCOMPARE(query2.initialTemplateName(), name); QCOMPARE(query2.networkAccessManager(), &networkManager); @@ -522,7 +522,7 @@ void tst_QXmlQuery::assignmentOperator() const QVERIFY(copy.isValid()); QCOMPARE(copy.uriResolver(), static_cast(&returnURI)); - QCOMPARE(copy.messageHandler(), &silencer); + QCOMPARE(copy.messageHandler(), static_cast(&silencer)); QCOMPARE(testName.localName(copy.namePool()), QString::fromLatin1("somethingToCheck")); QXmlResultItems result; @@ -559,7 +559,7 @@ void tst_QXmlQuery::assignmentOperator() const /* Check that the copy picked up the new things. */ QVERIFY(copy.isValid()); QCOMPARE(copy.uriResolver(), static_cast(&secondUriResolver)); - QCOMPARE(copy.messageHandler(), &secondSilencer); + QCOMPARE(copy.messageHandler(), static_cast(&secondSilencer)); QXmlResultItems resultCopy; copy.evaluateTo(&resultCopy); @@ -577,7 +577,7 @@ void tst_QXmlQuery::assignmentOperator() const /* Check that the original is unchanged. */ QVERIFY(original.isValid()); QCOMPARE(original.uriResolver(), static_cast(&returnURI)); - QCOMPARE(original.messageHandler(), &silencer); + QCOMPARE(original.messageHandler(), static_cast(&silencer)); QXmlResultItems resultOriginal; original.evaluateTo(&resultOriginal); @@ -931,7 +931,7 @@ void tst_QXmlQuery::setMessageHandler() const QXmlQuery query; MessageSilencer silencer; query.setMessageHandler(&silencer); - QCOMPARE(&silencer, query.messageHandler()); + QCOMPARE(static_cast(&silencer), query.messageHandler()); } void tst_QXmlQuery::evaluateToReceiver() @@ -1691,7 +1691,7 @@ void tst_QXmlQuery::setUriResolver() const TestURIResolver resolver; QXmlQuery query; query.setUriResolver(&resolver); - QCOMPARE(query.uriResolver(), &resolver); + QCOMPARE(query.uriResolver(), static_cast(&resolver)); } } diff --git a/tests/auto/qxmlschema/tst_qxmlschema.cpp b/tests/auto/qxmlschema/tst_qxmlschema.cpp index 79f5587..ec91f88 100644 --- a/tests/auto/qxmlschema/tst_qxmlschema.cpp +++ b/tests/auto/qxmlschema/tst_qxmlschema.cpp @@ -357,7 +357,7 @@ void tst_QXmlSchema::messageHandler() const QXmlSchema schema; schema.setMessageHandler(&handler); - QCOMPARE(schema.messageHandler(), &handler); + QCOMPARE(schema.messageHandler(), static_cast(&handler)); } } @@ -394,7 +394,7 @@ void tst_QXmlSchema::uriResolver() const QXmlSchema schema; schema.setUriResolver(&resolver); - QCOMPARE(schema.uriResolver(), &resolver); + QCOMPARE(schema.uriResolver(), static_cast(&resolver)); } } diff --git a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp index 519f864..9fc784b 100644 --- a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp +++ b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp @@ -149,8 +149,8 @@ void tst_QXmlSchemaValidator::propertyInitialization() const schema.setNetworkAccessManager(&manager); QXmlSchemaValidator validator(schema); - QCOMPARE(validator.messageHandler(), &handler); - QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.messageHandler(), static_cast(&handler)); + QCOMPARE(validator.uriResolver(), static_cast(&resolver)); QCOMPARE(validator.networkAccessManager(), &manager); } } @@ -384,7 +384,7 @@ void tst_QXmlSchemaValidator::messageHandler() const QXmlSchemaValidator validator(schema); validator.setMessageHandler(&handler); - QCOMPARE(validator.messageHandler(), &handler); + QCOMPARE(validator.messageHandler(), static_cast(&handler)); } /* Test that we return the message handler that was set, even if the schema changed in between. */ @@ -399,7 +399,7 @@ void tst_QXmlSchemaValidator::messageHandler() const const QXmlSchema schema2; validator.setSchema(schema2); - QCOMPARE(validator.messageHandler(), &handler); + QCOMPARE(validator.messageHandler(), static_cast(&handler)); } } @@ -452,7 +452,7 @@ void tst_QXmlSchemaValidator::uriResolver() const QXmlSchemaValidator validator(schema); validator.setUriResolver(&resolver); - QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.uriResolver(), static_cast(&resolver)); } /* Test that we return the uri resolver that was set, even if the schema changed in between. */ @@ -467,7 +467,7 @@ void tst_QXmlSchemaValidator::uriResolver() const const QXmlSchema schema2; validator.setSchema(schema2); - QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.uriResolver(), static_cast(&resolver)); } } diff --git a/tests/auto/qxmlserializer/tst_qxmlserializer.cpp b/tests/auto/qxmlserializer/tst_qxmlserializer.cpp index aeca140..51044ff 100644 --- a/tests/auto/qxmlserializer/tst_qxmlserializer.cpp +++ b/tests/auto/qxmlserializer/tst_qxmlserializer.cpp @@ -148,7 +148,7 @@ void tst_QXmlSerializer::outputDevice() const { const QXmlQuery query; const QXmlSerializer serializer(query, &file); - QCOMPARE(serializer.outputDevice(), &file); + QCOMPARE(serializer.outputDevice(), static_cast< QIODevice *>(&file)); } } @@ -158,7 +158,7 @@ void tst_QXmlSerializer::serializationError() const QXmlQuery query; MessageSilencer silencer; query.setMessageHandler(&silencer); - + query.setQuery(queryString); QByteArray output; diff --git a/tests/auto/xmlpatterns.pri b/tests/auto/xmlpatterns.pri index 7cdd67f..8c8ccad 100644 --- a/tests/auto/xmlpatterns.pri +++ b/tests/auto/xmlpatterns.pri @@ -15,8 +15,9 @@ QT -= gui XMLPATTERNS_SDK = QtXmlPatternsSDK if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { - win32:XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}d - else: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}_debug + symbian: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK} + else:win32: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}d + else: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}_debug } INCLUDEPATH += \ diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp index 0dcb070..22f6693 100644 --- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp +++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp @@ -48,6 +48,10 @@ #include "../qxmlquery/TestFundament.h" #include "../network-settings.h" +#if defined(Q_OS_SYMBIAN) +#define SRCDIR "" +#endif + /*! \class tst_XmlPatterns \internal @@ -130,6 +134,8 @@ void tst_XmlPatterns::xquerySupport() #ifdef Q_OS_WINCE QSKIP("WinCE: This test uses unsupported WinCE functionality", SkipAll); +#elif defined(Q_OS_SYMBIAN) + QSKIP("Symbian: This test uses unsupported Symbian functionality (QProcess with std streams)", SkipAll); #endif QFETCH(int, expectedExitCode); @@ -218,7 +224,7 @@ void tst_XmlPatterns::xquerySupport() void tst_XmlPatterns::xquerySupport_data() const { -#ifdef Q_OS_WINCE +#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) return; #endif @@ -849,6 +855,8 @@ void tst_XmlPatterns::xsltSupport_data() const #ifdef Q_OS_WINCE QSKIP("WinCE: This test uses unsupported WinCE functionality", SkipAll); +#elif defined(Q_OS_SYMBIAN) + QSKIP("Symbian: This test uses unsupported Symbian functionality (QProcess with std streams)", SkipAll); #endif QTest::addColumn("expectedExitCode"); diff --git a/tests/auto/xmlpatterns/xmlpatterns.pro b/tests/auto/xmlpatterns/xmlpatterns.pro index 01e3b2b..54dd9aa 100644 --- a/tests/auto/xmlpatterns/xmlpatterns.pro +++ b/tests/auto/xmlpatterns/xmlpatterns.pro @@ -2,10 +2,10 @@ load(qttest_p4) SOURCES += tst_xmlpatterns.cpp \ ../qxmlquery/TestFundament.cpp -!wince* { -DEFINES += SRCDIR=\\\"$$PWD/\\\" -} else { +wince* { DEFINES += SRCDIR=\\\"./\\\" +} else:!symbian { +DEFINES += SRCDIR=\\\"$$PWD/\\\" } include (../xmlpatterns.pri) diff --git a/tests/auto/xmlpatternsdiagnosticsts/test/test.pro b/tests/auto/xmlpatternsdiagnosticsts/test/test.pro index aeff896..acd71e4 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/test/test.pro +++ b/tests/auto/xmlpatternsdiagnosticsts/test/test.pro @@ -25,8 +25,8 @@ INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternsxqts/lib/ \ ../../xmlpatternsxqts/test \ ../../xmlpatternsxqts/lib -wince*: { - catalog.sources = TestSuite Baseline.xml +wince*|symbian { + catalog.sources = ../TestSuite ../Baseline.xml catalog.path = . DEPLOYMENT += catalog } diff --git a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro index bcc988a..0f55078 100644 --- a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro +++ b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro @@ -11,8 +11,9 @@ SOURCES += ../xmlpatternsxqts/test/tst_suitetest.cpp PATTERNIST_SDK = QtXmlPatternsSDK if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { - win32:PATTERNIST_SDK = $${PATTERNIST_SDK}d - else: PATTERNIST_SDK = $${PATTERNIST_SDK}_debug + symbian: PATTERNIST_SDK = $${PATTERNIST_SDK} + else:win32: PATTERNIST_SDK = $${PATTERNIST_SDK}d + else: PATTERNIST_SDK = $${PATTERNIST_SDK}_debug } LIBS += -l$$PATTERNIST_SDK diff --git a/tests/auto/xmlpatternsxqts/lib/Global.h b/tests/auto/xmlpatternsxqts/lib/Global.h index eadb940..a620417 100644 --- a/tests/auto/xmlpatternsxqts/lib/Global.h +++ b/tests/auto/xmlpatternsxqts/lib/Global.h @@ -47,7 +47,7 @@ #include "private/qitem_p.h" #include "private/qnamepool_p.h" -#ifdef Q_WS_WIN +#if defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) # ifdef Q_PATTERNISTSDK_BUILDING #define Q_PATTERNISTSDK_EXPORT __declspec(dllexport) #else diff --git a/tests/auto/xmlpatternsxqts/lib/lib.pro b/tests/auto/xmlpatternsxqts/lib/lib.pro index cb9453a..f5b0a06 100644 --- a/tests/auto/xmlpatternsxqts/lib/lib.pro +++ b/tests/auto/xmlpatternsxqts/lib/lib.pro @@ -13,6 +13,12 @@ mac { INSTALLS += target } +symbian { + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = All -Tcb + MMP_RULES += EXPORTUNFROZEN +} + # We add gui, because xmlpatterns.pri pull it out. QT += xmlpatterns xml network testlib gui -- cgit v0.12 From c95a0e6e8eb8ba5fd2a4412b318ad998b3ccb4fc Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 3 Nov 2009 16:06:05 +0100 Subject: Doc/i18n: Fixed source strings for translation. Reviewed-by: Oswald Buddenhagen --- src/3rdparty/phonon/gstreamer/mediaobject.cpp | 2 +- src/3rdparty/phonon/mmf/effectfactory.cpp | 4 ++-- .../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 4 ++-- src/gui/itemviews/qdirmodel.cpp | 2 +- src/network/ssl/qsslerror.cpp | 4 ++-- src/network/ssl/qsslsocket_openssl.cpp | 2 +- src/xmlpatterns/expr/qncnameconstructor_p.h | 2 +- src/xmlpatterns/parser/qquerytransformparser.cpp | 18 +++++++++--------- src/xmlpatterns/schema/qxsdschemahelper.cpp | 2 +- src/xmlpatterns/schema/qxsdschemaparser.cpp | 2 +- .../schema/qxsdvalidatinginstancereader.cpp | 4 ++-- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 5dcbd42..0eb34b0 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -87,7 +87,7 @@ MediaObject::MediaObject(Backend *backend, QObject *parent) m_name = "MediaObject" + QString::number(count++); if (!m_backend->isValid()) { - setError(tr("Cannot start playback. \n\nCheck your Gstreamer installation and make sure you " + setError(tr("Cannot start playback. \n\nCheck your GStreamer installation and make sure you " "\nhave libgstreamer-plugins-base installed."), Phonon::FatalError); } else { m_root = this; diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index 214baa0..e9c5e27 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -62,9 +62,9 @@ QHash EffectFactory::audioEffectDescriptions(AbstractAudio switch (type) { case AbstractAudioEffect::EffectAudioEqualizer: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "audio equalizer"), "Audio equalizer."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Audio Equalizer"), "Audio equalizer."); case AbstractAudioEffect::EffectBassBoost: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Bass boost"), "Bass boost."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Bass Boost"), "Bass boost."); case AbstractAudioEffect::EffectDistanceAttenuation: return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Distance Attenuation"), "Distance Attenuation."); case AbstractAudioEffect::EffectEnvironmentalReverb: diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 81ccbe8..1ed9b21 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -708,7 +708,7 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request) { ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().prettyURL(), - QCoreApplication::translate("QWebFrame", "Request cancelled", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Request canceled", 0, QCoreApplication::UnicodeUTF8)); error.setIsCancellation(true); return error; } @@ -746,7 +746,7 @@ WebCore::ResourceError FrameLoaderClientQt::interruptForPolicyChangeError(const WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response) { return ResourceError("WebKit", WebKitErrorCannotShowMIMEType, response.url().string(), - QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Cannot show MIME type", 0, QCoreApplication::UnicodeUTF8)); } WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response) diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp index 2973741..942cfd7 100644 --- a/src/gui/itemviews/qdirmodel.cpp +++ b/src/gui/itemviews/qdirmodel.cpp @@ -1351,7 +1351,7 @@ QString QDirModelPrivate::size(const QModelIndex &index) const return QFileSystemModel::tr("%1 MB").arg(QLocale().toString(qreal(bytes) / mb, 'f', 1)); if (bytes >= kb) return QFileSystemModel::tr("%1 KB").arg(QLocale().toString(bytes / kb)); - return QFileSystemModel::tr("%1 bytes").arg(QLocale().toString(bytes)); + return QFileSystemModel::tr("%1 byte(s)").arg(QLocale().toString(bytes)); } QString QDirModelPrivate::type(const QModelIndex &index) const diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp index 62fcd4c..8fb605c 100644 --- a/src/network/ssl/qsslerror.cpp +++ b/src/network/ssl/qsslerror.cpp @@ -251,10 +251,10 @@ QString QSslError::errorString() const errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "One of the CA certificates is invalid")); break; case PathLengthExceeded: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The basicConstraints pathlength parameter has been exceeded")); + errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The basicConstraints path length parameter has been exceeded")); break; case InvalidPurpose: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The supplied certificate is unsuited for this purpose")); + errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The supplied certificate is unsuitable for this purpose")); break; case CertificateUntrusted: errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The root CA certificate is not trusted for this purpose")); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 6f7e55a..743722f 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -324,7 +324,7 @@ init_context: // Check if the certificate matches the private key. if (!q_SSL_CTX_check_private_key(ctx)) { - q->setErrorString(QSslSocket::tr("Private key does not certificate public key, %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Private key does not certify public key, %1").arg(SSL_ERRORSTR())); emit q->error(QAbstractSocket::UnknownSocketError); return false; } diff --git a/src/xmlpatterns/expr/qncnameconstructor_p.h b/src/xmlpatterns/expr/qncnameconstructor_p.h index 6875c48..bbf9726 100644 --- a/src/xmlpatterns/expr/qncnameconstructor_p.h +++ b/src/xmlpatterns/expr/qncnameconstructor_p.h @@ -112,7 +112,7 @@ namespace QPatternist { return QtXmlPatterns::tr("The target name in a processing instruction " "cannot be %1 in any combination of upper " - "and lower case. Therefore, is %2 invalid.") + "and lower case. Therefore, %2 is invalid.") .arg(formatKeyword("xml"), formatKeyword(lexTarget)); } }; diff --git a/src/xmlpatterns/parser/qquerytransformparser.cpp b/src/xmlpatterns/parser/qquerytransformparser.cpp index 5894b83..c250d0c 100644 --- a/src/xmlpatterns/parser/qquerytransformparser.cpp +++ b/src/xmlpatterns/parser/qquerytransformparser.cpp @@ -418,7 +418,7 @@ static void registerNamedTemplate(const QXmlName &name, if(e) { - parseInfo->staticContext->error(QtXmlPatterns::tr("A template by name %1 " + parseInfo->staticContext->error(QtXmlPatterns::tr("A template with name %1 " "has already been declared.") .arg(formatKeyword(parseInfo->staticContext->namePool(), name)), @@ -882,7 +882,7 @@ static void variableUnavailable(const QXmlName &variableName, const ParserContext *const parseInfo, const YYLTYPE &location) { - parseInfo->staticContext->error(QtXmlPatterns::tr("No variable by name %1 exists") + parseInfo->staticContext->error(QtXmlPatterns::tr("No variable with name %1 exists") .arg(formatKeyword(parseInfo->staticContext->namePool(), variableName)), ReportContext::XPST0008, fromYYLTYPE(location, parseInfo)); } @@ -4028,7 +4028,7 @@ yyreduce: const AtomicValue::Ptr val(Decimal::fromLexical((yyvsp[(2) - (2)].sval))); if(val->hasError()) { - parseInfo->staticContext->error(QtXmlPatterns::tr("The value of attribute %1 must of type %2, which %3 isn't.") + parseInfo->staticContext->error(QtXmlPatterns::tr("The value of attribute %1 must be of type %2, which %3 isn't.") .arg(formatKeyword(QLatin1String("priority")), formatType(parseInfo->staticContext->namePool(), BuiltinTypes::xsDecimal), formatData((yyvsp[(2) - (2)].sval))), @@ -4104,7 +4104,7 @@ yyreduce: else if ((yyvsp[(5) - (7)].sval) == CommonNamespaces::XML || (yyvsp[(3) - (7)].sval) == QLatin1String("xml")) { parseInfo->staticContext->error(QtXmlPatterns::tr( - "The prefix %1 can not be bound. By default, it is already bound " + "The prefix %1 cannot be bound. By default, it is already bound " "to the namespace %2.") .arg(formatKeyword("xml")) .arg(formatURI(CommonNamespaces::XML)), @@ -4415,7 +4415,7 @@ yyreduce: allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(3) - (9)].enums.Bool)); if(variableByName((yyvsp[(5) - (9)].qName), parseInfo)) { - parseInfo->staticContext->error(QtXmlPatterns::tr("A variable by name %1 has already " + parseInfo->staticContext->error(QtXmlPatterns::tr("A variable with name %1 has already " "been declared.") .arg(formatKeyword(parseInfo->staticContext->namePool()->toLexical((yyvsp[(5) - (9)].qName)))), parseInfo->isXSLT() ? ReportContext::XTSE0630 : ReportContext::XQST0049, @@ -4455,7 +4455,7 @@ yyreduce: else { parseInfo->staticContext->error(QtXmlPatterns::tr("No value is available for the external " - "variable by name %1.") + "variable with name %1.") .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(5) - (9)].qName))), parseInfo->isXSLT() ? ReportContext::XTDE0050 : ReportContext::XPDY0002, fromYYLTYPE((yyloc), parseInfo)); @@ -4674,7 +4674,7 @@ yyreduce: { if((*it)->name() == (yyvsp[(3) - (3)].functionArgument)->name()) { - parseInfo->staticContext->error(QtXmlPatterns::tr("An argument by name %1 has already " + parseInfo->staticContext->error(QtXmlPatterns::tr("An argument with name %1 has already " "been declared. Every argument name " "must be unique.") .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(3) - (3)].functionArgument)->name())), @@ -6679,7 +6679,7 @@ yyreduce: (yyval.expr) = create(func, (yyloc), parseInfo); else { - parseInfo->staticContext->error(QtXmlPatterns::tr("No function by name %1 is available.") + parseInfo->staticContext->error(QtXmlPatterns::tr("No function with name %1 is available.") .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(1) - (4)].qName))), ReportContext::XPST0017, fromYYLTYPE((yyloc), parseInfo)); } @@ -6929,7 +6929,7 @@ yyreduce: &ryy, true); if(declaredAttributes.contains(att)) { - parseInfo->staticContext->error(QtXmlPatterns::tr("An attribute by name %1 has already appeared on this element.") + parseInfo->staticContext->error(QtXmlPatterns::tr("An attribute with name %1 has already appeared on this element.") .arg(formatKeyword(parseInfo->staticContext->namePool(), att)), ReportContext::XQST0040, fromYYLTYPE((yyloc), parseInfo)); diff --git a/src/xmlpatterns/schema/qxsdschemahelper.cpp b/src/xmlpatterns/schema/qxsdschemahelper.cpp index e9f32c2..7813808 100644 --- a/src/xmlpatterns/schema/qxsdschemahelper.cpp +++ b/src/xmlpatterns/schema/qxsdschemahelper.cpp @@ -727,7 +727,7 @@ bool XsdSchemaHelper::isValidAttributeUsesRestriction(const XsdAttributeUse::Lis } } else { if (!wildcard) { - errorMsg = QtXmlPatterns::tr("Derived attribute %1 does not exists in the base definition.").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool))); + errorMsg = QtXmlPatterns::tr("Derived attribute %1 does not exist in the base definition.").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool))); return false; } diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index 41c6b82..beb28bb 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -5959,7 +5959,7 @@ void XsdSchemaParser::validateIdAttribute(const char *elementName) attributeContentError("id", elementName, value, BuiltinTypes::xsID); } else { if (m_idCache->hasId(value)) { - error(QtXmlPatterns::tr("Component with id %1 has been defined previously.").arg(formatData(value))); + error(QtXmlPatterns::tr("Component with ID %1 has been defined previously.").arg(formatData(value))); } else { m_idCache->addId(value); } diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp index fda3548..622a39f 100644 --- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp @@ -469,7 +469,7 @@ bool XsdValidatingInstanceReader::validateElement(const XsdElement::Ptr &declara // 3.2.3.2 if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) { - error(QtXmlPatterns::tr("Fixed value constrained not allowed if element is nillable.")); + error(QtXmlPatterns::tr("Fixed value constraint not allowed if element is nillable.")); return false; } } @@ -699,7 +699,7 @@ bool XsdValidatingInstanceReader::validateElementComplexType(const XsdElement::P if (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed) { if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) { if (hasChildElement()) { - error(QtXmlPatterns::tr("Element %1 can not contain other elements, as it has a fixed content.").arg(formatKeyword(declaration->displayName(m_namePool)))); + error(QtXmlPatterns::tr("Element %1 cannot contain other elements, as it has a fixed content.").arg(formatKeyword(declaration->displayName(m_namePool)))); return false; } -- cgit v0.12 From a4e7db378ecd11bc858f76beb33c56ccebef6308 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 3 Nov 2009 15:59:41 +0100 Subject: Fixed fillRect on QImage::Format_ARGB32 images. With composition mode set to QPainter::CompositionMode_Source, the raster paint engine's fillRect function filled images which had non-premultiplied format with premultiplied colours. This was fixed by converting the premultiplied colour back to non-premultiplied before writing to the image. Task-number: QTBUG-5189 Reviewed-by: Trond --- src/gui/painting/qdrawhelper.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 53edbb0..41602a1 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7424,6 +7424,14 @@ QT_RECTFILL(qrgb444) QT_RECTFILL(qargb4444) #undef QT_RECTFILL +inline static void qt_rectfill_nonpremul_quint32(QRasterBuffer *rasterBuffer, + int x, int y, int width, int height, + quint32 color) +{ + qt_rectfill(reinterpret_cast(rasterBuffer->buffer()), + INV_PREMUL(color), x, y, width, height, rasterBuffer->bytesPerLine()); +} + // Map table for destination image format. Contains function pointers // for blends of various types unto the destination @@ -7466,7 +7474,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = qt_bitmapblit_quint32, qt_alphamapblit_quint32, qt_alphargbblit_quint32, - qt_rectfill_quint32 + qt_rectfill_nonpremul_quint32 }, // Format_ARGB32_Premultiplied { -- cgit v0.12 From 9f62759028b0bdb8fb7991c349d58a89323b8567 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 11:04:07 +0100 Subject: Change name of QStateMachine::animationsEnabled property to "animated" The name "animated" is consistent with naming in Qt otherwise, as in QTreeView::animated and QMainWindow::animated. Reviewed-by: Kent Hansen --- src/corelib/statemachine/qstatemachine.cpp | 14 +++++++------- src/corelib/statemachine/qstatemachine.h | 6 +++--- src/corelib/statemachine/qstatemachine_p.h | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 689967a..322e24a 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -164,7 +164,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_ANIMATION /*! - \property QStateMachine::animationsEnabled + \property QStateMachine::animated \brief whether animations are enabled @@ -188,7 +188,7 @@ QStateMachinePrivate::QStateMachinePrivate() globalRestorePolicy = QStateMachine::DoNotRestoreProperties; signalEventGenerator = 0; #ifndef QT_NO_ANIMATION - animationsEnabled = true; + animated = true; #endif } @@ -742,7 +742,7 @@ void QStateMachinePrivate::applyProperties(const QList &tr // Find the animations to use for the state change. QList selectedAnimations; - if (animationsEnabled) { + if (animated) { for (int i = 0; i < transitionList.size(); ++i) { QAbstractTransition *transition = transitionList.at(i); @@ -2116,19 +2116,19 @@ void QStateMachine::onExit(QEvent *event) /*! Returns whether animations are enabled for this state machine. */ -bool QStateMachine::animationsEnabled() const +bool QStateMachine::isAnimated() const { Q_D(const QStateMachine); - return d->animationsEnabled; + return d->animated; } /*! Sets whether animations are \a enabled for this state machine. */ -void QStateMachine::setAnimationsEnabled(bool enabled) +void QStateMachine::setAnimated(bool enabled) { Q_D(QStateMachine); - d->animationsEnabled = enabled; + d->animated = enabled; } /*! diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index 13b6fe2..f7ceba1 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -67,7 +67,7 @@ class Q_CORE_EXPORT QStateMachine : public QState Q_PROPERTY(RestorePolicy globalRestorePolicy READ globalRestorePolicy WRITE setGlobalRestorePolicy) Q_ENUMS(RestorePolicy) #ifndef QT_NO_ANIMATION - Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled) + Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated) #endif public: class SignalEvent : public QEvent @@ -133,8 +133,8 @@ public: bool isRunning() const; #ifndef QT_NO_ANIMATION - bool animationsEnabled() const; - void setAnimationsEnabled(bool enabled); + bool isAnimated() const; + void setAnimated(bool enabled); void addDefaultAnimation(QAbstractAnimation *animation); QList defaultAnimations() const; diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index 69b727d..f0d9c7c 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -200,7 +200,7 @@ public: QSet pendingErrorStatesForDefaultEntry; #ifndef QT_NO_ANIMATION - bool animationsEnabled; + bool animated; QPair, QList > initializeAnimation(QAbstractAnimation *abstractAnimation, diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 975b301..0df8d52 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1340,11 +1340,11 @@ void tst_QStateMachine::assignPropertyWithAnimation() // Single animation { QStateMachine machine; - QVERIFY(machine.animationsEnabled()); - machine.setAnimationsEnabled(false); - QVERIFY(!machine.animationsEnabled()); - machine.setAnimationsEnabled(true); - QVERIFY(machine.animationsEnabled()); + QVERIFY(machine.isAnimated()); + machine.setAnimated(false); + QVERIFY(!machine.isAnimated()); + machine.setAnimated(true); + QVERIFY(machine.isAnimated()); QObject obj; obj.setProperty("foo", 321); obj.setProperty("bar", 654); -- cgit v0.12 From b210026bda1fcd6d38b8a5a556aefe4fb5c4f891 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 12:05:55 +0100 Subject: Change name of DoNotRestoreProperties enum to DontRestoreProperties Using the abbreviated "Dont" is consistent with other negated enum names in Qt. Reviewed-by: Kent Hansen --- src/corelib/statemachine/qstatemachine.cpp | 8 ++++---- src/corelib/statemachine/qstatemachine.h | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 322e24a..0d07093 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -159,7 +159,7 @@ QT_BEGIN_NAMESPACE \brief the restore policy for states of this state machine. The default value of this property is - QStateMachine::DoNotRestoreProperties. + QStateMachine::DontRestoreProperties. */ #ifndef QT_NO_ANIMATION @@ -185,7 +185,7 @@ QStateMachinePrivate::QStateMachinePrivate() stop = false; stopProcessingReason = EventQueueEmpty; error = QStateMachine::NoError; - globalRestorePolicy = QStateMachine::DoNotRestoreProperties; + globalRestorePolicy = QStateMachine::DontRestoreProperties; signalEventGenerator = 0; #ifndef QT_NO_ANIMATION animated = true; @@ -1696,7 +1696,7 @@ QStateMachine::~QStateMachine() already been saved by the state machine, it will not be overwritten until the property has been successfully restored. - \value DoNotRestoreProperties The state machine should not save the initial values of properties + \value DontRestoreProperties The state machine should not save the initial values of properties and restore them later. \value RestoreProperties The state machine should save the initial values of properties and restore them later. @@ -1746,7 +1746,7 @@ QStateMachine::RestorePolicy QStateMachine::globalRestorePolicy() const /*! Sets the restore policy of the state machine to \a restorePolicy. The default - restore policy is QAbstractState::DoNotRestoreProperties. + restore policy is QAbstractState::DontRestoreProperties. \sa globalRestorePolicy() */ diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index f7ceba1..ff2b667 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -109,7 +109,7 @@ public: }; enum RestorePolicy { - DoNotRestoreProperties, + DontRestoreProperties, RestoreProperties }; diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 0df8d52..31ab3af 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -162,7 +162,7 @@ private slots: void defaultGlobalRestorePolicy(); void globalRestorePolicySetToRestore(); - void globalRestorePolicySetToDoNotRestore(); + void globalRestorePolicySetToDontRestore(); void noInitialStateForInitialState(); @@ -984,7 +984,7 @@ void tst_QStateMachine::customErrorStateNotInGraph() void tst_QStateMachine::restoreProperties() { QStateMachine machine; - QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DoNotRestoreProperties); + QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DontRestoreProperties); machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); QObject *object = new QObject(&machine); @@ -2736,10 +2736,10 @@ void tst_QStateMachine::restorePolicyNotInherited() }*/ -void tst_QStateMachine::globalRestorePolicySetToDoNotRestore() +void tst_QStateMachine::globalRestorePolicySetToDontRestore() { QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::DoNotRestoreProperties); + machine.setGlobalRestorePolicy(QStateMachine::DontRestoreProperties); QObject *propertyHolder = new QObject(&machine); propertyHolder->setProperty("a", 1); -- cgit v0.12 From 569e4b636fc91a9d5c6f6e4d65967327786adb3c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 13:13:35 +0100 Subject: Remove return type of QState::addTransition(QAbstractTransition*) Returning the input argument in a function can lead to confusion and serves no purpose here. Instead, we'll mirror the API from QMenu::addAction() overloads, where the overload that takes a preconstructed object has a void return type. Reviewed-by: Kent Hansen --- src/corelib/statemachine/qstate.cpp | 15 +++++---- src/corelib/statemachine/qstate.h | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 42 +++++++++++++++++--------- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index bcd8364..ea20619 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -286,15 +286,14 @@ void QState::setErrorState(QAbstractState *state) /*! Adds the given \a transition. The transition has this state as the source. - This state takes ownership of the transition. If the transition is successfully - added, the function will return the \a transition pointer. Otherwise it will return null. + This state takes ownership of the transition. */ -QAbstractTransition *QState::addTransition(QAbstractTransition *transition) +void QState::addTransition(QAbstractTransition *transition) { Q_D(QState); if (!transition) { qWarning("QState::addTransition: cannot add null transition"); - return 0; + return ; } transition->setParent(this); @@ -303,18 +302,17 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition) QAbstractState *t = targets.at(i).data(); if (!t) { qWarning("QState::addTransition: cannot add transition to null state"); - return 0; + return ; } if ((QAbstractStatePrivate::get(t)->machine() != d->machine()) && QAbstractStatePrivate::get(t)->machine() && d->machine()) { qWarning("QState::addTransition: cannot add transition " "to a state in a different state machine"); - return 0; + return ; } } if (machine() != 0 && machine()->configuration().contains(this)) QStateMachinePrivate::get(machine())->registerTransitions(this); - return transition; } /*! @@ -379,7 +377,8 @@ QAbstractTransition *QState::addTransition(QAbstractState *target) return 0; } UnconditionalTransition *trans = new UnconditionalTransition(target); - return addTransition(trans); + addTransition(trans); + return trans; } /*! diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 7a47447..781382d 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -76,7 +76,7 @@ public: QAbstractState *errorState() const; void setErrorState(QAbstractState *state); - QAbstractTransition *addTransition(QAbstractTransition *transition); + void addTransition(QAbstractTransition *transition); QSignalTransition *addTransition(QObject *sender, const char *signal, QAbstractState *target); QAbstractTransition *addTransition(QAbstractState *target); void removeTransition(QAbstractTransition *transition); diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 31ab3af..fb6567a 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -286,8 +286,8 @@ void tst_QStateMachine::transitionToRootState() machine.addState(initialState); machine.setInitialState(initialState); - QAbstractTransition *trans = initialState->addTransition(new EventTransition(QEvent::User, &machine)); - QVERIFY(trans != 0); + QAbstractTransition *trans = new EventTransition(QEvent::User, &machine); + initialState->addTransition(trans); QCOMPARE(trans->sourceState(), initialState); QCOMPARE(trans->targetState(), static_cast(&machine)); @@ -310,7 +310,7 @@ void tst_QStateMachine::transitionFromRootState() QState *root = &machine; QState *s1 = new QState(root); EventTransition *trans = new EventTransition(QEvent::User, s1); - QCOMPARE(root->addTransition(trans), static_cast(trans)); + root->addTransition(trans); QCOMPARE(trans->sourceState(), root); QCOMPARE(trans->targetState(), static_cast(s1)); } @@ -1155,7 +1155,7 @@ void tst_QStateMachine::stateEntryAndExit() QCOMPARE(t->targetState(), (QAbstractState*)s2); QCOMPARE(t->targetStates().size(), 1); QCOMPARE(t->targetStates().at(0), (QAbstractState*)s2); - QCOMPARE(s1->addTransition(t), (QAbstractTransition*)t); + s1->addTransition(t); QCOMPARE(t->sourceState(), (QState*)s1); QCOMPARE(t->machine(), &machine); @@ -1173,7 +1173,7 @@ void tst_QStateMachine::stateEntryAndExit() s2->removeTransition(trans); QCOMPARE(trans->sourceState(), (QState*)0); QCOMPARE(trans->targetState(), (QAbstractState*)s3); - QCOMPARE(s2->addTransition(trans), trans); + s2->addTransition(trans); QCOMPARE(trans->sourceState(), (QState*)s2); } @@ -3117,7 +3117,9 @@ void tst_QStateMachine::twoAnimatedTransitions() QState *s2 = new QState(&machine); s2->assignProperty(object, "foo", 5.0); QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3126,7 +3128,9 @@ void tst_QStateMachine::twoAnimatedTransitions() QState *s4 = new QState(&machine); s4->assignProperty(object, "foo", 2.0); QPropertyAnimation *fooAnimation2 = new QPropertyAnimation(object, "foo", s4); - s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation2); + trans = new EventTransition(QEvent::User, s4); + s3->addTransition(trans); + trans->addAnimation(fooAnimation2); QState *s5 = new QState(&machine); QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit())); @@ -3161,7 +3165,9 @@ void tst_QStateMachine::playAnimationTwice() QState *s2 = new QState(&machine); s2->assignProperty(object, "foo", 5.0); QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3169,7 +3175,9 @@ void tst_QStateMachine::playAnimationTwice() QState *s4 = new QState(&machine); s4->assignProperty(object, "foo", 2.0); - s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation); + trans = new EventTransition(QEvent::User, s4); + s3->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s5 = new QState(&machine); QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit())); @@ -3213,14 +3221,16 @@ void tst_QStateMachine::nestedTargetStateForAnimation() QState *s2Child2 = new QState(s2); s2Child2->assignProperty(object, "bar", 11.0); - QAbstractTransition *at = s2Child->addTransition(new EventTransition(QEvent::User, s2Child2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2Child2); + s2Child->addTransition(at); QPropertyAnimation *animation = new QPropertyAnimation(object, "bar", s2); animation->setDuration(2000); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(animation); - at = s1->addTransition(new EventTransition(QEvent::User, s2)); + at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); animation = new QPropertyAnimation(object, "foo", s2); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); @@ -3299,7 +3309,8 @@ void tst_QStateMachine::animatedGlobalRestoreProperty() QState *s4 = new QState(&machine); QObject::connect(s4, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", s2); connect(pa, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(pa); @@ -3341,7 +3352,9 @@ void tst_QStateMachine::specificTargetValueOfAnimation() QPropertyAnimation *anim = new QPropertyAnimation(object, "foo"); anim->setEndValue(10.0); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(anim); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(anim); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3495,7 +3508,8 @@ void tst_QStateMachine::overrideDefaultAnimationWithSpecific() QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); -- cgit v0.12 From 2596d721d64ad4d484176888cb166fbc43157ca9 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 13:39:40 +0100 Subject: Change name of modifiersMask property to "modifierMask" "modifierMask" is more correct English. Reviewed-by: Kent Hansen --- src/gui/statemachine/qbasickeyeventtransition.cpp | 24 +++++++++++----------- src/gui/statemachine/qbasickeyeventtransition_p.h | 6 +++--- .../statemachine/qbasicmouseeventtransition.cpp | 16 +++++++-------- .../statemachine/qbasicmouseeventtransition_p.h | 4 ++-- src/gui/statemachine/qkeyeventtransition.cpp | 18 ++++++++-------- src/gui/statemachine/qkeyeventtransition.h | 6 +++--- src/gui/statemachine/qmouseeventtransition.cpp | 18 ++++++++-------- src/gui/statemachine/qmouseeventtransition.h | 6 +++--- 8 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/gui/statemachine/qbasickeyeventtransition.cpp index 445a253..bf10e3d 100644 --- a/src/gui/statemachine/qbasickeyeventtransition.cpp +++ b/src/gui/statemachine/qbasickeyeventtransition.cpp @@ -68,14 +68,14 @@ public: QEvent::Type eventType; int key; - Qt::KeyboardModifiers modifiersMask; + Qt::KeyboardModifiers modifierMask; }; QBasicKeyEventTransitionPrivate::QBasicKeyEventTransitionPrivate() { eventType = QEvent::None; key = 0; - modifiersMask = Qt::NoModifier; + modifierMask = Qt::NoModifier; } QBasicKeyEventTransitionPrivate *QBasicKeyEventTransitionPrivate::get(QBasicKeyEventTransition *q) @@ -106,17 +106,17 @@ QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key, /*! Constructs a new event transition for events of the given \a type for the - given \a key, with the given \a modifiersMask and \a sourceState. + given \a key, with the given \a modifierMask and \a sourceState. */ QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key, - Qt::KeyboardModifiers modifiersMask, + Qt::KeyboardModifiers modifierMask, QState *sourceState) : QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState) { Q_D(QBasicKeyEventTransition); d->eventType = type; d->key = key; - d->modifiersMask = modifiersMask; + d->modifierMask = modifierMask; } /*! @@ -163,23 +163,23 @@ void QBasicKeyEventTransition::setKey(int key) } /*! - Returns the keyboard modifiers mask that this key event transition checks + Returns the keyboard modifier mask that this key event transition checks for. */ -Qt::KeyboardModifiers QBasicKeyEventTransition::modifiersMask() const +Qt::KeyboardModifiers QBasicKeyEventTransition::modifierMask() const { Q_D(const QBasicKeyEventTransition); - return d->modifiersMask; + return d->modifierMask; } /*! - Sets the keyboard modifiers mask that this key event transition will check + Sets the keyboard modifier mask that this key event transition will check for. */ -void QBasicKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QBasicKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QBasicKeyEventTransition); - d->modifiersMask = modifiersMask; + d->modifierMask = modifierMask; } /*! @@ -191,7 +191,7 @@ bool QBasicKeyEventTransition::eventTest(QEvent *event) if (event->type() == d->eventType) { QKeyEvent *ke = static_cast(event); return (ke->key() == d->key) - && ((ke->modifiers() & d->modifiersMask) == d->modifiersMask); + && ((ke->modifiers() & d->modifierMask) == d->modifierMask); } return false; } diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/gui/statemachine/qbasickeyeventtransition_p.h index 3c2ec7d..87d3dc7 100644 --- a/src/gui/statemachine/qbasickeyeventtransition_p.h +++ b/src/gui/statemachine/qbasickeyeventtransition_p.h @@ -69,7 +69,7 @@ public: QBasicKeyEventTransition(QState *sourceState = 0); QBasicKeyEventTransition(QEvent::Type type, int key, QState *sourceState = 0); QBasicKeyEventTransition(QEvent::Type type, int key, - Qt::KeyboardModifiers modifiersMask, + Qt::KeyboardModifiers modifierMask, QState *sourceState = 0); ~QBasicKeyEventTransition(); @@ -79,8 +79,8 @@ public: int key() const; void setKey(int key); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); protected: bool eventTest(QEvent *event); diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp index 694c319..4a977ba 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition.cpp +++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp @@ -69,7 +69,7 @@ public: QEvent::Type eventType; Qt::MouseButton button; - Qt::KeyboardModifiers modifiersMask; + Qt::KeyboardModifiers modifierMask; QPainterPath path; }; @@ -149,23 +149,23 @@ void QBasicMouseEventTransition::setButton(Qt::MouseButton button) } /*! - Returns the keyboard modifiers mask that this mouse event transition checks + Returns the keyboard modifier mask that this mouse event transition checks for. */ -Qt::KeyboardModifiers QBasicMouseEventTransition::modifiersMask() const +Qt::KeyboardModifiers QBasicMouseEventTransition::modifierMask() const { Q_D(const QBasicMouseEventTransition); - return d->modifiersMask; + return d->modifierMask; } /*! - Sets the keyboard modifiers mask that this mouse event transition will check + Sets the keyboard modifier mask that this mouse event transition will check for. */ -void QBasicMouseEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QBasicMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QBasicMouseEventTransition); - d->modifiersMask = modifiersMask; + d->modifierMask = modifierMask; } /*! @@ -195,7 +195,7 @@ bool QBasicMouseEventTransition::eventTest(QEvent *event) if (event->type() == d->eventType) { QMouseEvent *me = static_cast(event); return (me->button() == d->button) - && ((me->modifiers() & d->modifiersMask) == d->modifiersMask) + && ((me->modifiers() & d->modifierMask) == d->modifierMask) && (d->path.isEmpty() || d->path.contains(me->pos())); } return false; diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h index 512e0f8..8684fa3 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition_p.h +++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h @@ -79,8 +79,8 @@ public: Qt::MouseButton button() const; void setButton(Qt::MouseButton button); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); QPainterPath path() const; void setPath(const QPainterPath &path); diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/gui/statemachine/qkeyeventtransition.cpp index dee3168..a15e671 100644 --- a/src/gui/statemachine/qkeyeventtransition.cpp +++ b/src/gui/statemachine/qkeyeventtransition.cpp @@ -69,9 +69,9 @@ QT_BEGIN_NAMESPACE */ /*! - \property QKeyEventTransition::modifiersMask + \property QKeyEventTransition::modifierMask - \brief the keyboard modifiers mask that this key event transition checks for + \brief the keyboard modifier mask that this key event transition checks for */ class QKeyEventTransitionPrivate : public QEventTransitionPrivate @@ -133,23 +133,23 @@ void QKeyEventTransition::setKey(int key) } /*! - Returns the keyboard modifiers mask that this key event transition checks + Returns the keyboard modifier mask that this key event transition checks for. */ -Qt::KeyboardModifiers QKeyEventTransition::modifiersMask() const +Qt::KeyboardModifiers QKeyEventTransition::modifierMask() const { Q_D(const QKeyEventTransition); - return d->transition->modifiersMask(); + return d->transition->modifierMask(); } /*! - Sets the keyboard \a modifiers mask that this key event transition will - check for. + Sets the keyboard modifier mask that this key event transition will + check for to \a modifierMask. */ -void QKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QKeyEventTransition); - d->transition->setModifiersMask(modifiersMask); + d->transition->setModifierMask(modifierMask); } /*! diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/gui/statemachine/qkeyeventtransition.h index 8df8138..ab1c155 100644 --- a/src/gui/statemachine/qkeyeventtransition.h +++ b/src/gui/statemachine/qkeyeventtransition.h @@ -57,7 +57,7 @@ class Q_GUI_EXPORT QKeyEventTransition : public QEventTransition { Q_OBJECT Q_PROPERTY(int key READ key WRITE setKey) - Q_PROPERTY(Qt::KeyboardModifiers modifiersMask READ modifiersMask WRITE setModifiersMask) + Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask) public: QKeyEventTransition(QState *sourceState = 0); QKeyEventTransition(QObject *object, QEvent::Type type, int key, @@ -67,8 +67,8 @@ public: int key() const; void setKey(int key); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); protected: void onTransition(QEvent *event); diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp index 86cacf7..dbf9e19 100644 --- a/src/gui/statemachine/qmouseeventtransition.cpp +++ b/src/gui/statemachine/qmouseeventtransition.cpp @@ -70,9 +70,9 @@ QT_BEGIN_NAMESPACE */ /*! - \property QMouseEventTransition::modifiersMask + \property QMouseEventTransition::modifierMask - \brief the keyboard modifiers mask that this mouse event transition checks for + \brief the keyboard modifier mask that this mouse event transition checks for */ class QMouseEventTransitionPrivate : public QEventTransitionPrivate @@ -139,23 +139,23 @@ void QMouseEventTransition::setButton(Qt::MouseButton button) } /*! - Returns the keyboard modifiers mask that this mouse event transition checks + Returns the keyboard modifier mask that this mouse event transition checks for. */ -Qt::KeyboardModifiers QMouseEventTransition::modifiersMask() const +Qt::KeyboardModifiers QMouseEventTransition::modifierMask() const { Q_D(const QMouseEventTransition); - return d->transition->modifiersMask(); + return d->transition->modifierMask(); } /*! - Sets the keyboard \a modifiers mask that this mouse event transition will - check for. + Sets the keyboard modifier mask that this mouse event transition will + check for to \a modifierMask. */ -void QMouseEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QMouseEventTransition); - d->transition->setModifiersMask(modifiersMask); + d->transition->setModifierMask(modifierMask); } /*! diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h index 4e324ec..a6687b6 100644 --- a/src/gui/statemachine/qmouseeventtransition.h +++ b/src/gui/statemachine/qmouseeventtransition.h @@ -58,7 +58,7 @@ class Q_GUI_EXPORT QMouseEventTransition : public QEventTransition { Q_OBJECT Q_PROPERTY(Qt::MouseButton button READ button WRITE setButton) - Q_PROPERTY(Qt::KeyboardModifiers modifiersMask READ modifiersMask WRITE setModifiersMask) + Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask) public: QMouseEventTransition(QState *sourceState = 0); QMouseEventTransition(QObject *object, QEvent::Type type, @@ -68,8 +68,8 @@ public: Qt::MouseButton button() const; void setButton(Qt::MouseButton button); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); QPainterPath path() const; void setPath(const QPainterPath &path); -- cgit v0.12 From 19421cc33af4f439f4c7aea2de9f449987fbc420 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 13:53:19 +0100 Subject: Change name of QMouseEventTransition::path() to hitTestPath(). Make it clearer what the property actually does. Reviewed-by: Kent Hansen --- src/gui/statemachine/qbasicmouseeventtransition.cpp | 8 ++++---- src/gui/statemachine/qbasicmouseeventtransition_p.h | 4 ++-- src/gui/statemachine/qmouseeventtransition.cpp | 12 ++++++------ src/gui/statemachine/qmouseeventtransition.h | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp index 4a977ba..fe0dea9 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition.cpp +++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp @@ -169,18 +169,18 @@ void QBasicMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierM } /*! - Returns the path for this mouse event transition. + Returns the hit test path for this mouse event transition. */ -QPainterPath QBasicMouseEventTransition::path() const +QPainterPath QBasicMouseEventTransition::hitTestPath() const { Q_D(const QBasicMouseEventTransition); return d->path; } /*! - Sets the path for this mouse event transition. + Sets the hit test path for this mouse event transition. */ -void QBasicMouseEventTransition::setPath(const QPainterPath &path) +void QBasicMouseEventTransition::setHitTestPath(const QPainterPath &path) { Q_D(QBasicMouseEventTransition); d->path = path; diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h index 8684fa3..6754c55 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition_p.h +++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h @@ -82,8 +82,8 @@ public: Qt::KeyboardModifiers modifierMask() const; void setModifierMask(Qt::KeyboardModifiers modifiers); - QPainterPath path() const; - void setPath(const QPainterPath &path); + QPainterPath hitTestPath() const; + void setHitTestPath(const QPainterPath &path); protected: bool eventTest(QEvent *event); diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp index dbf9e19..f5c0cb1 100644 --- a/src/gui/statemachine/qmouseeventtransition.cpp +++ b/src/gui/statemachine/qmouseeventtransition.cpp @@ -159,25 +159,25 @@ void QMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) } /*! - Returns the path for this mouse event transition. + Returns the hit test path for this mouse event transition. */ -QPainterPath QMouseEventTransition::path() const +QPainterPath QMouseEventTransition::hitTestPath() const { Q_D(const QMouseEventTransition); - return d->transition->path(); + return d->transition->hitTestPath(); } /*! - Sets the \a path for this mouse event transition. + Sets the hit test path for this mouse event transition to \a path. If a valid path has been set, the transition will only trigger if the mouse event position (QMouseEvent::pos()) is inside the path. \sa QPainterPath::contains() */ -void QMouseEventTransition::setPath(const QPainterPath &path) +void QMouseEventTransition::setHitTestPath(const QPainterPath &path) { Q_D(QMouseEventTransition); - d->transition->setPath(path); + d->transition->setHitTestPath(path); } /*! diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h index a6687b6..e7f6a45 100644 --- a/src/gui/statemachine/qmouseeventtransition.h +++ b/src/gui/statemachine/qmouseeventtransition.h @@ -71,8 +71,8 @@ public: Qt::KeyboardModifiers modifierMask() const; void setModifierMask(Qt::KeyboardModifiers modifiers); - QPainterPath path() const; - void setPath(const QPainterPath &path); + QPainterPath hitTestPath() const; + void setHitTestPath(const QPainterPath &path); protected: void onTransition(QEvent *event); -- cgit v0.12 From ddd1c40712a6a50b0574341087118fe4db67c3b2 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 14:19:41 +0100 Subject: Rename QState::polished() signal to "propertiesAssigned" "Polished" was never a very descriptive word, and it already has a meaning attached in the QStyle API. Additionally, "propertiesAssigned" has the benefit of giving the relation to the assignProperty() function as part of the name. Reviewed-by: Kent Hansen --- doc/src/examples/stickman.qdoc | 9 +++--- doc/src/frameworks-technologies/statemachine.qdoc | 10 +++---- doc/src/snippets/statemachine/main5.cpp | 2 +- examples/animation/stickman/lifecycle.cpp | 4 +-- src/corelib/statemachine/qstate.cpp | 16 +++++++---- src/corelib/statemachine/qstate.h | 2 +- src/corelib/statemachine/qstate_p.h | 2 +- src/corelib/statemachine/qstatemachine.cpp | 8 +++--- tests/auto/qstatemachine/tst_qstatemachine.cpp | 34 +++++++++++------------ 9 files changed, 47 insertions(+), 40 deletions(-) diff --git a/doc/src/examples/stickman.qdoc b/doc/src/examples/stickman.qdoc index e70c39b..c9e98d0 100644 --- a/doc/src/examples/stickman.qdoc +++ b/doc/src/examples/stickman.qdoc @@ -55,9 +55,9 @@ Animations are implemented as composite states. Each child state of the animation state represents a frame in the animation by setting the position of each joint in the stickman's skeleton to the positions defined for the particular frame. The frames are then bound together - with animated transitions that trigger on the source state's polished() signal. Thus, the - machine will enter the state representing the next frame in the animation immediately after it - has finished animating into the previous frame. + with animated transitions that trigger on the source state's propertiesAssigned() signal. Thus, + the machine will enter the state representing the next frame in the animation immediately after + it has finished animating into the previous frame. \image stickman-example1.png @@ -67,7 +67,8 @@ \snippet examples/animation/stickman/lifecycle.cpp 1 - The states are then bound together with signal transitions that listen to the polished() signal. + The states are then bound together with signal transitions that listen to the + propertiesAssigned() signal. \snippet examples/animation/stickman/lifecycle.cpp 2 diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index ac10314..708561d 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -501,9 +501,9 @@ message box will pop up before the geometry of the button has actually been set. To ensure that the message box does not pop up until the geometry actually reaches its final - value, we can use the state's polished() signal. The polished() signal will be emitted when the - the property is assigned its final value, whether this is done immediately or after the animation - has finished playing. + value, we can use the state's propertiesAssigned() signal. The propertiesAssigned() signal will be + emitted when the property is assigned its final value, whether this is done immediately or + after the animation has finished playing. \code \snippet doc/src/snippets/statemachine/main5.cpp 6 \endcode @@ -519,14 +519,14 @@ has been assigned the defined value. If the global restore policy is set to QStateMachine::RestoreProperties, the state will not emit - the polished() signal until these have been executed as well. + the propertiesAssigned() signal until these have been executed as well. \section1 What Happens If A State Is Exited Before The Animation Has Finished If a state has property assignments, and the transition into the state has animations for the properties, the state can potentially be exited before the properties have been assigned to the values defines by the state. This is true in particular when there are transitions out from the - state that do not depend on the state being polished, as described in the previous section. + state that do not depend on the propertiesAssigned signal, as described in the previous section. The State Machine API guarantees that a property assigned by the state machine either: \list diff --git a/doc/src/snippets/statemachine/main5.cpp b/doc/src/snippets/statemachine/main5.cpp index 346cbce..ff25b7b 100644 --- a/doc/src/snippets/statemachine/main5.cpp +++ b/doc/src/snippets/statemachine/main5.cpp @@ -145,7 +145,7 @@ int main(int argv, char **args) connect(s3, SIGNAL(entered()), messageBox, SLOT(exec())); s1->addTransition(button, SIGNAL(clicked()), s2); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); //![6] } diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index 250fb85..1b6f9cd 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -194,14 +194,14 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa topLevel->setInitialState(frameState); else //! [2] - previousState->addTransition(previousState, SIGNAL(polished()), frameState); + previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), frameState); //! [2] previousState = frameState; } // Loop - previousState->addTransition(previousState, SIGNAL(polished()), topLevel->initialState()); + previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), topLevel->initialState()); return topLevel; diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index ea20619..6d89248 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -139,10 +139,10 @@ void QStatePrivate::emitFinished() emit q->finished(); } -void QStatePrivate::emitPolished() +void QStatePrivate::emitPropertiesAssigned() { Q_Q(QState); - emit q->polished(); + emit q->propertiesAssigned(); } /*! @@ -228,7 +228,7 @@ QList QStatePrivate::transitions() const Instructs this state to set the property with the given \a name of the given \a object to the given \a value when the state is entered. - \sa polished() + \sa propertiesAssigned() */ void QState::assignProperty(QObject *object, const char *name, const QVariant &value) @@ -491,9 +491,15 @@ bool QState::event(QEvent *e) */ /*! - \fn QState::polished() + \fn QState::propertiesAssigned() - This signal is emitted when all properties have been assigned their final value. + This signal is emitted when all properties have been assigned their final value. If the state + assigns a value to one or more properties for which an animation exists (either set on the + transition or as a default animation on the state machine), then the signal will not be emitted + until all such animations have finished playing. + + If there are no relevant animations, or no property assignments defined for the state, then + the signal will be emitted immediately before the state is entered. \sa QState::assignProperty(), QAbstractTransition::addAnimation() */ diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 781382d..423f940 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -94,7 +94,7 @@ public: Q_SIGNALS: void finished(); - void polished(); + void propertiesAssigned(); protected: void onEntry(QEvent *event); diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h index 34c8838..7fe6279 100644 --- a/src/corelib/statemachine/qstate_p.h +++ b/src/corelib/statemachine/qstate_p.h @@ -94,7 +94,7 @@ public: QList transitions() const; void emitFinished(); - void emitPolished(); + void emitPropertiesAssigned(); QAbstractState *errorState; QAbstractState *initialState; diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 0d07093..0648d14 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -807,7 +807,7 @@ void QStateMachinePrivate::applyProperties(const QList &tr if (anim->state() == QAbstractAnimation::Running) { // The animation is still running. This can happen if the // animation is a group, and one of its children just finished, - // and that caused a state to emit its polished() signal, and + // and that caused a state to emit its propertiesAssigned() signal, and // that triggered a transition in the machine. // Just stop the animation so it is correctly restarted again. anim->stop(); @@ -829,7 +829,7 @@ void QStateMachinePrivate::applyProperties(const QList &tr } } - // Emit polished signal for entered states that have no animated properties. + // Emit propertiesAssigned signal for entered states that have no animated properties. for (int i = 0; i < enteredStates.size(); ++i) { QState *s = qobject_cast(enteredStates.at(i)); if (s @@ -837,7 +837,7 @@ void QStateMachinePrivate::applyProperties(const QList &tr && !animationsForState.contains(s) #endif ) - QStatePrivate::get(s)->emitPolished(); + QStatePrivate::get(s)->emitPropertiesAssigned(); } } @@ -1100,7 +1100,7 @@ void QStateMachinePrivate::_q_animationFinished() animations.removeOne(anim); if (animations.isEmpty()) { animationsForState.erase(it); - QStatePrivate::get(qobject_cast(state))->emitPolished(); + QStatePrivate::get(qobject_cast(state))->emitPropertiesAssigned(); } } diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index fb6567a..9a2b2ed 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -184,7 +184,7 @@ private slots: void twoAnimatedTransitions(); void playAnimationTwice(); void nestedTargetStateForAnimation(); - void polishedSignalTransitionsReuseAnimationGroup(); + void propertiesAssignedSignalTransitionsReuseAnimationGroup(); void animatedGlobalRestoreProperty(); void specificTargetValueOfAnimation(); @@ -1319,9 +1319,9 @@ void tst_QStateMachine::assignProperty() QCOMPARE(s1->objectName(), QString::fromLatin1("foo")); { - QSignalSpy polishedSpy(s1, SIGNAL(polished())); + QSignalSpy propertiesAssignedSpy(s1, SIGNAL(propertiesAssigned())); machine.start(); - QTRY_COMPARE(polishedSpy.count(), 1); + QTRY_COMPARE(propertiesAssignedSpy.count(), 1); } // nested states @@ -1371,7 +1371,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() QCOMPARE(trans->animations().size(), 1); QCOMPARE(trans->animations().at(0), (QAbstractAnimation*)&anim); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1399,7 +1399,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() anim2.setDuration(150); trans->addAnimation(&anim2); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1427,7 +1427,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() group.addAnimation(new QPropertyAnimation(&obj, "bar")); trans->addAnimation(&group); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1473,10 +1473,10 @@ void tst_QStateMachine::assignPropertyWithAnimation() anim2.setDuration(250); trans->addAnimation(&anim2); - s21->addTransition(s21, SIGNAL(polished()), s22); + s21->addTransition(s21, SIGNAL(propertiesAssigned()), s22); QFinalState *s3 = new QFinalState(&machine); - s22->addTransition(s2, SIGNAL(polished()), s3); + s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1513,13 +1513,13 @@ void tst_QStateMachine::assignPropertyWithAnimation() machine.setInitialState(group); machine.start(); QTRY_COMPARE(machine.configuration().contains(s1), true); - QSignalSpy polishedSpy(s2, SIGNAL(polished())); + QSignalSpy propertiesAssignedSpy(s2, SIGNAL(propertiesAssigned())); emitter.emitSignalWithNoArg(); QTRY_COMPARE(machine.configuration().contains(s2), true); - QVERIFY(polishedSpy.isEmpty()); + QVERIFY(propertiesAssignedSpy.isEmpty()); emitter.emitSignalWithNoArg(); // will cause animations from s1-->s2 to abort QTRY_COMPARE(machine.configuration().contains(s3), true); - QVERIFY(polishedSpy.isEmpty()); + QVERIFY(propertiesAssignedSpy.isEmpty()); QCOMPARE(obj.property("foo").toInt(), 911); QCOMPARE(obj.property("bar").toInt(), 789); } @@ -3089,7 +3089,7 @@ void tst_QStateMachine::twoAnimations() QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); machine.start(); @@ -3241,7 +3241,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() at->addAnimation(animation); QState *s3 = new QState(&machine); - s2->addTransition(s2Child, SIGNAL(polished()), s3); + s2->addTransition(s2Child, SIGNAL(propertiesAssigned()), s3); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3258,7 +3258,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() QCOMPARE(counter.counter, 2); } -void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup() +void tst_QStateMachine::propertiesAssignedSignalTransitionsReuseAnimationGroup() { QStateMachine machine; QObject *object = new QObject(&machine); @@ -3275,9 +3275,9 @@ void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup() QParallelAnimationGroup animationGroup; animationGroup.addAnimation(new QPropertyAnimation(object, "foo")); QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished())); - s1->addTransition(s1, SIGNAL(polished()), s2)->addAnimation(&animationGroup); - s2->addTransition(s2, SIGNAL(polished()), s3)->addAnimation(&animationGroup); - s3->addTransition(s3, SIGNAL(polished()), s4); + s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup); + s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4); machine.setInitialState(s1); QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished())); -- cgit v0.12 From 66056ead409d4ba79b2b7dd08d12332ba47f5307 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 2 Nov 2009 17:42:17 +0100 Subject: Make the QDataStream autotest much more robust In the old version, we'd read all the types, then start comparing. If an operator left the stream in a bogus state, funny things would happen (e.g. crashes). Now, we test the value instantly before reading the next one, thus preventing reading bogus. --- tests/auto/qdatastream/tst_qdatastream.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index add0945..bb59809 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -3180,28 +3180,31 @@ void tst_QDataStream::streamRealDataTypes() QDataStream stream(&file); stream.setVersion(QDataStream::Qt_4_2); - stream >> a >> b >> c >> d >> e >> f >> point - >> rect >> polygon >> matrix >> p; - if (i == 1) - stream >> pict; - stream >> textLength >> col >> rGrad >> cGrad - >> pen; - - QCOMPARE(stream.status(), QDataStream::Ok); - + stream >> a; QCOMPARE(a, qreal(0)); + stream >> b; QCOMPARE(b, qreal(1.0)); + stream >> c; QCOMPARE(c, qreal(1.1)); + stream >> d; QCOMPARE(d, qreal(3.14)); + stream >> e; QCOMPARE(e, qreal(-3.14)); + stream >> f; QCOMPARE(f, qreal(-1)); + stream >> point; QCOMPARE(point, QPointF(3, 5)); + stream >> rect; QCOMPARE(rect, QRectF(-1, -2, 3, 4)); + stream >> polygon; QCOMPARE((QVector &)polygon, (QPolygonF() << QPointF(0, 0) << QPointF(1, 2))); + stream >> matrix; QCOMPARE(matrix, QMatrix().rotate(90).scale(2, 2)); + stream >> p; QCOMPARE(p, path); + if (i == 1) { + stream >> pict; - if (i == 0) { QByteArray pictA, pictB; QBuffer bufA, bufB; QVERIFY(bufA.open(QIODevice::ReadWrite)); @@ -3212,8 +3215,11 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(pictA, pictB); } + stream >> textLength; QCOMPARE(textLength, QTextLength(QTextLength::VariableLength, 1.5)); + stream >> col; QCOMPARE(col, color); + stream >> rGrad; QCOMPARE(rGrad.style(), radialBrush.style()); QCOMPARE(rGrad.matrix(), radialBrush.matrix()); QCOMPARE(rGrad.gradient()->type(), radialBrush.gradient()->type()); @@ -3222,6 +3228,7 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(((QRadialGradient *)rGrad.gradient())->center(), ((QRadialGradient *)radialBrush.gradient())->center()); QCOMPARE(((QRadialGradient *)rGrad.gradient())->focalPoint(), ((QRadialGradient *)radialBrush.gradient())->focalPoint()); QCOMPARE(((QRadialGradient *)rGrad.gradient())->radius(), ((QRadialGradient *)radialBrush.gradient())->radius()); + stream >> cGrad; QCOMPARE(cGrad.style(), conicalBrush.style()); QCOMPARE(cGrad.matrix(), conicalBrush.matrix()); QCOMPARE(cGrad.gradient()->type(), conicalBrush.gradient()->type()); @@ -3231,7 +3238,10 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(((QConicalGradient *)cGrad.gradient())->angle(), ((QConicalGradient *)conicalBrush.gradient())->angle()); QCOMPARE(cGrad, conicalBrush); + stream >> pen; QCOMPARE(pen.widthF(), qreal(1.5)); + + QCOMPARE(stream.status(), QDataStream::Ok); } #if defined(Q_OS_SYMBIAN) #undef qreal -- cgit v0.12 From 18b072835e3f726a1d2d7604b0dc98cd420d3088 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 2 Nov 2009 17:57:54 +0100 Subject: fix test for real - if the reference stream contains doubles, we must read doubles, and not qreals --- tests/auto/qdatastream/tst_qdatastream.cpp | 63 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index bb59809..56fc53a 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -3100,22 +3100,6 @@ void tst_QDataStream::streamToAndFromQByteArray() void tst_QDataStream::streamRealDataTypes() { -#if defined(Q_OS_WINCE) - // Note: Probably actually same 'qreal being typedeffed as float instead of double' issue as in Symbian - // instead of what CE skip message says. - QSKIP("Skipped on CE as it demands too much memory and fragments", SkipAll); -#elif defined(Q_OS_SYMBIAN) - // qreal is typedeffed float in symbian instead of double like in most platforms, so reference stream - // gets corrupted. Basically this test is flawed, as one shouldn't use naked typedeffed types in - // streams that are meant to work cross-platform. - // As this test also tests other floating point using classes, we do not simply skip it, but work around - // the qreal issue by redefining qreal as double for the duration of this function. - // Note that streaming classes works because they do explicitly use double instead of qreal when - // writing/reading to/from stream. -# define qreal double - qWarning("Note: streamRealDataTypes test redefines qreal as double in symbian!!!"); -#endif - // Generate QPicture from SVG. QSvgRenderer renderer(svgFile); QVERIFY(renderer.isValid()); @@ -3163,7 +3147,6 @@ void tst_QDataStream::streamRealDataTypes() file.close(); } - qreal a, b, c, d, e, f; QPointF point; QRectF rect; QPolygonF polygon; @@ -3180,18 +3163,37 @@ void tst_QDataStream::streamRealDataTypes() QDataStream stream(&file); stream.setVersion(QDataStream::Qt_4_2); - stream >> a; - QCOMPARE(a, qreal(0)); - stream >> b; - QCOMPARE(b, qreal(1.0)); - stream >> c; - QCOMPARE(c, qreal(1.1)); - stream >> d; - QCOMPARE(d, qreal(3.14)); - stream >> e; - QCOMPARE(e, qreal(-3.14)); - stream >> f; - QCOMPARE(f, qreal(-1)); + if (i == 0) { + // the reference stream for 4.2 contains doubles, + // so we must read them out as doubles! + double a, b, c, d, e, f; + stream >> a; + QCOMPARE(a, 0.0); + stream >> b; + QCOMPARE(b, 1.0); + stream >> c; + QCOMPARE(c, 1.1); + stream >> d; + QCOMPARE(d, 3.14); + stream >> e; + QCOMPARE(e, -3.14); + stream >> f; + QCOMPARE(f, -1.0); + } else { + qreal a, b, c, d, e, f; + stream >> a; + QCOMPARE(a, qreal(0)); + stream >> b; + QCOMPARE(b, qreal(1.0)); + stream >> c; + QCOMPARE(c, qreal(1.1)); + stream >> d; + QCOMPARE(d, qreal(3.14)); + stream >> e; + QCOMPARE(e, qreal(-3.14)); + stream >> f; + QCOMPARE(f, qreal(-1)); + } stream >> point; QCOMPARE(point, QPointF(3, 5)); stream >> rect; @@ -3243,9 +3245,6 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(stream.status(), QDataStream::Ok); } -#if defined(Q_OS_SYMBIAN) - #undef qreal -#endif } #ifdef QT3_SUPPORT -- cgit v0.12 From 4c1ac09381a259e96a1774a5c931c55e8393813f Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 3 Nov 2009 17:02:58 +0100 Subject: Update mkdist-webkit script: - Use newest qtwebkit tag - Keep BitmapInfo.h and BitmalInfo.cpp in src/3rdparty Reviewed-by: TrustMe --- util/webkit/mkdist-webkit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index f88f10e..ddf74bb 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -5,7 +5,7 @@ die() { exit 1 } -default_tag="qtwebkit-4.6-snapshot-22102009" +default_tag="qtwebkit-4.6-snapshot-20091003" if [ $# -eq 0 ]; then tag="$default_tag" @@ -155,7 +155,7 @@ excluded_directories="$excluded_directories WebKit/chromium" excluded_directories="$excluded_directories WebKit/English.lproj WebKit/WebKit.xcodeproj" excluded_directories="$excluded_directories WebCore/English.lproj" -exclude_with_exceptions_list="WebCore/platform/win/:WebCore/platform/win/SystemTimeWin.cpp" +exclude_with_exceptions_list="WebCore/platform/win/:WebCore/platform/win/SystemTimeWin.cpp\\|WebCore/platform/win/BitmapInfo.*" excluded_directories="$excluded_directories WebKit/mac/Carbon" excluded_directories="$excluded_directories WebKit/mac/ChangeLog" -- cgit v0.12 From 33eefe549f4570a79d2531bad82698f7109ab687 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 3 Nov 2009 17:12:30 +0100 Subject: Updated WebKit from /home/jturcott/dev/webkit/ to qtwebkit-4.6-snapshot-20091003 ( 8f810287200d21aded375664cc0a6ac0476dbdea ) 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-10-29 Kenneth Rohde Christiansen Reviewed by Tor Arne Vestbø. Remove QWebView::guessUrlFromString() and replace its use with the new QUrl::fromUserInput() if using Qt 4.6 or newer. * Api/qwebview.cpp: * Api/qwebview.h: * QGVLauncher/main.cpp: (urlFromUserInput): (WebPage::applyProxy): (MainWindow::load): * QtLauncher/main.cpp: (urlFromUserInput): (MainWindow::MainWindow): (MainWindow::changeLocation): * tests/qwebview/tst_qwebview.cpp: 2009-10-28 Kenneth Rohde Christiansen Reviewed by Tor Arne Vestbø. Serialize directly to the stream, and not first to an QByteArray, that is later serialized. That is slower and also uses more bytes. * Api/qwebhistory.cpp: (operator<<): (operator>>): 2009-10-28 Shinichiro Hamaji Reviewed by Eric Seidel. [Qt] WebFrame::counterValueForElementById must not be exposed https://bugs.webkit.org/show_bug.cgi?id=30882 * Api/qwebframe.cpp: (qt_drt_counterValueForElementById): * Api/qwebframe.h: 2009-10-27 Shinichiro Hamaji Reviewed by Darin Adler. Provide a way to get counter values with layoutTestContoller https://bugs.webkit.org/show_bug.cgi?id=30555 * Api/qwebframe.cpp: (QWebFrame::counterValueForElementById): (QWebHitTestResult::frame): * Api/qwebframe.h: 2009-10-28 Antonio Gomes Pushing missing WebKit/qt/tests/qwebframe/resources/ dir from bug 29248. [Qt] [API] Make it possible to have 'invisible' loads https://bugs.webkit.org/show_bug.cgi?id=29248 * tests/qwebframe/resources/image2.png: Copied from WebKit/qt/tests/qwebelement/image.png. 2009-10-28 Kenneth Rohde Christiansen Reviewed by Tor Arne Vestbø. [Qt] QWebHistory::saveState() is inconsistent with the Qt API https://bugs.webkit.org/show_bug.cgi?id=30710 Make the versioning internal and enforce it in the WebCore part. Adjust the comments, as well as remove now dead code. * Api/qwebhistory.cpp: (operator<<): (operator>>): * Api/qwebhistory.h: 2009-10-28 Kenneth Rohde Christiansen Reviewed by Holger Freyther. [Qt] QWebHistory::saveState() is inconsistent with the Qt API https://bugs.webkit.org/show_bug.cgi?id=30710 Remove the QWebHistory::saveState() and ::restoreState() as they are inconsistent with the Qt API. Update unittests to reflect the change. * Api/qwebhistory.cpp: (operator<<): (operator>>): * Api/qwebhistory.h: * tests/qwebhistory/tst_qwebhistory.cpp: (saveHistory): (restoreHistory): (tst_QWebHistory::saveAndRestore_crash_1): (tst_QWebHistory::saveAndRestore_crash_2): (tst_QWebHistory::saveAndRestore_crash_3): (tst_QWebHistory::clear): 2009-10-27 Antonio Gomes Reviewed by Holger Freyther. Complementary fix to bug 30779. By mistake I used QWeakPointer's toStrongRef() method which docs explicitly say to not be used in this situation (when the tracked pointer is devired from QObject). Instead QWeakPointer's data() is recommended. * Api/qwebpage.cpp: (QWebPage::view): 2009-10-27 Holger Hans Peter Freyther Reviewed by Simon Fraser. Change HitTestResult methods to use (3d) transformation aware methods https://bugs.webkit.org/show_bug.cgi?id=27347 The HitTestResult::boundingBox method was removed. The RenderObject must be used directly. In contrast to the old HitTestResult::boundingBox method this code must use a (3d) transformation aware method to not run into an assert in SVGRenderBase::mapLocalToContainer. * Api/qwebframe.cpp: (QWebHitTestResultPrivate::QWebHitTestResultPrivate): 2009-10-27 Kenneth Rohde Christiansen Rubberstamped by Oliver Hunt. Change two methods to be internal for DRT use only. Part of [Qt] Review all new API in Qt 4.6 https://bugs.webkit.org/show_bug.cgi?id=29843#c11 * Api/qwebsecurityorigin.cpp: (qt_drt_whiteListAccessFromOrigin): (qt_drt_resetOriginAccessWhiteLists): (QWebSecurityOrigin::localSchemes): * Api/qwebsecurityorigin.h: 2009-10-27 Kenneth Rohde Christiansen Reviewed by Tor Arne Vestbø. Make sure that initiating a rotation while rotating won't make it end up at rotation positions that are not a multiply of 180 degrees. * QGVLauncher/main.cpp: (MainView::animatedFlip): 2009-10-27 Kenneth Rohde Christiansen Unreviewed Qt build fix. Update the tests as well to the new API change. * tests/qwebelement/tst_qwebelement.cpp: (tst_QWebElement::clear): 2009-10-27 Kenneth Rohde Christiansen Rubberstamped by Tor Arne Vestbø. [Qt] QWebElement::removeChildren() should be QWebElement::removeAllChildren() https://bugs.webkit.org/show_bug.cgi?id=30630 * Api/qwebelement.cpp: (QWebElement::removeAllChildren): * Api/qwebelement.h: 2009-10-27 Antonio Gomes Reviewed by Antti Koivisto and Holger Freyther. Make QWebPagePrivate's (QWidget) view to be a QWeakPointer. https://bugs.webkit.org/show_bug.cgi?id=30779 The fact that it was been set from external objects of qwebpage and not being deleted internally can lead to dangling references. * Api/qgraphicswebview.cpp: (QGraphicsWebView::~QGraphicsWebView): * Api/qwebpage.cpp: (QWebPagePrivate::QWebPagePrivate): (QWebPagePrivate::createContextMenu): (QWebPagePrivate::handleSoftwareInputPanel): (QWebPagePrivate::keyPressEvent): (QWebPage::setView): (QWebPage::view): (QWebPage::javaScriptAlert): (QWebPage::javaScriptConfirm): (QWebPage::javaScriptPrompt): (QWebPage::shouldInterruptJavaScript): (QWebPage::createWindow): (QWebPage::extension): (QWebPage::chooseFile): (QWebPage::userAgentForUrl): * Api/qwebpage_p.h: * Api/qwebview.cpp: (QWebView::~QWebView): 2009-10-26 Kenneth Rohde Christiansen Unreviewed documentation fix from David Boddie (Qt Doc Team) Removes the check around the RenderHints property documentation that was clearly added to synchronize the source and header files when the #if !defined(Q_OS_SYMBIAN) guards was added to the property. The documentation has also been updated to ensure that Symbian users know that there is no actual RenderHints property on their platform. * Api/qwebview.cpp: 2009-10-26 Kenneth Rohde Christiansen Unreviewed documentation fix from David Boddie (Qt Doc Team) Ensure that qdoc will always see the RenderHints property. The property was only defined in the header file if the Q_OS_SYMBIAN symbol was not defined, resulting in the property not showing up in the Qt documentation just because one platform doesn't support it. A follow up commit will improve the documentation for the property and note that it is not supported on the Symbiam platform. * Api/qwebview.h: 2009-10-26 Benjamin Poulain Reviewed by Tor Arne Vestbø. [Qt] Reintroduce QWebElementCollection Revert the patch that has replaced QWebElementCollection with QList. Update the tests accordingly. Remove the constness of the return type of QWebElement operator[]. https://bugs.webkit.org/show_bug.cgi?id=30767 * Api/qwebelement.cpp: (QWebElement::findAll): (QWebElementCollectionPrivate::QWebElementCollectionPrivate): (QWebElementCollectionPrivate::create): (QWebElementCollection::QWebElementCollection): (QWebElementCollection::operator=): (QWebElementCollection::~QWebElementCollection): (QWebElementCollection::operator+): (QWebElementCollection::append): (QWebElementCollection::count): (QWebElementCollection::at): (QWebElementCollection::toList): * Api/qwebelement.h: (const_iterator::begin): (const_iterator::end): (const_iterator::operator[]): * Api/qwebframe.cpp: (QWebFrame::findAllElements): * Api/qwebframe.h: * QtLauncher/main.cpp: (MainWindow::selectElements): * tests/qwebelement/tst_qwebelement.cpp: (tst_QWebElement::simpleCollection): (tst_QWebElement::iteration): (tst_QWebElement::emptyCollection): (tst_QWebElement::appendCollection): (tst_QWebElement::nullSelect): (tst_QWebElement::hasSetFocus): (tst_QWebElement::render): * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::inputMethods): 2009-10-24 Laszlo Gombos Reviewed by Holger Freyther. [Qt] [Symbian] Set the capability and memory required to run QtWebKit for Symbian https://bugs.webkit.org/show_bug.cgi?id=30476 Assign ReadUserData WriteUserData NetworkServices Symbian capabilities to all QtWebkit executables. * QGVLauncher/QGVLauncher.pro: * QtLauncher/QtLauncher.pro: * tests/benchmarks/loading/tst_loading.pro: * tests/benchmarks/painting/tst_painting.pro: * tests/qgraphicswebview/qgraphicswebview.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-10-22 Gavin Barraclough Reviewed by NOBODY (speculative build fix - qt is currently already broken!) Build fix following bug #30696. * Api/qwebelement.cpp: (setupScriptContext): * Api/qwebframe.cpp: (QWebFrame::evaluateJavaScript): 2009-10-22 Shu Chang Reviewed by Eric Seidel. [Qt] Enable track visited links in QWebPage https://bugs.webkit.org/show_bug.cgi?id=30574 Test: fast/history/clicked-link-is-visited.html * Api/qwebpage.cpp: (QWebPagePrivate::QWebPagePrivate): 2009-10-22 Girish Ramakrishnan Reviewed by Eric Seidel. [Qt] Add Print Shortcut to QtLauncher https://bugs.webkit.org/show_bug.cgi?id=30682 * QtLauncher/main.cpp: (MainWindow::setupUI): 2009-10-22 Antonio Gomes Rubberstamped by Tor Arne Vestbø. Code standarlization for QGVLauncher. 1) Made member initilization lists in constructors to be per line. 2) Made applyProxy method inline as all other methods in WebPage class. * QGVLauncher/main.cpp: (WebPage::WebPage): (WebPage::applyProxy): (MainView::MainView): (MainWindow::MainWindow): (MainWindow::init): 2009-10-22 Antonio Gomes Reviewed by Tor Arne Vestbø. Add a Y-Axis rotation to QGVLauncher. It uses the QStateMachine API from Qt 4.6. * QGVLauncher/main.cpp: (WebView::WebView): (WebView::setYRotation): (WebView::yRotation): (MainView::flip): (MainView::animatedYFlip): (SharedScene::SharedScene): (SharedScene::webView): (MainWindow::init): (MainWindow::animatedYFlip): (MainWindow::buildUI): 2009-10-20 Kenneth Rohde Christiansen Reviewed By Adam Barth. Add some actions to the menu for cursor debugging. GraphicsView based launcher only. * QGVLauncher/main.cpp: (MainView::setWaitCursor): (MainView::resetCursor): (MainView::flip): (MainWindow::setWaitCursor): (MainWindow::resetCursor): (MainWindow::buildUI): 2009-10-20 Kenneth Rohde Christiansen Rubberstamped by Adam Barth. Remove clipRenderToViewport as agreed upon in https://bugs.webkit.org/show_bug.cgi?id=29843 * Api/qwebframe.cpp: * Api/qwebframe.h: * Api/qwebframe_p.h: (QWebFramePrivate::QWebFramePrivate): 2009-10-20 Kenneth Rohde Christiansen Reviewed by Adam Barth. Update the tests to test the new render functionality, and take into consideration that render() clips to the frame itself as well as the viewport. QWebFrame::render() now always clips, so the old tests were bogus. Rendering pure contents (no scrollbars etc) without clipping can now be accomplished using QWebFrame::documentElement()->render(...) * Api/qwebframe.cpp: * Api/qwebframe.h: * Api/qwebframe_p.h: (QWebFramePrivate::QWebFramePrivate): * tests/qwebframe/tst_qwebframe.cpp: 2009-10-20 Kenneth Rohde Christiansen Rubberstamped by Adam Barth. As we do not support rendering a QWebFrame without it being clipped the the frame as well as the viewport, we now set the viewport size to the size of the contents. Rendering pure contents (no scrollbars etc) without clipping can be acomplished using QWebFrame::documentElement()->render(...) * tests/qwebelement/tst_qwebelement.cpp: (tst_QWebElement::render): 2009-10-20 Kenneth Rohde Christiansen Reviewed by Tor Arne Vestbø. Add menu item to dump the plugin list to the console, which can be handy for debugging. * QtLauncher/main.cpp: (MainWindow::dumpPlugins): (MainWindow::setupUI): 2009-10-19 Kenneth Rohde Christiansen Reviewed by Tor Arne Vestbø. Introduce new render method on QWebFrame, which supports specifying which layers to render (scrollbars, contents, pan-icon). * Api/qwebframe.cpp: (QWebFramePrivate::renderPrivate): (QWebFrame::render): * Api/qwebframe.h: * Api/qwebframe_p.h: 2009-10-19 Antonio Gomes Reviewed by Ariya Hidayat. [Qt] Infinite loop (leading to crash) when setting cursor in QGraphicsWebView https://bugs.webkit.org/show_bug.cgi?id=30549 Patch reimplements QGraphicsItem's itemChange method, and make CursorChange event to be emitted after cursor has already been set. QWidget::setCursor send the event just after it sets the cursor, then patch makes both behaviors compatible. * Api/qgraphicswebview.cpp: (QGraphicsWebView::itemChange): * Api/qgraphicswebview.h: --- src/3rdparty/webkit/ChangeLog | 42 + src/3rdparty/webkit/JavaScriptCore/ChangeLog | 524 +++ .../webkit/JavaScriptCore/JavaScriptCore.gypi | 1 + .../webkit/JavaScriptCore/JavaScriptCore.pri | 2 + .../JavaScriptCore/assembler/ARMv7Assembler.h | 168 +- .../JavaScriptCore/assembler/MacroAssemblerARM.h | 9 +- .../JavaScriptCore/assembler/MacroAssemblerARMv7.h | 8 +- .../webkit/JavaScriptCore/bytecode/CodeBlock.cpp | 21 +- .../webkit/JavaScriptCore/bytecode/Opcode.h | 1 + .../bytecompiler/BytecodeGenerator.cpp | 13 + .../bytecompiler/BytecodeGenerator.h | 19 + .../JavaScriptCore/interpreter/Interpreter.cpp | 27 + .../JavaScriptCore/jit/ExecutableAllocator.h | 16 + src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp | 2 + src/3rdparty/webkit/JavaScriptCore/jit/JIT.h | 31 +- src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp | 2 +- .../webkit/JavaScriptCore/jit/JITInlineMethods.h | 9 +- .../webkit/JavaScriptCore/jit/JITOpcodes.cpp | 7 +- .../JavaScriptCore/jit/JITPropertyAccess.cpp | 148 +- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 78 +- src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h | 6 +- .../webkit/JavaScriptCore/parser/Nodes.cpp | 9 + .../webkit/JavaScriptCore/runtime/Collector.cpp | 12 +- .../JavaScriptCore/runtime/DateConstructor.cpp | 4 +- .../webkit/JavaScriptCore/runtime/DateInstance.cpp | 84 +- .../webkit/JavaScriptCore/runtime/DateInstance.h | 23 +- .../JavaScriptCore/runtime/DateInstanceCache.h | 89 + .../JavaScriptCore/runtime/DatePrototype.cpp | 235 +- .../webkit/JavaScriptCore/runtime/DatePrototype.h | 2 +- .../webkit/JavaScriptCore/runtime/JSCell.h | 1 + .../webkit/JavaScriptCore/runtime/JSFunction.h | 8 +- .../webkit/JavaScriptCore/runtime/JSGlobalData.h | 4 +- .../webkit/JavaScriptCore/runtime/JSObject.h | 4 +- .../runtime/JSPropertyNameIterator.cpp | 7 +- .../runtime/JSPropertyNameIterator.h | 18 +- .../webkit/JavaScriptCore/runtime/Structure.cpp | 9 + .../webkit/JavaScriptCore/runtime/Structure.h | 11 +- .../webkit/JavaScriptCore/wtf/CurrentTime.cpp | 4 + .../webkit/JavaScriptCore/wtf/DateMath.cpp | 11 +- .../webkit/JavaScriptCore/wtf/FastMalloc.h | 14 +- .../webkit/JavaScriptCore/wtf/MessageQueue.h | 17 +- src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 13 +- .../webkit/JavaScriptCore/wtf/StdLibExtras.h | 2 + .../webkit/JavaScriptCore/wtf/Threading.cpp | 2 +- src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h | 4 + .../JavaScriptCore/wtf/ThreadingPthreads.cpp | 4 +- .../JavaScriptCore/yarr/RegexInterpreter.cpp | 8 +- .../webkit/JavaScriptCore/yarr/RegexJIT.cpp | 5 +- src/3rdparty/webkit/VERSION | 4 +- src/3rdparty/webkit/WebCore/ChangeLog | 4258 +++++++++++++++++++- src/3rdparty/webkit/WebCore/DerivedSources.cpp | 1 + .../ForwardingHeaders/wtf/DateInstanceCache.h | 4 + src/3rdparty/webkit/WebCore/LICENSE-APPLE | 33 +- src/3rdparty/webkit/WebCore/WebCore.gypi | 35 +- src/3rdparty/webkit/WebCore/WebCore.pro | 35 +- .../accessibility/AccessibilityAllInOne.cpp | 44 + .../accessibility/AccessibilityListBoxOption.h | 1 + .../WebCore/accessibility/AccessibilityObject.h | 14 + .../accessibility/AccessibilityRenderObject.cpp | 42 +- .../accessibility/AccessibilityRenderObject.h | 1 + .../accessibility/qt/AccessibilityObjectQt.cpp | 5 + .../WebCore/bindings/ScriptControllerBase.cpp | 4 + .../WebCore/bindings/js/JSAbstractWorkerCustom.cpp | 4 +- .../WebCore/bindings/js/JSBindingsAllInOne.cpp | 150 + .../webkit/WebCore/bindings/js/JSCallbackData.cpp | 9 +- .../webkit/WebCore/bindings/js/JSCallbackData.h | 3 + .../bindings/js/JSCustomXPathNSResolver.cpp | 2 +- .../bindings/js/JSDOMApplicationCacheCustom.cpp | 4 +- .../webkit/WebCore/bindings/js/JSDOMBinding.cpp | 356 +- .../webkit/WebCore/bindings/js/JSDOMBinding.h | 110 +- .../WebCore/bindings/js/JSDOMGlobalObject.cpp | 29 +- .../webkit/WebCore/bindings/js/JSDOMGlobalObject.h | 8 +- .../webkit/WebCore/bindings/js/JSDOMWindowBase.cpp | 32 +- .../webkit/WebCore/bindings/js/JSDOMWindowBase.h | 5 +- .../WebCore/bindings/js/JSDOMWindowCustom.cpp | 15 +- .../WebCore/bindings/js/JSDOMWindowShell.cpp | 8 +- .../webkit/WebCore/bindings/js/JSDOMWindowShell.h | 2 +- .../bindings/js/JSDesktopNotificationsCustom.cpp | 4 +- .../webkit/WebCore/bindings/js/JSEventListener.cpp | 20 +- .../webkit/WebCore/bindings/js/JSEventListener.h | 7 +- .../WebCore/bindings/js/JSEventSourceCustom.cpp | 4 +- .../webkit/WebCore/bindings/js/JSEventTarget.cpp | 4 +- .../webkit/WebCore/bindings/js/JSExceptionBase.cpp | 128 +- .../webkit/WebCore/bindings/js/JSExceptionBase.h | 86 +- .../WebCore/bindings/js/JSHTMLAllCollection.cpp | 35 - .../WebCore/bindings/js/JSHTMLAllCollection.h | 58 - .../bindings/js/JSHTMLAllCollectionCustom.cpp | 135 + .../WebCore/bindings/js/JSHTMLCollectionCustom.cpp | 2 +- .../WebCore/bindings/js/JSHTMLDocumentCustom.cpp | 5 +- .../bindings/js/JSHTMLFrameSetElementCustom.cpp | 4 +- .../bindings/js/JSInspectorBackendCustom.cpp | 7 +- .../WebCore/bindings/js/JSLazyEventListener.cpp | 6 +- .../WebCore/bindings/js/JSLazyEventListener.h | 6 +- .../WebCore/bindings/js/JSMessageChannelCustom.cpp | 14 +- .../WebCore/bindings/js/JSMessagePortCustom.cpp | 11 +- .../webkit/WebCore/bindings/js/JSNodeCustom.cpp | 10 +- .../WebCore/bindings/js/JSNodeFilterCondition.cpp | 2 +- .../bindings/js/JSQuarantinedObjectWrapper.cpp | 8 +- .../bindings/js/JSSVGElementInstanceCustom.cpp | 4 +- .../WebCore/bindings/js/JSSharedWorkerCustom.cpp | 7 +- .../WebCore/bindings/js/JSWebSocketCustom.cpp | 4 +- .../WebCore/bindings/js/JSWorkerContextCustom.cpp | 8 +- .../WebCore/bindings/js/JSXMLHttpRequestCustom.cpp | 11 +- .../bindings/js/JSXMLHttpRequestUploadCustom.cpp | 11 +- .../webkit/WebCore/bindings/js/ScheduledAction.cpp | 15 +- .../webkit/WebCore/bindings/js/ScheduledAction.h | 9 +- .../WebCore/bindings/js/ScriptCachedFrameData.cpp | 13 +- .../WebCore/bindings/js/ScriptController.cpp | 193 +- .../webkit/WebCore/bindings/js/ScriptController.h | 43 +- .../WebCore/bindings/js/ScriptControllerMac.mm | 2 +- .../WebCore/bindings/js/ScriptEventListener.cpp | 4 +- .../WebCore/bindings/js/ScriptFunctionCall.cpp | 6 +- .../WebCore/bindings/js/ScriptObjectQuarantine.cpp | 6 +- .../webkit/WebCore/bindings/js/ScriptSourceCode.h | 8 + .../webkit/WebCore/bindings/js/ScriptState.cpp | 5 +- .../webkit/WebCore/bindings/js/ScriptState.h | 1 + .../WebCore/bindings/js/WorkerScriptController.cpp | 3 +- .../WebCore/bindings/js/WorkerScriptController.h | 3 + .../WebCore/bindings/scripts/CodeGeneratorJS.pm | 40 +- .../WebCore/bindings/scripts/CodeGeneratorV8.pm | 67 +- src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp | 9 +- .../webkit/WebCore/bridge/jni/jni_jsobject.mm | 5 +- src/3rdparty/webkit/WebCore/bridge/npapi.h | 25 +- .../webkit/WebCore/bridge/qt/qt_runtime.cpp | 6 +- .../WebCore/css/CSSComputedStyleDeclaration.cpp | 49 +- .../WebCore/css/CSSComputedStyleDeclaration.h | 3 + src/3rdparty/webkit/WebCore/css/CSSParser.cpp | 48 +- src/3rdparty/webkit/WebCore/css/CSSParser.h | 2 +- src/3rdparty/webkit/WebCore/css/CSSParserValues.h | 2 +- .../webkit/WebCore/css/CSSPrimitiveValueMappings.h | 5 +- src/3rdparty/webkit/WebCore/css/CSSProperty.h | 2 +- .../webkit/WebCore/css/CSSPropertyNames.in | 4 + .../webkit/WebCore/css/CSSStyleSelector.cpp | 1 + .../WebCore/css/SVGCSSComputedStyleDeclaration.cpp | 2 + src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp | 5 + .../webkit/WebCore/css/SVGCSSPropertyNames.in | 2 + .../webkit/WebCore/css/SVGCSSStyleSelector.cpp | 30 + src/3rdparty/webkit/WebCore/dom/Document.cpp | 19 +- src/3rdparty/webkit/WebCore/dom/Document.h | 17 +- src/3rdparty/webkit/WebCore/dom/Element.cpp | 2 +- src/3rdparty/webkit/WebCore/dom/EventTarget.cpp | 35 +- src/3rdparty/webkit/WebCore/dom/EventTarget.h | 20 +- .../webkit/WebCore/dom/HTMLAllCollection.idl | 40 - .../webkit/WebCore/dom/ScriptExecutionContext.cpp | 20 + .../webkit/WebCore/dom/ScriptExecutionContext.h | 4 + src/3rdparty/webkit/WebCore/dom/SelectElement.cpp | 22 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp | 49 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h | 7 +- .../webkit/WebCore/dom/XMLTokenizerLibxml2.cpp | 26 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp | 25 +- .../webkit/WebCore/editing/ApplyStyleCommand.cpp | 36 +- .../WebCore/editing/CompositeEditCommand.cpp | 177 +- .../webkit/WebCore/editing/CompositeEditCommand.h | 3 + .../webkit/WebCore/editing/EditorCommand.cpp | 4 +- .../WebCore/editing/IndentOutdentCommand.cpp | 63 +- .../webkit/WebCore/editing/IndentOutdentCommand.h | 1 - .../WebCore/editing/ReplaceNodeWithSpanCommand.cpp | 4 +- .../webkit/WebCore/editing/SelectionController.cpp | 2 + .../webkit/WebCore/generated/CSSPropertyNames.cpp | 428 +- .../webkit/WebCore/generated/CSSPropertyNames.h | 256 +- .../webkit/WebCore/generated/JSAbstractWorker.cpp | 4 +- .../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 | 18 +- .../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 | 21 +- .../webkit/WebCore/generated/JSDOMWindow.h | 2 + .../webkit/WebCore/generated/JSDataGridColumn.cpp | 2 +- .../WebCore/generated/JSDataGridColumnList.cpp | 2 +- .../webkit/WebCore/generated/JSDatabase.cpp | 2 +- .../webkit/WebCore/generated/JSDocument.cpp | 80 +- .../webkit/WebCore/generated/JSElement.cpp | 78 +- src/3rdparty/webkit/WebCore/generated/JSEvent.cpp | 2 +- .../webkit/WebCore/generated/JSEventException.cpp | 2 +- .../webkit/WebCore/generated/JSEventSource.cpp | 8 +- 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 +- .../WebCore/generated/JSHTMLAllCollection.cpp | 292 ++ .../webkit/WebCore/generated/JSHTMLAllCollection.h | 104 + .../webkit/WebCore/generated/JSHTMLBodyElement.cpp | 16 +- .../webkit/WebCore/generated/JSHTMLCollection.cpp | 24 +- .../webkit/WebCore/generated/JSHTMLCollection.h | 1 - .../WebCore/generated/JSHTMLFrameSetElement.cpp | 16 +- .../webkit/WebCore/generated/JSHistory.cpp | 2 +- .../webkit/WebCore/generated/JSImageData.cpp | 2 +- .../WebCore/generated/JSInspectorBackend.cpp | 2 +- .../WebCore/generated/JSJavaScriptCallFrame.cpp | 2 +- .../webkit/WebCore/generated/JSLocation.cpp | 2 +- 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 | 2 +- .../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 | 82 +- .../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 +- .../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 | 8 +- src/3rdparty/webkit/WebCore/generated/JSWorker.cpp | 2 +- .../webkit/WebCore/generated/JSWorkerContext.cpp | 1 - .../webkit/WebCore/generated/JSWorkerLocation.cpp | 2 +- .../webkit/WebCore/generated/JSWorkerNavigator.cpp | 2 +- .../webkit/WebCore/generated/JSXMLHttpRequest.cpp | 14 +- .../generated/JSXMLHttpRequestException.cpp | 2 +- .../WebCore/generated/JSXMLHttpRequestUpload.cpp | 12 +- .../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/qt/HistoryItemQt.cpp | 17 +- .../webkit/WebCore/html/HTMLAllCollection.cpp | 47 + .../webkit/WebCore/html/HTMLAllCollection.h | 44 + .../webkit/WebCore/html/HTMLAllCollection.idl | 43 + .../webkit/WebCore/html/HTMLCanvasElement.cpp | 9 +- src/3rdparty/webkit/WebCore/html/HTMLCollection.h | 3 +- .../webkit/WebCore/html/HTMLCollection.idl | 3 +- src/3rdparty/webkit/WebCore/html/HTMLDocument.idl | 2 +- .../webkit/WebCore/html/HTMLInputElement.cpp | 26 +- .../webkit/WebCore/html/HTMLInputElement.h | 2 + .../webkit/WebCore/html/HTMLMediaElement.cpp | 11 +- .../webkit/WebCore/html/HTMLMediaElement.h | 1 - .../webkit/WebCore/html/HTMLOptionsCollection.idl | 7 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp | 21 +- .../WebCore/html/canvas/CanvasRenderingContext.h | 3 +- .../html/canvas/CanvasRenderingContext2D.cpp | 80 +- .../html/canvas/CanvasRenderingContext3D.cpp | 359 +- .../WebCore/html/canvas/CanvasRenderingContext3D.h | 13 +- .../webkit/WebCore/inspector/ConsoleMessage.cpp | 7 +- .../webkit/WebCore/inspector/ConsoleMessage.h | 1 + .../WebCore/inspector/DOMDispatchTimelineItem.cpp | 58 - .../WebCore/inspector/DOMDispatchTimelineItem.h | 58 - .../WebCore/inspector/InspectorController.cpp | 47 +- .../webkit/WebCore/inspector/InspectorController.h | 3 +- .../webkit/WebCore/inspector/InspectorDOMAgent.h | 5 + .../webkit/WebCore/inspector/InspectorFrontend.cpp | 17 +- .../webkit/WebCore/inspector/InspectorFrontend.h | 5 +- .../webkit/WebCore/inspector/InspectorResource.cpp | 20 +- .../webkit/WebCore/inspector/InspectorResource.h | 2 + .../WebCore/inspector/InspectorTimelineAgent.cpp | 126 +- .../WebCore/inspector/InspectorTimelineAgent.h | 70 +- .../WebCore/inspector/JavaScriptCallFrame.cpp | 3 +- .../webkit/WebCore/inspector/TimelineItem.cpp | 81 - .../webkit/WebCore/inspector/TimelineItem.h | 88 - .../WebCore/inspector/TimelineRecordFactory.cpp | 116 + .../WebCore/inspector/TimelineRecordFactory.h | 63 + .../inspector/front-end/AbstractTimelinePanel.js | 548 +++ .../front-end/BottomUpProfileDataGridTree.js | 214 +- .../webkit/WebCore/inspector/front-end/Color.js | 8 +- .../WebCore/inspector/front-end/ConsoleView.js | 183 +- .../inspector/front-end/DatabaseQueryView.js | 7 +- .../WebCore/inspector/front-end/ElementsPanel.js | 7 +- .../inspector/front-end/ElementsTreeOutline.js | 26 +- .../front-end/EventListenersSidebarPane.js | 11 +- .../inspector/front-end/Images/timelineBarBlue.png | Bin 0 -> 419 bytes .../inspector/front-end/Images/timelineBarGray.png | Bin 0 -> 378 bytes .../front-end/Images/timelineBarGreen.png | Bin 0 -> 414 bytes .../front-end/Images/timelineBarOrange.png | Bin 0 -> 394 bytes .../front-end/Images/timelineBarPurple.png | Bin 0 -> 420 bytes .../inspector/front-end/Images/timelineBarRed.png | Bin 0 -> 408 bytes .../front-end/Images/timelineBarYellow.png | Bin 0 -> 400 bytes .../front-end/Images/timelineCheckmarks.png | Bin 0 -> 3528 bytes .../inspector/front-end/Images/timelineDots.png | Bin 0 -> 2436 bytes .../inspector/front-end/Images/timelineIcon.png | Bin 0 -> 4419 bytes .../WebCore/inspector/front-end/InjectedScript.js | 60 +- .../inspector/front-end/InspectorControllerStub.js | 291 ++ .../webkit/WebCore/inspector/front-end/Panel.js | 99 + .../inspector/front-end/ProfileDataGridTree.js | 36 +- .../WebCore/inspector/front-end/ProfileView.js | 23 +- .../WebCore/inspector/front-end/ProfilesPanel.js | 91 +- .../inspector/front-end/ResourceCategory.js | 11 +- .../WebCore/inspector/front-end/ResourceView.js | 2 +- .../WebCore/inspector/front-end/ResourcesPanel.js | 647 +-- .../WebCore/inspector/front-end/SourceFrame.js | 459 ++- .../WebCore/inspector/front-end/StoragePanel.js | 68 +- .../inspector/front-end/StylesSidebarPane.js | 15 +- .../WebCore/inspector/front-end/SummaryBar.js | 3 +- .../WebCore/inspector/front-end/TestController.js | 10 + .../WebCore/inspector/front-end/TimelineAgent.js | 29 +- .../WebCore/inspector/front-end/TimelinePanel.js | 362 ++ .../front-end/TopDownProfileDataGridTree.js | 9 +- .../webkit/WebCore/inspector/front-end/WebKit.qrc | 2 + .../WebCore/inspector/front-end/inspector.css | 224 +- .../WebCore/inspector/front-end/inspector.html | 7 +- .../WebCore/inspector/front-end/inspector.js | 96 +- .../WebCore/inspector/front-end/utilities.js | 5 + src/3rdparty/webkit/WebCore/loader/Cache.cpp | 6 + .../webkit/WebCore/loader/CachedResource.cpp | 6 + src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp | 52 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.h | 5 + .../webkit/WebCore/loader/RedirectScheduler.cpp | 13 +- .../webkit/WebCore/loader/ResourceLoadNotifier.h | 7 +- .../webkit/WebCore/loader/icon/IconDatabase.cpp | 4 +- .../WebCore/notifications/NotificationCenter.cpp | 14 + .../WebCore/notifications/NotificationCenter.h | 6 +- src/3rdparty/webkit/WebCore/page/Console.cpp | 4 +- src/3rdparty/webkit/WebCore/page/Console.h | 3 +- src/3rdparty/webkit/WebCore/page/DOMTimer.cpp | 27 + src/3rdparty/webkit/WebCore/page/DOMTimer.h | 1 + src/3rdparty/webkit/WebCore/page/DOMWindow.idl | 9 +- src/3rdparty/webkit/WebCore/page/Geolocation.cpp | 128 +- src/3rdparty/webkit/WebCore/page/Geolocation.h | 25 +- src/3rdparty/webkit/WebCore/page/SecurityOrigin.h | 5 +- .../WebCore/page/android/EventHandlerAndroid.cpp | 8 +- .../WebCore/page/animation/AnimationBase.cpp | 2 + src/3rdparty/webkit/WebCore/platform/FileSystem.h | 64 +- .../webkit/WebCore/platform/SSLKeyGenerator.h | 9 +- .../WebCore/platform/android/ClipboardAndroid.h | 44 +- .../WebCore/platform/android/CursorAndroid.cpp | 7 +- .../platform/android/FileChooserAndroid.cpp | 5 +- .../WebCore/platform/android/FileSystemAndroid.cpp | 10 +- .../WebCore/platform/android/KeyEventAndroid.cpp | 288 +- .../WebCore/platform/android/ScreenAndroid.cpp | 32 +- .../platform/android/TemporaryLinkStubs.cpp | 33 +- .../webkit/WebCore/platform/graphics/BitmapImage.h | 4 +- .../WebCore/platform/graphics/GraphicsContext3D.h | 8 +- .../WebCore/platform/graphics/GraphicsLayer.cpp | 6 - .../WebCore/platform/graphics/GraphicsLayer.h | 8 - .../platform/graphics/filters/FEColorMatrix.cpp | 5 +- .../graphics/filters/FEComponentTransfer.cpp | 10 +- .../platform/graphics/filters/FEGaussianBlur.cpp | 9 +- .../WebCore/platform/graphics/qt/ImageQt.cpp | 39 + .../webkit/WebCore/platform/network/Credential.cpp | 3 +- .../webkit/WebCore/platform/network/Credential.h | 2 +- .../WebCore/platform/network/FormDataBuilder.cpp | 38 +- .../platform/network/ResourceRequestBase.cpp | 22 +- .../WebCore/platform/network/ResourceRequestBase.h | 4 +- .../platform/network/qt/QNetworkReplyHandler.cpp | 3 +- .../webkit/WebCore/platform/qt/CursorQt.cpp | 18 +- .../webkit/WebCore/platform/qt/WheelEventQt.cpp | 4 +- .../webkit/WebCore/platform/text/String.cpp | 4 +- .../webkit/WebCore/platform/win/BitmapInfo.cpp | 66 + .../webkit/WebCore/platform/win/BitmapInfo.h | 43 + .../webkit/WebCore/plugins/PluginDatabase.cpp | 4 +- .../webkit/WebCore/plugins/PluginPackage.cpp | 11 +- src/3rdparty/webkit/WebCore/plugins/PluginView.cpp | 2 +- src/3rdparty/webkit/WebCore/plugins/PluginView.h | 8 +- .../webkit/WebCore/plugins/qt/PluginViewQt.cpp | 33 +- .../WebCore/plugins/win/PluginPackageWin.cpp | 11 - .../webkit/WebCore/plugins/win/PluginViewWin.cpp | 128 +- .../webkit/WebCore/rendering/HitTestResult.cpp | 13 +- .../webkit/WebCore/rendering/HitTestResult.h | 1 - .../WebCore/rendering/MediaControlElements.cpp | 9 + .../WebCore/rendering/MediaControlElements.h | 1 + src/3rdparty/webkit/WebCore/rendering/RenderBox.h | 2 +- .../webkit/WebCore/rendering/RenderInline.cpp | 87 + .../webkit/WebCore/rendering/RenderInline.h | 5 + .../webkit/WebCore/rendering/RenderMedia.cpp | 1 + .../rendering/RenderMediaControlsChromium.cpp | 23 +- .../WebCore/rendering/RenderThemeChromiumWin.cpp | 51 +- .../WebCore/rendering/RenderThemeChromiumWin.h | 2 +- .../webkit/WebCore/rendering/RenderTreeAsText.cpp | 28 + .../webkit/WebCore/rendering/RenderTreeAsText.h | 17 +- .../webkit/WebCore/rendering/SVGRenderSupport.cpp | 3 + .../WebCore/rendering/style/SVGRenderStyle.cpp | 5 +- .../WebCore/rendering/style/SVGRenderStyle.h | 4 + .../WebCore/rendering/style/SVGRenderStyleDefs.cpp | 19 + .../WebCore/rendering/style/SVGRenderStyleDefs.h | 28 + src/3rdparty/webkit/WebCore/storage/Database.cpp | 57 +- src/3rdparty/webkit/WebCore/storage/Database.h | 15 +- .../webkit/WebCore/storage/DatabaseThread.cpp | 22 +- .../webkit/WebCore/storage/DatabaseTracker.cpp | 23 +- .../webkit/WebCore/storage/DatabaseTracker.h | 2 + .../webkit/WebCore/storage/OriginQuotaManager.cpp | 3 +- .../webkit/WebCore/storage/SQLTransaction.cpp | 1 - .../WebCore/storage/SQLTransactionClient.cpp | 8 +- .../WebCore/storage/StorageEventDispatcher.cpp | 4 +- .../webkit/WebCore/svg/SVGStyledElement.cpp | 15 +- .../svg/SynchronizablePropertyController.cpp | 128 +- .../WebCore/svg/SynchronizablePropertyController.h | 68 +- .../webkit/WebCore/websockets/WebSocket.cpp | 10 +- .../webkit/WebCore/websockets/WebSocketChannel.cpp | 31 +- .../webkit/WebCore/websockets/WebSocketChannel.h | 4 +- .../webkit/WebCore/workers/WorkerContext.cpp | 1 + .../webkit/WebCore/workers/WorkerContext.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp | 33 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h | 2 +- src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp | 9 +- src/3rdparty/webkit/WebKit.pri | 4 + src/3rdparty/webkit/WebKit/ChangeLog | 16 + src/3rdparty/webkit/WebKit/LICENSE | 22 +- .../WebKit/mac/Configurations/Version.xcconfig | 3 +- .../webkit/WebKit/qt/Api/qgraphicswebview.cpp | 122 +- .../webkit/WebKit/qt/Api/qgraphicswebview.h | 1 + src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp | 414 +- src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h | 76 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 119 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h | 19 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h | 4 +- src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp | 149 +- src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h | 15 - src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 58 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h | 5 + .../webkit/WebKit/qt/Api/qwebsecurityorigin.cpp | 28 +- .../webkit/WebKit/qt/Api/qwebsecurityorigin.h | 2 - src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 109 +- src/3rdparty/webkit/WebKit/qt/Api/qwebview.h | 5 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 481 +++ .../qt/tests/benchmarks/loading/tst_loading.pro | 5 +- .../qt/tests/benchmarks/painting/tst_painting.pro | 5 +- .../qt/tests/qgraphicswebview/qgraphicswebview.pro | 4 + .../WebKit/qt/tests/qwebelement/qwebelement.pro | 5 +- .../qt/tests/qwebelement/tst_qwebelement.cpp | 91 +- .../webkit/WebKit/qt/tests/qwebframe/qwebframe.pro | 5 +- .../WebKit/qt/tests/qwebframe/resources/image2.png | Bin 0 -> 14743 bytes .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 47 +- .../WebKit/qt/tests/qwebhistory/qwebhistory.pro | 5 +- .../qt/tests/qwebhistory/tst_qwebhistory.cpp | 80 +- .../qwebhistoryinterface/qwebhistoryinterface.pro | 5 +- .../webkit/WebKit/qt/tests/qwebpage/qwebpage.pro | 5 +- .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 2 +- .../qwebplugindatabase/qwebplugindatabase.pro | 5 +- .../webkit/WebKit/qt/tests/qwebview/qwebview.pro | 5 +- .../WebKit/qt/tests/qwebview/tst_qwebview.cpp | 64 - 495 files changed, 14556 insertions(+), 4934 deletions(-) create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/DateInstanceCache.h create mode 100755 src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSBindingsAllInOne.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl create mode 100644 src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.h create mode 100644 src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h create mode 100644 src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl delete mode 100644 src/3rdparty/webkit/WebCore/inspector/DOMDispatchTimelineItem.cpp delete mode 100644 src/3rdparty/webkit/WebCore/inspector/DOMDispatchTimelineItem.h delete mode 100644 src/3rdparty/webkit/WebCore/inspector/TimelineItem.cpp delete mode 100644 src/3rdparty/webkit/WebCore/inspector/TimelineItem.h create mode 100644 src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.cpp create mode 100644 src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.h create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AbstractTimelinePanel.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarBlue.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGray.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGreen.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarOrange.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarPurple.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarRed.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarYellow.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineCheckmarks.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineDots.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineIcon.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/InspectorControllerStub.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TimelinePanel.js create mode 100644 src/3rdparty/webkit/WebCore/platform/win/BitmapInfo.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/win/BitmapInfo.h create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image2.png diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index fb7dddf..dc43e0e 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,45 @@ +2009-10-26 Holger Hans Peter Freyther + + Rubber-stamped by Darin Adler. + + Export fastMalloc, fastCalloc, fastRealloc and fastFree + https://bugs.webkit.org/show_bug.cgi?id=30769 + + Export the FastMalloc functions outside of the libwebkit library + to be able to instrument memory allocations. These are C++ symbols + but do not require the C++ runtime to be useful and should be of + no harm to plain C code. + + * autotools/symbols.filter: + +2009-10-26 Gustavo Noronha Silva + + Reviewed by Jan Alonzo. + + Alternative solution to regression introduced in r48672. + + * GNUmakefile.am: + +2009-10-26 Xan Lopez + + Reviewed by Gustavo Noronha. + + Update for 1.1.16 release. + + * configure.ac: + +2009-10-24 Laszlo Gombos + + Reviewed by Holger Freyther. + + [Qt] [Symbian] Set the capability and memory required to run QtWebKit for Symbian + https://bugs.webkit.org/show_bug.cgi?id=30476 + + Set the stack size to 80 Kb and heap size to the 128kB - 32MB range + to all executables linking against WebKit library. + + * WebKit.pri: + 2009-10-18 Jan Michael Alonzo Reviewed by Holger Freyther. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 8d6c2df..e6ab073 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,527 @@ +2009-10-29 Gabor Loki + + Reviewed by Gavin Barraclough. + + Add cacheFlush support for Thumb-2 on Linux + https://bugs.webkit.org/show_bug.cgi?id=30865 + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + +2009-10-28 Gavin Barraclough + + Reviewed by Oliver Hunt. + + JSC JIT on ARMv7 cannot link jumps >16Mb range + https://bugs.webkit.org/show_bug.cgi?id=30891 + + Start planing all relative jumps as move-32-bit-immediate-to-register-BX. + In the cases where the jump would fall within a relative jump range, use a relative jump. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * assembler/ARMv7Assembler.h: + (JSC::ARMv7Assembler::~ARMv7Assembler): + (JSC::ARMv7Assembler::LinkRecord::LinkRecord): + (JSC::ARMv7Assembler::): + (JSC::ARMv7Assembler::executableCopy): + (JSC::ARMv7Assembler::linkJump): + (JSC::ARMv7Assembler::relinkJump): + (JSC::ARMv7Assembler::setInt32): + (JSC::ARMv7Assembler::isB): + (JSC::ARMv7Assembler::isBX): + (JSC::ARMv7Assembler::isMOV_imm_T3): + (JSC::ARMv7Assembler::isMOVT): + (JSC::ARMv7Assembler::isNOP_T1): + (JSC::ARMv7Assembler::isNOP_T2): + (JSC::ARMv7Assembler::linkJumpAbsolute): + (JSC::ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmFirst): + (JSC::ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmSecond): + (JSC::ARMv7Assembler::ARMInstructionFormatter::twoWordOp5i6Imm4Reg4EncodedImm): + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::makeJump): + (JSC::MacroAssemblerARMv7::makeBranch): + * jit/JIT.h: + * wtf/Platform.h: + +2009-10-28 Oliver Hunt + + Reviewed by Geoff Garen. + + Improve for..in enumeration performance + https://bugs.webkit.org/show_bug.cgi?id=30887 + + Improve indexing of an object with a for..in iterator by + identifying cases where get_by_val is being used with a iterator + as the subscript and replace it with a new get_by_pname + bytecode. get_by_pname then optimizes lookups that directly access + the base object. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + * bytecode/Opcode.h: + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitGetByVal): + * bytecompiler/BytecodeGenerator.h: + (JSC::BytecodeGenerator::pushOptimisedForIn): + (JSC::BytecodeGenerator::popOptimisedForIn): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): + (JSC::JIT::privateCompileSlowCases): + * jit/JIT.h: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::compileGetDirectOffset): + (JSC::JIT::emit_op_get_by_pname): + (JSC::JIT::emitSlow_op_get_by_pname): + * parser/Nodes.cpp: + (JSC::ForInNode::emitBytecode): + * runtime/JSObject.h: + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::create): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::getOffset): + (JSC::JSPropertyNameIterator::JSPropertyNameIterator): + * runtime/JSValue.h: + (JSC::JSValue::): + * runtime/Structure.cpp: + (JSC::Structure::addPropertyTransition): + (JSC::Structure::changePrototypeTransition): + (JSC::Structure::despecifyFunctionTransition): + (JSC::Structure::addAnonymousSlotsTransition): + (JSC::Structure::getterSetterTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::addPropertyWithoutTransition): + Track the existence (or not) of non-enumerable properties. + * runtime/Structure.h: + (JSC::Structure::propertyStorageCapacity): + (JSC::Structure::propertyStorageSize): + (JSC::Structure::hasNonEnumerableProperties): + (JSC::Structure::hasAnonymousSlots): + +2009-10-28 Dmitry Titov + + Not reviewed, attemp to fix Windows build. + + Touch the cpp file to cause recompile. + + * wtf/Threading.cpp: + (WTF::threadEntryPoint): + +2009-10-28 Dmitry Titov + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=30805 + Add MessageQueue::removeIf(Predicate&) to remove certain tasks without pulling them from the queue. + Existing Database tests cover this since Database removes tasks when it is stopped. + + * wtf/MessageQueue.h: + (WTF::::removeIf): + +2009-10-28 Afonso R. Costa Jr. + + Reviewed by Oliver Hunt. + + [Qt] Enable YARR when YARR_JIT is enabled + https://bugs.webkit.org/show_bug.cgi?id=30730 + + When enabling or disabling JIT using JAVASCRIPTCORE_JIT, the ENABLE_YARR should + be toggled also. + + * JavaScriptCore.pri: + +2009-10-24 Martin Robinson + + Reviewed by Oliver Hunt. + + Fix strict aliasing warning by switching reinterpret_cast to bitwise_cast. + + strict-aliasing warnings in JSFunction.h + https://bugs.webkit.org/show_bug.cgi?id=27869 + + * runtime/JSFunction.h: + (JSC::JSFunction::nativeFunction): + (JSC::JSFunction::scopeChain): + (JSC::JSFunction::setScopeChain): + (JSC::JSFunction::setNativeFunction): + +2009-10-28 Jan-Arve Sæther + + Reviewed by Tor Arne Vestbø. + + Build-fix for 64-bit Windows + + * wtf/Platform.h: Make sure to use WTF_USE_JSVALUE64 + +2009-10-28 Gavin Barraclough + + Reviewed by NOBODY (build fix!). + + * jit/JIT.h: + +2009-10-26 Holger Hans Peter Freyther + + Rubber-stamped by Darin Adler. + + Export fastMalloc, fastCalloc, fastRealloc and fastFree on GCC/Unix + https://bugs.webkit.org/show_bug.cgi?id=30769 + + When using -fvisibility=hidden to hide all internal symbols by default + the malloc symbols will be hidden as well. For memory instrumentation + it is needed to provide an instrumented version of these symbols and + override the normal routines and by changing the visibility back to + default this becomes possible. + + The only other solution would be to use system malloc instead of the + TCmalloc implementation but this will not allow to analyze memory + behavior with the default allocator. + + * wtf/FastMalloc.h: Define WTF_FAST_MALLOC_EXPORT for GCC and !darwin + +2009-10-27 Gavin Barraclough + + Rubber Stamped by Samuel Q. Weinig. + + Make the asserts protecting the offsets in the JIT more descriptive. + + * jit/JIT.h: + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_method_check): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::compileGetByIdSlowCase): + (JSC::JIT::emit_op_put_by_id): + +2009-10-27 Geoffrey Garen + + Reviewed by Sam Weinig. + + A little bit of refactoring in the date code. + + * JavaScriptCore.exp: Don't export this unused symbol. + + * runtime/DateConstructor.cpp: + (JSC::constructDate): + + * runtime/DateInstance.cpp: + (JSC::DateInstance::DateInstance): + * runtime/DateInstance.h: Removed some unused functions. Changed the default + constructor to ensure that a DateInstance is always initialized. + + * runtime/DatePrototype.cpp: + (JSC::DatePrototype::DatePrototype): Pass an initializer to our constructor, + since it now requires one. + + * wtf/DateMath.cpp: + (WTF::msToGregorianDateTime): Only compute our offset from UTC if our + output will require it. Otherwise, our offset is 0. + +2009-10-27 Geoffrey Garen + + Build fix: Mark DateInstaceCache.h private, so other frameworks can see it. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-10-27 Geoffrey Garen + + Build fix: re-readded this file. + + * runtime/DateInstanceCache.h: Added. + (JSC::DateInstanceData::create): + (JSC::DateInstanceData::DateInstanceData): + (JSC::DateInstanceCache::DateInstanceCache): + (JSC::DateInstanceCache::add): + (JSC::DateInstanceCache::lookup): + +2009-10-27 Geoffrey Garen + + Reviewed by Darin Adler and Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=30800 + Cache recently computed date data. + + SunSpider reports a ~0.5% speedup, mostly from date-format-tofte.js. + + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: Added new file. + + * runtime/DateInstance.cpp: + (JSC::DateInstance::DateInstance): + (JSC::DateInstance::getGregorianDateTime): Use the shared cache. + + * runtime/DateInstance.h: Renamed m_cache to m_data, to avoid the confusion + of a "cache cache". + + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncToGMTString): + (JSC::dateProtoFuncGetMonth): + (JSC::dateProtoFuncGetUTCMonth): + (JSC::dateProtoFuncGetDate): + (JSC::dateProtoFuncGetUTCDate): + (JSC::dateProtoFuncGetDay): + (JSC::dateProtoFuncGetUTCDay): + (JSC::dateProtoFuncGetHours): + (JSC::dateProtoFuncGetUTCHours): + (JSC::dateProtoFuncGetMinutes): + (JSC::dateProtoFuncGetUTCMinutes): + (JSC::dateProtoFuncGetSeconds): + (JSC::dateProtoFuncGetUTCSeconds): + (JSC::dateProtoFuncGetTimezoneOffset): + (JSC::setNewValueFromTimeArgs): + (JSC::setNewValueFromDateArgs): + (JSC::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): Pass an ExecState to these functions, so they + can access the DateInstanceCache. + + * runtime/JSGlobalData.h: Keep a DateInstanceCache. + +2009-10-27 James Robinson + + Reviewed by Darin Fisher. + + Ensures that JavaScriptCore/wtf/CurrentTime.cpp is not built in PLATFORM(CHROMIUM) builds. + + Chromium uses a different method to calculate the current time than is used in + JavaScriptCore/wtf/CurrentTime.cpp. This can lead to time skew when calls to currentTime() and Chromium's time + function are mixed. In particular, timers can get scheduled in the past which leads to 100% CPU use. + See http://code.google.com/p/chromium/issues/detail?id=25892 for an example. + + https://bugs.webkit.org/show_bug.cgi?id=30833 + + * JavaScriptCore.gyp/JavaScriptCore.gyp: + * wtf/CurrentTime.cpp: + +2009-10-27 Peter Varga + + Rubber-stamped by Tor Arne Vestbø. + + Fix typo in RegexInterpreter.cpp and RegexJIT.cpp alterantive to + alternative. + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::ByteCompiler::alternativeBodyDisjunction): + (JSC::Yarr::ByteCompiler::alternativeDisjunction): + (JSC::Yarr::ByteCompiler::emitDisjunction): + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateDisjunction): + +2009-10-26 Laszlo Gombos + + Reviewed by Darin Adler. + + Make .rc files compile on Windows without depending on MFC headers + https://bugs.webkit.org/show_bug.cgi?id=30750 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: Use + winresrc.h because it exists even when MFC is not installed, and is + all that's needed here. + +2009-10-26 Gabor Loki + + Reviewed by Gavin Barraclough. + + The thunkReturnAddress is on JITStackFrame on ARM JIT as well + https://bugs.webkit.org/show_bug.cgi?id=30782 + + Move the thunkReturnAddress from top of the stack into the JITStackFrame + structure. This is a requirement for JSValue32_64 support on ARM. + + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::ret): Return with link register + (JSC::MacroAssemblerARM::prepareCall): Store the return address in link register + * jit/JIT.h: Remove unused ctiReturnRegister + * jit/JITInlineMethods.h: Same as ARMv7 + (JSC::JIT::restoreArgumentReference): Ditto. + (JSC::JIT::restoreArgumentReferenceForTrampoline): Ditto. + * jit/JITOpcodes.cpp: Remove ctiReturnRegister related instruction + * jit/JITStubs.cpp: Store thunkReturnAddress on JITStackFrame. Use + small trampoline functions which handle return addresses for each + CTI_STUB_FUNCTION. + * jit/JITStubs.h: Store thunkReturnAddress on JITStackFrame + (JSC::JITStackFrame::returnAddressSlot): Return with the address of thunkReturnAddress + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateEnter): Remove the unnecessary instruction + +2009-10-26 Steve Block + + Reviewed by Darin Adler. + + Adds ability to disable ReadWriteLock on platforms (eg Android) that use pthreads but do not support pthread_rwlock. + https://bugs.webkit.org/show_bug.cgi?id=30713 + + * wtf/Platform.h: Modified. Defines HAVE_PTHREAD_RWLOCK for all platforms currently using pthreads. + * wtf/Threading.h: Modified. Use pthread_rwlock_t only when HAVE_PTHREAD_RWLOCK is defined. + * wtf/ThreadingPthreads.cpp: Modified. Build ReadWriteLock methods only when HAVE_PTHREAD_RWLOCK is defined. + +2009-10-24 Laszlo Gombos + + Reviewed by Holger Freyther. + + [Qt] [Symbian] Set the capability and memory required to run QtWebKit for Symbian + https://bugs.webkit.org/show_bug.cgi?id=30476 + + Assign ReadUserData WriteUserData NetworkServices Symbian capabilities + to jsc.exe. + + * jsc.pro: + +2009-10-23 Steve Block + + Reviewed by Dmitry Titov. + + Fixes a leak in createThreadInternal on Android. + https://bugs.webkit.org/show_bug.cgi?id=30698 + + * wtf/ThreadingPthreads.cpp: Modified. + (WTF::createThreadInternal): Avoid leaking a ThreadData object on failure. + +2009-10-22 Geoffrey Garen + + Reviewed by Alexey Proskuryakov. + + Fixed ASSERT when opening Safari's Caches window while the Web Inspector + is open. + + * runtime/Collector.cpp: + (JSC::typeName): Added two new types to the type name list in the Collector. + These types have been around for a while, but nobody remembered to consider them here. + + * runtime/JSCell.h: + (JSC::JSCell::isPropertyNameIterator): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::isPropertyNameIterator): Give the Collector + a way to tell if a cell is a JSPropertyNameIterator. + +2009-10-22 Steve Falkenburg + + Reviewed by Jon Honeycutt. + + https://bugs.webkit.org/show_bug.cgi?id=30686 + Remove debug-specific def file. + Only Debug_All target uses JavaScriptCore_debug.dll naming, and since + that target is only used internally, maintaining two files just to + suppress a single link warning isn't worthwhile. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Removed. + +2009-10-21 Jon Honeycutt + + Screenshots of off-screen plug-ins are blank + After halting a transparent PluginView on + Windows, the transparency is applied twice + + Reviewed by Dan Bernstein. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + Export WTF::deleteOwnedPtr(HDC). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + Ditto. + +2009-10-20 Geoffrey Garen + + Windows build fix: updated variable name. + + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + +2009-10-20 Geoffrey Garen + + Reviewed by Mark Rowe. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_next_pname): Slightly tweaked this #ifdef to match the + size of a JSValue because m_jsStrings is an array of JSValues. + +2009-10-20 Geoffrey Garen + + Reviewed by Mark Rowe. + + Fixed a 64-bit regression caused by the fix for + https://bugs.webkit.org/show_bug.cgi?id=30570. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_next_pname): Use TimesEight stepping on 64-bit, since + 64-bit pointers are eight bytes long. + +2009-10-20 Geoffrey Garen + + Reviewed by Sam Weinig. + + Refactored DateInstance::msToGregorianDateTime so that a DateInstance's + caller doesn't need to supply the DateInstance's own internal value to + the DateInstance. + + * runtime/DateInstance.cpp: + (JSC::DateInstance::getGregorianDateTime): Renamed from "msToGregorianDateTime". + + * runtime/DateInstance.h: + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncToLocaleString): + (JSC::dateProtoFuncToLocaleDateString): + (JSC::dateProtoFuncToLocaleTimeString): + (JSC::dateProtoFuncGetTime): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncToGMTString): + (JSC::dateProtoFuncGetMonth): + (JSC::dateProtoFuncGetUTCMonth): + (JSC::dateProtoFuncGetDate): + (JSC::dateProtoFuncGetUTCDate): + (JSC::dateProtoFuncGetDay): + (JSC::dateProtoFuncGetUTCDay): + (JSC::dateProtoFuncGetHours): + (JSC::dateProtoFuncGetUTCHours): + (JSC::dateProtoFuncGetMinutes): + (JSC::dateProtoFuncGetUTCMinutes): + (JSC::dateProtoFuncGetSeconds): + (JSC::dateProtoFuncGetUTCSeconds): + (JSC::dateProtoFuncGetTimezoneOffset): + (JSC::setNewValueFromTimeArgs): + (JSC::setNewValueFromDateArgs): + (JSC::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): Also renamed "utc" to "outputIsUTC", for clarity. + +2009-10-20 Gabor Loki + + Reviewed by Geoffrey Garen. + + The op_next_pname should use 4 bytes addressing mode in case of JSValue32 + https://bugs.webkit.org/show_bug.cgi?id=30570 + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_next_pname): + +2009-10-20 Gabor Loki + + Reviewed by Oliver Hunt. + + Move OverridesMarkChildren flag from DatePrototype to its parent class + https://bugs.webkit.org/show_bug.cgi?id=30372 + + * runtime/DateInstance.h: + (JSC::DateInstance::createStructure): + * runtime/DatePrototype.h: + 2009-10-19 Geoffrey Garen Reviewed by Oliver Hunt. diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi index 4b316c8..03c23c3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi @@ -194,6 +194,7 @@ 'runtime/DateConversion.h', 'runtime/DateInstance.cpp', 'runtime/DateInstance.h', + 'runtime/DateInstanceCache.h', 'runtime/DatePrototype.cpp', 'runtime/DatePrototype.h', 'runtime/Error.cpp', diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index 89c483e..eb26664 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -39,10 +39,12 @@ win32-* { contains(JAVASCRIPTCORE_JIT,yes) { DEFINES+=ENABLE_JIT=1 DEFINES+=ENABLE_YARR_JIT=1 + DEFINES+=ENABLE_YARR=1 } contains(JAVASCRIPTCORE_JIT,no) { DEFINES+=ENABLE_JIT=0 DEFINES+=ENABLE_YARR_JIT=0 + DEFINES+=ENABLE_YARR=0 } # In debug mode JIT disabled until crash fixed diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h index 078de44..02ce2e9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h @@ -407,6 +407,11 @@ register writeback class ARMv7Assembler { public: + ~ARMv7Assembler() + { + ASSERT(m_jumpsToLink.isEmpty()); + } + typedef ARMRegisters::RegisterID RegisterID; typedef ARMRegisters::FPRegisterID FPRegisterID; @@ -477,6 +482,17 @@ public: private: + struct LinkRecord { + LinkRecord(intptr_t from, intptr_t to) + : from(from) + , to(to) + { + } + + intptr_t from; + intptr_t to; + }; + // ARMv7, Appx-A.6.3 bool BadReg(RegisterID reg) { @@ -574,6 +590,7 @@ private: OP_SUB_SP_imm_T1 = 0xB080, OP_BKPT = 0xBE00, OP_IT = 0xBF00, + OP_NOP_T1 = 0xBF00, } OpcodeID; typedef enum { @@ -608,6 +625,7 @@ private: OP_MOV_imm_T3 = 0xF240, OP_SUB_imm_T4 = 0xF2A0, OP_MOVT = 0xF2C0, + OP_NOP_T2a = 0xF3AF, OP_LDRH_reg_T2 = 0xF830, OP_LDRH_imm_T3 = 0xF830, OP_STR_imm_T4 = 0xF840, @@ -626,6 +644,7 @@ private: typedef enum { OP_B_T4b = 0x9000, + OP_NOP_T2b = 0x8000, } OpcodeID2; struct FourFours { @@ -1481,6 +1500,15 @@ public: void* executableCopy(ExecutablePool* allocator) { void* copy = m_formatter.executableCopy(allocator); + + unsigned jumpCount = m_jumpsToLink.size(); + for (unsigned i = 0; i < jumpCount; ++i) { + uint16_t* location = reinterpret_cast(reinterpret_cast(copy) + m_jumpsToLink[i].from); + uint16_t* target = reinterpret_cast(reinterpret_cast(copy) + m_jumpsToLink[i].to); + linkJumpAbsolute(location, target); + } + m_jumpsToLink.clear(); + ASSERT(copy); return copy; } @@ -1503,11 +1531,7 @@ public: { ASSERT(to.m_offset != -1); ASSERT(from.m_offset != -1); - - uint16_t* location = reinterpret_cast(reinterpret_cast(m_formatter.data()) + from.m_offset); - intptr_t relative = to.m_offset - from.m_offset; - - linkWithOffset(location, relative); + m_jumpsToLink.append(LinkRecord(from.m_offset, to.m_offset)); } static void linkJump(void* code, JmpSrc from, void* to) @@ -1515,9 +1539,7 @@ public: ASSERT(from.m_offset != -1); uint16_t* location = reinterpret_cast(reinterpret_cast(code) + from.m_offset); - intptr_t relative = reinterpret_cast(to) - reinterpret_cast(location); - - linkWithOffset(location, relative); + linkJumpAbsolute(location, to); } // bah, this mathod should really be static, since it is used by the LinkBuffer. @@ -1541,10 +1563,9 @@ public: ASSERT(!(reinterpret_cast(from) & 1)); ASSERT(!(reinterpret_cast(to) & 1)); - intptr_t relative = reinterpret_cast(to) - reinterpret_cast(from); - linkWithOffset(reinterpret_cast(from), relative); + linkJumpAbsolute(reinterpret_cast(from), to); - ExecutableAllocator::cacheFlush(reinterpret_cast(from) - 2, 2 * sizeof(uint16_t)); + ExecutableAllocator::cacheFlush(reinterpret_cast(from) - 5, 5 * sizeof(uint16_t)); } static void relinkCall(void* from, void* to) @@ -1613,14 +1634,14 @@ private: static void setInt32(void* code, uint32_t value) { uint16_t* location = reinterpret_cast(code); + ASSERT(isMOV_imm_T3(location - 4) && isMOVT(location - 2)); - uint16_t lo16 = value; - uint16_t hi16 = value >> 16; - - spliceHi5(location - 4, lo16); - spliceLo11(location - 3, lo16); - spliceHi5(location - 2, hi16); - spliceLo11(location - 1, hi16); + ARMThumbImmediate lo16 = ARMThumbImmediate::makeUInt16(static_cast(value)); + ARMThumbImmediate hi16 = ARMThumbImmediate::makeUInt16(static_cast(value >> 16)); + location[-4] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOV_imm_T3, lo16); + location[-3] = twoWordOp5i6Imm4Reg4EncodedImmSecond((location[-3] >> 8) & 0xf, lo16); + location[-2] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOVT, hi16); + location[-1] = twoWordOp5i6Imm4Reg4EncodedImmSecond((location[-1] >> 8) & 0xf, hi16); ExecutableAllocator::cacheFlush(location - 4, 4 * sizeof(uint16_t)); } @@ -1630,41 +1651,89 @@ private: setInt32(code, reinterpret_cast(value)); } - // Linking & patching: - // This method assumes that the JmpSrc being linked is a T4 b instruction. - static void linkWithOffset(uint16_t* instruction, intptr_t relative) - { - // Currently branches > 16m = mostly deathy. - if (((relative << 7) >> 7) != relative) { - // FIXME: This CRASH means we cannot turn the JIT on by default on arm-v7. - fprintf(stderr, "Error: Cannot link T4b.\n"); - CRASH(); - } - - // ARM encoding for the top two bits below the sign bit is 'peculiar'. - if (relative >= 0) - relative ^= 0xC00000; + static bool isB(void* address) + { + uint16_t* instruction = static_cast(address); + return ((instruction[0] & 0xf800) == OP_B_T4a) && ((instruction[1] & 0xd000) == OP_B_T4b); + } + + static bool isBX(void* address) + { + uint16_t* instruction = static_cast(address); + return (instruction[0] & 0xff87) == OP_BX; + } - // All branch offsets should be an even distance. - ASSERT(!(relative & 1)); + static bool isMOV_imm_T3(void* address) + { + uint16_t* instruction = static_cast(address); + return ((instruction[0] & 0xFBF0) == OP_MOV_imm_T3) && ((instruction[1] & 0x8000) == 0); + } - int word1 = ((relative & 0x1000000) >> 14) | ((relative & 0x3ff000) >> 12); - int word2 = ((relative & 0x800000) >> 10) | ((relative & 0x400000) >> 11) | ((relative & 0xffe) >> 1); + static bool isMOVT(void* address) + { + uint16_t* instruction = static_cast(address); + return ((instruction[0] & 0xFBF0) == OP_MOVT) && ((instruction[1] & 0x8000) == 0); + } - instruction[-2] = OP_B_T4a | word1; - instruction[-1] = OP_B_T4b | word2; + static bool isNOP_T1(void* address) + { + uint16_t* instruction = static_cast(address); + return instruction[0] == OP_NOP_T1; } - // These functions can be used to splice 16-bit immediates back into previously generated instructions. - static void spliceHi5(uint16_t* where, uint16_t what) + static bool isNOP_T2(void* address) { - uint16_t pattern = (what >> 12) | ((what & 0x0800) >> 1); - *where = (*where & 0xFBF0) | pattern; + uint16_t* instruction = static_cast(address); + return (instruction[0] == OP_NOP_T2a) && (instruction[1] == OP_NOP_T2b); } - static void spliceLo11(uint16_t* where, uint16_t what) + + static void linkJumpAbsolute(uint16_t* instruction, void* target) { - uint16_t pattern = ((what & 0x0700) << 4) | (what & 0x00FF); - *where = (*where & 0x8F00) | pattern; + // FIMXE: this should be up in the MacroAssembler layer. :-( + const uint16_t JUMP_TEMPORARY_REGISTER = ARMRegisters::ip; + + ASSERT(!(reinterpret_cast(instruction) & 1)); + ASSERT(!(reinterpret_cast(target) & 1)); + + ASSERT( (isMOV_imm_T3(instruction - 5) && isMOVT(instruction - 3) && isBX(instruction - 1)) + || (isNOP_T1(instruction - 5) && isNOP_T2(instruction - 4) && isB(instruction - 2)) ); + + intptr_t relative = reinterpret_cast(target) - (reinterpret_cast(instruction)); + if (((relative << 7) >> 7) == relative) { + // ARM encoding for the top two bits below the sign bit is 'peculiar'. + if (relative >= 0) + relative ^= 0xC00000; + + // All branch offsets should be an even distance. + ASSERT(!(relative & 1)); + // There may be a better way to fix this, but right now put the NOPs first, since in the + // case of an conditional branch this will be coming after an ITTT predicating *three* + // instructions! Looking backwards to modify the ITTT to an IT is not easy, due to + // variable wdith encoding - the previous instruction might *look* like an ITTT but + // actually be the second half of a 2-word op. + instruction[-5] = OP_NOP_T1; + instruction[-4] = OP_NOP_T2a; + instruction[-3] = OP_NOP_T2b; + instruction[-2] = OP_B_T4a | ((relative & 0x1000000) >> 14) | ((relative & 0x3ff000) >> 12); + instruction[-1] = OP_B_T4b | ((relative & 0x800000) >> 10) | ((relative & 0x400000) >> 11) | ((relative & 0xffe) >> 1); + } else { + ARMThumbImmediate lo16 = ARMThumbImmediate::makeUInt16(static_cast(reinterpret_cast(target) + 1)); + ARMThumbImmediate hi16 = ARMThumbImmediate::makeUInt16(static_cast(reinterpret_cast(target) >> 16)); + instruction[-5] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOV_imm_T3, lo16); + instruction[-4] = twoWordOp5i6Imm4Reg4EncodedImmSecond(JUMP_TEMPORARY_REGISTER, lo16); + instruction[-3] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOVT, hi16); + instruction[-2] = twoWordOp5i6Imm4Reg4EncodedImmSecond(JUMP_TEMPORARY_REGISTER, hi16); + instruction[-1] = OP_BX | (JUMP_TEMPORARY_REGISTER << 3); + } + } + + static uint16_t twoWordOp5i6Imm4Reg4EncodedImmFirst(uint16_t op, ARMThumbImmediate imm) + { + return op | (imm.m_value.i << 10) | imm.m_value.imm4; + } + static uint16_t twoWordOp5i6Imm4Reg4EncodedImmSecond(uint16_t rd, ARMThumbImmediate imm) + { + return (imm.m_value.imm3 << 12) | (rd << 8) | imm.m_value.imm8; } class ARMInstructionFormatter { @@ -1723,8 +1792,11 @@ private: void twoWordOp5i6Imm4Reg4EncodedImm(OpcodeID1 op, int imm4, RegisterID rd, ARMThumbImmediate imm) { - m_buffer.putShort(op | (imm.m_value.i << 10) | imm4); - m_buffer.putShort((imm.m_value.imm3 << 12) | (rd << 8) | imm.m_value.imm8); + ARMThumbImmediate newImm = imm; + newImm.m_value.imm4 = imm4; + + m_buffer.putShort(ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmFirst(op, newImm)); + m_buffer.putShort(ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmSecond(rd, newImm)); } void twoWordOp12Reg4Reg4Imm12(OpcodeID1 op, RegisterID reg1, RegisterID reg2, uint16_t imm) @@ -1749,6 +1821,8 @@ private: private: AssemblerBuffer m_buffer; } m_formatter; + + Vector m_jumpsToLink; }; } // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h index aa8cbb0..7a72b06 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -65,6 +65,7 @@ public: }; static const RegisterID stackPointerRegister = ARMRegisters::sp; + static const RegisterID linkRegister = ARMRegisters::lr; static const Scale ScalePtr = TimesFour; @@ -530,7 +531,7 @@ public: void ret() { - pop(ARMRegisters::pc); + m_assembler.mov_r(ARMRegisters::pc, linkRegister); } void set32(Condition cond, RegisterID left, RegisterID right, RegisterID dest) @@ -746,11 +747,9 @@ protected: void prepareCall() { - ensureSpace(3 * sizeof(ARMWord), sizeof(ARMWord)); + ensureSpace(2 * sizeof(ARMWord), sizeof(ARMWord)); - // S0 might be used for parameter passing - m_assembler.add_r(ARMRegisters::S1, ARMRegisters::pc, ARMAssembler::OP2_IMM | 0x4); - m_assembler.push_r(ARMRegisters::S1); + m_assembler.mov_r(linkRegister, ARMRegisters::pc); } void call32(RegisterID base, int32_t offset) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h index a549604..c479517 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h @@ -990,13 +990,15 @@ public: protected: ARMv7Assembler::JmpSrc makeJump() { - return m_assembler.b(); + moveFixedWidthEncoding(Imm32(0), dataTempRegister); + return m_assembler.bx(dataTempRegister); } ARMv7Assembler::JmpSrc makeBranch(ARMv7Assembler::Condition cond) { - m_assembler.it(cond); - return m_assembler.b(); + m_assembler.it(cond, true, true); + moveFixedWidthEncoding(Imm32(0), dataTempRegister); + return m_assembler.bx(dataTempRegister); } ARMv7Assembler::JmpSrc makeBranch(Condition cond) { return makeBranch(armV7Condition(cond)); } ARMv7Assembler::JmpSrc makeBranch(DoubleCondition cond) { return makeBranch(armV7Condition(cond)); } diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp index 18ca2ae..c915934 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp @@ -824,6 +824,16 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); break; } + case op_get_by_pname: { + int r0 = (++it)->u.operand; + int r1 = (++it)->u.operand; + int r2 = (++it)->u.operand; + int r3 = (++it)->u.operand; + int r4 = (++it)->u.operand; + int r5 = (++it)->u.operand; + printf("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), registerName(r4).c_str(), registerName(r5).c_str()); + break; + } case op_put_by_val: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; @@ -1015,14 +1025,17 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& break; } case op_get_pnames: { - int r0 = it[0].u.operand; - int r1 = it[1].u.operand; - printf("[%4d] get_pnames\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); + int r0 = it[1].u.operand; + int r1 = it[2].u.operand; + int r2 = it[3].u.operand; + int r3 = it[4].u.operand; + int offset = it[5].u.operand; + printf("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), offset, location + offset); it += OPCODE_LENGTH(op_get_pnames) - 1; break; } case op_next_pname: { - int dest = it[0].u.operand; + int dest = it[1].u.operand; int iter = it[4].u.operand; int offset = it[5].u.operand; printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, location + offset); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h index 8968252..4facbef 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h @@ -113,6 +113,7 @@ namespace JSC { macro(op_put_by_id_generic, 8) \ macro(op_del_by_id, 4) \ macro(op_get_by_val, 4) \ + macro(op_get_by_pname, 7) \ macro(op_put_by_val, 4) \ macro(op_del_by_val, 4) \ macro(op_put_by_index, 4) \ diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 41b5c39..04dae15 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -1281,6 +1281,19 @@ RegisterID* BytecodeGenerator::emitDeleteById(RegisterID* dst, RegisterID* base, RegisterID* BytecodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* property) { + for (size_t i = m_forInContextStack.size(); i > 0; i--) { + ForInContext& context = m_forInContextStack[i - 1]; + if (context.propertyRegister == property) { + emitOpcode(op_get_by_pname); + instructions().append(dst->index()); + instructions().append(base->index()); + instructions().append(property->index()); + instructions().append(context.expectedSubscriptRegister->index()); + instructions().append(context.iterRegister->index()); + instructions().append(context.indexRegister->index()); + return dst; + } + } emitOpcode(op_get_by_val); instructions().append(dst->index()); instructions().append(base->index()); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 61de173..4648fb5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -61,6 +61,13 @@ namespace JSC { FinallyContext finallyContext; }; + struct ForInContext { + RefPtr expectedSubscriptRegister; + RefPtr iterRegister; + RefPtr indexRegister; + RefPtr propertyRegister; + }; + class BytecodeGenerator : public FastAllocBase { public: typedef DeclarationStacks::VarStack VarStack; @@ -331,6 +338,17 @@ namespace JSC { void pushFinallyContext(Label* target, RegisterID* returnAddrDst); void popFinallyContext(); + void pushOptimisedForIn(RegisterID* expectedBase, RegisterID* iter, RegisterID* index, RegisterID* propertyRegister) + { + ForInContext context = { expectedBase, iter, index, propertyRegister }; + m_forInContextStack.append(context); + } + + void popOptimisedForIn() + { + m_forInContextStack.removeLast(); + } + LabelScope* breakTarget(const Identifier&); LabelScope* continueTarget(const Identifier&); @@ -467,6 +485,7 @@ namespace JSC { Vector m_scopeContextStack; Vector m_switchContextStack; + Vector m_forInContextStack; int m_nextGlobalIndex; int m_nextParameterIndex; diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 53964ad..c77a0f1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -2417,6 +2417,33 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi vPC += OPCODE_LENGTH(op_del_by_id); NEXT_INSTRUCTION(); } + DEFINE_OPCODE(op_get_by_pname) { + int dst = vPC[1].u.operand; + int base = vPC[2].u.operand; + int property = vPC[3].u.operand; + int expected = vPC[4].u.operand; + int iter = vPC[5].u.operand; + int i = vPC[6].u.operand; + + JSValue baseValue = callFrame->r(base).jsValue(); + JSPropertyNameIterator* it = callFrame->r(iter).propertyNameIterator(); + JSValue subscript = callFrame->r(property).jsValue(); + JSValue expectedSubscript = callFrame->r(expected).jsValue(); + int index = callFrame->r(i).i() - 1; + JSValue result; + int offset = 0; + if (subscript == expectedSubscript && baseValue.isCell() && (baseValue.asCell()->structure() == it->cachedStructure()) && it->getOffset(index, offset)) { + callFrame->r(dst) = asObject(baseValue)->getDirectOffset(offset); + vPC += OPCODE_LENGTH(op_get_by_pname); + NEXT_INSTRUCTION(); + } + Identifier propertyName(callFrame, subscript.toString(callFrame)); + result = baseValue.get(callFrame, propertyName); + CHECK_FOR_EXCEPTION(); + callFrame->r(dst) = result; + vPC += OPCODE_LENGTH(op_get_by_pname); + NEXT_INSTRUCTION(); + } DEFINE_OPCODE(op_get_by_val) { /* get_by_val dst(r) base(r) property(r) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h index 1d15ef0..5c43eeb 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h @@ -189,6 +189,22 @@ public: sys_dcache_flush(code, size); sys_icache_invalidate(code, size); } +#elif PLATFORM(ARM_THUMB2) && PLATFORM(LINUX) + static void cacheFlush(void* code, size_t size) + { + asm volatile ( + "push {r7}\n" + "mov r0, %0\n" + "mov r1, %1\n" + "movw r7, #0x2\n" + "movt r7, #0xf\n" + "movs r2, #0x0\n" + "svc 0x0\n" + "pop {r7}\n" + : + : "r" (code), "r" (reinterpret_cast(code) + size) + : "r0", "r1"); + } #elif PLATFORM(SYMBIAN) static void cacheFlush(void* code, size_t size) { diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp index fa0ac2e..000e4b8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp @@ -239,6 +239,7 @@ void JIT::privateCompileMainPass() DEFINE_OP(op_eq_null) DEFINE_OP(op_get_by_id) DEFINE_OP(op_get_by_val) + DEFINE_OP(op_get_by_pname) DEFINE_OP(op_get_global_var) DEFINE_OP(op_get_pnames) DEFINE_OP(op_get_scoped_var) @@ -385,6 +386,7 @@ void JIT::privateCompileSlowCases() DEFINE_SLOWCASE_OP(op_eq) DEFINE_SLOWCASE_OP(op_get_by_id) DEFINE_SLOWCASE_OP(op_get_by_val) + DEFINE_SLOWCASE_OP(op_get_by_pname) DEFINE_SLOWCASE_OP(op_instanceof) DEFINE_SLOWCASE_OP(op_jfalse) DEFINE_SLOWCASE_OP(op_jnless) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h index 9406d1f..e19ea17 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h @@ -38,6 +38,8 @@ #define JIT_CLASS_ALIGNMENT #endif +#define ASSERT_JIT_OFFSET(actual, expected) ASSERT_WITH_MESSAGE(actual == expected, "JIT Offset \"%s\" should be %d, not %d.\n", #expected, static_cast(actual), static_cast(expected)); + #include "CodeBlock.h" #include "Interpreter.h" #include "JITCode.h" @@ -249,7 +251,6 @@ namespace JSC { static const RegisterID timeoutCheckRegister = ARMRegisters::r5; static const RegisterID callFrameRegister = ARMRegisters::r4; - static const RegisterID ctiReturnRegister = ARMRegisters::r6; static const RegisterID regT0 = ARMRegisters::r0; static const RegisterID regT1 = ARMRegisters::r1; @@ -427,6 +428,7 @@ namespace JSC { #endif void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, Structure* structure, size_t cachedOffset); void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset); + void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID structure, RegisterID offset); void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, Structure* structure, size_t cachedOffset); // Arithmetic opcode helpers @@ -528,6 +530,7 @@ namespace JSC { #endif void compileGetDirectOffset(RegisterID base, RegisterID result, Structure* structure, size_t cachedOffset); void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID result, size_t cachedOffset); + void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID structure, RegisterID offset, RegisterID scratch); void compilePutDirectOffset(RegisterID base, RegisterID value, Structure* structure, size_t cachedOffset); #if PLATFORM(X86_64) @@ -583,26 +586,26 @@ namespace JSC { #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; + static const int patchOffsetPutByIdExternalLoad = 26; static const int patchLengthPutByIdExternalLoad = 12; - static const int patchOffsetPutByIdPropertyMapOffset = 40; + static const int patchOffsetPutByIdPropertyMapOffset = 46; // These architecture specific value are used to enable patching - see comment on op_get_by_id. static const int patchOffsetGetByIdStructure = 10; - static const int patchOffsetGetByIdBranchToSlowCase = 20; - static const int patchOffsetGetByIdExternalLoad = 20; + static const int patchOffsetGetByIdBranchToSlowCase = 26; + static const int patchOffsetGetByIdExternalLoad = 26; static const int patchLengthGetByIdExternalLoad = 12; - static const int patchOffsetGetByIdPropertyMapOffset = 40; - static const int patchOffsetGetByIdPutResult = 44; + static const int patchOffsetGetByIdPropertyMapOffset = 46; + static const int patchOffsetGetByIdPutResult = 50; #if ENABLE(OPCODE_SAMPLING) static const int patchOffsetGetByIdSlowCaseCall = 0; // FIMXE #else static const int patchOffsetGetByIdSlowCaseCall = 28; #endif - static const int patchOffsetOpCallCompareToJump = 10; + static const int patchOffsetOpCallCompareToJump = 16; - static const int patchOffsetMethodCheckProtoObj = 18; - static const int patchOffsetMethodCheckProtoStruct = 28; - static const int patchOffsetMethodCheckPutFunction = 46; + static const int patchOffsetMethodCheckProtoObj = 24; + static const int patchOffsetMethodCheckProtoStruct = 34; + static const int patchOffsetMethodCheckPutFunction = 58; #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; @@ -619,7 +622,7 @@ namespace JSC { #if ENABLE(OPCODE_SAMPLING) #error "OPCODE_SAMPLING is not yet supported" #else - static const int patchOffsetGetByIdSlowCaseCall = 36; + static const int patchOffsetGetByIdSlowCaseCall = 28; #endif static const int patchOffsetOpCallCompareToJump = 12; @@ -640,7 +643,7 @@ namespace JSC { static const int sequenceGetByIdHotPathInstructionSpace = 28; static const int sequenceGetByIdHotPathConstantSpace = 3; // sequenceGetByIdSlowCase - static const int sequenceGetByIdSlowCaseInstructionSpace = 40; + static const int sequenceGetByIdSlowCaseInstructionSpace = 32; static const int sequenceGetByIdSlowCaseConstantSpace = 2; // sequencePutById static const int sequencePutByIdInstructionSpace = 28; @@ -682,6 +685,7 @@ namespace JSC { void emit_op_eq_null(Instruction*); void emit_op_get_by_id(Instruction*); void emit_op_get_by_val(Instruction*); + void emit_op_get_by_pname(Instruction*); void emit_op_get_global_var(Instruction*); void emit_op_get_scoped_var(Instruction*); void emit_op_init_arguments(Instruction*); @@ -771,6 +775,7 @@ namespace JSC { void emitSlow_op_eq(Instruction*, Vector::iterator&); void emitSlow_op_get_by_id(Instruction*, Vector::iterator&); void emitSlow_op_get_by_val(Instruction*, Vector::iterator&); + void emitSlow_op_get_by_pname(Instruction*, Vector::iterator&); void emitSlow_op_instanceof(Instruction*, Vector::iterator&); void emitSlow_op_jfalse(Instruction*, Vector::iterator&); void emitSlow_op_jnless(Instruction*, Vector::iterator&); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp index cfaa69f..f7fcc0a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp @@ -614,7 +614,7 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca END_UNINTERRUPTED_SEQUENCE(sequenceOpCall); addSlowCase(jumpToSlow); - ASSERT(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow) == patchOffsetOpCallCompareToJump); + ASSERT_JIT_OFFSET(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow), patchOffsetOpCallCompareToJump); m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck; // The following is the fast case, only used whan a callee can be linked. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h index f26457a..93d6ce7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h @@ -144,7 +144,7 @@ ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace) #endif -#if PLATFORM(ARM_THUMB2) +#if PLATFORM(ARM) ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) { @@ -161,7 +161,7 @@ ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address) loadPtr(address, linkRegister); } -#else // PLATFORM(X86) || PLATFORM(X86_64) || PLATFORM(ARM_TRADITIONAL) +#else // PLATFORM(X86) || PLATFORM(X86_64) ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) { @@ -191,16 +191,13 @@ ALWAYS_INLINE void JIT::restoreArgumentReference() { move(stackPointerRegister, firstArgumentRegister); poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*)); -#if PLATFORM(ARM_TRADITIONAL) - move(ctiReturnRegister, ARMRegisters::lr); -#endif } 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_THUMB2) +#elif PLATFORM(ARM) 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 e10d105..14736cf 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -1792,7 +1792,6 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr* executable // Setup arg4: This is a plain hack move(stackPointerRegister, ARMRegisters::S0); - move(ctiReturnRegister, ARMRegisters::lr); call(Address(regT1, OBJECT_OFFSETOF(JSFunction, m_data))); addPtr(Imm32(sizeof(ArgList)), stackPointerRegister); @@ -2500,7 +2499,13 @@ void JIT::emit_op_next_pname(Instruction* currentInstruction) // Grab key @ i loadPtr(addressFor(it), regT1); loadPtr(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStrings)), regT2); + +#if USE(JSVALUE64) loadPtr(BaseIndex(regT2, regT0, TimesEight), regT2); +#else + loadPtr(BaseIndex(regT2, regT0, TimesFour), regT2); +#endif + emitPutVirtualRegister(dst, regT2); // Increment i diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp index 4241111..bf367a6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp @@ -33,6 +33,7 @@ #include "JITStubCall.h" #include "JSArray.h" #include "JSFunction.h" +#include "JSPropertyNameIterator.h" #include "Interpreter.h" #include "LinkBuffer.h" #include "RepatchBuffer.h" @@ -934,6 +935,69 @@ void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* str #endif // !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) +void JIT::compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID structure, RegisterID offset) +{ + ASSERT(sizeof(((Structure*)0)->m_propertyStorageCapacity) == sizeof(int32_t)); + ASSERT(sizeof(JSObject::inlineStorageCapacity) == sizeof(int32_t)); + ASSERT(sizeof(JSValue) == 8); + + Jump notUsingInlineStorage = branch32(NotEqual, Address(structure, OBJECT_OFFSETOF(Structure, m_propertyStorageCapacity)), Imm32(JSObject::inlineStorageCapacity)); + loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSObject, m_inlineStorage)+OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload); + loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSObject, m_inlineStorage)+OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag); + Jump finishedLoad = jump(); + notUsingInlineStorage.link(this); + loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base); + loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload); + loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag); + finishedLoad.link(this); +} + +void JIT::emit_op_get_by_pname(Instruction* currentInstruction) +{ + unsigned dst = currentInstruction[1].u.operand; + unsigned base = currentInstruction[2].u.operand; + unsigned property = currentInstruction[3].u.operand; + unsigned expected = currentInstruction[4].u.operand; + unsigned iter = currentInstruction[5].u.operand; + unsigned i = currentInstruction[6].u.operand; + + emitLoad2(property, regT1, regT0, base, regT3, regT2); + emitJumpSlowCaseIfNotJSCell(property, regT1); + addSlowCase(branchPtr(NotEqual, regT0, payloadFor(expected))); + // Property registers are now available as the property is known + emitJumpSlowCaseIfNotJSCell(base, regT3); + emitLoadPayload(iter, regT1); + + // Test base's structure + loadPtr(Address(regT2, OBJECT_OFFSETOF(JSCell, m_structure)), regT0); + addSlowCase(branchPtr(NotEqual, regT0, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure)))); + load32(addressFor(i), regT3); + sub32(Imm32(1), regT3); + addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots)))); + compileGetDirectOffset(regT2, regT1, regT0, regT0, regT3); + + emitStore(dst, regT1, regT0); + map(m_bytecodeIndex + OPCODE_LENGTH(op_get_by_pname), dst, regT1, regT0); +} + +void JIT::emitSlow_op_get_by_pname(Instruction* currentInstruction, Vector::iterator& iter) +{ + unsigned dst = currentInstruction[1].u.operand; + unsigned base = currentInstruction[2].u.operand; + unsigned property = currentInstruction[3].u.operand; + + linkSlowCaseIfNotJSCell(iter, property); + linkSlowCase(iter); + linkSlowCaseIfNotJSCell(iter, base); + linkSlowCase(iter); + linkSlowCase(iter); + + JITStubCall stubCall(this, cti_op_get_by_val); + stubCall.addArgument(base); + stubCall.addArgument(property); + stubCall.call(dst); +} + #else // USE(JSVALUE32_64) void JIT::emit_op_get_by_val(Instruction* currentInstruction) @@ -967,6 +1031,48 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction) emitPutVirtualRegister(dst); } +void JIT::emit_op_get_by_pname(Instruction* currentInstruction) +{ + unsigned dst = currentInstruction[1].u.operand; + unsigned base = currentInstruction[2].u.operand; + unsigned property = currentInstruction[3].u.operand; + unsigned expected = currentInstruction[4].u.operand; + unsigned iter = currentInstruction[5].u.operand; + unsigned i = currentInstruction[6].u.operand; + + emitGetVirtualRegister(property, regT0); + addSlowCase(branchPtr(NotEqual, regT0, addressFor(expected))); + emitGetVirtualRegisters(base, regT0, iter, regT1); + emitJumpSlowCaseIfNotJSCell(regT0, base); + + // Test base's structure + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); + addSlowCase(branchPtr(NotEqual, regT2, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure)))); + load32(addressFor(i), regT3); + sub32(Imm32(1), regT3); + addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots)))); + compileGetDirectOffset(regT0, regT0, regT2, regT3, regT1); + + emitPutVirtualRegister(dst, regT0); +} + +void JIT::emitSlow_op_get_by_pname(Instruction* currentInstruction, Vector::iterator& iter) +{ + unsigned dst = currentInstruction[1].u.operand; + unsigned base = currentInstruction[2].u.operand; + unsigned property = currentInstruction[3].u.operand; + + linkSlowCase(iter); + linkSlowCaseIfNotJSCell(iter, base); + linkSlowCase(iter); + linkSlowCase(iter); + + JITStubCall stubCall(this, cti_op_get_by_val); + stubCall.addArgument(base, regT2); + stubCall.addArgument(property, regT2); + stubCall.call(dst); +} + void JIT::emit_op_put_by_val(Instruction* currentInstruction) { unsigned base = currentInstruction[1].u.operand; @@ -1132,9 +1238,9 @@ void JIT::emit_op_method_check(Instruction* currentInstruction) Jump match = jump(); - ASSERT(differenceBetween(info.structureToCompare, protoObj) == patchOffsetMethodCheckProtoObj); - ASSERT(differenceBetween(info.structureToCompare, protoStructureToCompare) == patchOffsetMethodCheckProtoStruct); - ASSERT(differenceBetween(info.structureToCompare, putFunction) == patchOffsetMethodCheckPutFunction); + ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoObj), patchOffsetMethodCheckProtoObj); + ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoStructureToCompare), patchOffsetMethodCheckProtoStruct); + ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, putFunction), patchOffsetMethodCheckPutFunction); // Link the failure cases here. notCell.link(this); @@ -1201,22 +1307,22 @@ void JIT::compileGetByIdHotPath(int, int baseVReg, Identifier*, unsigned propert DataLabelPtr structureToCompare; Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast(patchGetByIdDefaultStructure))); addSlowCase(structureCheck); - ASSERT(differenceBetween(hotPathBegin, structureToCompare) == patchOffsetGetByIdStructure); - ASSERT(differenceBetween(hotPathBegin, structureCheck) == patchOffsetGetByIdBranchToSlowCase); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetGetByIdStructure); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureCheck), patchOffsetGetByIdBranchToSlowCase) Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0); Label externalLoadComplete(this); - ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetGetByIdExternalLoad); - ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthGetByIdExternalLoad); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, externalLoad), patchOffsetGetByIdExternalLoad); + ASSERT_JIT_OFFSET(differenceBetween(externalLoad, externalLoadComplete), patchLengthGetByIdExternalLoad); DataLabel32 displacementLabel = loadPtrWithAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0); - ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetGetByIdPropertyMapOffset); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel), patchOffsetGetByIdPropertyMapOffset); Label putResult(this); END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath); - ASSERT(differenceBetween(hotPathBegin, putResult) == patchOffsetGetByIdPutResult); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, putResult), patchOffsetGetByIdPutResult); } void JIT::emitSlow_op_get_by_id(Instruction* currentInstruction, Vector::iterator& iter) @@ -1251,7 +1357,7 @@ void JIT::compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase); - ASSERT(differenceBetween(coldPathBegin, call) == patchOffsetGetByIdSlowCaseCall); + ASSERT_JIT_OFFSET(differenceBetween(coldPathBegin, call), patchOffsetGetByIdSlowCaseCall); // Track the location of the call; this will be used to recover patch information. m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex].callReturnLocation = call; @@ -1282,19 +1388,19 @@ void JIT::emit_op_put_by_id(Instruction* currentInstruction) // It is important that the following instruction plants a 32bit immediate, in order that it can be patched over. DataLabelPtr structureToCompare; addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast(patchGetByIdDefaultStructure)))); - ASSERT(differenceBetween(hotPathBegin, structureToCompare) == patchOffsetPutByIdStructure); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetPutByIdStructure); // Plant a load from a bogus ofset in the object's property map; we will patch this later, if it is to be used. Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0); Label externalLoadComplete(this); - ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetPutByIdExternalLoad); - ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthPutByIdExternalLoad); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, externalLoad), patchOffsetPutByIdExternalLoad); + ASSERT_JIT_OFFSET(differenceBetween(externalLoad, externalLoadComplete), patchLengthPutByIdExternalLoad); DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT0, patchGetByIdDefaultOffset)); END_UNINTERRUPTED_SEQUENCE(sequencePutById); - ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetPutByIdPropertyMapOffset); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel), patchOffsetPutByIdPropertyMapOffset); } void JIT::emitSlow_op_put_by_id(Instruction* currentInstruction, Vector::iterator& iter) @@ -1351,6 +1457,20 @@ void JIT::compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID res } } +void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID structure, RegisterID offset, RegisterID scratch) +{ + ASSERT(sizeof(((Structure*)0)->m_propertyStorageCapacity) == sizeof(int32_t)); + ASSERT(sizeof(JSObject::inlineStorageCapacity) == sizeof(int32_t)); + + Jump notUsingInlineStorage = branch32(NotEqual, Address(structure, OBJECT_OFFSETOF(Structure, m_propertyStorageCapacity)), Imm32(JSObject::inlineStorageCapacity)); + loadPtr(BaseIndex(base, offset, ScalePtr, OBJECT_OFFSETOF(JSObject, m_inlineStorage)), result); + Jump finishedLoad = jump(); + notUsingInlineStorage.link(this); + loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), scratch); + loadPtr(BaseIndex(scratch, offset, ScalePtr, 0), result); + finishedLoad.link(this); +} + void JIT::testPrototype(Structure* structure, JumpList& failureCases) { if (structure->m_prototype.isNull()) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 457518c..c999618 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -75,25 +75,12 @@ namespace JSC { #define THUMB_FUNC_PARAM(name) #endif -#if PLATFORM(LINUX) && (PLATFORM(X86_64) || PLATFORM(X86)) +#if PLATFORM(LINUX) && PLATFORM(X86_64) #define SYMBOL_STRING_RELOCATION(name) #name "@plt" #else #define SYMBOL_STRING_RELOCATION(name) SYMBOL_STRING(name) #endif -#if PLATFORM(DARWIN) - // Mach-O platform -#define HIDE_SYMBOL(name) ".private_extern _" #name -#elif PLATFORM(AIX) - // IBM's own file format -#define HIDE_SYMBOL(name) ".lglobl " #name -#elif PLATFORM(LINUX) || PLATFORM(FREEBSD) || PLATFORM(OPENBSD) || PLATFORM(SOLARIS) || (PLATFORM(HPUX) && PLATFORM(IA64)) || PLATFORM(SYMBIAN) || PLATFORM(NETBSD) - // ELF platform -#define HIDE_SYMBOL(name) ".hidden " #name -#else -#define HIDE_SYMBOL(name) -#endif - #if USE(JSVALUE32_64) #if COMPILER(GCC) && PLATFORM(X86) @@ -106,9 +93,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x50, JITStackFrame_code_offset_matches_ctiTrampoline); asm volatile ( -".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushl %ebp" "\n" "movl %esp, %ebp" "\n" @@ -129,7 +114,6 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" #if !USE(JIT_STUB_ARGUMENT_VA_LIST) "movl %esp, %ecx" "\n" @@ -145,7 +129,6 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addl $0x3c, %esp" "\n" "popl %ebx" "\n" @@ -170,7 +153,6 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x80, JITStackFrame_code_ asm volatile ( ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushq %rbp" "\n" "movq %rsp, %rbp" "\n" @@ -197,7 +179,6 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "movq %rsp, %rdi" "\n" "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" @@ -213,7 +194,6 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addq $0x48, %rsp" "\n" "popq %rbx" "\n" @@ -235,7 +215,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" @@ -262,7 +241,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" @@ -368,9 +346,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x30, JITStackFrame_code_ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x1c, JITStackFrame_stub_argument_space_matches_ctiTrampoline); asm volatile ( -".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushl %ebp" "\n" "movl %esp, %ebp" "\n" @@ -391,7 +367,6 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" #if !USE(JIT_STUB_ARGUMENT_VA_LIST) "movl %esp, %ecx" "\n" @@ -407,7 +382,6 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addl $0x1c, %esp" "\n" "popl %ebx" "\n" @@ -430,9 +404,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x48, JITStackFrame_code_ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x78, JITStackFrame_stub_argument_space_matches_ctiTrampoline); asm volatile ( -".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushq %rbp" "\n" "movq %rsp, %rbp" "\n" @@ -466,7 +438,6 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "movq %rsp, %rdi" "\n" "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" @@ -482,7 +453,6 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addq $0x78, %rsp" "\n" "popq %rbx" "\n" @@ -504,7 +474,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" @@ -531,7 +500,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" @@ -549,7 +517,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" @@ -564,45 +531,31 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" #elif COMPILER(GCC) && PLATFORM(ARM_TRADITIONAL) asm volatile ( -".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "stmdb sp!, {r1-r3}" "\n" "stmdb sp!, {r4-r8, lr}" "\n" - "mov r6, pc" "\n" - "add r6, r6, #40" "\n" - "sub sp, sp, #32" "\n" - "ldr r4, [sp, #60]" "\n" + "sub sp, sp, #36" "\n" + "mov r4, r2" "\n" "mov r5, #512" "\n" - // r0 contains the code - "add r8, pc, #4" "\n" - "str r8, [sp, #-4]!" "\n" + "mov lr, pc" "\n" "mov pc, r0" "\n" - "add sp, sp, #32" "\n" + "add sp, sp, #36" "\n" "ldmia sp!, {r4-r8, lr}" "\n" "add sp, sp, #12" "\n" "mov pc, lr" "\n" - - // the return instruction - "ldr pc, [sp], #4" "\n" ); asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "mov r0, sp" "\n" - "mov lr, r6" "\n" - "add r8, pc, #4" "\n" - "str r8, [sp, #-4]!" "\n" - "b " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" + "bl " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" // Both has the same return sequence ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" - "add sp, sp, #32" "\n" + "add sp, sp, #36" "\n" "ldmia sp!, {r4-r8, lr}" "\n" "add sp, sp, #12" "\n" "mov pc, lr" "\n" @@ -935,7 +888,6 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD ".text" "\n" \ ".align 2" "\n" \ ".globl " SYMBOL_STRING(cti_##op) "\n" \ - HIDE_SYMBOL(cti_##op) "\n" \ ".thumb" "\n" \ ".thumb_func " THUMB_FUNC_PARAM(cti_##op) "\n" \ SYMBOL_STRING(cti_##op) ":" "\n" \ @@ -946,6 +898,22 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD ); \ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION) \ +#elif PLATFORM(ARM_TRADITIONAL) && COMPILER(GCC) + +#define DEFINE_STUB_FUNCTION(rtype, op) \ + extern "C" { \ + rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \ + }; \ + asm volatile ( \ + ".globl " SYMBOL_STRING(cti_##op) "\n" \ + SYMBOL_STRING(cti_##op) ":" "\n" \ + "str lr, [sp, #32]" "\n" \ + "bl " SYMBOL_STRING(JITStubThunked_##op) "\n" \ + "ldr lr, [sp, #32]" "\n" \ + "mov pc, lr" "\n" \ + ); \ + rtype JITStubThunked_##op(STUB_ARGS_DECLARATION) + #else #define DEFINE_STUB_FUNCTION(rtype, op) rtype JIT_STUB cti_##op(STUB_ARGS_DECLARATION) #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h index ccbcd2a..69776cb 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h @@ -163,6 +163,8 @@ namespace JSC { JITStubArg padding; // Unused JITStubArg args[7]; + ReturnAddressPtr thunkReturnAddress; + void* preservedR4; void* preservedR5; void* preservedR6; @@ -173,11 +175,13 @@ namespace JSC { RegisterFile* registerFile; CallFrame* callFrame; JSValue* exception; + + // These arguments passed on the stack. Profiler** enabledProfilerReference; JSGlobalData* globalData; // When JIT code makes a call, it pushes its return address just below the rest of the stack. - ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast(this) - 1; } + ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; } }; #else #error "JITStackFrame not defined for this platform." diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp index b1e317e..45009dc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp @@ -1477,6 +1477,7 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds generator.emitNode(base.get(), m_expr); RefPtr i = generator.newTemporary(); RefPtr size = generator.newTemporary(); + RefPtr expectedSubscript; RefPtr iter = generator.emitGetPropertyNames(generator.newTemporary(), base.get(), i.get(), size.get(), scope->breakTarget()); generator.emitJump(scope->continueTarget()); @@ -1484,6 +1485,7 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds generator.emitLabel(loopStart.get()); RegisterID* propertyName; + bool optimizedForinAccess = false; if (m_lexpr->isResolveNode()) { const Identifier& ident = static_cast(m_lexpr)->identifier(); propertyName = generator.registerFor(ident); @@ -1494,6 +1496,10 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds generator.emitExpressionInfo(divot(), startOffset(), endOffset()); generator.emitPutById(base, ident, propertyName); + } else { + expectedSubscript = generator.emitMove(generator.newTemporary(), propertyName); + generator.pushOptimisedForIn(expectedSubscript.get(), iter.get(), i.get(), propertyName); + optimizedForinAccess = true; } } else if (m_lexpr->isDotAccessorNode()) { DotAccessorNode* assignNode = static_cast(m_lexpr); @@ -1518,6 +1524,9 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds generator.emitNode(dst, m_statement); + if (optimizedForinAccess) + generator.popOptimisedForIn(); + generator.emitLabel(scope->continueTarget()); generator.emitNextPropertyName(propertyName, base.get(), i.get(), size.get(), iter.get(), loopStart.get()); generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index a69115c..b885049 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -240,9 +240,7 @@ void Heap::destroy() template NEVER_INLINE CollectorBlock* Heap::allocateBlock() { - // Disable the use of vm_map for the Qt build on Darwin, because when compiled on 10.4 - // it crashes on 10.5 -#if PLATFORM(DARWIN) && !PLATFORM(QT) +#if PLATFORM(DARWIN) vm_address_t address = 0; // FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: . vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); @@ -334,9 +332,7 @@ NEVER_INLINE void Heap::freeBlock(size_t block) NEVER_INLINE void Heap::freeBlock(CollectorBlock* block) { - // Disable the use of vm_deallocate for the Qt build on Darwin, because when compiled on 10.4 - // it crashes on 10.5 -#if PLATFORM(DARWIN) && !PLATFORM(QT) +#if PLATFORM(DARWIN) vm_deallocate(current_task(), reinterpret_cast(block), BLOCK_SIZE); #elif PLATFORM(SYMBIAN) userChunk->Free(reinterpret_cast(block)); @@ -1291,6 +1287,10 @@ static const char* typeName(JSCell* cell) #endif if (cell->isGetterSetter()) return "gettersetter"; + if (cell->isAPIValueWrapper()) + return "value wrapper"; + if (cell->isPropertyNameIterator()) + return "for-in iterator"; ASSERT(cell->isObject()); const ClassInfo* info = cell->classInfo(); return info ? info->className : "Object"; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp index f9b7d84..9908fef 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp @@ -112,9 +112,7 @@ JSObject* constructDate(ExecState* exec, const ArgList& args) } } - DateInstance* result = new (exec) DateInstance(exec->lexicalGlobalObject()->dateStructure()); - result->setInternalValue(jsNumber(exec, timeClip(value))); - return result; + return new (exec) DateInstance(exec, value); } static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp index 4cd58f5..d4c9ef7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp @@ -32,95 +32,43 @@ using namespace WTF; namespace JSC { -struct DateInstance::Cache { - double m_gregorianDateTimeCachedForMS; - GregorianDateTime m_cachedGregorianDateTime; - double m_gregorianDateTimeUTCCachedForMS; - GregorianDateTime m_cachedGregorianDateTimeUTC; -}; - const ClassInfo DateInstance::info = {"Date", 0, 0, 0}; -DateInstance::DateInstance(NonNullPassRefPtr structure) +DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr structure) : JSWrapperObject(structure) - , m_cache(0) { + setInternalValue(jsNaN(exec)); } DateInstance::DateInstance(ExecState* exec, double time) : JSWrapperObject(exec->lexicalGlobalObject()->dateStructure()) - , m_cache(0) { setInternalValue(jsNumber(exec, timeClip(time))); } -DateInstance::~DateInstance() +bool DateInstance::getGregorianDateTime(ExecState* exec, bool outputIsUTC, GregorianDateTime& t) const { - delete m_cache; -} + double milli = internalNumber(); + if (isnan(milli)) + return false; -void DateInstance::msToGregorianDateTime(double milli, bool outputIsUTC, GregorianDateTime& t) const -{ - if (!m_cache) { - m_cache = new Cache; - m_cache->m_gregorianDateTimeCachedForMS = NaN; - m_cache->m_gregorianDateTimeUTCCachedForMS = NaN; - } + if (!m_data) + m_data = exec->globalData().dateInstanceCache.add(milli); if (outputIsUTC) { - if (m_cache->m_gregorianDateTimeUTCCachedForMS != milli) { - WTF::msToGregorianDateTime(milli, true, m_cache->m_cachedGregorianDateTimeUTC); - m_cache->m_gregorianDateTimeUTCCachedForMS = milli; + if (m_data->m_gregorianDateTimeUTCCachedForMS != milli) { + WTF::msToGregorianDateTime(internalNumber(), true, m_data->m_cachedGregorianDateTimeUTC); + m_data->m_gregorianDateTimeUTCCachedForMS = milli; } - t.copyFrom(m_cache->m_cachedGregorianDateTimeUTC); + t.copyFrom(m_data->m_cachedGregorianDateTimeUTC); } else { - if (m_cache->m_gregorianDateTimeCachedForMS != milli) { - WTF::msToGregorianDateTime(milli, false, m_cache->m_cachedGregorianDateTime); - m_cache->m_gregorianDateTimeCachedForMS = milli; + if (m_data->m_gregorianDateTimeCachedForMS != milli) { + WTF::msToGregorianDateTime(internalNumber(), false, m_data->m_cachedGregorianDateTime); + m_data->m_gregorianDateTimeCachedForMS = milli; } - t.copyFrom(m_cache->m_cachedGregorianDateTime); + t.copyFrom(m_data->m_cachedGregorianDateTime); } -} -bool DateInstance::getTime(GregorianDateTime& t, int& offset) const -{ - double milli = internalNumber(); - if (isnan(milli)) - return false; - - msToGregorianDateTime(milli, false, t); - offset = gmtoffset(t); - return true; -} - -bool DateInstance::getUTCTime(GregorianDateTime& t) const -{ - double milli = internalNumber(); - if (isnan(milli)) - return false; - - msToGregorianDateTime(milli, true, t); - return true; -} - -bool DateInstance::getTime(double& milli, int& offset) const -{ - milli = internalNumber(); - if (isnan(milli)) - return false; - - GregorianDateTime t; - msToGregorianDateTime(milli, false, t); - offset = gmtoffset(t); - return true; -} - -bool DateInstance::getUTCTime(double& milli) const -{ - milli = internalNumber(); - if (isnan(milli)) - return false; - return true; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h index 36d90b1..38b321c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h @@ -32,27 +32,26 @@ namespace JSC { class DateInstance : public JSWrapperObject { public: DateInstance(ExecState*, double); - explicit DateInstance(NonNullPassRefPtr); - virtual ~DateInstance(); + explicit DateInstance(ExecState*, NonNullPassRefPtr); double internalNumber() const { return internalValue().uncheckedGetNumber(); } - bool getTime(WTF::GregorianDateTime&, int& offset) const; - bool getUTCTime(WTF::GregorianDateTime&) const; - bool getTime(double& milliseconds, int& offset) const; - bool getUTCTime(double& milliseconds) const; - static JS_EXPORTDATA const ClassInfo info; - void msToGregorianDateTime(double, bool outputIsUTC, WTF::GregorianDateTime&) const; + bool getGregorianDateTime(ExecState*, bool outputIsUTC, WTF::GregorianDateTime&) const; + + static PassRefPtr createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags)); + } + + protected: + static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags; private: virtual const ClassInfo* classInfo() const { return &info; } - using JSWrapperObject::internalValue; - - struct Cache; - mutable Cache* m_cache; + mutable RefPtr m_data; }; DateInstance* asDateInstance(JSValue); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h new file mode 100644 index 0000000..b626c1d --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DateInstanceCache_h +#define DateInstanceCache_h + +#include +#include +#include +#include + +namespace JSC { + + extern const double NaN; + + class DateInstanceData : public RefCounted { + public: + static PassRefPtr create() { return adoptRef(new DateInstanceData); } + + double m_gregorianDateTimeCachedForMS; + WTF::GregorianDateTime m_cachedGregorianDateTime; + double m_gregorianDateTimeUTCCachedForMS; + WTF::GregorianDateTime m_cachedGregorianDateTimeUTC; + + private: + DateInstanceData() + : m_gregorianDateTimeCachedForMS(NaN) + , m_gregorianDateTimeUTCCachedForMS(NaN) + { + } + }; + + class DateInstanceCache { + public: + DateInstanceCache() + { + for (size_t i = 0; i < cacheSize; ++i) + m_cache[i].key = NaN; + } + + DateInstanceData* add(double d) + { + CacheEntry& entry = lookup(d); + if (d == entry.key) + return entry.value.get(); + + entry.key = d; + entry.value = DateInstanceData::create(); + return entry.value.get(); + } + + private: + static const size_t cacheSize = 64; + + struct CacheEntry { + double key; + RefPtr value; + }; + + CacheEntry& lookup(double d) { return m_cache[WTF::FloatHash::hash(d) & (cacheSize - 1)]; } + + CacheEntry m_cache[cacheSize]; + }; + +} // namespace JSC + +#endif // DateInstanceCache_h diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp index e46ab67..3f3e1f9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp @@ -251,11 +251,12 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L return jsNontrivialString(exec, timebuffer); } -static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, double timeInMilliseconds, LocaleDateTimeFormat format, const ArgList&) +static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, double, LocaleDateTimeFormat format, const ArgList&) { GregorianDateTime gregorianDateTime; - const bool notUTC = false; - dateObject->msToGregorianDateTime(timeInMilliseconds, notUTC, gregorianDateTime); + const bool outputIsUTC = false; + if (!dateObject->getGregorianDateTime(exec, outputIsUTC, gregorianDateTime)) + return jsNontrivialString(exec, "Invalid Date"); return formatLocaleDate(exec, gregorianDateTime, format); } @@ -396,9 +397,8 @@ const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState // ECMA 15.9.4 DatePrototype::DatePrototype(ExecState* exec, NonNullPassRefPtr structure) - : DateInstance(structure) + : DateInstance(exec, structure) { - setInternalValue(jsNaN(exec)); // The constructor will be added later, after DateConstructor has been built. } @@ -420,16 +420,14 @@ JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); - return jsNontrivialString(exec, formatDate(t) + " " + formatTime(t, utc)); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); + return jsNontrivialString(exec, formatDate(t) + " " + formatTime(t, outputIsUTC)); } JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -437,16 +435,14 @@ JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); - return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, utc)); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); + return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, outputIsUTC)); } JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -454,19 +450,17 @@ JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (!isfinite(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); // Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds) // 6 for formatting and one for null termination = 27. We add one extra character to allow us to force null termination. char buffer[28]; - snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + t.year, t.month + 1, t.monthDay, t.hour, t.minute, t.second, static_cast(fmod(milli, 1000))); + snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + t.year, t.month + 1, t.monthDay, t.hour, t.minute, t.second, static_cast(fmod(thisDateObj->internalNumber(), 1000))); buffer[sizeof(buffer) - 1] = 0; return jsNontrivialString(exec, buffer); } @@ -476,15 +470,13 @@ JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSVa if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); return jsNontrivialString(exec, formatDate(t)); } @@ -493,16 +485,14 @@ JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSVa if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); - return jsNontrivialString(exec, formatTime(t, utc)); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); + return jsNontrivialString(exec, formatTime(t, outputIsUTC)); } JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) @@ -511,11 +501,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JS return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); - - return formatLocaleDate(exec, thisDateObj, milli, LocaleDateAndTime, args); + return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime, args); } JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) @@ -524,11 +510,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject* return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); - - return formatLocaleDate(exec, thisDateObj, milli, LocaleDate, args); + return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate, args); } JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) @@ -537,11 +519,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject* return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); - - return formatLocaleDate(exec, thisDateObj, milli, LocaleTime, args); + return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime, args); } JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -549,12 +527,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue t if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); - - return jsNumber(exec, milli); + return asDateInstance(thisValue)->internalValue(); } JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -562,15 +535,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, 1900 + t.year); } @@ -579,15 +550,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JS if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, 1900 + t.year); } @@ -596,16 +565,14 @@ JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); - return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, utc)); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); + return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, outputIsUTC)); } JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -613,15 +580,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.month); } @@ -630,15 +595,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.month); } @@ -647,15 +610,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue t if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.monthDay); } @@ -664,15 +625,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValu if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.monthDay); } @@ -681,15 +640,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue th if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.weekDay); } @@ -698,15 +655,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.weekDay); } @@ -715,15 +670,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.hour); } @@ -732,15 +685,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.hour); } @@ -749,15 +700,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValu if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.minute); } @@ -766,15 +715,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSV if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.minute); } @@ -783,15 +730,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValu if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.second); } @@ -800,15 +745,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSV if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.second); } @@ -847,15 +790,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, -gmtoffset(t) / minutesPerHour); } @@ -890,7 +831,7 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const double ms = milli - secs * msPerSecond; GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, inputIsUTC, t); + thisDateObj->getGregorianDateTime(exec, inputIsUTC, t); if (!fillStructuresUsingTimeArgs(exec, args, numArgsToUse, &ms, &t)) { JSValue result = jsNaN(exec); @@ -922,11 +863,11 @@ static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const if (numArgsToUse == 3 && isnan(milli)) // Based on ECMA 262 15.9.5.40 - .41 (set[UTC]FullYear) // the time must be reset to +0 if it is NaN. - thisDateObj->msToGregorianDateTime(0, true, t); + WTF::msToGregorianDateTime(0, true, t); else { double secs = floor(milli / msPerSecond); ms = milli - secs * msPerSecond; - thisDateObj->msToGregorianDateTime(milli, inputIsUTC, t); + thisDateObj->getGregorianDateTime(exec, inputIsUTC, t); } if (!fillStructuresUsingDateArgs(exec, args, numArgsToUse, &ms, &t)) { @@ -1029,7 +970,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); if (args.isEmpty()) { @@ -1045,11 +986,11 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t if (isnan(milli)) // Based on ECMA 262 B.2.5 (setYear) // the time must be reset to +0 if it is NaN. - thisDateObj->msToGregorianDateTime(0, true, t); + WTF::msToGregorianDateTime(0, true, t); else { double secs = floor(milli / msPerSecond); ms = milli - secs * msPerSecond; - thisDateObj->msToGregorianDateTime(milli, utc, t); + thisDateObj->getGregorianDateTime(exec, outputIsUTC, t); } bool ok = true; @@ -1061,7 +1002,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t } t.year = (year > 99 || year < 0) ? year - 1900 : year; - JSValue result = jsNumber(exec, gregorianDateTimeToMS(t, ms, utc)); + JSValue result = jsNumber(exec, gregorianDateTimeToMS(t, ms, outputIsUTC)); thisDateObj->setInternalValue(result); return result; } @@ -1071,15 +1012,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValue t if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); // NOTE: IE returns the full year even in getYear. return jsNumber(exec, t.year); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h index 5fe4f47..f565775 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h @@ -43,7 +43,7 @@ namespace JSC { } protected: - static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | DateInstance::StructureFlags; + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags; }; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h index 16a5131..722ae33 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h @@ -59,6 +59,7 @@ namespace JSC { virtual bool isGetterSetter() const; bool inherits(const ClassInfo*) const; virtual bool isAPIValueWrapper() const { return false; } + virtual bool isPropertyNameIterator() const { return false; } Structure* structure() const; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h index b4356c4..fcac9aa 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h @@ -66,7 +66,7 @@ namespace JSC { NativeFunction nativeFunction() { - return *reinterpret_cast(m_data); + return *WTF::bitwise_cast(m_data); } virtual ConstructType getConstructData(ConstructData&); @@ -97,7 +97,7 @@ namespace JSC { ScopeChain& scopeChain() { ASSERT(!isHostFunctionNonInline()); - return *reinterpret_cast(m_data); + return *WTF::bitwise_cast(m_data); } void clearScopeChain() { @@ -112,11 +112,11 @@ namespace JSC { void setScopeChain(const ScopeChain& sc) { ASSERT(!isHostFunctionNonInline()); - *reinterpret_cast(m_data) = sc; + *WTF::bitwise_cast(m_data) = sc; } void setNativeFunction(NativeFunction func) { - *reinterpret_cast(m_data) = func; + *WTF::bitwise_cast(m_data) = func; } unsigned char m_data[sizeof(void*)]; }; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h index 3ad90ad..d2aa2da 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h @@ -30,6 +30,7 @@ #define JSGlobalData_h #include "Collector.h" +#include "DateInstanceCache.h" #include "ExecutableAllocator.h" #include "JITStubs.h" #include "JSValue.h" @@ -116,7 +117,8 @@ namespace JSC { const MarkedArgumentBuffer* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark. SmallStrings smallStrings; NumericStrings numericStrings; - + DateInstanceCache dateInstanceCache; + #if ENABLE(ASSEMBLER) ExecutableAllocator executableAllocator; #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h index 1dbab94..5a89c40 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h @@ -202,8 +202,8 @@ namespace JSC { void allocatePropertyStorageInline(size_t oldSize, size_t newSize); bool isUsingInlineStorage() const { return m_structure->isUsingInlineStorage(); } - static const size_t inlineStorageCapacity = sizeof(EncodedJSValue) == 2 * sizeof(void*) ? 4 : 3; - static const size_t nonInlineBaseStorageCapacity = 16; + static const unsigned inlineStorageCapacity = sizeof(EncodedJSValue) == 2 * sizeof(void*) ? 4 : 3; + static const unsigned nonInlineBaseStorageCapacity = 16; static PassRefPtr createStructure(JSValue prototype) { diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp index 2cd9f75..6fd0344 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp @@ -43,7 +43,12 @@ JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject PropertyNameArray propertyNames(exec); o->getPropertyNames(exec, propertyNames); - JSPropertyNameIterator* jsPropertyNameIterator = new (exec) JSPropertyNameIterator(exec, propertyNames.data()); + size_t numCacheableSlots = 0; + if (!o->structure()->hasNonEnumerableProperties() && !o->structure()->hasAnonymousSlots() && + !o->structure()->isUncacheableDictionary() && !o->structure()->typeInfo().overridesGetPropertyNames()) + numCacheableSlots = o->structure()->propertyStorageSize(); + + JSPropertyNameIterator* jsPropertyNameIterator = new (exec) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots); if (o->structure()->isDictionary()) return jsPropertyNameIterator; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h index 0559e0b..529ae8b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h @@ -50,8 +50,18 @@ namespace JSC { return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren)); } + virtual bool isPropertyNameIterator() const { return true; } + virtual void markChildren(MarkStack&); + bool getOffset(size_t i, int& offset) + { + if (i >= m_numCacheableSlots) + return false; + offset = i; + return true; + } + JSValue get(ExecState*, JSObject*, size_t i); size_t size() { return m_jsStringsSize; } @@ -62,17 +72,19 @@ namespace JSC { StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); } private: - JSPropertyNameIterator(ExecState*, PropertyNameArrayData* propertyNameArrayData); + JSPropertyNameIterator(ExecState*, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlot); Structure* m_cachedStructure; RefPtr m_cachedPrototypeChain; - size_t m_jsStringsSize; + uint32_t m_numCacheableSlots; + uint32_t m_jsStringsSize; OwnArrayPtr m_jsStrings; }; -inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData) +inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlots) : JSCell(exec->globalData().propertyNameIteratorStructure.get()) , m_cachedStructure(0) + , m_numCacheableSlots(numCacheableSlots) , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size()) , m_jsStrings(new JSValue[m_jsStringsSize]) { diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp index a11050f..65b62f9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp @@ -375,6 +375,7 @@ PassRefPtr Structure::addPropertyTransition(Structure* structure, con transition->m_specificValueInPrevious = specificValue; transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; if (structure->m_propertyTable) { if (structure->m_isPinnedPropertyTable) @@ -417,6 +418,7 @@ PassRefPtr Structure::changePrototypeTransition(Structure* structure, transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; // Don't set m_offset, as one can not transition to this. @@ -433,6 +435,7 @@ PassRefPtr Structure::despecifyFunctionTransition(Structure* structur transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; // Don't set m_offset, as one can not transition to this. @@ -464,6 +467,7 @@ PassRefPtr Structure::addAnonymousSlotsTransition(Structure* structur transition->m_specificValueInPrevious = 0; transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; if (structure->m_propertyTable) { if (structure->m_isPinnedPropertyTable) @@ -492,6 +496,7 @@ PassRefPtr Structure::getterSetterTransition(Structure* structure) RefPtr transition = create(structure->storedPrototype(), structure->typeInfo()); transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; // Don't set m_offset, as one can not transition to this. @@ -510,6 +515,7 @@ PassRefPtr Structure::toDictionaryTransition(Structure* structure, Di transition->m_dictionaryKind = kind; transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; structure->materializePropertyMapIfNecessary(); transition->m_propertyTable = structure->copyPropertyTable(); @@ -550,6 +556,9 @@ size_t Structure::addPropertyWithoutTransition(const Identifier& propertyName, u materializePropertyMapIfNecessary(); m_isPinnedPropertyTable = true; + if (attributes & DontEnum) + m_hasNonEnumerableProperties = true; + size_t offset = put(propertyName, attributes, specificValue); if (propertyStorageSize() > propertyStorageCapacity()) growPropertyStorageCapacity(); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h index 2496c1b..f355c53 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h @@ -95,8 +95,8 @@ namespace JSC { Structure* previousID() const { return m_previous.get(); } void growPropertyStorageCapacity(); - size_t propertyStorageCapacity() const { return m_propertyStorageCapacity; } - size_t propertyStorageSize() const { return m_propertyTable ? m_propertyTable->keyCount + m_propertyTable->anonymousSlotCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : m_offset + 1; } + unsigned propertyStorageCapacity() const { return m_propertyStorageCapacity; } + unsigned propertyStorageSize() const { return m_propertyTable ? m_propertyTable->keyCount + m_propertyTable->anonymousSlotCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : m_offset + 1; } bool isUsingInlineStorage() const; size_t get(const Identifier& propertyName); @@ -119,6 +119,10 @@ namespace JSC { bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; } void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; } + bool hasNonEnumerableProperties() const { return m_hasNonEnumerableProperties; } + + bool hasAnonymousSlots() const { return m_propertyTable && m_propertyTable->anonymousSlotCount; } + bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == noOffset; } JSCell* specificValue() { return m_specificValueInPrevious; } @@ -190,12 +194,13 @@ namespace JSC { PropertyMapHashTable* m_propertyTable; - size_t m_propertyStorageCapacity; + uint32_t m_propertyStorageCapacity; signed char m_offset; unsigned m_dictionaryKind : 2; bool m_isPinnedPropertyTable : 1; bool m_hasGetterSetterProperties : 1; + bool m_hasNonEnumerableProperties : 1; #if COMPILER(WINSCW) // Workaround for Symbian WINSCW compiler that cannot resolve unsigned type of the declared // bitfield, when used as argument in make_pair() function calls in structure.ccp. diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp index a3d5290..b36cae5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp @@ -63,6 +63,10 @@ extern "C" time_t mktime(struct tm *t); #include #endif +#if PLATFORM(CHROMIUM) +#error Chromium uses a different timer implementation +#endif + namespace WTF { const double msPerSecond = 1000.0; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp index 0386494..2110432 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp @@ -501,13 +501,13 @@ double gregorianDateTimeToMS(const GregorianDateTime& t, double milliSeconds, bo return result; } +// input is UTC void msToGregorianDateTime(double ms, bool outputIsUTC, GregorianDateTime& tm) { - // input is UTC double dstOff = 0.0; - const double utcOff = getUTCOffset(); - - if (!outputIsUTC) { // convert to local time + double utcOff = 0.0; + if (!outputIsUTC) { + utcOff = getUTCOffset(); dstOff = getDSTOffset(ms, utcOff); ms += dstOff + utcOff; } @@ -522,8 +522,7 @@ void msToGregorianDateTime(double ms, bool outputIsUTC, GregorianDateTime& tm) tm.month = monthFromDayInYear(tm.yearDay, isLeapYear(year)); tm.year = year - 1900; tm.isDST = dstOff != 0.0; - - tm.utcOffset = outputIsUTC ? 0 : static_cast((dstOff + utcOff) / msPerSecond); + tm.utcOffset = static_cast((dstOff + utcOff) / msPerSecond); tm.timeZone = NULL; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h index ca0961c..541b05d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h @@ -26,13 +26,19 @@ #include #include +#if COMPILER(GCC) +#define WTF_FAST_MALLOC_EXPORT __attribute__((visibility("default"))) +#else +#define WTF_FAST_MALLOC_EXPORT +#endif + namespace WTF { // These functions call CRASH() if an allocation fails. - void* fastMalloc(size_t); + void* fastMalloc(size_t) WTF_FAST_MALLOC_EXPORT; void* fastZeroedMalloc(size_t); - void* fastCalloc(size_t numElements, size_t elementSize); - void* fastRealloc(void*, size_t); + void* fastCalloc(size_t numElements, size_t elementSize) WTF_FAST_MALLOC_EXPORT; + void* fastRealloc(void*, size_t) WTF_FAST_MALLOC_EXPORT; struct TryMallocReturnValue { TryMallocReturnValue(void* data) @@ -71,7 +77,7 @@ namespace WTF { TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size); TryMallocReturnValue tryFastRealloc(void* p, size_t n); - void fastFree(void*); + void fastFree(void*) WTF_FAST_MALLOC_EXPORT; #ifndef NDEBUG void fastMallocForbid(); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h index 12291cc..9c9a4a7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h @@ -55,9 +55,13 @@ namespace WTF { bool waitForMessage(DataType&); template MessageQueueWaitResult waitForMessageFilteredWithTimeout(DataType&, Predicate&, double absoluteTime); - void kill(); + + template + void removeIf(Predicate&); bool tryGetMessage(DataType&); + + void kill(); bool killed() const; // The result of isEmpty() is only valid if no other thread is manipulating the queue at the same time. @@ -149,6 +153,17 @@ namespace WTF { } template + template + inline void MessageQueue::removeIf(Predicate& predicate) + { + MutexLocker lock(m_mutex); + DequeConstIterator found = m_queue.end(); + while ((found = m_queue.findIf(predicate)) != m_queue.end()) { + m_queue.remove(found); + } + } + + template inline bool MessageQueue::isEmpty() { MutexLocker lock(m_mutex); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 7151b514..7632435 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -466,6 +466,7 @@ #if PLATFORM(MAC) && !PLATFORM(IPHONE) #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && defined(__x86_64__) #define WTF_USE_PLUGIN_HOST_PROCESS 1 #endif @@ -482,6 +483,7 @@ #if PLATFORM(CHROMIUM) && PLATFORM(DARWIN) #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #endif #if PLATFORM(IPHONE) @@ -498,6 +500,7 @@ #define HAVE_READLINE 1 #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #endif #if PLATFORM(WIN) @@ -511,6 +514,7 @@ #if PLATFORM(GTK) #if HAVE(PTHREAD_H) #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #endif #endif @@ -518,6 +522,7 @@ #define HAVE_POSIX_MEMALIGN 1 #define WTF_USE_CURL 1 #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #define USE_SYSTEM_MALLOC 1 #define ENABLE_NETSCAPE_PLUGIN_API 0 #endif @@ -698,7 +703,7 @@ #endif #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) -#if PLATFORM(X86_64) && (PLATFORM(DARWIN) || PLATFORM(LINUX)) +#if PLATFORM(X86_64) && (PLATFORM(DARWIN) || PLATFORM(LINUX) || PLATFORM(WIN_OS)) #define WTF_USE_JSVALUE64 1 #elif PLATFORM(ARM) || PLATFORM(PPC64) #define WTF_USE_JSVALUE32 1 @@ -725,8 +730,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 #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 1 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0 /* The JIT is tested & working on x86 Windows */ #elif PLATFORM(X86) && PLATFORM(WIN) @@ -792,8 +796,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ /* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */ #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_THUMB2) && PLATFORM(IPHONE) && 0) \ + || (PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE)) \ || (PLATFORM(X86) && PLATFORM(WIN)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h index d21d1ff..c9b5742 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h @@ -32,6 +32,7 @@ // Use these to declare and define a static local variable (static T;) so that // it is leaked so that its destructors are not called at exit. Using this // macro also allows workarounds a compiler bug present in Apple's version of GCC 4.0.1. +#ifndef DEFINE_STATIC_LOCAL #if COMPILER(GCC) && defined(__APPLE_CC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 1 #define DEFINE_STATIC_LOCAL(type, name, arguments) \ static type* name##Ptr = new type arguments; \ @@ -40,6 +41,7 @@ #define DEFINE_STATIC_LOCAL(type, name, arguments) \ static type& name = *new type arguments #endif +#endif // OBJECT_OFFSETOF: Like the C++ offsetof macro, but you can use it with classes. // The magic number 0x4000 is insignificant. We use it to avoid using NULL, since diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp index 56bf438..1d4185c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp @@ -51,7 +51,7 @@ static void* threadEntryPoint(void* contextData) setThreadNameInternal(context->name); - // Block until our creating thread has completed any extra setup work + // Block until our creating thread has completed any extra setup work. { MutexLocker locker(context->creationMutex); } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h index 5154545..71c9402 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h @@ -128,7 +128,11 @@ void detachThread(ThreadIdentifier); #if USE(PTHREADS) typedef pthread_mutex_t PlatformMutex; +#if HAVE(PTHREAD_RWLOCK) typedef pthread_rwlock_t PlatformReadWriteLock; +#else +typedef void* PlatformReadWriteLock; +#endif typedef pthread_cond_t PlatformCondition; #elif PLATFORM(GTK) typedef GOwnPtr PlatformMutex; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp index e4fb419..6cad5e3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp @@ -167,6 +167,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con if (pthread_create(&threadHandle, 0, runThreadWithRegistration, static_cast(threadData))) { LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data); + delete threadData; return 0; } return establishIdentifierForPthreadHandle(threadHandle); @@ -270,7 +271,7 @@ void Mutex::unlock() ASSERT_UNUSED(result, !result); } - +#if HAVE(PTHREAD_RWLOCK) ReadWriteLock::ReadWriteLock() { pthread_rwlock_init(&m_readWriteLock, NULL); @@ -324,6 +325,7 @@ void ReadWriteLock::unlock() int result = pthread_rwlock_unlock(&m_readWriteLock); ASSERT_UNUSED(result, !result); } +#endif // HAVE(PTHREAD_RWLOCK) ThreadCondition::ThreadCondition() { diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp index aafea3c..d088086 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp @@ -1490,7 +1490,7 @@ public: closeBodyAlternative(); } - void alterantiveBodyDisjunction() + void alternativeBodyDisjunction() { int newAlternativeIndex = m_bodyDisjunction->terms.size(); m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex; @@ -1499,7 +1499,7 @@ public: m_currentAlternativeIndex = newAlternativeIndex; } - void alterantiveDisjunction() + void alternativeDisjunction() { int newAlternativeIndex = m_bodyDisjunction->terms.size(); m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex; @@ -1515,9 +1515,9 @@ public: if (alt) { if (disjunction == m_pattern.m_body) - alterantiveBodyDisjunction(); + alternativeBodyDisjunction(); else - alterantiveDisjunction(); + alternativeDisjunction(); } PatternAlternative* alternative = disjunction->m_alternatives[alt]; diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp index b635a45..5ce579a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp @@ -1264,7 +1264,7 @@ class RegexGenerator : private MacroAssembler { // complex here in compilation, and in the common case we should end up coallescing the checks. // // FIXME: a nice improvement here may be to stop trying to match sooner, based on the least - // of the minimum-alterantive-lengths. E.g. if I have two alternatives of length 200 and 150, + // of the minimum-alternative-lengths. E.g. if I have two alternatives of length 200 and 150, // and a string of length 100, we'll end up looping index from 0 to 100, checking whether there // is sufficient input to run either alternative (constantly failing). If there had been only // one alternative, or if the shorter alternative had come first, we would have terminated @@ -1309,9 +1309,6 @@ class RegexGenerator : private MacroAssembler { loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output); #endif #elif PLATFORM(ARM) -#if PLATFORM(ARM_TRADITIONAL) - push(ARMRegisters::lr); -#endif push(ARMRegisters::r4); push(ARMRegisters::r5); push(ARMRegisters::r6); diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 488c6a0..98f007c 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 - qtwebkit-4.6-snapshot-22102009 branch/tag + qtwebkit-4.6-snapshot-20091003 branch/tag and has the sha1 checksum - 0639bb8e812c8923287cd5523248ca64fa5f7a50 + 8f810287200d21aded375664cc0a6ac0476dbdea diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 4e5dff8..2b36014 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,4260 @@ +2009-11-02 Tor Arne Vestbø + + Rubber-stamped by Antti Koivisto. + + [Qt] Build fix for Windows CE + + * plugins/PluginDatabase.cpp: + +2009-11-02 Jocelyn Turcotte + + Reviewed by Tor Arne Vestbø. + + [Qt] Fix Qt build on Windows. + https://bugs.webkit.org/show_bug.cgi?id=30905 + + * WebCore.pro: + * platform/graphics/BitmapImage.h: + * platform/graphics/qt/ImageQt.cpp: + (WebCore::BitmapImage::BitmapImage): + (WebCore::BitmapImage::create): + +2009-10-28 Adam Barth + + Reviewed by Eric Seidel. + + Don't run JavaScript URLs in view source mode + https://bugs.webkit.org/show_bug.cgi?id=30881 + + Just say no. + + Test: http/tests/security/view-source-no-javascript-url.html + + * bindings/ScriptControllerBase.cpp: + (WebCore::ScriptController::executeIfJavaScriptURL): + +2009-10-29 Gustavo Noronha Silva + + Unreviewed. Fixes style problems pointed out by Evan Martin. + + * platform/gtk/Language.cpp: + (WebCore::defaultLanguage): + +2009-10-29 Dan Bernstein + + Rubber-stamped by Mark Rowe. + + 64-bit Leopard build fix after r50259 + + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: + Declared ATSUTextInserted in 64-bit. + (WebCore::fontHasMirroringInfo): Use %d format and cast to int. + (WebCore::disableLigatures): Ditto. + (WebCore::initializeATSUStyle): Ditto. + (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Ditto. + +2009-10-29 Dan Bernstein + + Tiger build fix after r50259 + + * platform/graphics/mac/ComplexTextController.h: + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: + +2009-10-29 Dan Bernstein + + Attempted Tiger build fix after r50259 + + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: + +2009-10-28 Steve Falkenburg + + Rubber stamped by Mark Rowe. + + https://bugs.webkit.org/show_bug.cgi?id=30899 + WebKit fails to build release on 32-bit Windows systems + + * WebCore.vcproj/WebCore.vcproj: Excluded files from project. + * bindings/js/JSBindingsAllInOne.cpp: Added. + +2009-10-28 Dan Bernstein + + Reviewed by Jon Honeycutt. + + Fixed typos in color names. + + * inspector/front-end/Color.js: + +2009-10-28 Dan Bernstein + + Reviewed by Sam Weinig. + + Share code between the ATSUI- and Core Text-based Font implementations by doing the + following: + - Generalize CoreTextController as ComplexTextController, keeping the Core Text-specific + parts in ComplexTextControllerCoreText.cpp. + - Generalize FontMacCoreText as FontComplexTextMac using ComplexTextController + - Implement ATSUI-specific parts of ComplexTextController in ComplexTextControllerATSUI. + - Remove FontMacATSUI. + + * WebCore.xcodeproj/project.pbxproj: Removed CoreTextController.{cpp,h}, FontMacATSUI.mm, + and FontMacCoreText.cpp, and added ComplexTextController.{cpp,h}, + ComplexTextControllerATSUI.cpp, ComplexTextControllerCoreText.cpp, and + FontComplexTextMac.cpp. + + * platform/graphics/mac/ComplexTextController.cpp: Copied from CoreTextController.cpp and + kept the non-Core Text-specific bits. + (WebCore::ComplexTextController::ComplexTextController): Updated for renames, including + its own. + (WebCore::ComplexTextController::offsetForPosition): Updated for renames and for + m_complexTextRuns holding references instead of objects. + (WebCore::ComplexTextController::collectComplexTextRuns): Updated for renames, including + its own. + (WebCore::ComplexTextController::advance): Updated for renames. + (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Updated for renames and for + m_complexTextRuns holding references instead of objects, and changed to use the glyphs() + and advances() accessors. + + * platform/graphics/mac/ComplexTextController.h: Copied from CoreTextController.h and + renamed CoreTextController to ComplexTextController and CoreTextRun to ComplexTextRun. Made + the latter RefCounted, added ATSUI-specific members to it, and made some other members + Core Text-specific. Renamed m_coreTextRuns to m_complexTextRuns and made it hold references + rather than objects. + (WebCore::ComplexTextController::ComplexTextRun::create): + (WebCore::ComplexTextController::ComplexTextRun::glyphs): + (WebCore::ComplexTextController::ComplexTextRun::advances): + + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: Added. Includes ATSUI-specific + parts of the ComplexTextController implementation. + (WebCore::ComplexTextController::ComplexTextRun::overrideLayoutOperation): This ATSUI + callback populates the ComplexTextRun’s glyphs, advances and indices vectors. It is invoked + when the ComplexTextRun constructor calls ATSUGetGlyphBounds(). + (WebCore::isArabicLamWithAlefLigature): Helper function, copied from FontMacATSUI.mm. + (WebCore::shapeArabic): Helper function, adapted from FontMacATSUI.mm. + (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Sets up the + ATSUTextLayout, substituting the text buffer if necessary for things like shaping Arabic, + mirroring glyphs or directionality overrides, then calls ATSUGetGlyphBounds() in order to + get the glyphs, advances and indices vectors populated. + (WebCore::fontHasMirroringInfo): Helper function, copied from FontMacATSUI.mm. + (WebCore::disableLigatures): Ditto. + (WebCore::initializeATSUStyle): Ditto, somewhat cleaned up and simplified. + (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Constructs + ComplexTextRuns, either missing-glyphs ones or ATSUTextLayout-based ones. + + * platform/graphics/mac/ComplexTextControllerCoreText.cpp: Copied from + CoreTextController.cpp and kept the Core Text-specific bits. + (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Updated for renames, + including its own, and moved the code to initialize m_glyphs and m_advances here. Previously + this was done in adjustGlyphsAndAdvances(). + (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Updated for renames, + including its own. + * platform/graphics/mac/CoreTextController.cpp: Removed. + * platform/graphics/mac/CoreTextController.h: Removed. + * platform/graphics/mac/FontComplexTextMac.cpp: Renamed FontMacCoreText.cpp to this. + (WebCore::Font::selectionRectForComplexText): Changed to use ComplexTextController instead + of CoreTextController. + (WebCore::Font::drawComplexText): Ditto. + (WebCore::Font::floatWidthForComplexText): Ditto. + (WebCore::Font::offsetForPositionForComplexText): Ditto. + * platform/graphics/mac/FontMacATSUI.mm: Removed. + * platform/graphics/mac/FontMacCoreText.cpp: Removed. + +2009-10-27 Chris Fleizach + + Reviewed by Darin Adler. + + WAI-ARIA: add support for 'option' role + https://bugs.webkit.org/show_bug.cgi?id=30843 + + Test: accessibility/aria-option-role.html + + * accessibility/AccessibilityListBoxOption.h: + (WebCore::AccessibilityListBoxOption::canHaveChildren): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::RoleEntry::): + (WebCore::AccessibilityRenderObject::canHaveChildren): + +2009-10-28 Jens Alfke + + Reviewed by Eric Seidel. + + Fix GCC compiler warnings in WebCore, and enable -Wall and -Werror for Chromium build. + https://bugs.webkit.org/show_bug.cgi?id=30716 + + * WebCore.gyp/WebCore.gyp: Enable "chromium_code" flag, just on Mac build for now. + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::createARIARoleMap): Fix struct visibiity warning. + * bindings/v8/ScriptCallStack.h: Fix out-of-order member initialization warning. + * bindings/v8/V8Collection.h: + (WebCore::getV8Object): Function in header should not be 'static' (fixes unused-static warning.) + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::convertNewNodeToV8Object): Fix signed/unsigned comparison warning. + * bindings/v8/V8GCController.cpp: + (WebCore::ObjectGrouperVisitor::applyGrouping): Fix unused-variable warning. + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Enable ListButtonPart case to avoid + warning about missing cases in 'switch' statement. + * editing/EditorCommand.cpp: + (WebCore::createCommandMap): Fix struct visibiity warning. + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::State::State): Fix out-of-order member initialization warning. + * rendering/RenderMediaControlsChromium.cpp: + (WebCore::RenderMediaControlsChromium::shouldRenderMediaControlPart): Add empty 'default' case in + 'switch' statement to avoid missing-case warning. + (WebCore::RenderMediaControlsChromium::paintMediaControlsPart): Ditto. + * xml/XPathFunctions.cpp: + (WebCore::XPath::createFunctionMap): Fix struct visibiity warning. + +2009-10-29 Adam Barth + + Reviewed by Darin Adler. + + REGRESSION: crashes in WebCore::RedirectScheduler::timerFired(WebCore::Timer*) + https://bugs.webkit.org/show_bug.cgi?id=30839 + + Added null check for the case when the frame is detached from the page. + + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::timerFired): + +2009-10-28 Joanmarie Diggs + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=30817 + Use parentObjectUnignored instead of parentObject in webkit_accessible_get_parent + + Also removes the hack I had originally added to solve bug 25411, because + the fix here is what I should have done in the first place. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (webkit_accessible_get_parent): + +2009-10-28 Dmitry Titov + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=30805 + Add MessageQueue::removeIf(Predicate&) to remove certain tasks without pulling them from the queue. + Existing Database tests cover this, no change in functionality. + + * storage/DatabaseThread.cpp: + (WebCore::SameDatabasePredicate::SameDatabasePredicate): Added predicate that flags the tasks belonging to a specified database. + (WebCore::SameDatabasePredicate::operator()): + (WebCore::DatabaseThread::unscheduleDatabaseTasks): changed to use the new removeIf method. + +2009-10-28 Pavel Feldman + + Reviewed by Timothy Hatcher. + + Web Inspector: Glue subsequent timeline records with same category + and title together. + + https://bugs.webkit.org/show_bug.cgi?id=30885 + + * English.lproj/localizedStrings.js: + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype.addRecordToTimeline): + (WebInspector.TimelinePanel.prototype._formatRecord): + (WebInspector.TimelineRecordTreeElement.prototype.onattach): + (WebInspector.TimelineRecordTreeElement.prototype.refresh): + +2009-10-28 Gustavo Noronha Silva + + Reviewed by Xan Lopez. + + [GTK] Fails new test fast/js/navigator-language.html + https://bugs.webkit.org/show_bug.cgi?id=30440 + + Reimplement WebCore::defaultLanguage to account for changes in + locale done by setLocale. + + Already existing test: fast/js/navigator-language.html + + * platform/gtk/Language.cpp: + (WebCore::defaultLanguage): + +2009-10-28 Eric Carlson + + Reviewed by Simon Fraser. + + + Can't exit full screen mode or restart movie after pressing command -R. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::removedFromDocument): + (WebCore::HTMLMediaElement::documentWillBecomeInactive): + Exit from fullscreen if necessary. + * html/HTMLMediaElement.h: + +2009-10-28 Alexey Proskuryakov + + Unreviewed - a trivial fix to get Windows bots running. + + https://bugs.webkit.org/show_bug.cgi?id=30841 + WebKit should not pass Referer header through a redirect to a non-secure site + + * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::setHeaderFields): Don't try to + access empty vector's data. + +2009-10-28 Joanmarie Diggs + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=25897 + [Gtk] Extraneous object of ROLE_PANEL in hierarchy for entries + + Remove the extraneous object of ROLE_PANEL. + + * accessibility/gtk/AccessibilityObjectAtk.cpp: + (AccessibilityObject::accessibilityPlatformIncludesObject): + +2009-10-28 Jonathan Dixon + + Reviewed by Eric Seidel. + + Bug 30547: (Chromium) searchbox not rendered properly due to the css property -webkit-border-radius + https://bugs.webkit.org/show_bug.cgi?id=30547 + + Test: fast/css/text-input-with-webkit-border-radius.html + + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): + Implemented rounded border rendering in Chromium Windows theme renderer. + +2009-10-28 Pavel Feldman + + Reviewed by Timothy Hatcher. + + Web Inspector: Pull items collections from resources panel and + timeline panel into AbstractTimelinePanel. + + https://bugs.webkit.org/show_bug.cgi?id=30875 + + * inspector/front-end/AbstractTimelinePanel.js: + (WebInspector.AbstractTimelinePanel): + (WebInspector.AbstractTimelinePanel.prototype.populateSidebar): + (WebInspector.AbstractTimelinePanel.prototype.createItemTreeElement): + (WebInspector.AbstractTimelinePanel.prototype.createItemGraph): + (WebInspector.AbstractTimelinePanel.prototype._showCategory): + (WebInspector.AbstractTimelinePanel.prototype._hideCategory): + (WebInspector.AbstractTimelinePanel.prototype.filter): + (WebInspector.AbstractTimelinePanel.prototype._createGraph): + (WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth): + (WebInspector.AbstractTimelinePanel.prototype.refresh): + (WebInspector.AbstractTimelinePanel.prototype.reset): + (WebInspector.AbstractTimelinePanel.prototype.get calculator): + (WebInspector.AbstractTimelinePanel.prototype.set calculator): + (WebInspector.AbstractTimelinePanel.prototype.addItem): + (WebInspector.AbstractTimelinePanel.prototype.removeItem): + (WebInspector.AbstractTimelinePanel.prototype.refreshItem): + (WebInspector.AbstractTimelinePanel.prototype.revealAndSelectItem): + (WebInspector.AbstractTimelinePanel.prototype.sortItems): + (WebInspector.AbstractTimelinePanel.prototype.adjustScrollPosition): + (WebInspector.AbstractTimelineCategory): + (WebInspector.AbstractTimelineCategory.prototype.toString): + * inspector/front-end/ResourceCategory.js: + (WebInspector.ResourceCategory): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel): + (WebInspector.ResourcesPanel.prototype.createItemTreeElement): + (WebInspector.ResourcesPanel.prototype.createItemGraph): + (WebInspector.ResourcesPanel.prototype.isCategoryVisible): + (WebInspector.ResourcesPanel.prototype.populateSidebar): + (WebInspector.ResourcesPanel.prototype.get searchableViews): + (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction.sortFuction): + (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction): + (WebInspector.ResourcesPanel.prototype.searchMatchFound): + (WebInspector.ResourcesPanel.prototype.searchCanceled): + (WebInspector.ResourcesPanel.prototype.performSearch): + (WebInspector.ResourcesPanel.prototype.refresh): + (WebInspector.ResourcesPanel.prototype.reset): + (WebInspector.ResourcesPanel.prototype.removeResource): + (WebInspector.ResourcesPanel.prototype.addMessageToResource): + (WebInspector.ResourcesPanel.prototype.clearMessages): + (WebInspector.ResourcesPanel.prototype.refreshResource): + (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded): + (WebInspector.ResourcesPanel.prototype.showResource): + (WebInspector.ResourcesPanel.prototype._sortResourcesIfNeeded): + (WebInspector.ResourcesPanel.prototype._toggleLargerResources): + (WebInspector.ResourcesPanel.prototype._toggleResourceTracking): + (WebInspector.ResourcesPanel.prototype.get _resources): + (WebInspector.ResourceTimeCalculator.prototype._upperBound): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel): + (WebInspector.TimelinePanel.prototype.get categories): + (WebInspector.TimelinePanel.prototype.populateSidebar): + (WebInspector.TimelinePanel.prototype.addRecordToTimeline): + (WebInspector.TimelinePanel.prototype.createItemTreeElement): + (WebInspector.TimelinePanel.prototype.createItemGraph): + (WebInspector.TimelinePanel.prototype._formatRecord): + (WebInspector.TimelineCategory): + * inspector/front-end/inspector.css: + * inspector/front-end/inspector.html: + +2009-10-28 Kelly Norton + + Reviewed by Pavel Feldman. + + Resets InspectorFrontend in InspectorTimelineAgent instead of removing it so + that it remains active on refreshs and page transitions. + https://bugs.webkit.org/show_bug.cgi?id=30874 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::setFrontendProxyObject): + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::resetFrontendProxyObject): + * inspector/InspectorTimelineAgent.h: + +2009-10-27 Shinichiro Hamaji + + Reviewed by Darin Adler. + + Provide a way to get counter values with layoutTestContoller + https://bugs.webkit.org/show_bug.cgi?id=30555 + + Expose WebCore::counterValueForElement as a WebCore API. + + * WebCore.base.exp: + * rendering/RenderTreeAsText.cpp: + (WebCore::writeCounterValuesFromChildren): + (WebCore::counterValueForElement): + * rendering/RenderTreeAsText.h: + +2009-10-28 Nate Chapin + + Unreviewed, Chromium build fix for r50225. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::defaultObjectContentType): + +2009-10-28 Eric Z. Ayers + + Reviewed by Pavel Feldman. + + Adds InspectorTimelineAgent instrumentation for encountering a + . Check if it has the // expected value in all cases. // See smart window.open policy for where this is used. - ExecState* exec = m_windowShell->window()->globalExec(); + JSDOMWindowShell* shell = windowShell(world); + ExecState* exec = shell->window()->globalExec(); const String* savedSourceURL = m_sourceURL; m_sourceURL = &sourceURL; @@ -107,9 +117,9 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) RefPtr protect = m_frame; - m_windowShell->window()->globalData()->timeoutChecker.start(); - Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, m_windowShell); - m_windowShell->window()->globalData()->timeoutChecker.stop(); + exec->globalData().timeoutChecker.start(); + Completion comp = WebCore::evaluateInWorld(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell, world); + exec->globalData().timeoutChecker.stop(); // Evaluating the JavaScript could cause the frame to be deallocated // so we start the keep alive timer here. @@ -127,52 +137,114 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) return JSValue(); } -void ScriptController::evaluateInIsolatedWorld(unsigned /* worldID */, const Vector& sourceCode) +ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) +{ + return evaluateInWorld(sourceCode, mainThreadNormalWorld()); +} + +// An DOMWrapperWorld other than the thread's normal world. +class IsolatedWorld : public DOMWrapperWorld { +public: + IsolatedWorld(JSGlobalData* globalData) + : DOMWrapperWorld(globalData) + { + JSGlobalData::ClientData* clientData = globalData->clientData; + ASSERT(clientData); + static_cast(clientData)->rememberWorld(this); + } + + static PassRefPtr create(JSGlobalData* globalData) { return adoptRef(new IsolatedWorld(globalData)); } +}; + +static PassRefPtr findWorld(unsigned worldID) +{ + if (!worldID) + return IsolatedWorld::create(JSDOMWindow::commonJSGlobalData()); + + typedef HashMap > WorldMap; + DEFINE_STATIC_LOCAL(WorldMap, isolatedWorlds, ()); + + WorldMap::iterator iter = isolatedWorlds.find(worldID); + if (iter != isolatedWorlds.end()) + return iter->second; + + RefPtr newWorld = IsolatedWorld::create(JSDOMWindow::commonJSGlobalData()); + isolatedWorlds.add(worldID, newWorld); + return newWorld; +} + +JSDOMWindow* ScriptController::globalObject(unsigned worldID) +{ + RefPtr world = findWorld(worldID); + return windowShell(world.get())->window(); +} + +ScriptValue ScriptController::evaluateInIsolatedWorld(unsigned worldID, const ScriptSourceCode& sourceCode) +{ + RefPtr world = findWorld(worldID); + return evaluateInWorld(sourceCode, world.get()); +} + +void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector& sourceCode) { - // FIXME: Actually support isolated worlds! + RefPtr world = findWorld(worldID); + unsigned size = sourceCode.size(); for (unsigned i = 0; i < size; ++i) - evaluate(sourceCode[i]); + evaluateInWorld(sourceCode[i], world.get()); } void ScriptController::clearWindowShell() { - if (!m_windowShell) + if (m_windowShells.isEmpty()) return; JSLock lock(SilenceAssertionsOnly); // Clear the debugger from the current window before setting the new window. + DOMWrapperWorld* debugWorld = debuggerWorld(); attachDebugger(0); - m_windowShell->window()->willRemoveFromWindowShell(); - m_windowShell->setWindow(m_frame->domWindow()); + for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) { + DOMWrapperWorld* world = iter->first; + JSDOMWindowShell* windowShell = iter->second; + windowShell->window()->willRemoveFromWindowShell(); + windowShell->setWindow(m_frame->domWindow()); - if (Page* page = m_frame->page()) { - attachDebugger(page->debugger()); - m_windowShell->window()->setProfileGroup(page->group().identifier()); + if (Page* page = m_frame->page()) { + if (world == debugWorld) + attachDebugger(page->debugger()); + windowShell->window()->setProfileGroup(page->group().identifier()); + } } // There is likely to be a lot of garbage now. gcController().garbageCollectSoon(); } -void ScriptController::initScript() +JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world) { - if (m_windowShell) - return; + ASSERT(!m_windowShells.contains(world)); JSLock lock(SilenceAssertionsOnly); - m_windowShell = new JSDOMWindowShell(m_frame->domWindow()); - m_windowShell->window()->updateDocument(); + JSDOMWindowShell* windowShell = new JSDOMWindowShell(m_frame->domWindow()); + m_windowShells.add(world, windowShell); + world->rememberScriptController(this); + windowShell->window()->updateDocument(world); if (Page* page = m_frame->page()) { - attachDebugger(page->debugger()); - m_windowShell->window()->setProfileGroup(page->group().identifier()); + if (world == debuggerWorld()) + attachDebugger(page->debugger()); + windowShell->window()->setProfileGroup(page->group().identifier()); + } + + { + EnterDOMWrapperWorld worldEntry(*JSDOMWindow::commonJSGlobalData(), world); + m_frame->loader()->dispatchWindowObjectAvailable(); } - m_frame->loader()->dispatchWindowObjectAvailable(); + return windowShell; } bool ScriptController::processingUserGesture() const @@ -182,10 +254,11 @@ bool ScriptController::processingUserGesture() const bool ScriptController::processingUserGestureEvent() const { - if (!m_windowShell) + JSDOMWindowShell* shell = existingWindowShell(mainThreadNormalWorld()); + if (!shell) return false; - if (Event* event = m_windowShell->window()->currentEvent()) { + if (Event* event = shell->window()->currentEvent()) { if (event->createdByDOM()) return false; @@ -243,13 +316,16 @@ bool ScriptController::isEnabled() void ScriptController::attachDebugger(JSC::Debugger* debugger) { - if (!m_windowShell) + // FIXME: Should be able to debug isolated worlds. + JSDOMWindowShell* shell = existingWindowShell(debuggerWorld()); + if (!shell) return; + JSDOMWindow* globalObject = shell->window(); if (debugger) - debugger->attach(m_windowShell->window()); - else if (JSC::Debugger* currentDebugger = m_windowShell->window()->debugger()) - currentDebugger->detach(m_windowShell->window()); + debugger->attach(globalObject); + else if (JSC::Debugger* currentDebugger = globalObject->debugger()) + currentDebugger->detach(globalObject); } void ScriptController::updateDocument() @@ -258,8 +334,8 @@ void ScriptController::updateDocument() return; JSLock lock(SilenceAssertionsOnly); - if (m_windowShell) - m_windowShell->window()->updateDocument(); + for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) + iter->second->window()->updateDocument(iter->first); } void ScriptController::updateSecurityOrigin() @@ -274,7 +350,7 @@ Bindings::RootObject* ScriptController::bindingRootObject() if (!m_bindingRootObject) { JSLock lock(SilenceAssertionsOnly); - m_bindingRootObject = Bindings::RootObject::create(0, globalObject()); + m_bindingRootObject = Bindings::RootObject::create(0, globalObject(pluginWorld())); } return m_bindingRootObject.get(); } @@ -285,7 +361,7 @@ PassRefPtr ScriptController::createRootObject(void* native if (it != m_rootObjects.end()) return it->second; - RefPtr rootObject = Bindings::RootObject::create(nativeHandle, globalObject()); + RefPtr rootObject = Bindings::RootObject::create(nativeHandle, globalObject(pluginWorld())); m_rootObjects.set(nativeHandle, rootObject); return rootObject.release(); @@ -300,7 +376,7 @@ NPObject* ScriptController::windowScriptNPObject() // JavaScript is enabled, so there is a JavaScript window object. // Return an NPObject bound to the window object. JSC::JSLock lock(SilenceAssertionsOnly); - JSObject* win = windowShell()->window(); + JSObject* win = windowShell(pluginWorld())->window(); ASSERT(win); Bindings::RootObject* root = bindingRootObject(); m_windowScriptNPObject = _NPN_CreateScriptObject(0, win, root); @@ -334,8 +410,9 @@ JSObject* ScriptController::jsObjectForPluginElement(HTMLPlugInElement* plugin) // Create a JSObject bound to this element JSLock lock(SilenceAssertionsOnly); - ExecState* exec = globalObject()->globalExec(); - JSValue jsElementValue = toJS(exec, globalObject(), plugin); + JSDOMWindow* globalObj = globalObject(pluginWorld()); + // FIXME: is normal okay? - used for NP plugins? + JSValue jsElementValue = toJS(globalObj->globalExec(), globalObj, plugin); if (!jsElementValue || !jsElementValue.isObject()) return 0; @@ -391,4 +468,44 @@ void ScriptController::clearScriptObjects() #endif } +ScriptValue ScriptController::executeScriptInIsolatedWorld(unsigned worldID, const String& script, bool forceUserGesture) +{ + ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()); + + if (!isEnabled() || isPaused()) + return ScriptValue(); + + bool wasInExecuteScript = m_inExecuteScript; + m_inExecuteScript = true; + + ScriptValue result = evaluateInIsolatedWorld(worldID, sourceCode); + + if (!wasInExecuteScript) { + m_inExecuteScript = false; + Document::updateStyleForAllDocuments(); + } + + return result; +} + +ScriptValue ScriptController::executeScriptInIsolatedWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture) +{ + ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()); + + if (!isEnabled() || isPaused()) + return ScriptValue(); + + bool wasInExecuteScript = m_inExecuteScript; + m_inExecuteScript = true; + + ScriptValue result = evaluateInWorld(sourceCode, world); + + if (!wasInExecuteScript) { + m_inExecuteScript = false; + Document::updateStyleForAllDocuments(); + } + + return result; +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h index bd4b65e..f2a497d 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h @@ -63,31 +63,49 @@ class XSSAuditor; typedef HashMap > RootObjectMap; class ScriptController { + typedef WTF::HashMap > ShellMap; + public: ScriptController(Frame*); ~ScriptController(); - bool haveWindowShell() const { return m_windowShell; } - JSDOMWindowShell* windowShell() + JSDOMWindowShell* windowShell(DOMWrapperWorld* world) + { + ShellMap::iterator iter = m_windowShells.find(world); + return (iter != m_windowShells.end()) ? iter->second.get() : initScript(world); + } + JSDOMWindowShell* existingWindowShell(DOMWrapperWorld* world) const + { + ShellMap::const_iterator iter = m_windowShells.find(world); + return (iter != m_windowShells.end()) ? iter->second.get() : 0; + } + JSDOMWindow* globalObject(DOMWrapperWorld* world) { - initScriptIfNeeded(); - return m_windowShell; + return windowShell(world)->window(); } + JSDOMWindow* globalObject(unsigned worldID); - JSDOMWindow* globalObject() + void forgetWorld(DOMWrapperWorld* world) { - initScriptIfNeeded(); - return m_windowShell->window(); + m_windowShells.remove(world); } ScriptValue executeScript(const ScriptSourceCode&); ScriptValue executeScript(const String& script, bool forceUserGesture = false); + ScriptValue executeScriptInIsolatedWorld(unsigned worldID, const String& script, bool forceUserGesture = false); + ScriptValue executeScriptInIsolatedWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture = false); // Returns true if argument is a JavaScript URL. bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, bool replaceDocument = true); + // This function must be called from the main thread. It is safe to call it repeatedly. + // Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly. + static void initializeThreading(); + ScriptValue evaluate(const ScriptSourceCode&); - void evaluateInIsolatedWorld(unsigned worldID, const Vector&); + ScriptValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*); + ScriptValue evaluateInIsolatedWorld(unsigned /*worldID*/, const ScriptSourceCode&); + void evaluateInIsolatedWorld(unsigned /*worldID*/, const Vector&); void setEventHandlerLineNumber(int lineno) { m_handlerLineNumber = lineno; } int eventHandlerLineNumber() { return m_handlerLineNumber; } @@ -144,19 +162,14 @@ public: XSSAuditor* xssAuditor() { return m_XSSAuditor.get(); } private: - void initScriptIfNeeded() - { - if (!m_windowShell) - initScript(); - } - void initScript(); + JSDOMWindowShell* initScript(DOMWrapperWorld* world); void disconnectPlatformScriptObjects(); bool processingUserGestureEvent() const; bool isJavaScriptAnchorNavigation() const; - JSC::ProtectedPtr m_windowShell; + ShellMap m_windowShells; Frame* m_frame; int m_handlerLineNumber; const String* m_sourceURL; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm index e6a654f..21ec0f2 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm @@ -114,7 +114,7 @@ WebScriptObject* ScriptController::windowScriptObject() if (!m_windowScriptObject) { JSC::JSLock lock(JSC::SilenceAssertionsOnly); JSC::Bindings::RootObject* root = bindingRootObject(); - m_windowScriptObject = [WebScriptObject scriptObjectForJSObject:toRef(windowShell()) originRootObject:root rootObject:root]; + m_windowScriptObject = [WebScriptObject scriptObjectForJSObject:toRef(windowShell(pluginWorld())) originRootObject:root rootObject:root]; } ASSERT([m_windowScriptObject.get() isKindOfClass:[DOMAbstractView class]]); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp index 0b0047b..8399c7a 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp @@ -71,7 +71,7 @@ PassRefPtr createAttributeEventListener(Node* node, Attribu sourceURL = node->document()->url().string(); } - return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber); + return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber, mainThreadNormalWorld()); } PassRefPtr createAttributeEventListener(Frame* frame, Attribute* attr) @@ -93,7 +93,7 @@ PassRefPtr createAttributeEventListener(Frame* frame, Attri lineNumber = scriptController->eventHandlerLineNumber(); sourceURL = frame->document()->url().string(); - return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber); + return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, mainThreadNormalWorld()); } String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* eventListener) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp index 46e80ac..91b2a57 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp @@ -123,7 +123,8 @@ ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions) if (callType == CallTypeNone) return ScriptValue(); - JSValue result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments); + // FIXME: Should this function take a worldID? - only used by inspector? + JSValue result = callInWorld(m_exec, function, callType, callData, thisObject, m_arguments, debuggerWorld()); if (m_exec->hadException()) { if (reportExceptions) reportException(m_exec, m_exec->exception()); @@ -161,7 +162,8 @@ ScriptObject ScriptFunctionCall::construct(bool& hadException, bool reportExcept if (constructType == ConstructTypeNone) return ScriptObject(); - JSValue result = JSC::construct(m_exec, constructor, constructType, constructData, m_arguments); + // FIXME: Currently this method constructs objects in debuggerWorld(). We could use the current world, or pass a worldID to this function? + JSValue result = constructInWorld(m_exec, constructor, constructType, constructData, m_arguments, debuggerWorld()); if (m_exec->hadException()) { if (reportExceptions) reportException(m_exec, m_exec->exception()); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp index b48556e..313530f 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp @@ -72,7 +72,7 @@ bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObj if (!frame) return false; - JSDOMGlobalObject* globalObject = toJSDOMWindow(frame); + JSDOMGlobalObject* globalObject = toJSDOMWindow(frame, debuggerWorld()); ExecState* exec = globalObject->globalExec(); JSLock lock(SilenceAssertionsOnly); @@ -89,7 +89,7 @@ bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObjec Frame* frame = storage->frame(); ASSERT(frame); - JSDOMGlobalObject* globalObject = toJSDOMWindow(frame); + JSDOMGlobalObject* globalObject = toJSDOMWindow(frame, debuggerWorld()); ExecState* exec = globalObject->globalExec(); JSLock lock(SilenceAssertionsOnly); @@ -116,7 +116,7 @@ bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedO { ASSERT(domWindow); - JSDOMWindow* window = toJSDOMWindow(domWindow->frame()); + JSDOMWindow* window = toJSDOMWindow(domWindow->frame(), debuggerWorld()); ExecState* exec = window->globalExec(); JSLock lock(SilenceAssertionsOnly); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceCode.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceCode.h index 1b05ded..32d6298 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceCode.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceCode.h @@ -44,6 +44,7 @@ public: ScriptSourceCode(const String& source, const KURL& url = KURL(), int startLine = 1) : m_provider(StringSourceProvider::create(source, url.isNull() ? String() : url.string())) , m_code(m_provider, startLine) + , m_url(url) { } @@ -59,10 +60,17 @@ public: const String& source() const { return m_provider->source(); } + int startLine() const { return m_code.firstLine(); } + + const KURL& url() const { return m_url; } + private: RefPtr m_provider; JSC::SourceCode m_code; + + KURL m_url; + }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp index 8bfa33d..60ba2a0 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp @@ -32,6 +32,7 @@ #include "ScriptState.h" #include "Frame.h" +#include "JSDOMWindowBase.h" #include "Node.h" #include "Page.h" @@ -49,12 +50,12 @@ ScriptState* scriptStateFromNode(Node* node) return 0; if (!frame->script()->isEnabled()) return 0; - return frame->script()->globalObject()->globalExec(); + return frame->script()->globalObject(mainThreadCurrentWorld())->globalExec(); } ScriptState* scriptStateFromPage(Page* page) { - return page->mainFrame()->script()->globalObject()->globalExec(); + return page->mainFrame()->script()->globalObject(mainThreadCurrentWorld())->globalExec(); } } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h index fa5c4a8..279234e 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h @@ -35,6 +35,7 @@ #include "JSDOMBinding.h" namespace WebCore { + class DOMWrapperWorld; class Node; class Page; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp index 3590dad..b66b0e8 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp @@ -52,6 +52,7 @@ WorkerScriptController::WorkerScriptController(WorkerContext* workerContext) , m_workerContext(workerContext) , m_executionForbidden(false) { + m_globalData->clientData = new WebCoreJSClientData(m_globalData.get()); } WorkerScriptController::~WorkerScriptController() @@ -122,7 +123,7 @@ ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, ExecState* exec = m_workerContextWrapper->globalExec(); m_workerContextWrapper->globalData()->timeoutChecker.start(); - Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper); + Completion comp = evaluateInWorld(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper, currentWorld(exec)); m_workerContextWrapper->globalData()->timeoutChecker.stop(); if (comp.complType() == Normal || comp.complType() == ReturnValue) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.h b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.h index bb33f60..c820cd9 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.h @@ -62,6 +62,9 @@ namespace WebCore { void setException(ScriptValue); void forbidExecution(); + + JSC::JSGlobalData* globalData() { return m_globalData.get(); } + private: void initScriptIfNeeded() { diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm index ff7b52f..d8367ac 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -292,7 +292,7 @@ sub GenerateGetOwnPropertySlotBody my @getOwnPropertySlotImpl = (); - if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection") { + if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") { push(@getOwnPropertySlotImpl, " ${namespaceMaybe}JSValue proto = prototype();\n"); push(@getOwnPropertySlotImpl, " if (proto.isObject() && static_cast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n"); push(@getOwnPropertySlotImpl, " return false;\n\n"); @@ -369,7 +369,7 @@ sub GenerateGetOwnPropertyDescriptorBody my @getOwnPropertyDescriptorImpl = (); - if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection") { + if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") { push(@getOwnPropertyDescriptorImpl, " ${namespaceMaybe}JSValue proto = prototype();\n"); push(@getOwnPropertyDescriptorImpl, " if (proto.isObject() && static_cast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n"); push(@getOwnPropertyDescriptorImpl, " return false;\n\n"); @@ -658,6 +658,12 @@ sub GenerateHeader # Custom lookupSetter function push(@headerContent, " virtual JSC::JSValue lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName);\n") if $dataNode->extendedAttributes->{"CustomLookupSetter"}; + # Override toBoolean to return false for objects that want to 'MasqueradesAsUndefined'. + if ($dataNode->extendedAttributes->{"MasqueradesAsUndefined"}) { + push(@headerContent, " virtual bool toBoolean(JSC::ExecState*) const { return false; };\n"); + $structureFlags{"JSC::MasqueradesAsUndefined"} = 1; + } + # Constructor object getter push(@headerContent, " static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*);\n") if $dataNode->extendedAttributes->{"GenerateConstructor"}; @@ -1188,19 +1194,21 @@ sub GenerateImplementation push(@implContent, " impl()->invalidateEventListeners();\n"); } - if ($interfaceName eq "Node") { - push(@implContent, " forgetDOMNode(impl()->document(), impl());\n"); - } else { - if ($podType) { - my $animatedType = $implClassName; - $animatedType =~ s/SVG/SVGAnimated/; + if (!$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) { + if ($interfaceName eq "Node") { + push(@implContent, " forgetDOMNode(this, impl(), impl()->document());\n"); + } else { + if ($podType) { + my $animatedType = $implClassName; + $animatedType =~ s/SVG/SVGAnimated/; - # Special case for JSSVGNumber - if ($codeGenerator->IsSVGAnimatedType($animatedType) and $podType ne "float") { - push(@implContent, " JSSVGDynamicPODTypeWrapperCache<$podType, $animatedType>::forgetWrapper(m_impl.get());\n"); + # Special case for JSSVGNumber + if ($codeGenerator->IsSVGAnimatedType($animatedType) and $podType ne "float") { + push(@implContent, " JSSVGDynamicPODTypeWrapperCache<$podType, $animatedType>::forgetWrapper(m_impl.get());\n"); + } } + push(@implContent, " forgetDOMObject(this, impl());\n"); } - push(@implContent, " forgetDOMObject(*Heap::heap(this)->globalData(), impl());\n"); } push(@implContent, "}\n\n"); @@ -1210,7 +1218,7 @@ sub GenerateImplementation # its own special handling rather than relying on the caching that Node normally does. if ($interfaceName eq "Document") { push(@implContent, "${className}::~$className()\n"); - push(@implContent, "{\n forgetDOMObject(*Heap::heap(this)->globalData(), static_cast<${implClassName}*>(impl()));\n}\n\n"); + push(@implContent, "{\n forgetDOMObject(this, static_cast<${implClassName}*>(impl()));\n}\n\n"); } if ($needsMarkChildren && !$dataNode->extendedAttributes->{"CustomMarkFunction"}) { @@ -1476,7 +1484,7 @@ sub GenerateImplementation } else { $implIncludes{"Frame.h"} = 1; $implIncludes{"JSDOMGlobalObject.h"} = 1; - push(@implContent, " JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());\n"); + push(@implContent, " JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec);\n"); push(@implContent, " if (!globalObject)\n"); push(@implContent, " return;\n"); } @@ -1700,7 +1708,7 @@ sub GenerateImplementation push(@implContent, " return toJS(exec, thisObj->globalObject(), static_cast<$implClassName*>(thisObj->impl())->item(slot.index()));\n"); } push(@implContent, "}\n"); - if ($interfaceName eq "HTMLCollection") { + if ($interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") { $implIncludes{"JSNode.h"} = 1; $implIncludes{"Node.h"} = 1; } @@ -1711,7 +1719,7 @@ sub GenerateImplementation push(@implContent, "{\n"); push(@implContent, " return jsNumber(exec, static_cast<$implClassName*>(impl())->item(index));\n"); push(@implContent, "}\n"); - if ($interfaceName eq "HTMLCollection") { + if ($interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") { $implIncludes{"JSNode.h"} = 1; $implIncludes{"Node.h"} = 1; } diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm index 28562f1..95b2aa2 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -215,7 +215,6 @@ sub AddClassForwardIfNeeded sub GetImplementationFileName { my $iface = shift; - return "HTMLCollection.h" if $iface eq "HTMLAllCollection"; return "Event.h" if $iface eq "DOMTimeStamp"; return "NamedAttrMap.h" if $iface eq "NamedNodeMap"; return "NameNodeList.h" if $iface eq "NodeList"; @@ -307,7 +306,7 @@ sub GenerateSetDOMException my $indent = shift; my $result = ""; - $result .= $indent . "if (ec) {\n"; + $result .= $indent . "if (UNLIKELY(ec)) {\n"; $result .= $indent . " V8Proxy::setDOMException(ec);\n"; $result .= $indent . " return v8::Handle();\n"; $result .= $indent . "}\n"; @@ -622,15 +621,17 @@ END push(@implContentDecls, " if (!imp->document())\n"); push(@implContentDecls, " return v8::Undefined();\n"); } - push(@implContentDecls, " $nativeType v = "); - - push(@implContentDecls, "$getterString;\n"); if ($useExceptions) { + push(@implContentDecls, " $nativeType v = "); + push(@implContentDecls, "$getterString;\n"); push(@implContentDecls, GenerateSetDOMException(" ")); + $result = "v"; + $result .= ".release()" if (IsRefPtrType($returnType)); + } else { + # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary + $result = $getterString; } - - $result = "v"; } if (IsSVGTypeNeedingContextParameter($attrType) && !$skipContext) { @@ -646,7 +647,6 @@ END my $classIndex = uc($attrType); push(@implContentDecls, " return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"); } else { - $result .= ".release()" if (IsRefPtrType($attrType)); push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, " ").";\n"); } @@ -784,7 +784,8 @@ END } if ($useExceptions) { - push(@implContentDecls, " V8Proxy::setDOMException(ec);\n"); + push(@implContentDecls, " if (UNLIKELY(ec))\n"); + push(@implContentDecls, " V8Proxy::setDOMException(ec);\n"); } if ($isPodType) { @@ -917,7 +918,7 @@ END if (TypeCanFailConversion($parameter)) { $implIncludes{"ExceptionCode.h"} = 1; push(@implContentDecls, -" if (!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ") {\n" . +" if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n" . " V8Proxy::setDOMException(TYPE_MISMATCH_ERR);\n" . " return v8::Handle();\n" . " }\n"); @@ -926,7 +927,7 @@ END if ($parameter->extendedAttributes->{"IsIndex"}) { $implIncludes{"ExceptionCode.h"} = 1; push(@implContentDecls, -" if ($parameterName < 0) {\n" . +" if (UNLIKELY($parameterName < 0)) {\n" . " V8Proxy::setDOMException(INDEX_SIZE_ERR);\n" . " return v8::Handle();\n" . " }\n"); @@ -1322,6 +1323,13 @@ END $template = "instance"; } + my $conditional = ""; + if ($attrExt->{"EnabledAtRuntime"}) { + # Only call Set()/SetAccessor() if this method should be enabled + $enable_function = $interfaceName . $codeGenerator->WK_ucfirst($function->signature->name); + $conditional = "if (V8Custom::v8${enable_function}Enabled())\n"; + } + if ($attrExt->{"DoNotCheckDomainSecurity"} && ($dataNode->extendedAttributes->{"CheckDomainSecurity"} || $interfaceName eq "DOMWindow")) { # Mark the accessor as ReadOnly and set it on the proto object so @@ -1342,7 +1350,7 @@ END push(@implContent, <SetAccessor( + $conditional $template->SetAccessor( v8::String::New("$name"), ${interfaceName}Internal::${name}AttrGetter, 0, @@ -1370,7 +1378,7 @@ END push(@implContent, <Set( + $conditional ${template}->Set( v8::String::New("$name"), $templateFunction, static_cast($property_attributes)); @@ -1388,7 +1396,7 @@ END } # Set the class name. This is used when printing objects. - push(@implContent, " desc->SetClassName(v8::String::New(\"" . GetClassName(${interfaceName}) . "\"));\n"); + push(@implContent, " desc->SetClassName(v8::String::New(\"${interfaceName}\"));\n"); if ($has_constants) { push(@implContent, < > result = $functionString;\n"; - } else { + } elsif (@{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) { $result .= $indent . $nativeReturnType . " result = $functionString;\n"; + } else { + # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary + $return = $functionString; + $returnIsRef = 0; } if (@{$function->raisesExceptions}) { $result .= GenerateSetDOMException($indent); } - my $return = "result"; - # If the return type is a POD type, separate out the wrapper generation if ($returnsListItemPodType) { $result .= $indent . "RefPtr > wrapper = "; @@ -1602,7 +1615,7 @@ sub GenerateFunctionCallString() my $classIndex = uc($returnType); $result .= $indent . "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"; } else { - $return .= ".release()" if (IsRefPtrType($returnType)); + $return .= ".release()" if ($returnIsRef); $result .= $indent . ReturnNativeToJSValue($function->signature, $return, $indent) . ";\n"; } @@ -1610,15 +1623,6 @@ sub GenerateFunctionCallString() } -# Get the class name used for printing javascript DOM-object wrappers. -sub GetClassName -{ - my $type = shift; - return "HTMLCollection" if $type eq "HTMLAllCollection"; - return $type; -} - - sub GetTypeFromSignature { my $signature = shift; @@ -1696,6 +1700,7 @@ sub IsRefPtrType return 1 if $type eq "EventListener"; return 1 if $type eq "FileList"; return 1 if $type eq "HTMLCollection"; + return 1 if $type eq "HTMLAllCollection"; return 1 if $type eq "HTMLDocument"; return 1 if $type eq "HTMLElement"; return 1 if $type eq "HTMLOptionsCollection"; @@ -2147,7 +2152,11 @@ sub ReturnNativeToJSValue # special case for non-DOM node interfaces if (IsDOMNodeType($type)) { - return "return V8DOMWrapper::convertNodeToV8Object($value)"; + if ($signature->extendedAttributes->{"ReturnsNew"}) { + return "return V8DOMWrapper::convertNewNodeToV8Object($value)"; + } else { + return "return V8DOMWrapper::convertNodeToV8Object($value)"; + } } if ($type eq "EventTarget" or $type eq "SVGElementInstance") { @@ -2159,7 +2168,7 @@ sub ReturnNativeToJSValue } if ($type eq "EventListener") { - return "return V8DOMWrapper::convertEventListenerToV8Object($value)"; + return "return V8DOMWrapper::convertEventListenerToV8Object(imp->scriptExecutionContext(), $value)"; } if ($type eq "SerializedScriptValue") { diff --git a/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp b/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp index 006f17f..6a89652 100644 --- a/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp @@ -34,6 +34,7 @@ #include "c_utility.h" #include "c_instance.h" #include "IdentifierRep.h" +#include "JSDOMBinding.h" #include "npruntime_impl.h" #include "npruntime_priv.h" #include "runtime_root.h" @@ -123,7 +124,7 @@ bool _NPN_InvokeDefault(NPP, NPObject* o, const NPVariant* args, uint32_t argCou getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - JSValue resultV = call(exec, function, callType, callData, function, argList); + JSValue resultV = callInWorld(exec, function, callType, callData, function, argList, pluginWorld()); globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result of the function call. @@ -173,7 +174,7 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - JSValue resultV = call(exec, function, callType, callData, obj->imp, argList); + JSValue resultV = callInWorld(exec, function, callType, callData, obj->imp, argList, pluginWorld()); globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result of the function call. @@ -203,7 +204,7 @@ bool _NPN_Evaluate(NPP, NPObject* o, NPString* s, NPVariant* variant) String scriptString = convertNPStringToUTF16(s); ProtectedPtr globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - Completion completion = JSC::evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(scriptString)); + Completion completion = evaluateInWorld(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(scriptString), JSC::JSValue(), pluginWorld()); globalObject->globalData()->timeoutChecker.stop(); ComplType type = completion.complType(); @@ -443,7 +444,7 @@ bool _NPN_Construct(NPP, NPObject* o, const NPVariant* args, uint32_t argCount, getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - JSValue resultV = construct(exec, constructor, constructType, constructData, argList); + JSValue resultV = constructInWorld(exec, constructor, constructType, constructData, argList, pluginWorld()); globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result. diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm index eb4a6bd..cc28a75 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm @@ -29,6 +29,7 @@ #if ENABLE(MAC_JAVA_BRIDGE) #include "Frame.h" +#include "JSDOMBinding.h" #include "ScriptController.h" #include "StringSourceProvider.h" #include "WebCoreFrameView.h" @@ -302,7 +303,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const MarkedArgumentBuffer argList; getListFromJArray(exec, args, argList); rootObject->globalObject()->globalData()->timeoutChecker.start(); - JSValue result = JSC::call(exec, function, callType, callData, _imp, argList); + JSValue result = WebCore::callInWorld(exec, function, callType, callData, _imp, argList, WebCore::pluginWorld()); rootObject->globalObject()->globalData()->timeoutChecker.stop(); return convertValueToJObject(result); @@ -321,7 +322,7 @@ jobject JavaJSObject::eval(jstring script) const return 0; rootObject->globalObject()->globalData()->timeoutChecker.start(); - Completion completion = JSC::evaluate(rootObject->globalObject()->globalExec(), rootObject->globalObject()->globalScopeChain(), makeSource(JavaString(script))); + Completion completion = WebCore::evaluateInWorld(rootObject->globalObject()->globalExec(), rootObject->globalObject()->globalScopeChain(), makeSource(JavaString(script)), JSC::JSValue(), WebCore::pluginWorld()); rootObject->globalObject()->globalData()->timeoutChecker.stop(); ComplType type = completion.complType(); diff --git a/src/3rdparty/webkit/WebCore/bridge/npapi.h b/src/3rdparty/webkit/WebCore/bridge/npapi.h index 5d48b0d..c6cd557 100644 --- a/src/3rdparty/webkit/WebCore/bridge/npapi.h +++ b/src/3rdparty/webkit/WebCore/bridge/npapi.h @@ -56,6 +56,12 @@ # endif /* XP_WIN */ #endif /* _WIN32 */ +#ifdef __SYMBIAN32__ +# ifndef XP_SYMBIAN +# define XP_SYMBIAN 1 +# endif +#endif /* __SYMBIAN32__ */ + #ifdef __MWERKS__ # define _declspec __declspec # ifdef macintosh @@ -64,22 +70,15 @@ # endif /* XP_MAC */ # endif /* macintosh */ # ifdef __INTEL__ -# ifndef __SYMBIAN32__ +# ifndef XP_SYMBIAN # undef NULL -# endif -# ifndef XP_WIN -# define XP_WIN 1 -# endif /* __INTEL__ */ -# endif /* XP_PC */ +# ifndef XP_WIN +# define XP_WIN 1 +# endif /* XP_WIN */ +# endif /* XP_SYMBIAN */ +# endif /* __INTEL__ */ #endif /* __MWERKS__ */ -#ifdef __SYMBIAN32__ -# ifndef XP_SYMBIAN -# define XP_SYMBIAN 1 -# undef XP_WIN -# endif -#endif /* __SYMBIAN32__ */ - #if defined(__APPLE_CC__) && !defined(__MACOS_CLASSIC__) && !defined(XP_UNIX) # define XP_MACOSX #endif diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp index 3cb2156..6887325 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp @@ -458,7 +458,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type if (type == Date) { DateInstance* date = static_cast(object); WTF::GregorianDateTime gdt; - date->getUTCTime(gdt); + WTF::msToGregorianDateTime(date->internalNumber(), true, gdt); if (hint == QMetaType::QDateTime) { ret = QDateTime(QDate(gdt.year + 1900, gdt.month + 1, gdt.monthDay), QTime(gdt.hour, gdt.minute, gdt.second), Qt::UTC); dist = 0; @@ -834,9 +834,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr root, con dt.isDST = -1; double ms = WTF::gregorianDateTimeToMS(dt, time.msec(), /*inputIsUTC*/ false); - DateInstance* instance = new (exec) DateInstance(exec->lexicalGlobalObject()->dateStructure()); - instance->setInternalValue(jsNumber(exec, trunc(ms))); - return instance; + return new (exec) DateInstance(exec, trunc(ms)); } if (type == QMetaType::QByteArray) { diff --git a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp index 4e067ce..b8769f9 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -157,6 +157,7 @@ static const int computedProperties[] = { CSSPropertyWebkitBackgroundClip, CSSPropertyWebkitBackgroundComposite, CSSPropertyWebkitBackgroundOrigin, + CSSPropertyWebkitBackgroundSize, CSSPropertyWebkitBorderFit, CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderImage, @@ -260,30 +261,13 @@ static const int computedProperties[] = { CSSPropertyTextAnchor, CSSPropertyWritingMode, CSSPropertyGlyphOrientationHorizontal, - CSSPropertyGlyphOrientationVertical + CSSPropertyGlyphOrientationVertical, + CSSPropertyWebkitShadow #endif }; const unsigned numComputedProperties = sizeof(computedProperties) / sizeof(computedProperties[0]); -static PassRefPtr valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID) -{ - if (!shadow) - return CSSPrimitiveValue::createIdentifier(CSSValueNone); - - RefPtr list = CSSValueList::createCommaSeparated(); - for (const ShadowData* s = shadow; s; s = s->next) { - RefPtr x = CSSPrimitiveValue::create(s->x, CSSPrimitiveValue::CSS_PX); - RefPtr y = CSSPrimitiveValue::create(s->y, CSSPrimitiveValue::CSS_PX); - RefPtr blur = CSSPrimitiveValue::create(s->blur, CSSPrimitiveValue::CSS_PX); - RefPtr spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread, CSSPrimitiveValue::CSS_PX); - RefPtr style = propertyID == CSSPropertyTextShadow || s->style == Normal ? 0 : CSSPrimitiveValue::createIdentifier(CSSValueInset); - RefPtr color = CSSPrimitiveValue::createColor(s->color.rgb()); - list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release())); - } - return list.release(); -} - static int valueForRepeatRule(int rule) { switch (rule) { @@ -571,6 +555,26 @@ PassRefPtr CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringK return CSSPrimitiveValue::create(style->fontDescription().computedPixelSize(), CSSPrimitiveValue::CSS_PX); } +PassRefPtr CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id) const +{ + if (!shadow) + return CSSPrimitiveValue::createIdentifier(CSSValueNone); + + CSSPropertyID propertyID = static_cast(id); + + RefPtr list = CSSValueList::createCommaSeparated(); + for (const ShadowData* s = shadow; s; s = s->next) { + RefPtr x = CSSPrimitiveValue::create(s->x, CSSPrimitiveValue::CSS_PX); + RefPtr y = CSSPrimitiveValue::create(s->y, CSSPrimitiveValue::CSS_PX); + RefPtr blur = CSSPrimitiveValue::create(s->blur, CSSPrimitiveValue::CSS_PX); + RefPtr spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread, CSSPrimitiveValue::CSS_PX); + RefPtr style = propertyID == CSSPropertyTextShadow || s->style == Normal ? 0 : CSSPrimitiveValue::createIdentifier(CSSValueInset); + RefPtr color = CSSPrimitiveValue::createColor(s->color.rgb()); + list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release())); + } + return list.release(); +} + PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID) const { return getPropertyCSSValue(propertyID, UpdateLayout); @@ -676,7 +680,8 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(int proper if (style->backgroundImage()) return style->backgroundImage()->cssValue(); return CSSPrimitiveValue::createIdentifier(CSSValueNone); - case CSSPropertyBackgroundSize: { + case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: { EFillSizeType size = style->backgroundSizeType(); if (size == Contain) return CSSPrimitiveValue::createIdentifier(CSSValueContain); @@ -777,7 +782,7 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyWebkitBoxReflect: return valueForReflection(style->boxReflect()); case CSSPropertyWebkitBoxShadow: - return valueForShadow(style->boxShadow(), static_cast(propertyID)); + return valueForShadow(style->boxShadow(), propertyID); case CSSPropertyCaptionSide: return CSSPrimitiveValue::create(style->captionSide()); case CSSPropertyClear: @@ -1061,7 +1066,7 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyTextIndent: return CSSPrimitiveValue::create(style->textIndent()); case CSSPropertyTextShadow: - return valueForShadow(style->textShadow(), static_cast(propertyID)); + return valueForShadow(style->textShadow(), propertyID); case CSSPropertyTextRendering: return CSSPrimitiveValue::create(style->fontDescription().textRenderingMode()); case CSSPropertyTextOverflow: diff --git a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.h b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.h index c1f34c3..842a995 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.h +++ b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.h @@ -27,6 +27,7 @@ namespace WebCore { class CSSMutableStyleDeclaration; +class ShadowData; enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true }; @@ -66,6 +67,8 @@ private: virtual String removeProperty(int propertyID, ExceptionCode&); virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&); + PassRefPtr valueForShadow(const ShadowData*, int) const; + RefPtr m_node; }; diff --git a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp index 10949dd..6024a5b 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp @@ -873,6 +873,7 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyBackgroundPositionX: case CSSPropertyBackgroundPositionY: case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: case CSSPropertyBackgroundRepeat: case CSSPropertyBackgroundRepeatX: case CSSPropertyBackgroundRepeatY: @@ -1726,6 +1727,15 @@ void CSSParser::addFillValue(RefPtr& lval, PassRefPtr rval) lval = rval; } +static bool parseBackgroundClip(CSSParserValue* parserValue, RefPtr& cssValue) +{ + if (parserValue->id == CSSValueBorderBox || parserValue->id == CSSValuePaddingBox || parserValue->id == CSSValueWebkitText) { + cssValue = CSSPrimitiveValue::createIdentifier(parserValue->id); + return true; + } + return false; +} + const int cMaxFillProperties = 9; bool CSSParser::parseFillShorthand(int propId, const int* properties, int numProperties, bool important) @@ -1777,6 +1787,7 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro RefPtr val1; RefPtr val2; int propId1, propId2; + CSSParserValue* parserValue = m_valueList->current(); if (parseFillProperty(properties[i], propId1, propId2, val1, val2)) { parsedProperty[i] = found = true; addFillValue(values[i], val1.release()); @@ -1786,7 +1797,7 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro addFillValue(repeatYValue, val2.release()); if (properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) { // Reparse the value as a clip, and see if we succeed. - if (parseFillProperty(CSSPropertyBackgroundClip, propId1, propId2, val1, val2)) + if (parseBackgroundClip(parserValue, val1)) addFillValue(clipValue, val1.release()); // The property parsed successfully. else addFillValue(clipValue, CSSInitialValue::createImplicit()); // Some value was used for origin that is not supported by clip. Just reset clip instead. @@ -2319,7 +2330,7 @@ void CSSParser::parseFillRepeat(RefPtr& value1, RefPtr& valu } } -PassRefPtr CSSParser::parseFillSize(bool& allowComma) +PassRefPtr CSSParser::parseFillSize(int propId, bool& allowComma) { allowComma = true; CSSParserValue* value = m_valueList->current(); @@ -2328,7 +2339,7 @@ PassRefPtr CSSParser::parseFillSize(bool& allowComma) return CSSPrimitiveValue::createIdentifier(value->id); RefPtr parsedValue1; - + if (value->id == CSSValueAuto) parsedValue1 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN); else { @@ -2336,8 +2347,9 @@ PassRefPtr CSSParser::parseFillSize(bool& allowComma) return 0; parsedValue1 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); } - - RefPtr parsedValue2 = parsedValue1; + + CSSPropertyID property = static_cast(propId); + RefPtr parsedValue2; if ((value = m_valueList->next())) { if (value->id == CSSValueAuto) parsedValue2 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN); @@ -2349,7 +2361,13 @@ PassRefPtr CSSParser::parseFillSize(bool& allowComma) parsedValue2 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); } } - + if (!parsedValue2) { + if (property == CSSPropertyWebkitBackgroundSize || property == CSSPropertyWebkitMaskSize) + parsedValue2 = parsedValue1; + else + parsedValue2 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN); + } + return CSSPrimitiveValue::create(Pair::create(parsedValue1.release(), parsedValue2.release())); } @@ -2425,10 +2443,8 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2, } break; case CSSPropertyBackgroundClip: - if (val->id == CSSValueBorderBox || val->id == CSSValuePaddingBox || val->id == CSSValueWebkitText) { - currValue = CSSPrimitiveValue::createIdentifier(val->id); + if (parseBackgroundClip(val, currValue)) m_valueList->next(); - } break; case CSSPropertyBackgroundOrigin: if (val->id == CSSValueBorderBox || val->id == CSSValuePaddingBox || val->id == CSSValueContentBox) { @@ -2470,8 +2486,9 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2, // parseFillRepeat advances the m_valueList pointer break; case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: case CSSPropertyWebkitMaskSize: { - currValue = parseFillSize(allowComma); + currValue = parseFillSize(propId, allowComma); if (currValue) m_valueList->next(); break; @@ -3736,7 +3753,11 @@ bool CSSParser::parseShadow(int propId, bool important) // Other operators aren't legal or we aren't done with the current shadow // value. Treat as invalid. return false; - +#if ENABLE(SVG) + // -webkit-shadow does not support multiple values. + if (static_cast(propId) == CSSPropertyWebkitShadow) + return false; +#endif // The value is good. Commit it. context.commitValue(); } else if (validUnit(val, FLength, true)) { @@ -5182,11 +5203,6 @@ static int cssPropertyID(const UChar* propertyName, unsigned length) const char* const opacity = "opacity"; name = opacity; length = strlen(opacity); - } else if (strcmp(buffer, "-webkit-background-size") == 0) { - // CSS Backgrounds/Borders. -webkit-background-size worked in Safari 4 and earlier. - const char* const backgroundSize = "background-size"; - name = backgroundSize; - length = strlen(backgroundSize); } else if (hasPrefix(buffer + 7, length - 7, "-border-")) { // -webkit-border-*-*-radius worked in Safari 4 and earlier. -webkit-border-radius syntax // differs from border-radius, so it is remains as a distinct property. diff --git a/src/3rdparty/webkit/WebCore/css/CSSParser.h b/src/3rdparty/webkit/WebCore/css/CSSParser.h index 1a156da..6d1bb32 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParser.h +++ b/src/3rdparty/webkit/WebCore/css/CSSParser.h @@ -83,7 +83,7 @@ namespace WebCore { PassRefPtr parseFillPositionXY(bool& xFound, bool& yFound); void parseFillPosition(RefPtr&, RefPtr&); void parseFillRepeat(RefPtr&, RefPtr&); - PassRefPtr parseFillSize(bool &allowComma); + PassRefPtr parseFillSize(int propId, bool &allowComma); bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr&, RefPtr&); bool parseFillShorthand(int propId, const int* properties, int numProperties, bool important); diff --git a/src/3rdparty/webkit/WebCore/css/CSSParserValues.h b/src/3rdparty/webkit/WebCore/css/CSSParserValues.h index 242cda8..1e9767a 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParserValues.h +++ b/src/3rdparty/webkit/WebCore/css/CSSParserValues.h @@ -88,7 +88,7 @@ private: unsigned m_variablesCount; }; -struct CSSParserFunction { +struct CSSParserFunction : FastAllocBase { CSSParserString name; CSSParserValueList* args; diff --git a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h index 3616aa5..6f89df9 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h +++ b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h @@ -200,11 +200,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case ListboxPart: m_value.ident = CSSValueListbox; break; -#if ENABLE(DATALIST) case ListButtonPart: +#if ENABLE(DATALIST) m_value.ident = CSSValueListButton; - break; #endif + break; case ListItemPart: m_value.ident = CSSValueListitem; break; @@ -378,6 +378,7 @@ template<> inline CSSPrimitiveValue::operator EFillBox() const case CSSValueContentBox: return ContentFillBox; case CSSValueText: + case CSSValueWebkitText: return TextFillBox; default: ASSERT_NOT_REACHED(); diff --git a/src/3rdparty/webkit/WebCore/css/CSSProperty.h b/src/3rdparty/webkit/WebCore/css/CSSProperty.h index 7af8348..b5635d0 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSProperty.h +++ b/src/3rdparty/webkit/WebCore/css/CSSProperty.h @@ -29,7 +29,7 @@ namespace WebCore { -class CSSProperty { +class CSSProperty : public FastAllocBase { public: CSSProperty(int propID, PassRefPtr value, bool important = false, int shorthandID = 0, bool implicit = false) : m_id(propID) diff --git a/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in b/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in index 5ef6605..48a18e7 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in +++ b/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in @@ -160,6 +160,10 @@ zoom -webkit-background-clip -webkit-background-composite -webkit-background-origin +# -webkit-background-size differs from background-size only in the interpretation of +# a single value: -webkit-background-size: l; is equivalent to background-size: l l; +# whereas background-size: l; is equivalent to background-size: l auto; +-webkit-background-size -webkit-binding -webkit-border-fit -webkit-border-horizontal-spacing diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp index 181e480..40627cf 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp @@ -2961,6 +2961,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) HANDLE_BACKGROUND_VALUE(origin, Origin, value) return; case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: HANDLE_BACKGROUND_VALUE(size, Size, value) return; case CSSPropertyWebkitMaskAttachment: diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp index e8492d4..1f19983 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp @@ -166,6 +166,8 @@ PassRefPtr CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro return 0; } + case CSSPropertyWebkitShadow: + return valueForShadow(svgStyle->shadow(), propertyID); case CSSPropertyMarker: case CSSPropertyEnableBackground: case CSSPropertyColorProfile: diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp b/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp index 0ae9fbc..8730e49 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp @@ -257,6 +257,11 @@ bool CSSParser::parseSVGValue(int propId, bool important) m_valueList->next(); } break; + case CSSPropertyWebkitShadow: + if (id == CSSValueNone) + valid_primitive = true; + else + return parseShadow(propId, important); /* shorthand properties */ case CSSPropertyMarker: diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in b/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in index e400ffe..809eabe 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in @@ -46,3 +46,5 @@ glyph-orientation-vertical kerning text-anchor writing-mode + +-webkit-shadow diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp b/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp index b81b4f2..7e4483f 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp @@ -37,6 +37,7 @@ #include "CSSPropertyNames.h" #include "CSSValueList.h" #include "Document.h" +#include "ShadowValue.h" #include "SVGColor.h" #include "SVGNames.h" #include "SVGPaint.h" @@ -526,6 +527,35 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value) // Silently ignoring this property for now // http://bugs.webkit.org/show_bug.cgi?id=6022 break; + case CSSPropertyWebkitShadow: { + if (isInherit) + return svgstyle->setShadow(m_parentStyle->svgStyle()->shadow() ? new ShadowData(*m_parentStyle->svgStyle()->shadow()) : 0); + if (isInitial || primitiveValue) // initial | none + return svgstyle->setShadow(0); + + if (!value->isValueList()) + return; + + float zoomFactor = m_style->effectiveZoom(); + + CSSValueList *list = static_cast(value); + ASSERT(list->length() == 1); + ShadowValue* item = static_cast(list->itemWithoutBoundsCheck(0)); + int x = item->x->computeLengthInt(style(), m_rootElementStyle, zoomFactor); + int y = item->y->computeLengthInt(style(), m_rootElementStyle, zoomFactor); + int blur = item->blur ? item->blur->computeLengthInt(style(), m_rootElementStyle, zoomFactor) : 0; + Color color; + if (item->color) + color = getColorFromPrimitiveValue(item->color.get()); + + // -webkit-shadow does should not have a spread or style + ASSERT(!item->spread); + ASSERT(!item->style); + + ShadowData* shadowData = new ShadowData(x, y, blur, 0, Normal, color.isValid() ? color : Color::transparent); + svgstyle->setShadow(shadowData); + return; + } default: // If you crash here, it's because you added a css property and are not handling it // in either this switch statement or the one in CSSStyleSelector::applyProperty diff --git a/src/3rdparty/webkit/WebCore/dom/Document.cpp b/src/3rdparty/webkit/WebCore/dom/Document.cpp index 475a8c1..4eb44f7 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Document.cpp @@ -58,6 +58,7 @@ #include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" +#include "HTMLAllCollection.h" #include "HTMLAnchorElement.h" #include "HTMLBodyElement.h" #include "HTMLCanvasElement.h" @@ -511,6 +512,16 @@ Document::~Document() m_styleSheets->documentDestroyed(); } +Document::JSWrapperCache* Document::createWrapperCache(DOMWrapperWorld* world) +{ + JSWrapperCache* wrapperCache = new JSWrapperCache(); + m_wrapperCacheMap.set(world, wrapperCache); +#if USE(JSC) + world->rememberDocument(this); +#endif + return wrapperCache; +} + void Document::resetLinkColor() { m_linkColor = Color(0, 0, 238); @@ -943,7 +954,7 @@ Element* Document::elementFromPoint(int x, int y) const return 0; float zoomFactor = frame->pageZoomFactor(); - IntPoint point = roundedIntPoint(FloatPoint((x + view()->scrollX()) * zoomFactor, (y + view()->scrollY()) * zoomFactor)); + IntPoint point = roundedIntPoint(FloatPoint(x * zoomFactor + view()->scrollX(), y * zoomFactor + view()->scrollY())); if (!frameView->visibleContentRect().contains(point)) return 0; @@ -973,7 +984,7 @@ PassRefPtr Document::caretRangeFromPoint(int x, int y) return 0; float zoomFactor = frame->pageZoomFactor(); - IntPoint point = roundedIntPoint(FloatPoint((x + view()->scrollX()) * zoomFactor, (y + view()->scrollY()) * zoomFactor)); + IntPoint point = roundedIntPoint(FloatPoint(x * zoomFactor + view()->scrollX(), y * zoomFactor + view()->scrollY())); if (!frameView->visibleContentRect().contains(point)) return 0; @@ -3988,9 +3999,9 @@ PassRefPtr Document::anchors() return HTMLCollection::create(this, DocAnchors); } -PassRefPtr Document::all() +PassRefPtr Document::all() { - return HTMLCollection::create(this, DocAll); + return HTMLAllCollection::create(this); } PassRefPtr Document::windowNamedItems(const String &name) diff --git a/src/3rdparty/webkit/WebCore/dom/Document.h b/src/3rdparty/webkit/WebCore/dom/Document.h index 09bba58..0632be1 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.h +++ b/src/3rdparty/webkit/WebCore/dom/Document.h @@ -71,6 +71,7 @@ namespace WebCore { class HitTestRequest; class HTMLCanvasElement; class HTMLCollection; + class HTMLAllCollection; class HTMLDocument; class HTMLElement; class HTMLFormElement; @@ -79,6 +80,7 @@ namespace WebCore { class HTMLMapElement; class InspectorTimelineAgent; class IntPoint; + class DOMWrapperWorld; class JSNode; class MouseEventWithHitTestResults; class NodeFilter; @@ -315,12 +317,13 @@ public: PassRefPtr links(); PassRefPtr forms(); PassRefPtr anchors(); - PassRefPtr all(); PassRefPtr objects(); PassRefPtr scripts(); PassRefPtr windowNamedItems(const String& name); PassRefPtr documentNamedItems(const String& name); + PassRefPtr all(); + // Find first anchor with the given name. // First searches for an element with the given ID, but if that fails, then looks // for an anchor with the given name. ID matching is always case sensitive, but @@ -819,7 +822,15 @@ public: virtual void postTask(PassRefPtr); // Executes the task on context's thread asynchronously. typedef HashMap JSWrapperCache; - JSWrapperCache& wrapperCache() { return m_wrapperCache; } + typedef HashMap JSWrapperCacheMap; + JSWrapperCacheMap& wrapperCacheMap() { return m_wrapperCacheMap; } + JSWrapperCache* getWrapperCache(DOMWrapperWorld* world) + { + if (JSWrapperCache* wrapperCache = m_wrapperCacheMap.get(world)) + return wrapperCache; + return createWrapperCache(world); + } + JSWrapperCache* createWrapperCache(DOMWrapperWorld*); virtual void finishedParsing(); @@ -1137,7 +1148,7 @@ private: unsigned m_numNodeListCaches; - JSWrapperCache m_wrapperCache; + JSWrapperCacheMap m_wrapperCacheMap; #if ENABLE(DATABASE) RefPtr m_databaseThread; diff --git a/src/3rdparty/webkit/WebCore/dom/Element.cpp b/src/3rdparty/webkit/WebCore/dom/Element.cpp index 621c63a..9edde25 100644 --- a/src/3rdparty/webkit/WebCore/dom/Element.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Element.cpp @@ -1414,7 +1414,7 @@ KURL Element::getURLAttribute(const QualifiedName& name) const ASSERT(isURLAttribute(attribute)); } #endif - return document()->completeURL(getAttribute(name)); + return document()->completeURL(deprecatedParseURL(getAttribute(name))); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp index ceb5221..694e78a 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp +++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp @@ -192,9 +192,16 @@ bool EventTarget::removeEventListener(const AtomicString& eventType, EventListen // Notify firing events planning to invoke the listener at 'index' that // they have one less listener to invoke. - for (size_t i = 0; i < d->firingEventEndIterators.size(); ++i) { - if (eventType == *d->firingEventEndIterators[i].eventType && index < *d->firingEventEndIterators[i].value) - --*d->firingEventEndIterators[i].value; + for (size_t i = 0; i < d->firingEventIterators.size(); ++i) { + if (eventType != d->firingEventIterators[i].eventType) + continue; + + if (index >= d->firingEventIterators[i].end) + continue; + + --d->firingEventIterators[i].end; + if (index <= d->firingEventIterators[i].iterator) + --d->firingEventIterators[i].iterator; } return true; @@ -232,6 +239,10 @@ bool EventTarget::dispatchEvent(PassRefPtr event, ExceptionCode& ec) ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; return false; } + + if (!scriptExecutionContext()) + return false; + return dispatchEvent(event); } @@ -259,9 +270,15 @@ bool EventTarget::fireEventListeners(Event* event) RefPtr protect = this; + // Fire all listeners registered for this event. Don't fire listeners removed + // during event dispatch. Also, don't fire event listeners added during event + // dispatch. Conveniently, all new event listeners will be added after 'end', + // so iterating to 'end' naturally excludes new event listeners. + + size_t i = 0; size_t end = entry.size(); - d->firingEventEndIterators.append(FiringEventEndIterator(&event->type(), &end)); - for (size_t i = 0; i < end; ++i) { + d->firingEventIterators.append(FiringEventIterator(event->type(), i, end)); + for ( ; i < end; ++i) { RegisteredEventListener& registeredListener = entry[i]; if (event->eventPhase() == Event::CAPTURING_PHASE && !registeredListener.useCapture) continue; @@ -271,7 +288,7 @@ bool EventTarget::fireEventListeners(Event* event) // event listeners, even though that violates some versions of the DOM spec. registeredListener.listener->handleEvent(scriptExecutionContext(), event); } - d->firingEventEndIterators.removeLast(); + d->firingEventIterators.removeLast(); return !event->defaultPrevented(); } @@ -298,8 +315,10 @@ void EventTarget::removeAllEventListeners() // Notify firing events planning to invoke the listener at 'index' that // they have one less listener to invoke. - for (size_t i = 0; i < d->firingEventEndIterators.size(); ++i) - *d->firingEventEndIterators[i].value = 0; + for (size_t i = 0; i < d->firingEventIterators.size(); ++i) { + d->firingEventIterators[i].iterator = 0; + d->firingEventIterators[i].end = 0; + } } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.h b/src/3rdparty/webkit/WebCore/dom/EventTarget.h index 2d612e1..9a1975c 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventTarget.h +++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.h @@ -61,24 +61,26 @@ namespace WebCore { typedef int ExceptionCode; - struct FiringEventEndIterator { - FiringEventEndIterator(const AtomicString* eventType, size_t* value) + struct FiringEventIterator { + FiringEventIterator(const AtomicString& eventType, size_t& iterator, size_t& end) : eventType(eventType) - , value(value) + , iterator(iterator) + , end(end) { } - - const AtomicString* eventType; - size_t* value; + + const AtomicString& eventType; + size_t& iterator; + size_t& end; }; - typedef Vector FiringEventEndIteratorVector; + typedef Vector FiringEventIteratorVector; typedef Vector EventListenerVector; typedef HashMap EventListenerMap; struct EventTargetData { EventListenerMap eventListenerMap; - FiringEventEndIteratorVector firingEventEndIterators; + FiringEventIteratorVector firingEventIterators; }; class EventTarget { @@ -209,7 +211,7 @@ namespace WebCore { EventTargetData* d = eventTargetData(); if (!d) return false; - return d->firingEventEndIterators.size() != 0; + return d->firingEventIterators.size() != 0; } inline bool EventTarget::hasEventListeners() diff --git a/src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl b/src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl deleted file mode 100644 index dee365f..0000000 --- a/src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2008, 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - - // This interface is used for undetectable HTMLCollections. - // An undetectable HTMLCollection behaves like an HTMLCollection - // when used, but the 'typeof' operator returns undefined and - // ToBoolean returns false. - interface HTMLAllCollection : HTMLCollection { - }; - -} diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp index 45d4e23..f7046e3 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp @@ -36,6 +36,10 @@ #include #include +#if USE(JSC) +#include "JSDOMWindow.h" +#endif + namespace WebCore { class ProcessMessagesSoonTask : public ScriptExecutionContext::Task { @@ -195,4 +199,20 @@ ScriptExecutionContext::Task::~Task() { } +#if USE(JSC) +JSC::JSGlobalData* ScriptExecutionContext::globalData() +{ + if (isDocument()) + return JSDOMWindow::commonJSGlobalData(); + +#if ENABLE(WORKERS) + if (isWorkerContext()) + return static_cast(this)->script()->globalData(); +#endif + + ASSERT_NOT_REACHED(); + return 0; +} +#endif + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h index bb78b6f..398afec 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h +++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h @@ -104,6 +104,10 @@ namespace WebCore { void removeTimeout(int timeoutId); DOMTimer* findTimeout(int timeoutId); +#if USE(JSC) + JSC::JSGlobalData* globalData(); +#endif + protected: // Explicitly override the security origin for this script context. // Note: It is dangerous to change the security origin of a script context diff --git a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp index 49713ba..3d2a549 100644 --- a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp +++ b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp @@ -479,12 +479,14 @@ bool SelectElement::appendFormData(SelectElementData& data, Element* element, Fo // We return the first one if it was a combobox select if (!successful && !data.multiple() && data.size() <= 1 && items.size()) { OptionElement* optionElement = toOptionElement(items[0]); - const AtomicString& value = optionElement->value(); - if (value.isNull()) - list.appendData(name, optionElement->text().stripWhiteSpace()); - else - list.appendData(name, value); - successful = true; + if (optionElement) { + const AtomicString& value = optionElement->value(); + if (value.isNull()) + list.appendData(name, optionElement->text().stripWhiteSpace()); + else + list.appendData(name, value); + successful = true; + } } return successful; @@ -874,13 +876,19 @@ void SelectElement::typeAheadFind(SelectElementData& data, Element* element, Key int index = (optionToListIndex(data, element, selected >= 0 ? selected : 0) + searchStartOffset) % itemCount; ASSERT(index >= 0); + // Compute a case-folded copy of the prefix string before beginning the search for + // a matching element. This code uses foldCase to work around the fact that + // String::startWith does not fold non-ASCII characters. This code can be changed + // to use startWith once that is fixed. + String prefixWithCaseFolded(prefix.foldCase()); for (int i = 0; i < itemCount; ++i, index = (index + 1) % itemCount) { OptionElement* optionElement = toOptionElement(items[index]); if (!optionElement || items[index]->disabled()) continue; + // Fold the option string and check if its prefix is equal to the folded prefix. String text = optionElement->textIndentedToRespectGroupLabel(); - if (stripLeadingWhiteSpace(text).startsWith(prefix, false)) { + if (stripLeadingWhiteSpace(text).foldCase().startsWith(prefixWithCaseFolded)) { setSelectedIndex(data, element, listToOptionIndex(data, element, index)); if (!data.usesMenuList()) listBoxOnChange(data, element); diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp index 543927d..30d39e0 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp @@ -79,15 +79,41 @@ bool XMLTokenizer::isWMLDocument() const } #endif -void XMLTokenizer::setCurrentNode(Node* n) +void XMLTokenizer::pushCurrentNode(Node* n) { - bool nodeNeedsReference = n && n != m_doc; - if (nodeNeedsReference) - n->ref(); - if (m_currentNodeIsReferenced) - m_currentNode->deref(); + ASSERT(n); + ASSERT(m_currentNode); + if (n != m_doc) + n->ref(); + m_currentNodeStack.append(m_currentNode); m_currentNode = n; - m_currentNodeIsReferenced = nodeNeedsReference; +} + +void XMLTokenizer::popCurrentNode() +{ + ASSERT(m_currentNode); + ASSERT(m_currentNodeStack.size()); + + if (m_currentNode != m_doc) + m_currentNode->deref(); + + m_currentNode = m_currentNodeStack.last(); + m_currentNodeStack.removeLast(); +} + +void XMLTokenizer::clearCurrentNodeStack() +{ + if (m_currentNode && m_currentNode != m_doc) + m_currentNode->deref(); + m_currentNode = 0; + + if (m_currentNodeStack.size()) { // Aborted parsing. + for (size_t i = m_currentNodeStack.size() - 1; i != 0; --i) + m_currentNodeStack[i]->deref(); + if (m_currentNodeStack[0] && m_currentNodeStack[0] != m_doc) + m_currentNodeStack[0]->deref(); + m_currentNodeStack.clear(); + } } void XMLTokenizer::write(const SegmentedString& s, bool /*appendData*/) @@ -143,7 +169,7 @@ bool XMLTokenizer::enterText() RefPtr newNode = Text::create(m_doc, ""); if (!m_currentNode->addChild(newNode.get())) return false; - setCurrentNode(newNode.get()); + pushCurrentNode(newNode.get()); return true; } @@ -173,10 +199,7 @@ void XMLTokenizer::exitText() if (m_view && m_currentNode && !m_currentNode->attached()) m_currentNode->attach(); - // FIXME: What's the right thing to do if the parent is really 0? - // Just leaving the current node set to the text node doesn't make much sense. - if (Node* par = m_currentNode->parentNode()) - setCurrentNode(par); + popCurrentNode(); } void XMLTokenizer::end() @@ -190,7 +213,7 @@ void XMLTokenizer::end() m_doc->updateStyleSelector(); } - setCurrentNode(0); + clearCurrentNodeStack(); if (!m_parsingFragment) m_doc->finishedParsing(); } diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h index 019a831..e1ee09f 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h @@ -124,7 +124,10 @@ public: friend bool parseXMLDocumentFragment(const String& chunk, DocumentFragment* fragment, Element* parent); void initializeParserContext(const char* chunk = 0); - void setCurrentNode(Node*); + + void pushCurrentNode(Node*); + void popCurrentNode(); + void clearCurrentNodeStack(); void insertErrorMessageBlock(); @@ -148,7 +151,7 @@ public: Vector m_bufferedText; #endif Node* m_currentNode; - bool m_currentNodeIsReferenced; + Vector m_currentNodeStack; bool m_sawError; bool m_sawXSLTransform; diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp index 6cc0a0c..9aa0961 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp @@ -530,7 +530,6 @@ XMLTokenizer::XMLTokenizer(Document* _doc, FrameView* _view) , m_context(0) , m_pendingCallbacks(new PendingCallbacks) , m_currentNode(_doc) - , m_currentNodeIsReferenced(false) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -557,7 +556,6 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) , m_context(0) , m_pendingCallbacks(new PendingCallbacks) , m_currentNode(fragment) - , m_currentNodeIsReferenced(fragment) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -576,8 +574,7 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) , m_scriptStartLine(0) , m_parsingFragment(true) { - if (fragment) - fragment->ref(); + fragment->ref(); if (m_doc) m_doc->ref(); @@ -614,7 +611,7 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) XMLTokenizer::~XMLTokenizer() { - setCurrentNode(0); + clearCurrentNodeStack(); if (m_parsingFragment && m_doc) m_doc->deref(); if (m_pendingScript) @@ -801,7 +798,7 @@ void XMLTokenizer::startElementNs(const xmlChar* xmlLocalName, const xmlChar* xm return; } - setCurrentNode(newElement.get()); + pushCurrentNode(newElement.get()); if (m_view && !newElement->attached()) newElement->attach(); @@ -822,22 +819,29 @@ void XMLTokenizer::endElementNs() exitText(); Node* n = m_currentNode; - RefPtr parent = n->parentNode(); n->finishParsingChildren(); if (!n->isElementNode() || !m_view) { - setCurrentNode(parent.get()); + popCurrentNode(); return; } Element* element = static_cast(n); + + // The element's parent may have already been removed from document. + // Parsing continues in this case, but scripts aren't executed. + if (!element->inDocument()) { + popCurrentNode(); + return; + } + ScriptElement* scriptElement = toScriptElement(element); if (!scriptElement) { - setCurrentNode(parent.get()); + popCurrentNode(); return; } - // don't load external scripts for standalone documents (for now) + // Don't load external scripts for standalone documents (for now). ASSERT(!m_pendingScript); m_requestingScript = true; @@ -865,7 +869,7 @@ void XMLTokenizer::endElementNs() m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); } m_requestingScript = false; - setCurrentNode(parent.get()); + popCurrentNode(); } void XMLTokenizer::characters(const xmlChar* s, int len) diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp index 65cbc21..c6e73ba 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp @@ -85,7 +85,6 @@ XMLTokenizer::XMLTokenizer(Document* _doc, FrameView* _view) , m_view(_view) , m_wroteText(false) , m_currentNode(_doc) - , m_currentNodeIsReferenced(false) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -114,7 +113,6 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) , m_view(0) , m_wroteText(false) , m_currentNode(fragment) - , m_currentNodeIsReferenced(fragment) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -133,8 +131,7 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) , m_scriptStartLine(0) , m_parsingFragment(true) { - if (fragment) - fragment->ref(); + fragment->ref(); if (m_doc) m_doc->ref(); @@ -188,7 +185,7 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) XMLTokenizer::~XMLTokenizer() { - setCurrentNode(0); + clearCurrentNodeStack(); if (m_parsingFragment && m_doc) m_doc->deref(); if (m_pendingScript) @@ -569,7 +566,7 @@ void XMLTokenizer::parseStartElement() return; } - setCurrentNode(newElement.get()); + pushCurrentNode(newElement.get()); if (m_view && !newElement->attached()) newElement->attach(); @@ -582,18 +579,26 @@ void XMLTokenizer::parseEndElement() exitText(); Node* n = m_currentNode; - RefPtr parent = n->parentNode(); n->finishParsingChildren(); if (!n->isElementNode() || !m_view) { - setCurrentNode(parent.get()); + if (!m_currentNodeStack.isEmpty()) + popCurrentNode(); return; } Element* element = static_cast(n); + + // The element's parent may have already been removed from document. + // Parsing continues in this case, but scripts aren't executed. + if (!element->inDocument()) { + popCurrentNode(); + return; + } + ScriptElement* scriptElement = toScriptElement(element); if (!scriptElement) { - setCurrentNode(parent.get()); + popCurrentNode(); return; } @@ -625,7 +630,7 @@ void XMLTokenizer::parseEndElement() m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); } m_requestingScript = false; - setCurrentNode(parent.get()); + popCurrentNode(); } void XMLTokenizer::parseCharacters() diff --git a/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp b/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp index 89d862f..7a8f025 100644 --- a/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp @@ -334,6 +334,38 @@ static void diffTextDecorations(CSSMutableStyleDeclaration* style, int propertID setTextDecorationProperty(style, newTextDecoration.get(), propertID); } +static bool fontWeightIsBold(CSSStyleDeclaration* style) +{ + ASSERT(style); + RefPtr fontWeight = style->getPropertyCSSValue(CSSPropertyFontWeight); + + if (!fontWeight) + return false; + if (!fontWeight->isPrimitiveValue()) + return false; + + // Because b tag can only bold text, there are only two states in plain html: bold and not bold. + // Collapse all other values to either one of these two states for editing purposes. + switch (static_cast(fontWeight.get())->getIdent()) { + case CSSValue100: + case CSSValue200: + case CSSValue300: + case CSSValue400: + case CSSValue500: + case CSSValueNormal: + return false; + case CSSValueBold: + case CSSValue600: + case CSSValue700: + case CSSValue800: + case CSSValue900: + return true; + } + + ASSERT_NOT_REACHED(); // For CSSValueBolder and CSSValueLighter + return false; // Make compiler happy +} + RefPtr getPropertiesNotInComputedStyle(CSSStyleDeclaration* style, CSSComputedStyleDeclaration* computedStyle) { ASSERT(style); @@ -345,6 +377,9 @@ RefPtr getPropertiesNotInComputedStyle(CSSStyleDecla diffTextDecorations(result.get(), CSSPropertyTextDecoration, computedTextDecorationsInEffect.get()); diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect, computedTextDecorationsInEffect.get()); + if (fontWeightIsBold(result.get()) == fontWeightIsBold(computedStyle)) + result->removeProperty(CSSPropertyFontWeight); + return result; } @@ -352,7 +387,6 @@ RefPtr getPropertiesNotInComputedStyle(CSSStyleDecla // e.g. when a user inserts a new paragraph, all properties listed here must be copied to the new paragraph. // FIXME: The current editingStyleProperties contains all inheritableProperties but we may not need to preserve all inheritable properties static const int editingStyleProperties[] = { - CSSPropertyBackgroundColor, // CSS inheritable properties CSSPropertyBorderCollapse, CSSPropertyColor, diff --git a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp index 0496a8f..1617be8 100644 --- a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -71,7 +71,7 @@ namespace WebCore { using namespace HTMLNames; -CompositeEditCommand::CompositeEditCommand(Document *document) +CompositeEditCommand::CompositeEditCommand(Document *document) : EditCommand(document) { } @@ -396,7 +396,7 @@ void CompositeEditCommand::rebalanceWhitespaceAt(const Position& position) Node* node = position.node(); if (!node || !node->isTextNode()) return; - Text* textNode = static_cast(node); + Text* textNode = static_cast(node); if (textNode->length() == 0) return; @@ -739,6 +739,129 @@ void CompositeEditCommand::pushPartiallySelectedAnchorElementsDown() setEndingSelection(originalSelection); } +// Clone the paragraph between start and end under blockElement, +// preserving the hierarchy up to outerNode. + +void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Position& end, Node* outerNode, Element* blockElement) +{ + // First we clone the outerNode + + RefPtr lastNode = outerNode->cloneNode(isTableElement(outerNode)); + appendNode(lastNode, blockElement); + + if (start.node() != outerNode) { + Vector > ancestors; + + // Insert each node from innerNode to outerNode (excluded) in a list. + for (Node* n = start.node(); n && n != outerNode; n = n->parentNode()) + ancestors.append(n); + + // Clone every node between start.node() and outerBlock. + + for (size_t i = ancestors.size(); i != 0; --i) { + Node* item = ancestors[i - 1].get(); + RefPtr child = item->cloneNode(isTableElement(item)); + appendNode(child, static_cast(lastNode.get())); + lastNode = child.release(); + } + } + + // Handle the case of paragraphs with more than one node, + // cloning all the siblings until end.node() is reached. + + if (start.node() != end.node()) { + for (Node* n = start.node()->nextSibling(); n != NULL; n = n->nextSibling()) { + RefPtr clonedNode = n->cloneNode(true); + insertNodeAfter(clonedNode, lastNode); + lastNode = clonedNode.release(); + if (n == end.node()) + break; + } + } +} + + +// There are bugs in deletion when it removes a fully selected table/list. +// It expands and removes the entire table/list, but will let content +// before and after the table/list collapse onto one line. +// Deleting a paragraph will leave a placeholder. Remove it (and prune +// empty or unrendered parents). + +void CompositeEditCommand::cleanupAfterDeletion() +{ + VisiblePosition caretAfterDelete = endingSelection().visibleStart(); + if (isStartOfParagraph(caretAfterDelete) && isEndOfParagraph(caretAfterDelete)) { + // Note: We want the rightmost candidate. + Position position = caretAfterDelete.deepEquivalent().downstream(); + Node* node = position.node(); + // Normally deletion will leave a br as a placeholder. + if (node->hasTagName(brTag)) + removeNodeAndPruneAncestors(node); + // If the selection to move was empty and in an empty block that + // doesn't require a placeholder to prop itself open (like a bordered + // div or an li), remove it during the move (the list removal code + // expects this behavior). + else if (isBlock(node)) + removeNodeAndPruneAncestors(node); + else if (lineBreakExistsAtPosition(position)) { + // There is a preserved '\n' at caretAfterDelete. + // We can safely assume this is a text node. + Text* textNode = static_cast(node); + if (textNode->length() == 1) + removeNodeAndPruneAncestors(node); + else + deleteTextFromNode(textNode, position.deprecatedEditingOffset(), 1); + } + } +} + +// This is a version of moveParagraph that preserves style by keeping the original markup +// It is currently used only by IndentOutdentCommand but it is meant to be used in the +// future by several other commands such as InsertList and the align commands. +// The blockElement parameter is the element to move the paragraph to, +// outerNode is the top element of the paragraph hierarchy. + +void CompositeEditCommand::moveParagraphWithClones(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, Element* blockElement, Node* outerNode) +{ + ASSERT(outerNode); + ASSERT(blockElement); + + VisiblePosition beforeParagraph = startOfParagraphToMove.previous(); + VisiblePosition afterParagraph(endOfParagraphToMove.next()); + + // We upstream() the end and downstream() the start so that we don't include collapsed whitespace in the move. + // When we paste a fragment, spaces after the end and before the start are treated as though they were rendered. + Position start = startOfParagraphToMove.deepEquivalent().downstream(); + Position end = endOfParagraphToMove.deepEquivalent().upstream(); + + cloneParagraphUnderNewElement(start, end, outerNode, blockElement); + + setEndingSelection(VisibleSelection(start, end, DOWNSTREAM)); + deleteSelection(false, false, false, false); + + // There are bugs in deletion when it removes a fully selected table/list. + // It expands and removes the entire table/list, but will let content + // before and after the table/list collapse onto one line. + + cleanupAfterDeletion(); + + // Add a br if pruning an empty block level element caused a collapse. For example: + // foo^ + //
bar
+ // baz + // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. That would + // cause 'baz' to collapse onto the line with 'foobar' unless we insert a br. + // Must recononicalize these two VisiblePositions after the pruning above. + beforeParagraph = VisiblePosition(beforeParagraph.deepEquivalent()); + afterParagraph = VisiblePosition(afterParagraph.deepEquivalent()); + + if (beforeParagraph.isNotNull() && !isTableElement(beforeParagraph.deepEquivalent().node()) && (!isEndOfParagraph(beforeParagraph) || beforeParagraph == afterParagraph)) { + // FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal. + insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquivalent()); + } +} + + // This moves a paragraph preserving its style. void CompositeEditCommand::moveParagraph(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, const VisiblePosition& destination, bool preserveSelection, bool preserveStyle) { @@ -784,7 +907,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap VisiblePosition afterParagraph(endOfParagraphToMove.next()); // We upstream() the end and downstream() the start so that we don't include collapsed whitespace in the move. - // When we paste a fragment, spaces after the end and before the start are treated as though they were rendered. + // When we paste a fragment, spaces after the end and before the start are treated as though they were rendered. Position start = startOfParagraphToMove.deepEquivalent().downstream(); Position end = endOfParagraphToMove.deepEquivalent().upstream(); @@ -793,7 +916,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap Position endRangeCompliant = rangeCompliantEquivalent(end); RefPtr range = Range::create(document(), startRangeCompliant.node(), startRangeCompliant.deprecatedEditingOffset(), endRangeCompliant.node(), endRangeCompliant.deprecatedEditingOffset()); - // FIXME: This is an inefficient way to preserve style on nodes in the paragraph to move. It + // FIXME: This is an inefficient way to preserve style on nodes in the paragraph to move. It // shouldn't matter though, since moved paragraphs will usually be quite small. RefPtr fragment = startOfParagraphToMove != endOfParagraphToMove ? createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotAnnotateForInterchange, true), "") : 0; @@ -813,42 +936,14 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap deleteSelection(false, false, false, false); ASSERT(destination.deepEquivalent().node()->inDocument()); - - // There are bugs in deletion when it removes a fully selected table/list. - // It expands and removes the entire table/list, but will let content - // before and after the table/list collapse onto one line. - - // Deleting a paragraph will leave a placeholder. Remove it (and prune - // empty or unrendered parents). - VisiblePosition caretAfterDelete = endingSelection().visibleStart(); - if (isStartOfParagraph(caretAfterDelete) && isEndOfParagraph(caretAfterDelete)) { - // Note: We want the rightmost candidate. - Position position = caretAfterDelete.deepEquivalent().downstream(); - Node* node = position.node(); - // Normally deletion will leave a br as a placeholder. - if (node->hasTagName(brTag)) - removeNodeAndPruneAncestors(node); - // If the selection to move was empty and in an empty block that - // doesn't require a placeholder to prop itself open (like a bordered - // div or an li), remove it during the move (the list removal code - // expects this behavior). - else if (isBlock(node)) - removeNodeAndPruneAncestors(node); - else if (lineBreakExistsAtVisiblePosition(caretAfterDelete)) { - // There is a preserved '\n' at caretAfterDelete. - Text* textNode = static_cast(node); - if (textNode->length() == 1) - removeNodeAndPruneAncestors(node); - else - deleteTextFromNode(textNode, position.deprecatedEditingOffset(), 1); - } - } - // Add a br if pruning an empty block level element caused a collapse. For example: + cleanupAfterDeletion(); + + // Add a br if pruning an empty block level element caused a collapse. For example: // foo^ //
bar
// baz - // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. That would + // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. That would // cause 'baz' to collapse onto the line with 'foobar' unless we insert a br. // Must recononicalize these two VisiblePositions after the pruning above. beforeParagraph = VisiblePosition(beforeParagraph.deepEquivalent()); @@ -912,7 +1007,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem() removeNodePreservingChildren(listNode->parentNode()); newBlock = createListItemElement(document()); } - // If listNode does NOT appear at the end of the outer list item, then behave as if in a regular paragraph. + // If listNode does NOT appear at the end of the outer list item, then behave as if in a regular paragraph. } else if (blockEnclosingList->hasTagName(olTag) || blockEnclosingList->hasTagName(ulTag)) newBlock = createListItemElement(document()); } @@ -971,7 +1066,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph() // to hold the caret before the highest blockquote. insertNodeBefore(br, highestBlockquote); VisiblePosition atBR(Position(br.get(), 0)); - // If the br we inserted collapsed, for example foo
...
, insert + // If the br we inserted collapsed, for example foo
...
, insert // a second one. if (!isStartOfParagraph(atBR)) insertNodeBefore(createBreakElement(document()), br); @@ -1002,7 +1097,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph() return true; } -// Operations use this function to avoid inserting content into an anchor when at the start or the end of +// Operations use this function to avoid inserting content into an anchor when at the start or the end of // that anchor, as in NSTextView. // FIXME: This is only an approximation of NSTextViews insertion behavior, which varies depending on how // the caret was made. @@ -1022,7 +1117,7 @@ Position CompositeEditCommand::positionAvoidingSpecialElementBoundary(const Posi if (enclosingAnchor && !isBlock(enclosingAnchor)) { VisiblePosition firstInAnchor(firstDeepEditingPositionForNode(enclosingAnchor)); VisiblePosition lastInAnchor(lastDeepEditingPositionForNode(enclosingAnchor)); - // If visually just after the anchor, insert *inside* the anchor unless it's the last + // If visually just after the anchor, insert *inside* the anchor unless it's the last // VisiblePosition in the document, to match NSTextView. if (visiblePos == lastInAnchor) { // Make sure anchors are pushed down before avoiding them so that we don't diff --git a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.h b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.h index 2c6403e..0cceaaa 100644 --- a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.h +++ b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.h @@ -102,6 +102,9 @@ protected: void moveParagraph(const VisiblePosition&, const VisiblePosition&, const VisiblePosition&, bool preserveSelection = false, bool preserveStyle = true); void moveParagraphs(const VisiblePosition&, const VisiblePosition&, const VisiblePosition&, bool preserveSelection = false, bool preserveStyle = true); + void moveParagraphWithClones(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, Element* blockElement, Node* outerNode); + void cloneParagraphUnderNewElement(Position& start, Position& end, Node* outerNode, Element* blockElement); + void cleanupAfterDeletion(); bool breakOutOfEmptyListItem(); bool breakOutOfEmptyMailBlockquotedParagraph(); diff --git a/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp b/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp index abd0174..3379b3c 100644 --- a/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp @@ -1291,10 +1291,10 @@ static String valueForeColor(Frame* frame, Event*) // Map of functions +struct CommandEntry { const char* name; EditorInternalCommand command; }; + static const CommandMap& createCommandMap() { - struct CommandEntry { const char* name; EditorInternalCommand command; }; - static const CommandEntry commands[] = { { "AlignCenter", { executeJustifyCenter, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "AlignJustified", { executeJustifyFull, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, diff --git a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp index 84fa147..808a2f8 100644 --- a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp @@ -67,37 +67,6 @@ IndentOutdentCommand::IndentOutdentCommand(Document* document, EIndentType typeO { } -// This function is a workaround for moveParagraph's tendency to strip blockquotes. It updates lastBlockquote to point to the -// correct level for the current paragraph, and returns a pointer to a placeholder br where the insertion should be performed. -PassRefPtr IndentOutdentCommand::prepareBlockquoteLevelForInsertion(const VisiblePosition& currentParagraph, RefPtr& lastBlockquote) -{ - int currentBlockquoteLevel = 0; - int lastBlockquoteLevel = 0; - Node* node = currentParagraph.deepEquivalent().node(); - while ((node = enclosingNodeWithTag(Position(node->parentNode(), 0), blockquoteTag))) - currentBlockquoteLevel++; - node = lastBlockquote.get(); - while ((node = enclosingNodeWithTag(Position(node->parentNode(), 0), blockquoteTag))) - lastBlockquoteLevel++; - while (currentBlockquoteLevel > lastBlockquoteLevel) { - RefPtr newBlockquote = createIndentBlockquoteElement(document()); - appendNode(newBlockquote, lastBlockquote); - lastBlockquote = newBlockquote; - lastBlockquoteLevel++; - } - while (currentBlockquoteLevel < lastBlockquoteLevel) { - lastBlockquote = static_cast(enclosingNodeWithTag(Position(lastBlockquote->parentNode(), 0), blockquoteTag)); - lastBlockquoteLevel--; - } - RefPtr placeholder = createBreakElement(document()); - appendNode(placeholder, lastBlockquote); - // Add another br before the placeholder if it collapsed. - VisiblePosition visiblePos(Position(placeholder.get(), 0)); - if (!isStartOfParagraph(visiblePos)) - insertNodeBefore(createBreakElement(document()), placeholder); - return placeholder.release(); -} - bool IndentOutdentCommand::tryIndentingAsListItem(const VisiblePosition& endOfCurrentParagraph) { // If our selection is not inside a list, bail out. @@ -117,13 +86,9 @@ bool IndentOutdentCommand::tryIndentingAsListItem(const VisiblePosition& endOfCu Element* nextList = selectedListItem->nextElementSibling(); RefPtr newList = document()->createElement(listNode->tagQName(), false); - RefPtr newListItem = selectedListItem->cloneElementWithoutChildren(); - RefPtr placeholder = createBreakElement(document()); insertNodeBefore(newList, selectedListItem); - appendNode(newListItem, newList); - appendNode(placeholder, newListItem); - moveParagraph(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, VisiblePosition(Position(placeholder, 0)), true); + moveParagraphWithClones(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, newList.get(), selectedListItem); if (canMergeLists(previousList, newList.get())) mergeIdenticalElements(previousList, newList); @@ -137,25 +102,31 @@ void IndentOutdentCommand::indentIntoBlockquote(const VisiblePosition& endOfCurr { Node* enclosingCell = 0; + Position start = startOfParagraph(endOfCurrentParagraph).deepEquivalent(); + enclosingCell = enclosingNodeOfType(start, &isTableCell); + Node* nodeToSplitTo; + if (enclosingCell) + nodeToSplitTo = enclosingCell; + else if (enclosingList(start.node())) + nodeToSplitTo = enclosingBlock(start.node()); + else + nodeToSplitTo = editableRootForPosition(start); + + RefPtr outerBlock = splitTreeToNode(start.node(), nodeToSplitTo); + if (!targetBlockquote) { // Create a new blockquote and insert it as a child of the root editable element. We accomplish // this by splitting all parents of the current paragraph up to that point. targetBlockquote = createIndentBlockquoteElement(document()); - Position start = startOfParagraph(endOfCurrentParagraph).deepEquivalent(); - enclosingCell = enclosingNodeOfType(start, &isTableCell); - Node* nodeToSplitTo = enclosingCell ? enclosingCell : editableRootForPosition(start); - RefPtr startOfNewBlock = splitTreeToNode(start.node(), nodeToSplitTo); - insertNodeBefore(targetBlockquote, startOfNewBlock); + insertNodeBefore(targetBlockquote, outerBlock); } - RefPtr insertionPoint = prepareBlockquoteLevelForInsertion(endOfCurrentParagraph, targetBlockquote); - + moveParagraphWithClones(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, targetBlockquote.get(), outerBlock.get()); + // Don't put the next paragraph in the blockquote we just created for this paragraph unless // the next paragraph is in the same cell. if (enclosingCell && enclosingCell != enclosingNodeOfType(endOfNextParagraph.deepEquivalent(), &isTableCell)) targetBlockquote = 0; - - moveParagraph(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, VisiblePosition(Position(insertionPoint, 0)), true); } void IndentOutdentCommand::indentRegion() @@ -191,8 +162,6 @@ void IndentOutdentCommand::indentRegion() blockquoteForNextIndent = 0; else indentIntoBlockquote(endOfCurrentParagraph, endOfNextParagraph, blockquoteForNextIndent); - // blockquoteForNextIndent maybe updated - // this is due to the way prepareBlockquoteLevelForInsertion was designed. // Sanity check: Make sure our moveParagraph calls didn't remove endOfNextParagraph.deepEquivalent().node() // If somehow we did, return to prevent crashes. if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().node()->inDocument()) { diff --git a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h index 419f832f..817b4c8 100644 --- a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h +++ b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h @@ -49,7 +49,6 @@ private: void indentRegion(); void outdentRegion(); void outdentParagraph(); - PassRefPtr prepareBlockquoteLevelForInsertion(const VisiblePosition&, RefPtr&); bool tryIndentingAsListItem(const VisiblePosition&); void indentIntoBlockquote(const VisiblePosition&, const VisiblePosition&, RefPtr&); diff --git a/src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.cpp b/src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.cpp index 21ca924..0874201 100644 --- a/src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.cpp @@ -57,7 +57,9 @@ static void swapInNodePreservingAttributesAndChildren(Node* newNode, Node* nodeT parentNode->insertBefore(newNode, nodeToReplace, ec); ASSERT(!ec); - for (Node* child = nodeToReplace->firstChild(); child; child = child->nextSibling()) { + Node* nextChild; + for (Node* child = nodeToReplace->firstChild(); child; child = nextChild) { + nextChild = child->nextSibling(); newNode->appendChild(child, ec); ASSERT(!ec); } diff --git a/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp b/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp index 7d99916..00672f2 100644 --- a/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp +++ b/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp @@ -725,6 +725,8 @@ bool SelectionController::modify(EAlteration alter, int verticalDistance, bool u if (userTriggered) m_frame->setSelectionGranularity(CharacterGranularity); + m_lastChangeWasHorizontalExtension = alter == EXTEND; + return true; } diff --git a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp index 8780c36..919eb24 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp +++ b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp @@ -226,7 +226,7 @@ findProp (register const char *str, register unsigned int len) { enum { - TOTAL_KEYWORDS = 278, + TOTAL_KEYWORDS = 280, MIN_WORD_LENGTH = 3, MAX_WORD_LENGTH = 43, MIN_HASH_VALUE = 6, @@ -241,67 +241,67 @@ findProp (register const char *str, register unsigned int len) {"zoom", CSSPropertyZoom}, #line 23 "CSSPropertyNames.gperf" {"border", CSSPropertyBorder}, -#line 267 "CSSPropertyNames.gperf" +#line 268 "CSSPropertyNames.gperf" {"marker", CSSPropertyMarker}, #line 24 "CSSPropertyNames.gperf" {"border-bottom", CSSPropertyBorderBottom}, -#line 269 "CSSPropertyNames.gperf" +#line 270 "CSSPropertyNames.gperf" {"marker-mid", CSSPropertyMarkerMid}, #line 78 "CSSPropertyNames.gperf" {"margin", CSSPropertyMargin}, -#line 285 "CSSPropertyNames.gperf" +#line 286 "CSSPropertyNames.gperf" {"kerning", CSSPropertyKerning}, -#line 268 "CSSPropertyNames.gperf" +#line 269 "CSSPropertyNames.gperf" {"marker-end", CSSPropertyMarkerEnd}, #line 79 "CSSPropertyNames.gperf" {"margin-bottom", CSSPropertyMarginBottom}, -#line 251 "CSSPropertyNames.gperf" +#line 252 "CSSPropertyNames.gperf" {"mask", CSSPropertyMask}, -#line 272 "CSSPropertyNames.gperf" +#line 273 "CSSPropertyNames.gperf" {"stroke", CSSPropertyStroke}, #line 111 "CSSPropertyNames.gperf" {"size", CSSPropertySize}, #line 144 "CSSPropertyNames.gperf" {"word-break", CSSPropertyWordBreak}, -#line 287 "CSSPropertyNames.gperf" +#line 288 "CSSPropertyNames.gperf" {"writing-mode", CSSPropertyWritingMode}, -#line 162 "CSSPropertyNames.gperf" +#line 163 "CSSPropertyNames.gperf" {"-webkit-binding", CSSPropertyWebkitBinding}, #line 109 "CSSPropertyNames.gperf" {"resize", CSSPropertyResize}, -#line 266 "CSSPropertyNames.gperf" +#line 267 "CSSPropertyNames.gperf" {"image-rendering", CSSPropertyImageRendering}, #line 149 "CSSPropertyNames.gperf" {"-webkit-animation", CSSPropertyWebkitAnimation}, -#line 165 "CSSPropertyNames.gperf" +#line 166 "CSSPropertyNames.gperf" {"-webkit-border-image", CSSPropertyWebkitBorderImage}, -#line 205 "CSSPropertyNames.gperf" +#line 206 "CSSPropertyNames.gperf" {"-webkit-mask", CSSPropertyWebkitMask}, #line 136 "CSSPropertyNames.gperf" {"top", CSSPropertyTop}, #line 142 "CSSPropertyNames.gperf" {"widows", CSSPropertyWidows}, -#line 270 "CSSPropertyNames.gperf" +#line 271 "CSSPropertyNames.gperf" {"marker-start", CSSPropertyMarkerStart}, #line 154 "CSSPropertyNames.gperf" {"-webkit-animation-name", CSSPropertyWebkitAnimationName}, #line 102 "CSSPropertyNames.gperf" {"page", CSSPropertyPage}, -#line 210 "CSSPropertyNames.gperf" +#line 211 "CSSPropertyNames.gperf" {"-webkit-mask-image", CSSPropertyWebkitMaskImage}, #line 43 "CSSPropertyNames.gperf" {"border-top", CSSPropertyBorderTop}, #line 97 "CSSPropertyNames.gperf" {"padding", CSSPropertyPadding}, -#line 240 "CSSPropertyNames.gperf" +#line 241 "CSSPropertyNames.gperf" {"-webkit-transition", CSSPropertyWebkitTransition}, -#line 211 "CSSPropertyNames.gperf" +#line 212 "CSSPropertyNames.gperf" {"-webkit-mask-origin", CSSPropertyWebkitMaskOrigin}, #line 98 "CSSPropertyNames.gperf" {"padding-bottom", CSSPropertyPaddingBottom}, #line 82 "CSSPropertyNames.gperf" {"margin-top", CSSPropertyMarginTop}, -#line 197 "CSSPropertyNames.gperf" +#line 198 "CSSPropertyNames.gperf" {"-webkit-margin-start", CSSPropertyWebkitMarginStart}, #line 55 "CSSPropertyNames.gperf" {"content", CSSPropertyContent}, @@ -309,35 +309,35 @@ findProp (register const char *str, register unsigned int len) {"position", CSSPropertyPosition}, #line 59 "CSSPropertyNames.gperf" {"direction", CSSPropertyDirection}, -#line 218 "CSSPropertyNames.gperf" +#line 219 "CSSPropertyNames.gperf" {"-webkit-mask-size", CSSPropertyWebkitMaskSize}, #line 112 "CSSPropertyNames.gperf" {"src", CSSPropertySrc}, #line 146 "CSSPropertyNames.gperf" {"word-wrap", CSSPropertyWordWrap}, -#line 220 "CSSPropertyNames.gperf" +#line 221 "CSSPropertyNames.gperf" {"-webkit-nbsp-mode", CSSPropertyWebkitNbspMode}, #line 105 "CSSPropertyNames.gperf" {"page-break-inside", CSSPropertyPageBreakInside}, -#line 215 "CSSPropertyNames.gperf" +#line 216 "CSSPropertyNames.gperf" {"-webkit-mask-repeat", CSSPropertyWebkitMaskRepeat}, #line 101 "CSSPropertyNames.gperf" {"padding-top", CSSPropertyPaddingTop}, -#line 221 "CSSPropertyNames.gperf" +#line 222 "CSSPropertyNames.gperf" {"-webkit-padding-start", CSSPropertyWebkitPaddingStart}, #line 151 "CSSPropertyNames.gperf" {"-webkit-animation-direction", CSSPropertyWebkitAnimationDirection}, -#line 212 "CSSPropertyNames.gperf" +#line 213 "CSSPropertyNames.gperf" {"-webkit-mask-position", CSSPropertyWebkitMaskPosition}, -#line 193 "CSSPropertyNames.gperf" +#line 194 "CSSPropertyNames.gperf" {"-webkit-line-break", CSSPropertyWebkitLineBreak}, -#line 277 "CSSPropertyNames.gperf" +#line 278 "CSSPropertyNames.gperf" {"stroke-miterlimit", CSSPropertyStrokeMiterlimit}, -#line 226 "CSSPropertyNames.gperf" +#line 227 "CSSPropertyNames.gperf" {"-webkit-rtl-ordering", CSSPropertyWebkitRtlOrdering}, -#line 276 "CSSPropertyNames.gperf" +#line 277 "CSSPropertyNames.gperf" {"stroke-linejoin", CSSPropertyStrokeLinejoin}, -#line 282 "CSSPropertyNames.gperf" +#line 283 "CSSPropertyNames.gperf" {"dominant-baseline", CSSPropertyDominantBaseline}, #line 51 "CSSPropertyNames.gperf" {"caption-side", CSSPropertyCaptionSide}, @@ -357,25 +357,25 @@ findProp (register const char *str, register unsigned int len) {"word-spacing", CSSPropertyWordSpacing}, #line 31 "CSSPropertyNames.gperf" {"border-color", CSSPropertyBorderColor}, -#line 199 "CSSPropertyNames.gperf" +#line 200 "CSSPropertyNames.gperf" {"-webkit-marquee", CSSPropertyWebkitMarquee}, #line 25 "CSSPropertyNames.gperf" {"border-bottom-color", CSSPropertyBorderBottomColor}, #line 152 "CSSPropertyNames.gperf" {"-webkit-animation-duration", CSSPropertyWebkitAnimationDuration}, -#line 245 "CSSPropertyNames.gperf" +#line 246 "CSSPropertyNames.gperf" {"-webkit-user-drag", CSSPropertyWebkitUserDrag}, -#line 166 "CSSPropertyNames.gperf" +#line 167 "CSSPropertyNames.gperf" {"-webkit-border-radius", CSSPropertyWebkitBorderRadius}, -#line 209 "CSSPropertyNames.gperf" +#line 210 "CSSPropertyNames.gperf" {"-webkit-mask-composite", CSSPropertyWebkitMaskComposite}, -#line 262 "CSSPropertyNames.gperf" +#line 263 "CSSPropertyNames.gperf" {"color-rendering", CSSPropertyColorRendering}, #line 137 "CSSPropertyNames.gperf" {"unicode-bidi", CSSPropertyUnicodeBidi}, #line 53 "CSSPropertyNames.gperf" {"clip", CSSPropertyClip}, -#line 242 "CSSPropertyNames.gperf" +#line 243 "CSSPropertyNames.gperf" {"-webkit-transition-duration", CSSPropertyWebkitTransitionDuration}, #line 157 "CSSPropertyNames.gperf" {"-webkit-appearance", CSSPropertyWebkitAppearance}, @@ -395,33 +395,35 @@ findProp (register const char *str, register unsigned int len) {"background-origin", CSSPropertyBackgroundOrigin}, #line 57 "CSSPropertyNames.gperf" {"counter-reset", CSSPropertyCounterReset}, -#line 257 "CSSPropertyNames.gperf" +#line 258 "CSSPropertyNames.gperf" {"stop-color", CSSPropertyStopColor}, -#line 280 "CSSPropertyNames.gperf" +#line 281 "CSSPropertyNames.gperf" {"alignment-baseline", CSSPropertyAlignmentBaseline}, #line 22 "CSSPropertyNames.gperf" {"background-size", CSSPropertyBackgroundSize}, -#line 202 "CSSPropertyNames.gperf" +#line 203 "CSSPropertyNames.gperf" {"-webkit-marquee-repetition", CSSPropertyWebkitMarqueeRepetition}, -#line 275 "CSSPropertyNames.gperf" +#line 276 "CSSPropertyNames.gperf" {"stroke-linecap", CSSPropertyStrokeLinecap}, #line 161 "CSSPropertyNames.gperf" {"-webkit-background-origin", CSSPropertyWebkitBackgroundOrigin}, #line 72 "CSSPropertyNames.gperf" {"letter-spacing", CSSPropertyLetterSpacing}, -#line 203 "CSSPropertyNames.gperf" +#line 204 "CSSPropertyNames.gperf" {"-webkit-marquee-speed", CSSPropertyWebkitMarqueeSpeed}, -#line 208 "CSSPropertyNames.gperf" +#line 209 "CSSPropertyNames.gperf" {"-webkit-mask-clip", CSSPropertyWebkitMaskClip}, #line 153 "CSSPropertyNames.gperf" {"-webkit-animation-iteration-count", CSSPropertyWebkitAnimationIterationCount}, -#line 200 "CSSPropertyNames.gperf" - {"-webkit-marquee-direction", CSSPropertyWebkitMarqueeDirection}, #line 201 "CSSPropertyNames.gperf" + {"-webkit-marquee-direction", CSSPropertyWebkitMarqueeDirection}, +#line 162 "CSSPropertyNames.gperf" + {"-webkit-background-size", CSSPropertyWebkitBackgroundSize}, +#line 202 "CSSPropertyNames.gperf" {"-webkit-marquee-increment", CSSPropertyWebkitMarqueeIncrement}, #line 19 "CSSPropertyNames.gperf" {"background-repeat", CSSPropertyBackgroundRepeat}, -#line 222 "CSSPropertyNames.gperf" +#line 223 "CSSPropertyNames.gperf" {"-webkit-perspective", CSSPropertyWebkitPerspective}, #line 110 "CSSPropertyNames.gperf" {"right", CSSPropertyRight}, @@ -433,7 +435,7 @@ findProp (register const char *str, register unsigned int len) {"background-position", CSSPropertyBackgroundPosition}, #line 86 "CSSPropertyNames.gperf" {"min-width", CSSPropertyMinWidth}, -#line 223 "CSSPropertyNames.gperf" +#line 224 "CSSPropertyNames.gperf" {"-webkit-perspective-origin", CSSPropertyWebkitPerspectiveOrigin}, #line 37 "CSSPropertyNames.gperf" {"border-right", CSSPropertyBorderRight}, @@ -445,18 +447,20 @@ findProp (register const char *str, register unsigned int len) {"margin-right", CSSPropertyMarginRight}, #line 29 "CSSPropertyNames.gperf" {"border-bottom-width", CSSPropertyBorderBottomWidth}, -#line 252 "CSSPropertyNames.gperf" +#line 253 "CSSPropertyNames.gperf" {"enable-background", CSSPropertyEnableBackground}, -#line 279 "CSSPropertyNames.gperf" +#line 280 "CSSPropertyNames.gperf" {"stroke-width", CSSPropertyStrokeWidth}, -#line 189 "CSSPropertyNames.gperf" +#line 190 "CSSPropertyNames.gperf" {"-webkit-columns", CSSPropertyWebkitColumns}, -#line 194 "CSSPropertyNames.gperf" +#line 195 "CSSPropertyNames.gperf" {"-webkit-line-clamp", CSSPropertyWebkitLineClamp}, -#line 259 "CSSPropertyNames.gperf" +#line 260 "CSSPropertyNames.gperf" {"color-interpolation", CSSPropertyColorInterpolation}, -#line 163 "CSSPropertyNames.gperf" +#line 164 "CSSPropertyNames.gperf" {"-webkit-border-fit", CSSPropertyWebkitBorderFit}, +#line 289 "CSSPropertyNames.gperf" + {"-webkit-shadow", CSSPropertyWebkitShadow}, #line 65 "CSSPropertyNames.gperf" {"font-size", CSSPropertyFontSize}, #line 30 "CSSPropertyNames.gperf" @@ -467,11 +471,11 @@ findProp (register const char *str, register unsigned int len) {"z-index", CSSPropertyZIndex}, #line 139 "CSSPropertyNames.gperf" {"vertical-align", CSSPropertyVerticalAlign}, -#line 181 "CSSPropertyNames.gperf" +#line 182 "CSSPropertyNames.gperf" {"-webkit-column-break-inside", CSSPropertyWebkitColumnBreakInside}, #line 100 "CSSPropertyNames.gperf" {"padding-right", CSSPropertyPaddingRight}, -#line 247 "CSSPropertyNames.gperf" +#line 248 "CSSPropertyNames.gperf" {"-webkit-user-select", CSSPropertyWebkitUserSelect}, #line 48 "CSSPropertyNames.gperf" {"border-top-width", CSSPropertyBorderTopWidth}, @@ -479,49 +483,49 @@ findProp (register const char *str, register unsigned int len) {"text-rendering", CSSPropertyTextRendering}, #line 88 "CSSPropertyNames.gperf" {"orphans", CSSPropertyOrphans}, -#line 174 "CSSPropertyNames.gperf" +#line 175 "CSSPropertyNames.gperf" {"-webkit-box-orient", CSSPropertyWebkitBoxOrient}, -#line 234 "CSSPropertyNames.gperf" +#line 235 "CSSPropertyNames.gperf" {"-webkit-transform", CSSPropertyWebkitTransform}, -#line 183 "CSSPropertyNames.gperf" +#line 184 "CSSPropertyNames.gperf" {"-webkit-column-gap", CSSPropertyWebkitColumnGap}, -#line 196 "CSSPropertyNames.gperf" +#line 197 "CSSPropertyNames.gperf" {"-webkit-margin-collapse", CSSPropertyWebkitMarginCollapse}, #line 160 "CSSPropertyNames.gperf" {"-webkit-background-composite", CSSPropertyWebkitBackgroundComposite}, -#line 195 "CSSPropertyNames.gperf" +#line 196 "CSSPropertyNames.gperf" {"-webkit-margin-bottom-collapse", CSSPropertyWebkitMarginBottomCollapse}, #line 13 "CSSPropertyNames.gperf" {"background-color", CSSPropertyBackgroundColor}, -#line 231 "CSSPropertyNames.gperf" +#line 232 "CSSPropertyNames.gperf" {"-webkit-text-stroke", CSSPropertyWebkitTextStroke}, -#line 271 "CSSPropertyNames.gperf" +#line 272 "CSSPropertyNames.gperf" {"shape-rendering", CSSPropertyShapeRendering}, #line 104 "CSSPropertyNames.gperf" {"page-break-before", CSSPropertyPageBreakBefore}, -#line 235 "CSSPropertyNames.gperf" +#line 236 "CSSPropertyNames.gperf" {"-webkit-transform-origin", CSSPropertyWebkitTransformOrigin}, #line 103 "CSSPropertyNames.gperf" {"page-break-after", CSSPropertyPageBreakAfter}, #line 90 "CSSPropertyNames.gperf" {"outline-color", CSSPropertyOutlineColor}, -#line 207 "CSSPropertyNames.gperf" +#line 208 "CSSPropertyNames.gperf" {"-webkit-mask-box-image", CSSPropertyWebkitMaskBoxImage}, -#line 178 "CSSPropertyNames.gperf" +#line 179 "CSSPropertyNames.gperf" {"-webkit-box-sizing", CSSPropertyWebkitBoxSizing}, #line 71 "CSSPropertyNames.gperf" {"left", CSSPropertyLeft}, -#line 238 "CSSPropertyNames.gperf" +#line 239 "CSSPropertyNames.gperf" {"-webkit-transform-origin-z", CSSPropertyWebkitTransformOriginZ}, #line 68 "CSSPropertyNames.gperf" {"font-variant", CSSPropertyFontVariant}, #line 62 "CSSPropertyNames.gperf" {"float", CSSPropertyFloat}, -#line 253 "CSSPropertyNames.gperf" +#line 254 "CSSPropertyNames.gperf" {"filter", CSSPropertyFilter}, #line 32 "CSSPropertyNames.gperf" {"border-left", CSSPropertyBorderLeft}, -#line 206 "CSSPropertyNames.gperf" +#line 207 "CSSPropertyNames.gperf" {"-webkit-mask-attachment", CSSPropertyWebkitMaskAttachment}, #line 115 "CSSPropertyNames.gperf" {"text-decoration", CSSPropertyTextDecoration}, @@ -529,31 +533,31 @@ findProp (register const char *str, register unsigned int len) {"margin-left", CSSPropertyMarginLeft}, #line 12 "CSSPropertyNames.gperf" {"background-clip", CSSPropertyBackgroundClip}, -#line 198 "CSSPropertyNames.gperf" +#line 199 "CSSPropertyNames.gperf" {"-webkit-margin-top-collapse", CSSPropertyWebkitMarginTopCollapse}, -#line 167 "CSSPropertyNames.gperf" +#line 168 "CSSPropertyNames.gperf" {"-webkit-border-vertical-spacing", CSSPropertyWebkitBorderVerticalSpacing}, -#line 250 "CSSPropertyNames.gperf" +#line 251 "CSSPropertyNames.gperf" {"clip-rule", CSSPropertyClipRule}, -#line 169 "CSSPropertyNames.gperf" +#line 170 "CSSPropertyNames.gperf" {"-webkit-box-direction", CSSPropertyWebkitBoxDirection}, #line 141 "CSSPropertyNames.gperf" {"white-space", CSSPropertyWhiteSpace}, #line 114 "CSSPropertyNames.gperf" {"text-align", CSSPropertyTextAlign}, -#line 216 "CSSPropertyNames.gperf" +#line 217 "CSSPropertyNames.gperf" {"-webkit-mask-repeat-x", CSSPropertyWebkitMaskRepeatX}, #line 159 "CSSPropertyNames.gperf" {"-webkit-background-clip", CSSPropertyWebkitBackgroundClip}, -#line 217 "CSSPropertyNames.gperf" +#line 218 "CSSPropertyNames.gperf" {"-webkit-mask-repeat-y", CSSPropertyWebkitMaskRepeatY}, -#line 168 "CSSPropertyNames.gperf" +#line 169 "CSSPropertyNames.gperf" {"-webkit-box-align", CSSPropertyWebkitBoxAlign}, -#line 213 "CSSPropertyNames.gperf" +#line 214 "CSSPropertyNames.gperf" {"-webkit-mask-position-x", CSSPropertyWebkitMaskPositionX}, #line 99 "CSSPropertyNames.gperf" {"padding-left", CSSPropertyPaddingLeft}, -#line 190 "CSSPropertyNames.gperf" +#line 191 "CSSPropertyNames.gperf" {"-webkit-font-size-delta", CSSPropertyWebkitFontSizeDelta}, #line 27 "CSSPropertyNames.gperf" {"border-bottom-right-radius", CSSPropertyBorderBottomRightRadius}, @@ -561,61 +565,61 @@ findProp (register const char *str, register unsigned int len) {"opacity", CSSPropertyOpacity}, #line 38 "CSSPropertyNames.gperf" {"border-right-color", CSSPropertyBorderRightColor}, -#line 175 "CSSPropertyNames.gperf" +#line 176 "CSSPropertyNames.gperf" {"-webkit-box-pack", CSSPropertyWebkitBoxPack}, -#line 172 "CSSPropertyNames.gperf" +#line 173 "CSSPropertyNames.gperf" {"-webkit-box-lines", CSSPropertyWebkitBoxLines}, #line 42 "CSSPropertyNames.gperf" {"border-style", CSSPropertyBorderStyle}, -#line 214 "CSSPropertyNames.gperf" +#line 215 "CSSPropertyNames.gperf" {"-webkit-mask-position-y", CSSPropertyWebkitMaskPositionY}, #line 94 "CSSPropertyNames.gperf" {"overflow", CSSPropertyOverflow}, #line 28 "CSSPropertyNames.gperf" {"border-bottom-style", CSSPropertyBorderBottomStyle}, -#line 263 "CSSPropertyNames.gperf" +#line 264 "CSSPropertyNames.gperf" {"fill", CSSPropertyFill}, #line 150 "CSSPropertyNames.gperf" {"-webkit-animation-delay", CSSPropertyWebkitAnimationDelay}, -#line 278 "CSSPropertyNames.gperf" +#line 279 "CSSPropertyNames.gperf" {"stroke-opacity", CSSPropertyStrokeOpacity}, #line 123 "CSSPropertyNames.gperf" {"text-overline", CSSPropertyTextOverline}, -#line 182 "CSSPropertyNames.gperf" +#line 183 "CSSPropertyNames.gperf" {"-webkit-column-count", CSSPropertyWebkitColumnCount}, #line 125 "CSSPropertyNames.gperf" {"text-overline-mode", CSSPropertyTextOverlineMode}, #line 46 "CSSPropertyNames.gperf" {"border-top-right-radius", CSSPropertyBorderTopRightRadius}, -#line 241 "CSSPropertyNames.gperf" +#line 242 "CSSPropertyNames.gperf" {"-webkit-transition-delay", CSSPropertyWebkitTransitionDelay}, #line 60 "CSSPropertyNames.gperf" {"display", CSSPropertyDisplay}, #line 93 "CSSPropertyNames.gperf" {"outline-width", CSSPropertyOutlineWidth}, -#line 243 "CSSPropertyNames.gperf" +#line 244 "CSSPropertyNames.gperf" {"-webkit-transition-property", CSSPropertyWebkitTransitionProperty}, #line 47 "CSSPropertyNames.gperf" {"border-top-style", CSSPropertyBorderTopStyle}, -#line 184 "CSSPropertyNames.gperf" +#line 185 "CSSPropertyNames.gperf" {"-webkit-column-rule", CSSPropertyWebkitColumnRule}, #line 140 "CSSPropertyNames.gperf" {"visibility", CSSPropertyVisibility}, -#line 249 "CSSPropertyNames.gperf" +#line 250 "CSSPropertyNames.gperf" {"clip-path", CSSPropertyClipPath}, -#line 258 "CSSPropertyNames.gperf" +#line 259 "CSSPropertyNames.gperf" {"stop-opacity", CSSPropertyStopOpacity}, -#line 248 "CSSPropertyNames.gperf" +#line 249 "CSSPropertyNames.gperf" {"-webkit-variable-declaration-block", CSSPropertyWebkitVariableDeclarationBlock}, -#line 230 "CSSPropertyNames.gperf" +#line 231 "CSSPropertyNames.gperf" {"-webkit-text-size-adjust", CSSPropertyWebkitTextSizeAdjust}, -#line 232 "CSSPropertyNames.gperf" +#line 233 "CSSPropertyNames.gperf" {"-webkit-text-stroke-color", CSSPropertyWebkitTextStrokeColor}, -#line 256 "CSSPropertyNames.gperf" +#line 257 "CSSPropertyNames.gperf" {"lighting-color", CSSPropertyLightingColor}, #line 70 "CSSPropertyNames.gperf" {"height", CSSPropertyHeight}, -#line 254 "CSSPropertyNames.gperf" +#line 255 "CSSPropertyNames.gperf" {"flood-color", CSSPropertyFloodColor}, #line 156 "CSSPropertyNames.gperf" {"-webkit-animation-timing-function", CSSPropertyWebkitAnimationTimingFunction}, @@ -635,21 +639,21 @@ findProp (register const char *str, register unsigned int len) {"border-left-color", CSSPropertyBorderLeftColor}, #line 74 "CSSPropertyNames.gperf" {"list-style", CSSPropertyListStyle}, -#line 164 "CSSPropertyNames.gperf" +#line 165 "CSSPropertyNames.gperf" {"-webkit-border-horizontal-spacing", CSSPropertyWebkitBorderHorizontalSpacing}, -#line 244 "CSSPropertyNames.gperf" +#line 245 "CSSPropertyNames.gperf" {"-webkit-transition-timing-function", CSSPropertyWebkitTransitionTimingFunction}, #line 75 "CSSPropertyNames.gperf" {"list-style-image", CSSPropertyListStyleImage}, #line 40 "CSSPropertyNames.gperf" {"border-right-width", CSSPropertyBorderRightWidth}, -#line 188 "CSSPropertyNames.gperf" +#line 189 "CSSPropertyNames.gperf" {"-webkit-column-width", CSSPropertyWebkitColumnWidth}, #line 20 "CSSPropertyNames.gperf" {"background-repeat-x", CSSPropertyBackgroundRepeatX}, #line 69 "CSSPropertyNames.gperf" {"font-weight", CSSPropertyFontWeight}, -#line 261 "CSSPropertyNames.gperf" +#line 262 "CSSPropertyNames.gperf" {"color-profile", CSSPropertyColorProfile}, #line 45 "CSSPropertyNames.gperf" {"border-top-left-radius", CSSPropertyBorderTopLeftRadius}, @@ -659,21 +663,21 @@ findProp (register const char *str, register unsigned int len) {"background-position-x", CSSPropertyBackgroundPositionX}, #line 84 "CSSPropertyNames.gperf" {"max-width", CSSPropertyMaxWidth}, -#line 224 "CSSPropertyNames.gperf" +#line 225 "CSSPropertyNames.gperf" {"-webkit-perspective-origin-x", CSSPropertyWebkitPerspectiveOriginX}, -#line 180 "CSSPropertyNames.gperf" +#line 181 "CSSPropertyNames.gperf" {"-webkit-column-break-before", CSSPropertyWebkitColumnBreakBefore}, -#line 179 "CSSPropertyNames.gperf" +#line 180 "CSSPropertyNames.gperf" {"-webkit-column-break-after", CSSPropertyWebkitColumnBreakAfter}, #line 18 "CSSPropertyNames.gperf" {"background-position-y", CSSPropertyBackgroundPositionY}, -#line 191 "CSSPropertyNames.gperf" +#line 192 "CSSPropertyNames.gperf" {"-webkit-font-smoothing", CSSPropertyWebkitFontSmoothing}, -#line 173 "CSSPropertyNames.gperf" +#line 174 "CSSPropertyNames.gperf" {"-webkit-box-ordinal-group", CSSPropertyWebkitBoxOrdinalGroup}, -#line 204 "CSSPropertyNames.gperf" +#line 205 "CSSPropertyNames.gperf" {"-webkit-marquee-style", CSSPropertyWebkitMarqueeStyle}, -#line 225 "CSSPropertyNames.gperf" +#line 226 "CSSPropertyNames.gperf" {"-webkit-perspective-origin-y", CSSPropertyWebkitPerspectiveOriginY}, #line 129 "CSSPropertyNames.gperf" {"text-shadow", CSSPropertyTextShadow}, @@ -683,13 +687,13 @@ findProp (register const char *str, register unsigned int len) {"list-style-position", CSSPropertyListStylePosition}, #line 113 "CSSPropertyNames.gperf" {"table-layout", CSSPropertyTableLayout}, -#line 177 "CSSPropertyNames.gperf" +#line 178 "CSSPropertyNames.gperf" {"-webkit-box-shadow", CSSPropertyWebkitBoxShadow}, #line 124 "CSSPropertyNames.gperf" {"text-overline-color", CSSPropertyTextOverlineColor}, #line 61 "CSSPropertyNames.gperf" {"empty-cells", CSSPropertyEmptyCells}, -#line 233 "CSSPropertyNames.gperf" +#line 234 "CSSPropertyNames.gperf" {"-webkit-text-stroke-width", CSSPropertyWebkitTextStrokeWidth}, #line 130 "CSSPropertyNames.gperf" {"text-transform", CSSPropertyTextTransform}, @@ -697,25 +701,25 @@ findProp (register const char *str, register unsigned int len) {"font-stretch", CSSPropertyFontStretch}, #line 92 "CSSPropertyNames.gperf" {"outline-style", CSSPropertyOutlineStyle}, -#line 286 "CSSPropertyNames.gperf" +#line 287 "CSSPropertyNames.gperf" {"text-anchor", CSSPropertyTextAnchor}, -#line 185 "CSSPropertyNames.gperf" +#line 186 "CSSPropertyNames.gperf" {"-webkit-column-rule-color", CSSPropertyWebkitColumnRuleColor}, -#line 273 "CSSPropertyNames.gperf" +#line 274 "CSSPropertyNames.gperf" {"stroke-dasharray", CSSPropertyStrokeDasharray}, #line 35 "CSSPropertyNames.gperf" {"border-left-width", CSSPropertyBorderLeftWidth}, -#line 265 "CSSPropertyNames.gperf" +#line 266 "CSSPropertyNames.gperf" {"fill-rule", CSSPropertyFillRule}, -#line 236 "CSSPropertyNames.gperf" +#line 237 "CSSPropertyNames.gperf" {"-webkit-transform-origin-x", CSSPropertyWebkitTransformOriginX}, -#line 281 "CSSPropertyNames.gperf" +#line 282 "CSSPropertyNames.gperf" {"baseline-shift", CSSPropertyBaselineShift}, #line 132 "CSSPropertyNames.gperf" {"text-underline-color", CSSPropertyTextUnderlineColor}, -#line 237 "CSSPropertyNames.gperf" +#line 238 "CSSPropertyNames.gperf" {"-webkit-transform-origin-y", CSSPropertyWebkitTransformOriginY}, -#line 260 "CSSPropertyNames.gperf" +#line 261 "CSSPropertyNames.gperf" {"color-interpolation-filters", CSSPropertyColorInterpolationFilters}, #line 39 "CSSPropertyNames.gperf" {"border-right-style", CSSPropertyBorderRightStyle}, @@ -727,63 +731,63 @@ findProp (register const char *str, register unsigned int len) {"overflow-x", CSSPropertyOverflowX}, #line 122 "CSSPropertyNames.gperf" {"text-overflow", CSSPropertyTextOverflow}, -#line 176 "CSSPropertyNames.gperf" +#line 177 "CSSPropertyNames.gperf" {"-webkit-box-reflect", CSSPropertyWebkitBoxReflect}, -#line 246 "CSSPropertyNames.gperf" +#line 247 "CSSPropertyNames.gperf" {"-webkit-user-modify", CSSPropertyWebkitUserModify}, -#line 187 "CSSPropertyNames.gperf" +#line 188 "CSSPropertyNames.gperf" {"-webkit-column-rule-width", CSSPropertyWebkitColumnRuleWidth}, #line 96 "CSSPropertyNames.gperf" {"overflow-y", CSSPropertyOverflowY}, -#line 239 "CSSPropertyNames.gperf" +#line 240 "CSSPropertyNames.gperf" {"-webkit-transform-style", CSSPropertyWebkitTransformStyle}, #line 91 "CSSPropertyNames.gperf" {"outline-offset", CSSPropertyOutlineOffset}, #line 135 "CSSPropertyNames.gperf" {"text-underline-width", CSSPropertyTextUnderlineWidth}, -#line 255 "CSSPropertyNames.gperf" +#line 256 "CSSPropertyNames.gperf" {"flood-opacity", CSSPropertyFloodOpacity}, #line 34 "CSSPropertyNames.gperf" {"border-left-style", CSSPropertyBorderLeftStyle}, #line 83 "CSSPropertyNames.gperf" {"max-height", CSSPropertyMaxHeight}, -#line 229 "CSSPropertyNames.gperf" +#line 230 "CSSPropertyNames.gperf" {"-webkit-text-security", CSSPropertyWebkitTextSecurity}, -#line 192 "CSSPropertyNames.gperf" +#line 193 "CSSPropertyNames.gperf" {"-webkit-highlight", CSSPropertyWebkitHighlight}, -#line 264 "CSSPropertyNames.gperf" +#line 265 "CSSPropertyNames.gperf" {"fill-opacity", CSSPropertyFillOpacity}, -#line 274 "CSSPropertyNames.gperf" +#line 275 "CSSPropertyNames.gperf" {"stroke-dashoffset", CSSPropertyStrokeDashoffset}, #line 126 "CSSPropertyNames.gperf" {"text-overline-style", CSSPropertyTextOverlineStyle}, #line 77 "CSSPropertyNames.gperf" {"list-style-type", CSSPropertyListStyleType}, -#line 219 "CSSPropertyNames.gperf" +#line 220 "CSSPropertyNames.gperf" {"-webkit-match-nearest-mail-blockquote-color", CSSPropertyWebkitMatchNearestMailBlockquoteColor}, -#line 186 "CSSPropertyNames.gperf" +#line 187 "CSSPropertyNames.gperf" {"-webkit-column-rule-style", CSSPropertyWebkitColumnRuleStyle}, #line 158 "CSSPropertyNames.gperf" {"-webkit-backface-visibility", CSSPropertyWebkitBackfaceVisibility}, -#line 228 "CSSPropertyNames.gperf" +#line 229 "CSSPropertyNames.gperf" {"-webkit-text-fill-color", CSSPropertyWebkitTextFillColor}, #line 134 "CSSPropertyNames.gperf" {"text-underline-style", CSSPropertyTextUnderlineStyle}, -#line 284 "CSSPropertyNames.gperf" +#line 285 "CSSPropertyNames.gperf" {"glyph-orientation-vertical", CSSPropertyGlyphOrientationVertical}, #line 64 "CSSPropertyNames.gperf" {"font-family", CSSPropertyFontFamily}, -#line 170 "CSSPropertyNames.gperf" +#line 171 "CSSPropertyNames.gperf" {"-webkit-box-flex", CSSPropertyWebkitBoxFlex}, #line 117 "CSSPropertyNames.gperf" {"text-line-through", CSSPropertyTextLineThrough}, #line 119 "CSSPropertyNames.gperf" {"text-line-through-mode", CSSPropertyTextLineThroughMode}, -#line 227 "CSSPropertyNames.gperf" +#line 228 "CSSPropertyNames.gperf" {"-webkit-text-decorations-in-effect", CSSPropertyWebkitTextDecorationsInEffect}, -#line 283 "CSSPropertyNames.gperf" +#line 284 "CSSPropertyNames.gperf" {"glyph-orientation-horizontal", CSSPropertyGlyphOrientationHorizontal}, -#line 171 "CSSPropertyNames.gperf" +#line 172 "CSSPropertyNames.gperf" {"-webkit-box-flex-group", CSSPropertyWebkitBoxFlexGroup}, #line 118 "CSSPropertyNames.gperf" {"text-line-through-color", CSSPropertyTextLineThroughColor}, @@ -825,113 +829,113 @@ findProp (register const char *str, register unsigned int len) -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, 81, -1, 82, 83, -1, -1, 84, 85, -1, -1, -1, 86, -1, 87, 88, -1, -1, - -1, -1, -1, 89, -1, 90, -1, -1, -1, -1, - 91, -1, -1, -1, -1, -1, -1, 92, -1, -1, - -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, - 94, -1, 95, -1, -1, 96, -1, -1, -1, 97, - -1, -1, -1, -1, 98, -1, 99, 100, -1, -1, - -1, -1, 101, -1, 102, -1, -1, 103, -1, 104, - -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, - -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, - 107, -1, -1, 108, 109, -1, -1, -1, 110, -1, - -1, -1, -1, -1, 111, 112, 113, 114, -1, 115, - -1, -1, -1, -1, -1, -1, -1, 116, 117, 118, - -1, 119, -1, -1, 120, -1, -1, 121, 122, -1, - -1, -1, 123, 124, -1, -1, -1, -1, 125, -1, - -1, -1, -1, 126, -1, 127, 128, -1, -1, 129, - 130, -1, 131, -1, 132, -1, 133, -1, 134, -1, - -1, -1, 135, 136, 137, -1, 138, 139, -1, -1, - 140, 141, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 142, -1, 143, -1, -1, -1, -1, -1, -1, - 144, 145, -1, -1, -1, 146, -1, 147, -1, -1, - -1, 148, -1, -1, 149, -1, 150, -1, -1, -1, - -1, 151, -1, -1, -1, 152, 153, -1, 154, -1, + -1, -1, -1, 89, -1, 90, -1, -1, 91, -1, + 92, -1, -1, -1, -1, -1, -1, 93, -1, -1, + -1, -1, -1, -1, 94, -1, -1, -1, -1, -1, + 95, -1, 96, -1, -1, 97, -1, -1, -1, 98, + -1, -1, -1, -1, 99, -1, 100, 101, -1, -1, + -1, -1, 102, -1, 103, -1, -1, 104, -1, 105, + -1, -1, -1, -1, -1, -1, -1, 106, -1, -1, + -1, -1, 107, -1, -1, -1, -1, -1, -1, -1, + 108, -1, -1, 109, 110, -1, -1, -1, 111, 112, + -1, -1, -1, -1, 113, 114, 115, 116, -1, 117, + -1, -1, -1, -1, -1, -1, -1, 118, 119, 120, + -1, 121, -1, -1, 122, -1, -1, 123, 124, -1, + -1, -1, 125, 126, -1, -1, -1, -1, 127, -1, + -1, -1, -1, 128, -1, 129, 130, -1, -1, 131, + 132, -1, 133, -1, 134, -1, 135, -1, 136, -1, + -1, -1, 137, 138, 139, -1, 140, 141, -1, -1, + 142, 143, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 144, -1, 145, -1, -1, -1, -1, -1, -1, + 146, 147, -1, -1, -1, 148, -1, 149, -1, -1, + -1, 150, -1, -1, 151, -1, 152, -1, -1, -1, + -1, 153, -1, -1, -1, 154, 155, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 155, 156, 157, -1, - -1, -1, 158, 159, -1, -1, 160, 161, 162, -1, - -1, 163, 164, -1, -1, -1, -1, 165, 166, -1, - -1, -1, -1, 167, 168, -1, -1, -1, -1, 169, - -1, -1, -1, 170, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 171, -1, -1, -1, 172, -1, - 173, -1, -1, 174, -1, -1, -1, -1, 175, 176, - -1, -1, 177, 178, -1, -1, -1, -1, -1, -1, - -1, -1, 179, -1, -1, -1, 180, -1, -1, 181, - 182, -1, -1, -1, -1, -1, -1, -1, -1, 183, - -1, -1, 184, -1, 185, -1, -1, -1, -1, 186, - 187, -1, -1, -1, 188, -1, -1, -1, -1, -1, - -1, 189, -1, -1, -1, -1, 190, -1, 191, 192, - 193, -1, -1, 194, 195, -1, -1, -1, -1, -1, - 196, 197, 198, -1, -1, 199, -1, -1, -1, -1, - -1, -1, -1, 200, 201, -1, -1, -1, -1, -1, - -1, 202, -1, 203, -1, -1, -1, -1, -1, -1, - 204, -1, -1, -1, 205, -1, 206, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 207, -1, - -1, -1, 208, -1, 209, -1, 210, -1, -1, 211, - -1, -1, -1, 212, -1, -1, -1, 213, -1, -1, - -1, 214, -1, -1, -1, -1, 215, 216, -1, -1, - 217, 218, -1, 219, -1, -1, 220, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 221, -1, -1, 222, - -1, -1, -1, -1, -1, -1, -1, 223, 224, 225, - -1, 226, -1, -1, -1, 227, -1, -1, -1, 228, - -1, -1, 229, -1, -1, -1, -1, -1, 230, -1, - -1, 231, -1, -1, -1, -1, -1, -1, -1, -1, - 232, -1, -1, -1, -1, -1, 233, 234, -1, -1, - -1, -1, -1, -1, 235, -1, -1, -1, -1, -1, - -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 237, - 238, 239, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 157, 158, 159, -1, + -1, -1, 160, 161, -1, -1, 162, 163, 164, -1, + -1, 165, 166, -1, -1, -1, -1, 167, 168, -1, + -1, -1, -1, 169, 170, -1, -1, -1, -1, 171, + -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 173, -1, -1, -1, 174, -1, + 175, -1, -1, 176, -1, -1, -1, -1, 177, 178, + -1, -1, 179, 180, -1, -1, -1, -1, -1, -1, + -1, -1, 181, -1, -1, -1, 182, -1, -1, 183, + 184, -1, -1, -1, -1, -1, -1, -1, -1, 185, + -1, -1, 186, -1, 187, -1, -1, -1, -1, 188, + 189, -1, -1, -1, 190, -1, -1, -1, -1, -1, + -1, 191, -1, -1, -1, -1, 192, -1, 193, 194, + 195, -1, -1, 196, 197, -1, -1, -1, -1, -1, + 198, 199, 200, -1, -1, 201, -1, -1, -1, -1, + -1, -1, -1, 202, 203, -1, -1, -1, -1, -1, + -1, 204, -1, 205, -1, -1, -1, -1, -1, -1, + 206, -1, -1, -1, 207, -1, 208, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 209, -1, + -1, -1, 210, -1, 211, -1, 212, -1, -1, 213, + -1, -1, -1, 214, -1, -1, -1, 215, -1, -1, + -1, 216, -1, -1, -1, -1, 217, 218, -1, -1, + 219, 220, -1, 221, -1, -1, 222, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 223, -1, -1, 224, + -1, -1, -1, -1, -1, -1, -1, 225, 226, 227, + -1, 228, -1, -1, -1, 229, -1, -1, -1, 230, + -1, -1, 231, -1, -1, -1, -1, -1, 232, -1, + -1, 233, -1, -1, -1, -1, -1, -1, -1, -1, + 234, -1, -1, -1, -1, -1, 235, 236, -1, -1, + -1, -1, -1, -1, 237, -1, -1, -1, -1, -1, + -1, 238, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 239, + 240, 241, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 240, -1, -1, -1, -1, -1, 241, -1, - -1, -1, -1, -1, -1, 242, -1, -1, -1, -1, + -1, -1, 242, -1, -1, -1, -1, -1, 243, -1, + -1, -1, -1, -1, -1, 244, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 245, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 244, -1, -1, 245, -1, -1, -1, -1, -1, 246, - -1, -1, -1, -1, 247, 248, -1, -1, -1, -1, - 249, -1, -1, 250, -1, -1, -1, -1, -1, -1, + 246, -1, -1, 247, -1, -1, -1, -1, -1, 248, + -1, -1, -1, -1, 249, 250, -1, -1, -1, -1, + 251, -1, -1, 252, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 251, - -1, -1, -1, -1, -1, 252, -1, -1, -1, -1, - -1, -1, -1, 253, -1, -1, -1, -1, -1, -1, - -1, -1, 254, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 253, + -1, -1, -1, -1, -1, 254, -1, -1, -1, -1, + -1, -1, -1, 255, -1, -1, -1, -1, -1, -1, + -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 255, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 256, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 258, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 257, -1, -1, -1, -1, 258, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 259, -1, 260, + -1, -1, 259, -1, -1, -1, -1, 260, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 261, -1, 262, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 261, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 262, -1, - 263, -1, -1, -1, -1, -1, -1, 264, -1, -1, - -1, -1, -1, 265, -1, -1, -1, -1, -1, -1, + 263, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 264, -1, + 265, -1, -1, -1, -1, -1, -1, 266, -1, -1, + -1, -1, -1, 267, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 266, -1, -1, -1, -1, -1, 267, -1, -1, -1, + 268, -1, -1, -1, -1, -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 268, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 270, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 271, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 270, -1, -1, -1, -1, 271, -1, -1, + -1, -1, 272, -1, -1, -1, -1, 273, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 274, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 273, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 275, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -939,10 +943,10 @@ findProp (register const char *str, register unsigned int len) -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 274, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 276, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 275, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 277, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -956,7 +960,7 @@ findProp (register const char *str, register unsigned int len) -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 276, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 278, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -976,7 +980,7 @@ findProp (register const char *str, register unsigned int len) -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 277 + -1, -1, -1, 279 }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) @@ -998,9 +1002,9 @@ findProp (register const char *str, register unsigned int len) } return 0; } -#line 288 "CSSPropertyNames.gperf" +#line 290 "CSSPropertyNames.gperf" -static const char * const propertyNameStrings[278] = { +static const char * const propertyNameStrings[280] = { "background", "background-attachment", "background-clip", @@ -1153,6 +1157,7 @@ static const char * const propertyNameStrings[278] = { "-webkit-background-clip", "-webkit-background-composite", "-webkit-background-origin", +"-webkit-background-size", "-webkit-binding", "-webkit-border-fit", "-webkit-border-horizontal-spacing", @@ -1279,6 +1284,7 @@ static const char * const propertyNameStrings[278] = { "kerning", "text-anchor", "writing-mode", +"-webkit-shadow", }; const char* getPropertyName(CSSPropertyID id) { diff --git a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h index f1332e3..8957af8 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h +++ b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h @@ -157,136 +157,138 @@ enum CSSPropertyID { CSSPropertyWebkitBackgroundClip = 1150, CSSPropertyWebkitBackgroundComposite = 1151, CSSPropertyWebkitBackgroundOrigin = 1152, - CSSPropertyWebkitBinding = 1153, - CSSPropertyWebkitBorderFit = 1154, - CSSPropertyWebkitBorderHorizontalSpacing = 1155, - CSSPropertyWebkitBorderImage = 1156, - CSSPropertyWebkitBorderRadius = 1157, - CSSPropertyWebkitBorderVerticalSpacing = 1158, - CSSPropertyWebkitBoxAlign = 1159, - CSSPropertyWebkitBoxDirection = 1160, - CSSPropertyWebkitBoxFlex = 1161, - CSSPropertyWebkitBoxFlexGroup = 1162, - CSSPropertyWebkitBoxLines = 1163, - CSSPropertyWebkitBoxOrdinalGroup = 1164, - CSSPropertyWebkitBoxOrient = 1165, - CSSPropertyWebkitBoxPack = 1166, - CSSPropertyWebkitBoxReflect = 1167, - CSSPropertyWebkitBoxShadow = 1168, - CSSPropertyWebkitBoxSizing = 1169, - CSSPropertyWebkitColumnBreakAfter = 1170, - CSSPropertyWebkitColumnBreakBefore = 1171, - CSSPropertyWebkitColumnBreakInside = 1172, - CSSPropertyWebkitColumnCount = 1173, - CSSPropertyWebkitColumnGap = 1174, - CSSPropertyWebkitColumnRule = 1175, - CSSPropertyWebkitColumnRuleColor = 1176, - CSSPropertyWebkitColumnRuleStyle = 1177, - CSSPropertyWebkitColumnRuleWidth = 1178, - CSSPropertyWebkitColumnWidth = 1179, - CSSPropertyWebkitColumns = 1180, - CSSPropertyWebkitFontSizeDelta = 1181, - CSSPropertyWebkitFontSmoothing = 1182, - CSSPropertyWebkitHighlight = 1183, - CSSPropertyWebkitLineBreak = 1184, - CSSPropertyWebkitLineClamp = 1185, - CSSPropertyWebkitMarginBottomCollapse = 1186, - CSSPropertyWebkitMarginCollapse = 1187, - CSSPropertyWebkitMarginStart = 1188, - CSSPropertyWebkitMarginTopCollapse = 1189, - CSSPropertyWebkitMarquee = 1190, - CSSPropertyWebkitMarqueeDirection = 1191, - CSSPropertyWebkitMarqueeIncrement = 1192, - CSSPropertyWebkitMarqueeRepetition = 1193, - CSSPropertyWebkitMarqueeSpeed = 1194, - CSSPropertyWebkitMarqueeStyle = 1195, - CSSPropertyWebkitMask = 1196, - CSSPropertyWebkitMaskAttachment = 1197, - CSSPropertyWebkitMaskBoxImage = 1198, - CSSPropertyWebkitMaskClip = 1199, - CSSPropertyWebkitMaskComposite = 1200, - CSSPropertyWebkitMaskImage = 1201, - CSSPropertyWebkitMaskOrigin = 1202, - CSSPropertyWebkitMaskPosition = 1203, - CSSPropertyWebkitMaskPositionX = 1204, - CSSPropertyWebkitMaskPositionY = 1205, - CSSPropertyWebkitMaskRepeat = 1206, - CSSPropertyWebkitMaskRepeatX = 1207, - CSSPropertyWebkitMaskRepeatY = 1208, - CSSPropertyWebkitMaskSize = 1209, - CSSPropertyWebkitMatchNearestMailBlockquoteColor = 1210, - CSSPropertyWebkitNbspMode = 1211, - CSSPropertyWebkitPaddingStart = 1212, - CSSPropertyWebkitPerspective = 1213, - CSSPropertyWebkitPerspectiveOrigin = 1214, - CSSPropertyWebkitPerspectiveOriginX = 1215, - CSSPropertyWebkitPerspectiveOriginY = 1216, - CSSPropertyWebkitRtlOrdering = 1217, - CSSPropertyWebkitTextDecorationsInEffect = 1218, - CSSPropertyWebkitTextFillColor = 1219, - CSSPropertyWebkitTextSecurity = 1220, - CSSPropertyWebkitTextSizeAdjust = 1221, - CSSPropertyWebkitTextStroke = 1222, - CSSPropertyWebkitTextStrokeColor = 1223, - CSSPropertyWebkitTextStrokeWidth = 1224, - CSSPropertyWebkitTransform = 1225, - CSSPropertyWebkitTransformOrigin = 1226, - CSSPropertyWebkitTransformOriginX = 1227, - CSSPropertyWebkitTransformOriginY = 1228, - CSSPropertyWebkitTransformOriginZ = 1229, - CSSPropertyWebkitTransformStyle = 1230, - CSSPropertyWebkitTransition = 1231, - CSSPropertyWebkitTransitionDelay = 1232, - CSSPropertyWebkitTransitionDuration = 1233, - CSSPropertyWebkitTransitionProperty = 1234, - CSSPropertyWebkitTransitionTimingFunction = 1235, - CSSPropertyWebkitUserDrag = 1236, - CSSPropertyWebkitUserModify = 1237, - CSSPropertyWebkitUserSelect = 1238, - CSSPropertyWebkitVariableDeclarationBlock = 1239, - CSSPropertyClipPath = 1240, - CSSPropertyClipRule = 1241, - CSSPropertyMask = 1242, - CSSPropertyEnableBackground = 1243, - CSSPropertyFilter = 1244, - CSSPropertyFloodColor = 1245, - CSSPropertyFloodOpacity = 1246, - CSSPropertyLightingColor = 1247, - CSSPropertyStopColor = 1248, - CSSPropertyStopOpacity = 1249, - CSSPropertyColorInterpolation = 1250, - CSSPropertyColorInterpolationFilters = 1251, - CSSPropertyColorProfile = 1252, - CSSPropertyColorRendering = 1253, - CSSPropertyFill = 1254, - CSSPropertyFillOpacity = 1255, - CSSPropertyFillRule = 1256, - CSSPropertyImageRendering = 1257, - CSSPropertyMarker = 1258, - CSSPropertyMarkerEnd = 1259, - CSSPropertyMarkerMid = 1260, - CSSPropertyMarkerStart = 1261, - CSSPropertyShapeRendering = 1262, - CSSPropertyStroke = 1263, - CSSPropertyStrokeDasharray = 1264, - CSSPropertyStrokeDashoffset = 1265, - CSSPropertyStrokeLinecap = 1266, - CSSPropertyStrokeLinejoin = 1267, - CSSPropertyStrokeMiterlimit = 1268, - CSSPropertyStrokeOpacity = 1269, - CSSPropertyStrokeWidth = 1270, - CSSPropertyAlignmentBaseline = 1271, - CSSPropertyBaselineShift = 1272, - CSSPropertyDominantBaseline = 1273, - CSSPropertyGlyphOrientationHorizontal = 1274, - CSSPropertyGlyphOrientationVertical = 1275, - CSSPropertyKerning = 1276, - CSSPropertyTextAnchor = 1277, - CSSPropertyWritingMode = 1278, + CSSPropertyWebkitBackgroundSize = 1153, + CSSPropertyWebkitBinding = 1154, + CSSPropertyWebkitBorderFit = 1155, + CSSPropertyWebkitBorderHorizontalSpacing = 1156, + CSSPropertyWebkitBorderImage = 1157, + CSSPropertyWebkitBorderRadius = 1158, + CSSPropertyWebkitBorderVerticalSpacing = 1159, + CSSPropertyWebkitBoxAlign = 1160, + CSSPropertyWebkitBoxDirection = 1161, + CSSPropertyWebkitBoxFlex = 1162, + CSSPropertyWebkitBoxFlexGroup = 1163, + CSSPropertyWebkitBoxLines = 1164, + CSSPropertyWebkitBoxOrdinalGroup = 1165, + CSSPropertyWebkitBoxOrient = 1166, + CSSPropertyWebkitBoxPack = 1167, + CSSPropertyWebkitBoxReflect = 1168, + CSSPropertyWebkitBoxShadow = 1169, + CSSPropertyWebkitBoxSizing = 1170, + CSSPropertyWebkitColumnBreakAfter = 1171, + CSSPropertyWebkitColumnBreakBefore = 1172, + CSSPropertyWebkitColumnBreakInside = 1173, + CSSPropertyWebkitColumnCount = 1174, + CSSPropertyWebkitColumnGap = 1175, + CSSPropertyWebkitColumnRule = 1176, + CSSPropertyWebkitColumnRuleColor = 1177, + CSSPropertyWebkitColumnRuleStyle = 1178, + CSSPropertyWebkitColumnRuleWidth = 1179, + CSSPropertyWebkitColumnWidth = 1180, + CSSPropertyWebkitColumns = 1181, + CSSPropertyWebkitFontSizeDelta = 1182, + CSSPropertyWebkitFontSmoothing = 1183, + CSSPropertyWebkitHighlight = 1184, + CSSPropertyWebkitLineBreak = 1185, + CSSPropertyWebkitLineClamp = 1186, + CSSPropertyWebkitMarginBottomCollapse = 1187, + CSSPropertyWebkitMarginCollapse = 1188, + CSSPropertyWebkitMarginStart = 1189, + CSSPropertyWebkitMarginTopCollapse = 1190, + CSSPropertyWebkitMarquee = 1191, + CSSPropertyWebkitMarqueeDirection = 1192, + CSSPropertyWebkitMarqueeIncrement = 1193, + CSSPropertyWebkitMarqueeRepetition = 1194, + CSSPropertyWebkitMarqueeSpeed = 1195, + CSSPropertyWebkitMarqueeStyle = 1196, + CSSPropertyWebkitMask = 1197, + CSSPropertyWebkitMaskAttachment = 1198, + CSSPropertyWebkitMaskBoxImage = 1199, + CSSPropertyWebkitMaskClip = 1200, + CSSPropertyWebkitMaskComposite = 1201, + CSSPropertyWebkitMaskImage = 1202, + CSSPropertyWebkitMaskOrigin = 1203, + CSSPropertyWebkitMaskPosition = 1204, + CSSPropertyWebkitMaskPositionX = 1205, + CSSPropertyWebkitMaskPositionY = 1206, + CSSPropertyWebkitMaskRepeat = 1207, + CSSPropertyWebkitMaskRepeatX = 1208, + CSSPropertyWebkitMaskRepeatY = 1209, + CSSPropertyWebkitMaskSize = 1210, + CSSPropertyWebkitMatchNearestMailBlockquoteColor = 1211, + CSSPropertyWebkitNbspMode = 1212, + CSSPropertyWebkitPaddingStart = 1213, + CSSPropertyWebkitPerspective = 1214, + CSSPropertyWebkitPerspectiveOrigin = 1215, + CSSPropertyWebkitPerspectiveOriginX = 1216, + CSSPropertyWebkitPerspectiveOriginY = 1217, + CSSPropertyWebkitRtlOrdering = 1218, + CSSPropertyWebkitTextDecorationsInEffect = 1219, + CSSPropertyWebkitTextFillColor = 1220, + CSSPropertyWebkitTextSecurity = 1221, + CSSPropertyWebkitTextSizeAdjust = 1222, + CSSPropertyWebkitTextStroke = 1223, + CSSPropertyWebkitTextStrokeColor = 1224, + CSSPropertyWebkitTextStrokeWidth = 1225, + CSSPropertyWebkitTransform = 1226, + CSSPropertyWebkitTransformOrigin = 1227, + CSSPropertyWebkitTransformOriginX = 1228, + CSSPropertyWebkitTransformOriginY = 1229, + CSSPropertyWebkitTransformOriginZ = 1230, + CSSPropertyWebkitTransformStyle = 1231, + CSSPropertyWebkitTransition = 1232, + CSSPropertyWebkitTransitionDelay = 1233, + CSSPropertyWebkitTransitionDuration = 1234, + CSSPropertyWebkitTransitionProperty = 1235, + CSSPropertyWebkitTransitionTimingFunction = 1236, + CSSPropertyWebkitUserDrag = 1237, + CSSPropertyWebkitUserModify = 1238, + CSSPropertyWebkitUserSelect = 1239, + CSSPropertyWebkitVariableDeclarationBlock = 1240, + CSSPropertyClipPath = 1241, + CSSPropertyClipRule = 1242, + CSSPropertyMask = 1243, + CSSPropertyEnableBackground = 1244, + CSSPropertyFilter = 1245, + CSSPropertyFloodColor = 1246, + CSSPropertyFloodOpacity = 1247, + CSSPropertyLightingColor = 1248, + CSSPropertyStopColor = 1249, + CSSPropertyStopOpacity = 1250, + CSSPropertyColorInterpolation = 1251, + CSSPropertyColorInterpolationFilters = 1252, + CSSPropertyColorProfile = 1253, + CSSPropertyColorRendering = 1254, + CSSPropertyFill = 1255, + CSSPropertyFillOpacity = 1256, + CSSPropertyFillRule = 1257, + CSSPropertyImageRendering = 1258, + CSSPropertyMarker = 1259, + CSSPropertyMarkerEnd = 1260, + CSSPropertyMarkerMid = 1261, + CSSPropertyMarkerStart = 1262, + CSSPropertyShapeRendering = 1263, + CSSPropertyStroke = 1264, + CSSPropertyStrokeDasharray = 1265, + CSSPropertyStrokeDashoffset = 1266, + CSSPropertyStrokeLinecap = 1267, + CSSPropertyStrokeLinejoin = 1268, + CSSPropertyStrokeMiterlimit = 1269, + CSSPropertyStrokeOpacity = 1270, + CSSPropertyStrokeWidth = 1271, + CSSPropertyAlignmentBaseline = 1272, + CSSPropertyBaselineShift = 1273, + CSSPropertyDominantBaseline = 1274, + CSSPropertyGlyphOrientationHorizontal = 1275, + CSSPropertyGlyphOrientationVertical = 1276, + CSSPropertyKerning = 1277, + CSSPropertyTextAnchor = 1278, + CSSPropertyWritingMode = 1279, + CSSPropertyWebkitShadow = 1280, }; const int firstCSSProperty = 1001; -const int numCSSProperties = 278; +const int numCSSProperties = 280; const size_t maxCSSPropertyNameLength = 43; const char* getPropertyName(CSSPropertyID); diff --git a/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp b/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp index d472340..bee17ac 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp @@ -149,7 +149,7 @@ JSAbstractWorker::JSAbstractWorker(NonNullPassRefPtr structure, JSDOM JSAbstractWorker::~JSAbstractWorker() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } void JSAbstractWorker::markChildren(MarkStack& markStack) @@ -199,7 +199,7 @@ void setJSAbstractWorkerOnerror(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); AbstractWorker* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp b/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp index 2f02580..348c086 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp @@ -76,7 +76,7 @@ JSBarInfo::JSBarInfo(NonNullPassRefPtr structure, JSDOMGlobalObject* JSBarInfo::~JSBarInfo() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSBarInfo::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp index 307b17a..8d99056 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp @@ -162,7 +162,7 @@ JSCSSRule::JSCSSRule(NonNullPassRefPtr structure, JSDOMGlobalObject* JSCSSRule::~JSCSSRule() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSRule::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp index e02a6ce..0bb58c2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp @@ -140,7 +140,7 @@ JSCSSRuleList::JSCSSRuleList(NonNullPassRefPtr structure, JSDOMGlobal JSCSSRuleList::~JSCSSRuleList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSRuleList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp index 6292b64..5fbf986 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp @@ -154,7 +154,7 @@ JSCSSStyleDeclaration::JSCSSStyleDeclaration(NonNullPassRefPtr struct JSCSSStyleDeclaration::~JSCSSStyleDeclaration() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSStyleDeclaration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp index 22f6c30..1cb1b75 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp @@ -145,7 +145,7 @@ JSCSSValue::JSCSSValue(NonNullPassRefPtr structure, JSDOMGlobalObject JSCSSValue::~JSCSSValue() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSValue::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp index ef1d726..975d56d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp @@ -147,7 +147,7 @@ JSCSSVariablesDeclaration::JSCSSVariablesDeclaration(NonNullPassRefPtrglobalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSVariablesDeclaration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp index aeeeb4f..05be08c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp @@ -93,7 +93,7 @@ JSCanvasArray::JSCanvasArray(NonNullPassRefPtr structure, JSDOMGlobal JSCanvasArray::~JSCanvasArray() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp index cf1c0fe..7099ce9 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp @@ -80,7 +80,7 @@ JSCanvasArrayBuffer::JSCanvasArrayBuffer(NonNullPassRefPtr structure, JSCanvasArrayBuffer::~JSCanvasArrayBuffer() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasArrayBuffer::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp index 22de482..4d2bfa3 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp @@ -74,7 +74,7 @@ JSCanvasGradient::JSCanvasGradient(NonNullPassRefPtr structure, JSDOM JSCanvasGradient::~JSCanvasGradient() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasGradient::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp index 7356770..cfb521b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp @@ -61,7 +61,7 @@ JSCanvasPattern::JSCanvasPattern(NonNullPassRefPtr structure, JSDOMGl JSCanvasPattern::~JSCanvasPattern() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasPattern::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp index 1d06dfe..07710a1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp @@ -126,7 +126,7 @@ JSCanvasRenderingContext::JSCanvasRenderingContext(NonNullPassRefPtr JSCanvasRenderingContext::~JSCanvasRenderingContext() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasRenderingContext::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp index 175d660..48dccd3 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp @@ -130,7 +130,7 @@ JSClientRect::JSClientRect(NonNullPassRefPtr structure, JSDOMGlobalOb JSClientRect::~JSClientRect() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSClientRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp b/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp index 143ee8c..ff9d963 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp @@ -141,7 +141,7 @@ JSClientRectList::JSClientRectList(NonNullPassRefPtr structure, JSDOM JSClientRectList::~JSClientRectList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSClientRectList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp b/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp index f72e341..8f4a7d4 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp @@ -145,7 +145,7 @@ JSClipboard::JSClipboard(NonNullPassRefPtr structure, JSDOMGlobalObje JSClipboard::~JSClipboard() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSClipboard::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp b/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp index 4bb40c6..0657890 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp @@ -104,7 +104,7 @@ JSConsole::JSConsole(NonNullPassRefPtr structure, JSDOMGlobalObject* JSConsole::~JSConsole() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSConsole::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp b/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp index 6919ad2..348bcc6 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp @@ -83,7 +83,7 @@ JSCoordinates::JSCoordinates(NonNullPassRefPtr structure, JSDOMGlobal JSCoordinates::~JSCoordinates() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCoordinates::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp b/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp index d17a368..7c22959 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp @@ -128,7 +128,7 @@ JSCounter::JSCounter(NonNullPassRefPtr structure, JSDOMGlobalObject* JSCounter::~JSCounter() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCounter::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp index 2b65699..17a527e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp @@ -118,7 +118,7 @@ JSDOMApplicationCache::JSDOMApplicationCache(NonNullPassRefPtr struct JSDOMApplicationCache::~JSDOMApplicationCache() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } void JSDOMApplicationCache::markChildren(MarkStack& markStack) @@ -255,7 +255,7 @@ void setJSDOMApplicationCacheOnchecking(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnchecking(globalObject->createJSAttributeEventListener(value)); @@ -265,7 +265,7 @@ void setJSDOMApplicationCacheOnerror(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -275,7 +275,7 @@ void setJSDOMApplicationCacheOnnoupdate(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnnoupdate(globalObject->createJSAttributeEventListener(value)); @@ -285,7 +285,7 @@ void setJSDOMApplicationCacheOndownloading(ExecState* exec, JSObject* thisObject { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndownloading(globalObject->createJSAttributeEventListener(value)); @@ -295,7 +295,7 @@ void setJSDOMApplicationCacheOnprogress(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnprogress(globalObject->createJSAttributeEventListener(value)); @@ -305,7 +305,7 @@ void setJSDOMApplicationCacheOnupdateready(ExecState* exec, JSObject* thisObject { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnupdateready(globalObject->createJSAttributeEventListener(value)); @@ -315,7 +315,7 @@ void setJSDOMApplicationCacheOncached(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncached(globalObject->createJSAttributeEventListener(value)); @@ -325,7 +325,7 @@ void setJSDOMApplicationCacheOnobsolete(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnobsolete(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp index d625e2b..ff88905 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp @@ -185,7 +185,7 @@ JSDOMCoreException::JSDOMCoreException(NonNullPassRefPtr structure, J JSDOMCoreException::~JSDOMCoreException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDOMCoreException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp index 62eef6c..268647b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp @@ -148,7 +148,7 @@ JSDOMImplementation::JSDOMImplementation(NonNullPassRefPtr structure, JSDOMImplementation::~JSDOMImplementation() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDOMImplementation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp index 4af88cb..ecd336a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp @@ -147,7 +147,7 @@ JSDOMParser::JSDOMParser(NonNullPassRefPtr structure, JSDOMGlobalObje JSDOMParser::~JSDOMParser() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDOMParser::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp index 45ec248..e3a69b0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp @@ -119,7 +119,7 @@ JSDOMSelection::JSDOMSelection(NonNullPassRefPtr structure, JSDOMGlob JSDOMSelection::~JSDOMSelection() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDOMSelection::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp index dc53217..12edc42 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp @@ -92,6 +92,7 @@ #include "JSEventSource.h" #include "JSFile.h" #include "JSFileList.h" +#include "JSHTMLAllCollection.h" #include "JSHTMLAnchorElement.h" #include "JSHTMLAppletElement.h" #include "JSHTMLAreaElement.h" @@ -246,7 +247,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSDOMWindow); /* Hash table */ -static const HashTableValue JSDOMWindowTableValues[296] = +static const HashTableValue JSDOMWindowTableValues[297] = { { "screen", DontDelete|ReadOnly, (intptr_t)jsDOMWindowScreen, (intptr_t)0 }, { "history", DontDelete|ReadOnly, (intptr_t)jsDOMWindowHistory, (intptr_t)0 }, @@ -468,6 +469,7 @@ static const HashTableValue JSDOMWindowTableValues[296] = { "HTMLTitleElement", DontDelete, (intptr_t)jsDOMWindowHTMLTitleElementConstructor, (intptr_t)setJSDOMWindowHTMLTitleElementConstructor }, { "HTMLUListElement", DontDelete, (intptr_t)jsDOMWindowHTMLUListElementConstructor, (intptr_t)setJSDOMWindowHTMLUListElementConstructor }, { "HTMLCollection", DontDelete, (intptr_t)jsDOMWindowHTMLCollectionConstructor, (intptr_t)setJSDOMWindowHTMLCollectionConstructor }, + { "HTMLAllCollection", DontDelete, (intptr_t)jsDOMWindowHTMLAllCollectionConstructor, (intptr_t)setJSDOMWindowHTMLAllCollectionConstructor }, { "Image", DontDelete, (intptr_t)jsDOMWindowImageConstructor, (intptr_t)setJSDOMWindowImageConstructor }, { "Option", DontDelete, (intptr_t)jsDOMWindowOptionConstructor, (intptr_t)setJSDOMWindowOptionConstructor }, { "CanvasRenderingContext2D", DontDelete, (intptr_t)jsDOMWindowCanvasRenderingContext2DConstructor, (intptr_t)setJSDOMWindowCanvasRenderingContext2DConstructor }, @@ -666,7 +668,6 @@ JSDOMWindow::JSDOMWindow(NonNullPassRefPtr structure, PassRefPtrinvalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSValue jsDOMWindowScreen(ExecState* exec, const Identifier&, const PropertySlot& slot) @@ -2846,6 +2847,14 @@ JSValue jsDOMWindowHTMLCollectionConstructor(ExecState* exec, const Identifier&, return JSHTMLCollection::getConstructor(exec, castedThis); } +JSValue jsDOMWindowHTMLAllCollectionConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSDOMWindow* castedThis = static_cast(asObject(slot.slotBase())); + if (!castedThis->allowsAccessFrom(exec)) + return jsUndefined(); + return JSHTMLAllCollection::getConstructor(exec, castedThis); +} + JSValue jsDOMWindowImageConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) { JSDOMWindow* castedThis = static_cast(asObject(slot.slotBase())); @@ -5261,6 +5270,14 @@ void setJSDOMWindowHTMLCollectionConstructor(ExecState* exec, JSObject* thisObje static_cast(thisObject)->putDirect(Identifier(exec, "HTMLCollection"), value); } +void setJSDOMWindowHTMLAllCollectionConstructor(ExecState* exec, JSObject* thisObject, JSValue value) +{ + if (!static_cast(thisObject)->allowsAccessFrom(exec)) + return; + // Shadowing a built-in constructor + static_cast(thisObject)->putDirect(Identifier(exec, "HTMLAllCollection"), value); +} + void setJSDOMWindowImageConstructor(ExecState* exec, JSObject* thisObject, JSValue value) { if (!static_cast(thisObject)->allowsAccessFrom(exec)) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h index 232c8eb..afc8106 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h @@ -577,6 +577,8 @@ JSC::JSValue jsDOMWindowHTMLUListElementConstructor(JSC::ExecState*, const JSC:: void setJSDOMWindowHTMLUListElementConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowHTMLCollectionConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowHTMLCollectionConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsDOMWindowHTMLAllCollectionConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +void setJSDOMWindowHTMLAllCollectionConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowImageConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowImageConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowOptionConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp index 586edd1..42b91d1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp @@ -157,7 +157,7 @@ JSDataGridColumn::JSDataGridColumn(NonNullPassRefPtr structure, JSDOM JSDataGridColumn::~JSDataGridColumn() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDataGridColumn::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp index 08585fe..945c257 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp @@ -151,7 +151,7 @@ JSDataGridColumnList::JSDataGridColumnList(NonNullPassRefPtr structur JSDataGridColumnList::~JSDataGridColumnList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDataGridColumnList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp b/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp index 5acd5b1..c5ac44d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp @@ -95,7 +95,7 @@ JSDatabase::JSDatabase(NonNullPassRefPtr structure, JSDOMGlobalObject JSDatabase::~JSDatabase() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDatabase::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp b/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp index 47a2936..1fb3b46 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp @@ -304,7 +304,7 @@ JSDocument::JSDocument(NonNullPassRefPtr structure, JSDOMGlobalObject JSDocument::~JSDocument() { - forgetDOMObject(*Heap::heap(this)->globalData(), static_cast(impl())); + forgetDOMObject(this, static_cast(impl())); } JSObject* JSDocument::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -1099,7 +1099,7 @@ void setJSDocumentOnabort(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -1109,7 +1109,7 @@ void setJSDocumentOnblur(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnblur(globalObject->createJSAttributeEventListener(value)); @@ -1119,7 +1119,7 @@ void setJSDocumentOnchange(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnchange(globalObject->createJSAttributeEventListener(value)); @@ -1129,7 +1129,7 @@ void setJSDocumentOnclick(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnclick(globalObject->createJSAttributeEventListener(value)); @@ -1139,7 +1139,7 @@ void setJSDocumentOncontextmenu(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncontextmenu(globalObject->createJSAttributeEventListener(value)); @@ -1149,7 +1149,7 @@ void setJSDocumentOndblclick(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndblclick(globalObject->createJSAttributeEventListener(value)); @@ -1159,7 +1159,7 @@ void setJSDocumentOndrag(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrag(globalObject->createJSAttributeEventListener(value)); @@ -1169,7 +1169,7 @@ void setJSDocumentOndragend(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragend(globalObject->createJSAttributeEventListener(value)); @@ -1179,7 +1179,7 @@ void setJSDocumentOndragenter(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragenter(globalObject->createJSAttributeEventListener(value)); @@ -1189,7 +1189,7 @@ void setJSDocumentOndragleave(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragleave(globalObject->createJSAttributeEventListener(value)); @@ -1199,7 +1199,7 @@ void setJSDocumentOndragover(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragover(globalObject->createJSAttributeEventListener(value)); @@ -1209,7 +1209,7 @@ void setJSDocumentOndragstart(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragstart(globalObject->createJSAttributeEventListener(value)); @@ -1219,7 +1219,7 @@ void setJSDocumentOndrop(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrop(globalObject->createJSAttributeEventListener(value)); @@ -1229,7 +1229,7 @@ void setJSDocumentOnerror(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -1239,7 +1239,7 @@ void setJSDocumentOnfocus(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnfocus(globalObject->createJSAttributeEventListener(value)); @@ -1249,7 +1249,7 @@ void setJSDocumentOninput(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninput(globalObject->createJSAttributeEventListener(value)); @@ -1259,7 +1259,7 @@ void setJSDocumentOninvalid(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninvalid(globalObject->createJSAttributeEventListener(value)); @@ -1269,7 +1269,7 @@ void setJSDocumentOnkeydown(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeydown(globalObject->createJSAttributeEventListener(value)); @@ -1279,7 +1279,7 @@ void setJSDocumentOnkeypress(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeypress(globalObject->createJSAttributeEventListener(value)); @@ -1289,7 +1289,7 @@ void setJSDocumentOnkeyup(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeyup(globalObject->createJSAttributeEventListener(value)); @@ -1299,7 +1299,7 @@ void setJSDocumentOnload(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -1309,7 +1309,7 @@ void setJSDocumentOnmousedown(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousedown(globalObject->createJSAttributeEventListener(value)); @@ -1319,7 +1319,7 @@ void setJSDocumentOnmousemove(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousemove(globalObject->createJSAttributeEventListener(value)); @@ -1329,7 +1329,7 @@ void setJSDocumentOnmouseout(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseout(globalObject->createJSAttributeEventListener(value)); @@ -1339,7 +1339,7 @@ void setJSDocumentOnmouseover(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseover(globalObject->createJSAttributeEventListener(value)); @@ -1349,7 +1349,7 @@ void setJSDocumentOnmouseup(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseup(globalObject->createJSAttributeEventListener(value)); @@ -1359,7 +1359,7 @@ void setJSDocumentOnmousewheel(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousewheel(globalObject->createJSAttributeEventListener(value)); @@ -1369,7 +1369,7 @@ void setJSDocumentOnscroll(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnscroll(globalObject->createJSAttributeEventListener(value)); @@ -1379,7 +1379,7 @@ void setJSDocumentOnselect(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselect(globalObject->createJSAttributeEventListener(value)); @@ -1389,7 +1389,7 @@ void setJSDocumentOnsubmit(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsubmit(globalObject->createJSAttributeEventListener(value)); @@ -1399,7 +1399,7 @@ void setJSDocumentOnbeforecut(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecut(globalObject->createJSAttributeEventListener(value)); @@ -1409,7 +1409,7 @@ void setJSDocumentOncut(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncut(globalObject->createJSAttributeEventListener(value)); @@ -1419,7 +1419,7 @@ void setJSDocumentOnbeforecopy(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecopy(globalObject->createJSAttributeEventListener(value)); @@ -1429,7 +1429,7 @@ void setJSDocumentOncopy(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncopy(globalObject->createJSAttributeEventListener(value)); @@ -1439,7 +1439,7 @@ void setJSDocumentOnbeforepaste(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforepaste(globalObject->createJSAttributeEventListener(value)); @@ -1449,7 +1449,7 @@ void setJSDocumentOnpaste(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnpaste(globalObject->createJSAttributeEventListener(value)); @@ -1459,7 +1459,7 @@ void setJSDocumentOnreset(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnreset(globalObject->createJSAttributeEventListener(value)); @@ -1469,7 +1469,7 @@ void setJSDocumentOnsearch(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsearch(globalObject->createJSAttributeEventListener(value)); @@ -1479,7 +1479,7 @@ void setJSDocumentOnselectstart(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); Document* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselectstart(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSElement.cpp index 869c23f..3d3187f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSElement.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSElement.cpp @@ -897,7 +897,7 @@ void setJSElementOnabort(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -907,7 +907,7 @@ void setJSElementOnblur(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnblur(globalObject->createJSAttributeEventListener(value)); @@ -917,7 +917,7 @@ void setJSElementOnchange(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnchange(globalObject->createJSAttributeEventListener(value)); @@ -927,7 +927,7 @@ void setJSElementOnclick(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnclick(globalObject->createJSAttributeEventListener(value)); @@ -937,7 +937,7 @@ void setJSElementOncontextmenu(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncontextmenu(globalObject->createJSAttributeEventListener(value)); @@ -947,7 +947,7 @@ void setJSElementOndblclick(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndblclick(globalObject->createJSAttributeEventListener(value)); @@ -957,7 +957,7 @@ void setJSElementOndrag(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrag(globalObject->createJSAttributeEventListener(value)); @@ -967,7 +967,7 @@ void setJSElementOndragend(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragend(globalObject->createJSAttributeEventListener(value)); @@ -977,7 +977,7 @@ void setJSElementOndragenter(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragenter(globalObject->createJSAttributeEventListener(value)); @@ -987,7 +987,7 @@ void setJSElementOndragleave(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragleave(globalObject->createJSAttributeEventListener(value)); @@ -997,7 +997,7 @@ void setJSElementOndragover(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragover(globalObject->createJSAttributeEventListener(value)); @@ -1007,7 +1007,7 @@ void setJSElementOndragstart(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragstart(globalObject->createJSAttributeEventListener(value)); @@ -1017,7 +1017,7 @@ void setJSElementOndrop(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrop(globalObject->createJSAttributeEventListener(value)); @@ -1027,7 +1027,7 @@ void setJSElementOnerror(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -1037,7 +1037,7 @@ void setJSElementOnfocus(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnfocus(globalObject->createJSAttributeEventListener(value)); @@ -1047,7 +1047,7 @@ void setJSElementOninput(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninput(globalObject->createJSAttributeEventListener(value)); @@ -1057,7 +1057,7 @@ void setJSElementOninvalid(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninvalid(globalObject->createJSAttributeEventListener(value)); @@ -1067,7 +1067,7 @@ void setJSElementOnkeydown(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeydown(globalObject->createJSAttributeEventListener(value)); @@ -1077,7 +1077,7 @@ void setJSElementOnkeypress(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeypress(globalObject->createJSAttributeEventListener(value)); @@ -1087,7 +1087,7 @@ void setJSElementOnkeyup(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeyup(globalObject->createJSAttributeEventListener(value)); @@ -1097,7 +1097,7 @@ void setJSElementOnload(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -1107,7 +1107,7 @@ void setJSElementOnmousedown(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousedown(globalObject->createJSAttributeEventListener(value)); @@ -1117,7 +1117,7 @@ void setJSElementOnmousemove(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousemove(globalObject->createJSAttributeEventListener(value)); @@ -1127,7 +1127,7 @@ void setJSElementOnmouseout(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseout(globalObject->createJSAttributeEventListener(value)); @@ -1137,7 +1137,7 @@ void setJSElementOnmouseover(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseover(globalObject->createJSAttributeEventListener(value)); @@ -1147,7 +1147,7 @@ void setJSElementOnmouseup(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseup(globalObject->createJSAttributeEventListener(value)); @@ -1157,7 +1157,7 @@ void setJSElementOnmousewheel(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousewheel(globalObject->createJSAttributeEventListener(value)); @@ -1167,7 +1167,7 @@ void setJSElementOnscroll(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnscroll(globalObject->createJSAttributeEventListener(value)); @@ -1177,7 +1177,7 @@ void setJSElementOnselect(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselect(globalObject->createJSAttributeEventListener(value)); @@ -1187,7 +1187,7 @@ void setJSElementOnsubmit(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsubmit(globalObject->createJSAttributeEventListener(value)); @@ -1197,7 +1197,7 @@ void setJSElementOnbeforecut(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecut(globalObject->createJSAttributeEventListener(value)); @@ -1207,7 +1207,7 @@ void setJSElementOncut(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncut(globalObject->createJSAttributeEventListener(value)); @@ -1217,7 +1217,7 @@ void setJSElementOnbeforecopy(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecopy(globalObject->createJSAttributeEventListener(value)); @@ -1227,7 +1227,7 @@ void setJSElementOncopy(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncopy(globalObject->createJSAttributeEventListener(value)); @@ -1237,7 +1237,7 @@ void setJSElementOnbeforepaste(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforepaste(globalObject->createJSAttributeEventListener(value)); @@ -1247,7 +1247,7 @@ void setJSElementOnpaste(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnpaste(globalObject->createJSAttributeEventListener(value)); @@ -1257,7 +1257,7 @@ void setJSElementOnreset(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnreset(globalObject->createJSAttributeEventListener(value)); @@ -1267,7 +1267,7 @@ void setJSElementOnsearch(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsearch(globalObject->createJSAttributeEventListener(value)); @@ -1277,7 +1277,7 @@ void setJSElementOnselectstart(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Element* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselectstart(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp index acd952f..67eefd0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp @@ -199,7 +199,7 @@ JSEvent::JSEvent(NonNullPassRefPtr structure, JSDOMGlobalObject* glob JSEvent::~JSEvent() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp b/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp index 2246c8f..bd25734 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp @@ -151,7 +151,7 @@ JSEventException::JSEventException(NonNullPassRefPtr structure, JSDOM JSEventException::~JSEventException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSEventException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp b/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp index dcec14e..526d8af 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp @@ -120,7 +120,7 @@ JSEventSource::JSEventSource(NonNullPassRefPtr structure, JSDOMGlobal JSEventSource::~JSEventSource() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } void JSEventSource::markChildren(MarkStack& markStack) @@ -205,7 +205,7 @@ void setJSEventSourceOnopen(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); EventSource* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnopen(globalObject->createJSAttributeEventListener(value)); @@ -215,7 +215,7 @@ void setJSEventSourceOnmessage(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); EventSource* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); @@ -225,7 +225,7 @@ void setJSEventSourceOnerror(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); EventSource* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSFile.cpp b/src/3rdparty/webkit/WebCore/generated/JSFile.cpp index 2ee62ae..59192af 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSFile.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSFile.cpp @@ -128,7 +128,7 @@ JSFile::JSFile(NonNullPassRefPtr structure, JSDOMGlobalObject* global JSFile::~JSFile() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSFile::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp b/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp index 931aae4..50e1f0a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp @@ -141,7 +141,7 @@ JSFileList::JSFileList(NonNullPassRefPtr structure, JSDOMGlobalObject JSFileList::~JSFileList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSFileList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp index 17a0509..be50fac 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp @@ -92,7 +92,7 @@ JSGeolocation::JSGeolocation(NonNullPassRefPtr structure, JSDOMGlobal JSGeolocation::~JSGeolocation() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSGeolocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp b/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp index a77413b..ab42d2b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp @@ -80,7 +80,7 @@ JSGeoposition::JSGeoposition(NonNullPassRefPtr structure, JSDOMGlobal JSGeoposition::~JSGeoposition() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSGeoposition::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.cpp new file mode 100644 index 0000000..4a8fc83 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.cpp @@ -0,0 +1,292 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "JSHTMLAllCollection.h" + +#include "AtomicString.h" +#include "HTMLAllCollection.h" +#include "JSNode.h" +#include "JSNodeList.h" +#include "NameNodeList.h" +#include "Node.h" +#include "NodeList.h" +#include +#include +#include +#include + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSHTMLAllCollection); + +/* Hash table */ + +static const HashTableValue JSHTMLAllCollectionTableValues[3] = +{ + { "length", DontDelete|ReadOnly, (intptr_t)jsHTMLAllCollectionLength, (intptr_t)0 }, + { "constructor", DontEnum|ReadOnly, (intptr_t)jsHTMLAllCollectionConstructor, (intptr_t)0 }, + { 0, 0, 0, 0 } +}; + +static JSC_CONST_HASHTABLE HashTable JSHTMLAllCollectionTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 15, JSHTMLAllCollectionTableValues, 0 }; +#else + { 5, 3, JSHTMLAllCollectionTableValues, 0 }; +#endif + +/* Hash table for constructor */ + +static const HashTableValue JSHTMLAllCollectionConstructorTableValues[1] = +{ + { 0, 0, 0, 0 } +}; + +static JSC_CONST_HASHTABLE HashTable JSHTMLAllCollectionConstructorTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 0, JSHTMLAllCollectionConstructorTableValues, 0 }; +#else + { 1, 0, JSHTMLAllCollectionConstructorTableValues, 0 }; +#endif + +class JSHTMLAllCollectionConstructor : public DOMConstructorObject { +public: + JSHTMLAllCollectionConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSHTMLAllCollectionConstructor::createStructure(globalObject->objectPrototype()), globalObject) + { + putDirect(exec->propertyNames().prototype, JSHTMLAllCollectionPrototype::self(exec, globalObject), None); + } + virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); + virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); + virtual const ClassInfo* classInfo() const { return &s_info; } + static const ClassInfo s_info; + + static PassRefPtr createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); + } + +protected: + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +const ClassInfo JSHTMLAllCollectionConstructor::s_info = { "HTMLAllCollectionConstructor", 0, &JSHTMLAllCollectionConstructorTable, 0 }; + +bool JSHTMLAllCollectionConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSHTMLAllCollectionConstructorTable, this, propertyName, slot); +} + +bool JSHTMLAllCollectionConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSHTMLAllCollectionConstructorTable, this, propertyName, descriptor); +} + +/* Hash table for prototype */ + +static const HashTableValue JSHTMLAllCollectionPrototypeTableValues[4] = +{ + { "item", DontDelete|Function, (intptr_t)jsHTMLAllCollectionPrototypeFunctionItem, (intptr_t)1 }, + { "namedItem", DontDelete|Function, (intptr_t)jsHTMLAllCollectionPrototypeFunctionNamedItem, (intptr_t)1 }, + { "tags", DontDelete|Function, (intptr_t)jsHTMLAllCollectionPrototypeFunctionTags, (intptr_t)1 }, + { 0, 0, 0, 0 } +}; + +static JSC_CONST_HASHTABLE HashTable JSHTMLAllCollectionPrototypeTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 7, JSHTMLAllCollectionPrototypeTableValues, 0 }; +#else + { 8, 7, JSHTMLAllCollectionPrototypeTableValues, 0 }; +#endif + +const ClassInfo JSHTMLAllCollectionPrototype::s_info = { "HTMLAllCollectionPrototype", 0, &JSHTMLAllCollectionPrototypeTable, 0 }; + +JSObject* JSHTMLAllCollectionPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype(exec, globalObject); +} + +bool JSHTMLAllCollectionPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticFunctionSlot(exec, &JSHTMLAllCollectionPrototypeTable, this, propertyName, slot); +} + +bool JSHTMLAllCollectionPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticFunctionDescriptor(exec, &JSHTMLAllCollectionPrototypeTable, this, propertyName, descriptor); +} + +const ClassInfo JSHTMLAllCollection::s_info = { "HTMLAllCollection", 0, &JSHTMLAllCollectionTable, 0 }; + +JSHTMLAllCollection::JSHTMLAllCollection(NonNullPassRefPtr structure, JSDOMGlobalObject* globalObject, PassRefPtr impl) + : DOMObjectWithGlobalPointer(structure, globalObject) + , m_impl(impl) +{ +} + +JSHTMLAllCollection::~JSHTMLAllCollection() +{ + forgetDOMObject(this, impl()); +} + +JSObject* JSHTMLAllCollection::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSHTMLAllCollectionPrototype(JSHTMLAllCollectionPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSHTMLAllCollection::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSValue proto = prototype(); + if (proto.isObject() && static_cast(asObject(proto))->hasProperty(exec, propertyName)) + return false; + + const HashEntry* entry = JSHTMLAllCollectionTable.entry(exec, propertyName); + if (entry) { + slot.setCustom(this, entry->propertyGetter()); + return true; + } + bool ok; + unsigned index = propertyName.toUInt32(&ok, false); + if (ok && index < static_cast(impl())->length()) { + slot.setCustomIndex(this, index, indexGetter); + return true; + } + if (canGetItemsForName(exec, static_cast(impl()), propertyName)) { + slot.setCustom(this, nameGetter); + return true; + } + return getStaticValueSlot(exec, &JSHTMLAllCollectionTable, this, propertyName, slot); +} + +bool JSHTMLAllCollection::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSValue proto = prototype(); + if (proto.isObject() && static_cast(asObject(proto))->hasProperty(exec, propertyName)) + return false; + + const HashEntry* entry = JSHTMLAllCollectionTable.entry(exec, propertyName); + if (entry) { + PropertySlot slot; + slot.setCustom(this, entry->propertyGetter()); + descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); + return true; + } + bool ok; + unsigned index = propertyName.toUInt32(&ok, false); + if (ok && index < static_cast(impl())->length()) { + PropertySlot slot; + slot.setCustomIndex(this, index, indexGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly); + return true; + } + if (canGetItemsForName(exec, static_cast(impl()), propertyName)) { + PropertySlot slot; + slot.setCustom(this, nameGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum); + return true; + } + return getStaticValueDescriptor(exec, &JSHTMLAllCollectionTable, this, propertyName, descriptor); +} + +bool JSHTMLAllCollection::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) +{ + if (propertyName < static_cast(impl())->length()) { + slot.setCustomIndex(this, propertyName, indexGetter); + return true; + } + return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot); +} + +JSValue jsHTMLAllCollectionLength(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSHTMLAllCollection* castedThis = static_cast(asObject(slot.slotBase())); + UNUSED_PARAM(exec); + HTMLAllCollection* imp = static_cast(castedThis->impl()); + return jsNumber(exec, imp->length()); +} + +JSValue jsHTMLAllCollectionConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSHTMLAllCollection* domObject = static_cast(asObject(slot.slotBase())); + return JSHTMLAllCollection::getConstructor(exec, domObject->globalObject()); +} +void JSHTMLAllCollection::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +{ + for (unsigned i = 0; i < static_cast(impl())->length(); ++i) + propertyNames.add(Identifier::from(exec, i)); + Base::getOwnPropertyNames(exec, propertyNames); +} + +JSValue JSHTMLAllCollection::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor(exec, static_cast(globalObject)); +} + +JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSHTMLAllCollection::s_info)) + return throwError(exec, TypeError); + JSHTMLAllCollection* castedThisObj = static_cast(asObject(thisValue)); + return castedThisObj->item(exec, args); +} + +JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionNamedItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSHTMLAllCollection::s_info)) + return throwError(exec, TypeError); + JSHTMLAllCollection* castedThisObj = static_cast(asObject(thisValue)); + return castedThisObj->namedItem(exec, args); +} + +JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionTags(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSHTMLAllCollection::s_info)) + return throwError(exec, TypeError); + JSHTMLAllCollection* castedThisObj = static_cast(asObject(thisValue)); + HTMLAllCollection* imp = static_cast(castedThisObj->impl()); + const UString& name = args.at(0).toString(exec); + + + JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->tags(name))); + return result; +} + + +JSValue JSHTMLAllCollection::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSHTMLAllCollection* thisObj = static_cast(asObject(slot.slotBase())); + return toJS(exec, thisObj->globalObject(), static_cast(thisObj->impl())->item(slot.index())); +} +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, HTMLAllCollection* object) +{ + return getDOMObjectWrapper(exec, globalObject, object); +} +HTMLAllCollection* toHTMLAllCollection(JSC::JSValue value) +{ + return value.inherits(&JSHTMLAllCollection::s_info) ? static_cast(asObject(value))->impl() : 0; +} + +} diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.h new file mode 100644 index 0000000..000986e --- /dev/null +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.h @@ -0,0 +1,104 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef JSHTMLAllCollection_h +#define JSHTMLAllCollection_h + +#include "DOMObjectWithSVGContext.h" +#include "JSDOMBinding.h" +#include +#include +#include + +namespace WebCore { + +class HTMLAllCollection; + +class JSHTMLAllCollection : public DOMObjectWithGlobalPointer { + typedef DOMObjectWithGlobalPointer Base; +public: + JSHTMLAllCollection(NonNullPassRefPtr, JSDOMGlobalObject*, PassRefPtr); + virtual ~JSHTMLAllCollection(); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + virtual bool getOwnPropertySlot(JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + + static PassRefPtr createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags)); + } + + virtual JSC::CallType getCallData(JSC::CallData&); + + virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); + virtual bool toBoolean(JSC::ExecState*) const { return false; }; + static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); + + // Custom functions + JSC::JSValue item(JSC::ExecState*, const JSC::ArgList&); + JSC::JSValue namedItem(JSC::ExecState*, const JSC::ArgList&); + HTMLAllCollection* impl() const { return m_impl.get(); } + +private: + RefPtr m_impl; +protected: + static const unsigned StructureFlags = JSC::OverridesGetPropertyNames | JSC::OverridesGetOwnPropertySlot | JSC::MasqueradesAsUndefined | Base::StructureFlags; + static JSC::JSValue indexGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +private: + static bool canGetItemsForName(JSC::ExecState*, HTMLAllCollection*, const JSC::Identifier&); + static JSC::JSValue nameGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +}; + +JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, HTMLAllCollection*); +HTMLAllCollection* toHTMLAllCollection(JSC::JSValue); + +class JSHTMLAllCollectionPrototype : public JSC::JSObject { + typedef JSC::JSObject Base; +public: + static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static PassRefPtr createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags)); + } + JSHTMLAllCollectionPrototype(NonNullPassRefPtr structure) : JSC::JSObject(structure) { } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +}; + +// Functions + +JSC::JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionNamedItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionTags(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +// Attributes + +JSC::JSValue jsHTMLAllCollectionLength(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +JSC::JSValue jsHTMLAllCollectionConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); + +} // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp index 920f152..5e81799 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp @@ -350,7 +350,7 @@ void setJSHTMLBodyElementOnbeforeunload(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforeunload(globalObject->createJSAttributeEventListener(value)); @@ -360,7 +360,7 @@ void setJSHTMLBodyElementOnhashchange(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnhashchange(globalObject->createJSAttributeEventListener(value)); @@ -370,7 +370,7 @@ void setJSHTMLBodyElementOnmessage(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); @@ -380,7 +380,7 @@ void setJSHTMLBodyElementOnoffline(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnoffline(globalObject->createJSAttributeEventListener(value)); @@ -390,7 +390,7 @@ void setJSHTMLBodyElementOnonline(ExecState* exec, JSObject* thisObject, JSValue { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnonline(globalObject->createJSAttributeEventListener(value)); @@ -400,7 +400,7 @@ void setJSHTMLBodyElementOnresize(ExecState* exec, JSObject* thisObject, JSValue { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnresize(globalObject->createJSAttributeEventListener(value)); @@ -410,7 +410,7 @@ void setJSHTMLBodyElementOnstorage(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnstorage(globalObject->createJSAttributeEventListener(value)); @@ -420,7 +420,7 @@ void setJSHTMLBodyElementOnunload(ExecState* exec, JSObject* thisObject, JSValue { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnunload(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp index 63c0d93..213b3c5 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp @@ -24,10 +24,7 @@ #include "AtomicString.h" #include "HTMLCollection.h" #include "JSNode.h" -#include "JSNodeList.h" -#include "NameNodeList.h" #include "Node.h" -#include "NodeList.h" #include #include #include @@ -104,11 +101,10 @@ bool JSHTMLCollectionConstructor::getOwnPropertyDescriptor(ExecState* exec, cons /* Hash table for prototype */ -static const HashTableValue JSHTMLCollectionPrototypeTableValues[4] = +static const HashTableValue JSHTMLCollectionPrototypeTableValues[3] = { { "item", DontDelete|Function, (intptr_t)jsHTMLCollectionPrototypeFunctionItem, (intptr_t)1 }, { "namedItem", DontDelete|Function, (intptr_t)jsHTMLCollectionPrototypeFunctionNamedItem, (intptr_t)1 }, - { "tags", DontDelete|Function, (intptr_t)jsHTMLCollectionPrototypeFunctionTags, (intptr_t)1 }, { 0, 0, 0, 0 } }; @@ -116,7 +112,7 @@ static JSC_CONST_HASHTABLE HashTable JSHTMLCollectionPrototypeTable = #if ENABLE(PERFECT_HASH_SIZE) { 7, JSHTMLCollectionPrototypeTableValues, 0 }; #else - { 8, 7, JSHTMLCollectionPrototypeTableValues, 0 }; + { 5, 3, JSHTMLCollectionPrototypeTableValues, 0 }; #endif const ClassInfo JSHTMLCollectionPrototype::s_info = { "HTMLCollectionPrototype", 0, &JSHTMLCollectionPrototypeTable, 0 }; @@ -146,7 +142,7 @@ JSHTMLCollection::JSHTMLCollection(NonNullPassRefPtr structure, JSDOM JSHTMLCollection::~JSHTMLCollection() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSHTMLCollection::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -260,20 +256,6 @@ JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionNamedItem(ExecState* exec return castedThisObj->namedItem(exec, args); } -JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionTags(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) -{ - UNUSED_PARAM(args); - if (!thisValue.inherits(&JSHTMLCollection::s_info)) - return throwError(exec, TypeError); - JSHTMLCollection* castedThisObj = static_cast(asObject(thisValue)); - HTMLCollection* imp = static_cast(castedThisObj->impl()); - const UString& name = args.at(0).toString(exec); - - - JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->tags(name))); - return result; -} - JSValue JSHTMLCollection::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) { diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.h index 447f620..e14a2c2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.h +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.h @@ -92,7 +92,6 @@ protected: JSC::JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); JSC::JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionNamedItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionTags(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); // Attributes JSC::JSValue jsHTMLCollectionLength(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp index f336c76..9e506a0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp @@ -300,7 +300,7 @@ void setJSHTMLFrameSetElementOnbeforeunload(ExecState* exec, JSObject* thisObjec { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforeunload(globalObject->createJSAttributeEventListener(value)); @@ -310,7 +310,7 @@ void setJSHTMLFrameSetElementOnhashchange(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnhashchange(globalObject->createJSAttributeEventListener(value)); @@ -320,7 +320,7 @@ void setJSHTMLFrameSetElementOnmessage(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); @@ -330,7 +330,7 @@ void setJSHTMLFrameSetElementOnoffline(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnoffline(globalObject->createJSAttributeEventListener(value)); @@ -340,7 +340,7 @@ void setJSHTMLFrameSetElementOnonline(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnonline(globalObject->createJSAttributeEventListener(value)); @@ -350,7 +350,7 @@ void setJSHTMLFrameSetElementOnresize(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnresize(globalObject->createJSAttributeEventListener(value)); @@ -360,7 +360,7 @@ void setJSHTMLFrameSetElementOnstorage(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnstorage(globalObject->createJSAttributeEventListener(value)); @@ -370,7 +370,7 @@ void setJSHTMLFrameSetElementOnunload(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnunload(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp b/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp index 5331441..02be6ba 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp @@ -92,7 +92,7 @@ JSHistory::JSHistory(NonNullPassRefPtr structure, JSDOMGlobalObject* JSHistory::~JSHistory() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSHistory::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp b/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp index a21fb87..1de3c43 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp @@ -126,7 +126,7 @@ JSImageData::JSImageData(NonNullPassRefPtr structure, JSDOMGlobalObje JSImageData::~JSImageData() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSImageData::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp b/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp index 8da82cc..f72baaa 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp @@ -214,7 +214,7 @@ JSInspectorBackend::JSInspectorBackend(NonNullPassRefPtr structure, J JSInspectorBackend::~JSInspectorBackend() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSInspectorBackend::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp b/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp index 798d540..2acd1af 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp @@ -101,7 +101,7 @@ JSJavaScriptCallFrame::JSJavaScriptCallFrame(NonNullPassRefPtr struct JSJavaScriptCallFrame::~JSJavaScriptCallFrame() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSJavaScriptCallFrame::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp index ca21205..bb4d56c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp @@ -108,7 +108,7 @@ JSLocation::JSLocation(NonNullPassRefPtr structure, JSDOMGlobalObject JSLocation::~JSLocation() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSLocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp b/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp index b7d4c19..93cde9f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp @@ -138,7 +138,7 @@ JSMedia::JSMedia(NonNullPassRefPtr structure, JSDOMGlobalObject* glob JSMedia::~JSMedia() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMedia::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp b/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp index 97e35e0..534a585 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp @@ -146,7 +146,7 @@ JSMediaError::JSMediaError(NonNullPassRefPtr structure, JSDOMGlobalOb JSMediaError::~JSMediaError() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMediaError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp b/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp index 93a17b4..e7b758e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp @@ -142,7 +142,7 @@ JSMediaList::JSMediaList(NonNullPassRefPtr structure, JSDOMGlobalObje JSMediaList::~JSMediaList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMediaList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp b/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp index 4fdac64..8ba6f01 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp @@ -87,7 +87,7 @@ JSMessageChannel::JSMessageChannel(NonNullPassRefPtr structure, JSDOM JSMessageChannel::~JSMessageChannel() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMessageChannel::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp b/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp index 28e1492..a65091c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp @@ -158,7 +158,7 @@ JSMessagePort::JSMessagePort(NonNullPassRefPtr structure, JSDOMGlobal JSMessagePort::~JSMessagePort() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMessagePort::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -202,7 +202,7 @@ void setJSMessagePortOnmessage(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); MessagePort* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp b/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp index f797df2..c91aaeb 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp @@ -131,7 +131,7 @@ JSMimeType::JSMimeType(NonNullPassRefPtr structure, JSDOMGlobalObject JSMimeType::~JSMimeType() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMimeType::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp index 0384539..3c7b740 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp @@ -142,7 +142,7 @@ JSMimeTypeArray::JSMimeTypeArray(NonNullPassRefPtr structure, JSDOMGl JSMimeTypeArray::~JSMimeTypeArray() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMimeTypeArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp b/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp index e3cc8d2..e9c79a1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp @@ -147,7 +147,7 @@ JSNamedNodeMap::JSNamedNodeMap(NonNullPassRefPtr structure, JSDOMGlob JSNamedNodeMap::~JSNamedNodeMap() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNamedNodeMap::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp b/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp index 6dcda62..1c8e190 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp @@ -108,7 +108,7 @@ JSNavigator::JSNavigator(NonNullPassRefPtr structure, JSDOMGlobalObje JSNavigator::~JSNavigator() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNavigator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNode.cpp b/src/3rdparty/webkit/WebCore/generated/JSNode.cpp index e132829..e3a2006 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNode.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNode.cpp @@ -221,7 +221,7 @@ JSNode::JSNode(NonNullPassRefPtr structure, JSDOMGlobalObject* global JSNode::~JSNode() { impl()->invalidateEventListeners(); - forgetDOMNode(impl()->document(), impl()); + forgetDOMNode(this, impl(), impl()->document()); } JSObject* JSNode::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp index 141a060..22726f6 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp @@ -167,7 +167,7 @@ JSNodeFilter::JSNodeFilter(NonNullPassRefPtr structure, JSDOMGlobalOb JSNodeFilter::~JSNodeFilter() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNodeFilter::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp index cf85e40..8570d24 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp @@ -148,7 +148,7 @@ JSNodeIterator::JSNodeIterator(NonNullPassRefPtr structure, JSDOMGlob JSNodeIterator::~JSNodeIterator() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNodeIterator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp index 01ee9ac..3f3131e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp @@ -142,7 +142,7 @@ JSNodeList::JSNodeList(NonNullPassRefPtr structure, JSDOMGlobalObject JSNodeList::~JSNodeList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNodeList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp b/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp index 035a352..1c7b6ec 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp @@ -147,7 +147,7 @@ JSPlugin::JSPlugin(NonNullPassRefPtr structure, JSDOMGlobalObject* gl JSPlugin::~JSPlugin() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSPlugin::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp index bd0b579..38a9346 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp @@ -143,7 +143,7 @@ JSPluginArray::JSPluginArray(NonNullPassRefPtr structure, JSDOMGlobal JSPluginArray::~JSPluginArray() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSPluginArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp b/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp index e178bd9..fffa0c1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp @@ -146,7 +146,7 @@ JSPositionError::JSPositionError(NonNullPassRefPtr structure, JSDOMGl JSPositionError::~JSPositionError() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSPositionError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp b/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp index 0dff99a..e45ce66 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp @@ -128,7 +128,7 @@ JSRGBColor::JSRGBColor(NonNullPassRefPtr structure, JSDOMGlobalObject JSRGBColor::~JSRGBColor() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSRGBColor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRange.cpp b/src/3rdparty/webkit/WebCore/generated/JSRange.cpp index cc59119..bc9979b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRange.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRange.cpp @@ -194,7 +194,7 @@ JSRange::JSRange(NonNullPassRefPtr structure, JSDOMGlobalObject* glob JSRange::~JSRange() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSRange::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp b/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp index 2f8e618..bbb172d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp @@ -145,7 +145,7 @@ JSRangeException::JSRangeException(NonNullPassRefPtr structure, JSDOM JSRangeException::~JSRangeException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSRangeException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSRect.cpp index 37c4669..e57d688 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRect.cpp @@ -129,7 +129,7 @@ JSRect::JSRect(NonNullPassRefPtr structure, JSDOMGlobalObject* global JSRect::~JSRect() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp index a318e1d..79fdc89 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp @@ -83,7 +83,7 @@ JSSQLError::JSSQLError(NonNullPassRefPtr structure, JSDOMGlobalObject JSSQLError::~JSSQLError() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSQLError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp index 223de95..fa85ad6 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp @@ -84,7 +84,7 @@ JSSQLResultSet::JSSQLResultSet(NonNullPassRefPtr structure, JSDOMGlob JSSQLResultSet::~JSSQLResultSet() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSQLResultSet::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp index dddf0c4..090e4f7 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp @@ -92,7 +92,7 @@ JSSQLResultSetRowList::JSSQLResultSetRowList(NonNullPassRefPtr struct JSSQLResultSetRowList::~JSSQLResultSetRowList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSQLResultSetRowList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp index c2c0e54..e165dad 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp @@ -76,7 +76,7 @@ JSSQLTransaction::JSSQLTransaction(NonNullPassRefPtr structure, JSDOM JSSQLTransaction::~JSSQLTransaction() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSQLTransaction::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp index 220f4a6..e6d4795 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp @@ -156,7 +156,7 @@ JSSVGAngle::JSSVGAngle(NonNullPassRefPtr structure, JSDOMGlobalObject JSSVGAngle::~JSSVGAngle() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAngle::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp index c09ce1c..599f5ca 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedAngle::JSSVGAnimatedAngle(NonNullPassRefPtr structure, J JSSVGAnimatedAngle::~JSSVGAnimatedAngle() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedAngle::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp index fb3f4c8..131b358 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp @@ -79,7 +79,7 @@ JSSVGAnimatedBoolean::JSSVGAnimatedBoolean(NonNullPassRefPtr structur JSSVGAnimatedBoolean::~JSSVGAnimatedBoolean() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedBoolean::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp index 8fbe43e..6a27988 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedEnumeration::JSSVGAnimatedEnumeration(NonNullPassRefPtr JSSVGAnimatedEnumeration::~JSSVGAnimatedEnumeration() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedEnumeration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp index f52a51b..86c388b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedInteger::JSSVGAnimatedInteger(NonNullPassRefPtr structur JSSVGAnimatedInteger::~JSSVGAnimatedInteger() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedInteger::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp index 50826a7..f5fff5e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedLength::JSSVGAnimatedLength(NonNullPassRefPtr structure, JSSVGAnimatedLength::~JSSVGAnimatedLength() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedLength::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp index b0c3743..5525640 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedLengthList::JSSVGAnimatedLengthList(NonNullPassRefPtr st JSSVGAnimatedLengthList::~JSSVGAnimatedLengthList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedLengthList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp index ef16117..69f1490 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedNumber::JSSVGAnimatedNumber(NonNullPassRefPtr structure, JSSVGAnimatedNumber::~JSSVGAnimatedNumber() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedNumber::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp index af11dbd..0fa8afa 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedNumberList::JSSVGAnimatedNumberList(NonNullPassRefPtr st JSSVGAnimatedNumberList::~JSSVGAnimatedNumberList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedNumberList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp index 53f0b60..b64ee3a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedPreserveAspectRatio::JSSVGAnimatedPreserveAspectRatio(NonNullPassRe JSSVGAnimatedPreserveAspectRatio::~JSSVGAnimatedPreserveAspectRatio() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedPreserveAspectRatio::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp index 432a4d5..0db579b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedRect::JSSVGAnimatedRect(NonNullPassRefPtr structure, JSD JSSVGAnimatedRect::~JSSVGAnimatedRect() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp index c3ccd92..a26a070 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp @@ -82,7 +82,7 @@ JSSVGAnimatedString::JSSVGAnimatedString(NonNullPassRefPtr structure, JSSVGAnimatedString::~JSSVGAnimatedString() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedString::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp index 52b2395..62c3121 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedTransformList::JSSVGAnimatedTransformList(NonNullPassRefPtrglobalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedTransformList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp index 10d375d..1bb0736 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp @@ -153,7 +153,7 @@ JSSVGElementInstance::JSSVGElementInstance(NonNullPassRefPtr structur JSSVGElementInstance::~JSSVGElementInstance() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGElementInstance::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -724,7 +724,7 @@ void setJSSVGElementInstanceOnabort(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -734,7 +734,7 @@ void setJSSVGElementInstanceOnblur(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnblur(globalObject->createJSAttributeEventListener(value)); @@ -744,7 +744,7 @@ void setJSSVGElementInstanceOnchange(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnchange(globalObject->createJSAttributeEventListener(value)); @@ -754,7 +754,7 @@ void setJSSVGElementInstanceOnclick(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnclick(globalObject->createJSAttributeEventListener(value)); @@ -764,7 +764,7 @@ void setJSSVGElementInstanceOncontextmenu(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncontextmenu(globalObject->createJSAttributeEventListener(value)); @@ -774,7 +774,7 @@ void setJSSVGElementInstanceOndblclick(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndblclick(globalObject->createJSAttributeEventListener(value)); @@ -784,7 +784,7 @@ void setJSSVGElementInstanceOnerror(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -794,7 +794,7 @@ void setJSSVGElementInstanceOnfocus(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnfocus(globalObject->createJSAttributeEventListener(value)); @@ -804,7 +804,7 @@ void setJSSVGElementInstanceOninput(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninput(globalObject->createJSAttributeEventListener(value)); @@ -814,7 +814,7 @@ void setJSSVGElementInstanceOnkeydown(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeydown(globalObject->createJSAttributeEventListener(value)); @@ -824,7 +824,7 @@ void setJSSVGElementInstanceOnkeypress(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeypress(globalObject->createJSAttributeEventListener(value)); @@ -834,7 +834,7 @@ void setJSSVGElementInstanceOnkeyup(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeyup(globalObject->createJSAttributeEventListener(value)); @@ -844,7 +844,7 @@ void setJSSVGElementInstanceOnload(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -854,7 +854,7 @@ void setJSSVGElementInstanceOnmousedown(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousedown(globalObject->createJSAttributeEventListener(value)); @@ -864,7 +864,7 @@ void setJSSVGElementInstanceOnmousemove(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousemove(globalObject->createJSAttributeEventListener(value)); @@ -874,7 +874,7 @@ void setJSSVGElementInstanceOnmouseout(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseout(globalObject->createJSAttributeEventListener(value)); @@ -884,7 +884,7 @@ void setJSSVGElementInstanceOnmouseover(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseover(globalObject->createJSAttributeEventListener(value)); @@ -894,7 +894,7 @@ void setJSSVGElementInstanceOnmouseup(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseup(globalObject->createJSAttributeEventListener(value)); @@ -904,7 +904,7 @@ void setJSSVGElementInstanceOnmousewheel(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousewheel(globalObject->createJSAttributeEventListener(value)); @@ -914,7 +914,7 @@ void setJSSVGElementInstanceOnbeforecut(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecut(globalObject->createJSAttributeEventListener(value)); @@ -924,7 +924,7 @@ void setJSSVGElementInstanceOncut(ExecState* exec, JSObject* thisObject, JSValue { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncut(globalObject->createJSAttributeEventListener(value)); @@ -934,7 +934,7 @@ void setJSSVGElementInstanceOnbeforecopy(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecopy(globalObject->createJSAttributeEventListener(value)); @@ -944,7 +944,7 @@ void setJSSVGElementInstanceOncopy(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncopy(globalObject->createJSAttributeEventListener(value)); @@ -954,7 +954,7 @@ void setJSSVGElementInstanceOnbeforepaste(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforepaste(globalObject->createJSAttributeEventListener(value)); @@ -964,7 +964,7 @@ void setJSSVGElementInstanceOnpaste(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnpaste(globalObject->createJSAttributeEventListener(value)); @@ -974,7 +974,7 @@ void setJSSVGElementInstanceOndragenter(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragenter(globalObject->createJSAttributeEventListener(value)); @@ -984,7 +984,7 @@ void setJSSVGElementInstanceOndragover(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragover(globalObject->createJSAttributeEventListener(value)); @@ -994,7 +994,7 @@ void setJSSVGElementInstanceOndragleave(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragleave(globalObject->createJSAttributeEventListener(value)); @@ -1004,7 +1004,7 @@ void setJSSVGElementInstanceOndrop(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrop(globalObject->createJSAttributeEventListener(value)); @@ -1014,7 +1014,7 @@ void setJSSVGElementInstanceOndragstart(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragstart(globalObject->createJSAttributeEventListener(value)); @@ -1024,7 +1024,7 @@ void setJSSVGElementInstanceOndrag(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrag(globalObject->createJSAttributeEventListener(value)); @@ -1034,7 +1034,7 @@ void setJSSVGElementInstanceOndragend(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragend(globalObject->createJSAttributeEventListener(value)); @@ -1044,7 +1044,7 @@ void setJSSVGElementInstanceOnreset(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnreset(globalObject->createJSAttributeEventListener(value)); @@ -1054,7 +1054,7 @@ void setJSSVGElementInstanceOnresize(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnresize(globalObject->createJSAttributeEventListener(value)); @@ -1064,7 +1064,7 @@ void setJSSVGElementInstanceOnscroll(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnscroll(globalObject->createJSAttributeEventListener(value)); @@ -1074,7 +1074,7 @@ void setJSSVGElementInstanceOnsearch(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsearch(globalObject->createJSAttributeEventListener(value)); @@ -1084,7 +1084,7 @@ void setJSSVGElementInstanceOnselect(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselect(globalObject->createJSAttributeEventListener(value)); @@ -1094,7 +1094,7 @@ void setJSSVGElementInstanceOnselectstart(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselectstart(globalObject->createJSAttributeEventListener(value)); @@ -1104,7 +1104,7 @@ void setJSSVGElementInstanceOnsubmit(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsubmit(globalObject->createJSAttributeEventListener(value)); @@ -1114,7 +1114,7 @@ void setJSSVGElementInstanceOnunload(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnunload(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp index 8bc5bc0..893cc76 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp @@ -94,7 +94,7 @@ JSSVGElementInstanceList::JSSVGElementInstanceList(NonNullPassRefPtr JSSVGElementInstanceList::~JSSVGElementInstanceList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGElementInstanceList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp index 039182f..8906774 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp @@ -150,7 +150,7 @@ JSSVGException::JSSVGException(NonNullPassRefPtr structure, JSDOMGlob JSSVGException::~JSSVGException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp index f97df89..0bcf836 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp @@ -169,7 +169,7 @@ JSSVGLength::JSSVGLength(NonNullPassRefPtr structure, JSDOMGlobalObje JSSVGLength::~JSSVGLength() { JSSVGDynamicPODTypeWrapperCache::forgetWrapper(m_impl.get()); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGLength::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp index 952a5f0..a984bd1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp @@ -100,7 +100,7 @@ JSSVGLengthList::JSSVGLengthList(NonNullPassRefPtr structure, JSDOMGl JSSVGLengthList::~JSSVGLengthList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGLengthList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp index ba8dfe8..d46ce6f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp @@ -107,7 +107,7 @@ JSSVGMatrix::JSSVGMatrix(NonNullPassRefPtr structure, JSDOMGlobalObje JSSVGMatrix::~JSSVGMatrix() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGMatrix::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp index 2bfe658..8ba2042 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp @@ -79,7 +79,7 @@ JSSVGNumber::JSSVGNumber(NonNullPassRefPtr structure, JSDOMGlobalObje JSSVGNumber::~JSSVGNumber() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGNumber::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp index dc6f5a4..fa0e3cf 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp @@ -99,7 +99,7 @@ JSSVGNumberList::JSSVGNumberList(NonNullPassRefPtr structure, JSDOMGl JSSVGNumberList::~JSSVGNumberList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGNumberList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp index 2f1ecbd..767098b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp @@ -181,7 +181,7 @@ JSSVGPathSeg::JSSVGPathSeg(NonNullPassRefPtr structure, JSDOMGlobalOb JSSVGPathSeg::~JSSVGPathSeg() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPathSeg::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp index 0043533..9a35c1b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp @@ -99,7 +99,7 @@ JSSVGPathSegList::JSSVGPathSegList(NonNullPassRefPtr structure, JSDOM JSSVGPathSegList::~JSSVGPathSegList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPathSegList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp index e4c2415..67c35e2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp @@ -94,7 +94,7 @@ JSSVGPoint::JSSVGPoint(NonNullPassRefPtr structure, JSDOMGlobalObject JSSVGPoint::~JSSVGPoint() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPoint::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp index 4a22ff9..6968c80 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp @@ -98,7 +98,7 @@ JSSVGPointList::JSSVGPointList(NonNullPassRefPtr structure, JSDOMGlob JSSVGPointList::~JSSVGPointList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPointList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp index 0f3329c..578cd34 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp @@ -167,7 +167,7 @@ JSSVGPreserveAspectRatio::JSSVGPreserveAspectRatio(NonNullPassRefPtr JSSVGPreserveAspectRatio::~JSSVGPreserveAspectRatio() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPreserveAspectRatio::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp index 8360b4b..e60a309 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp @@ -83,7 +83,7 @@ JSSVGRect::JSSVGRect(NonNullPassRefPtr structure, JSDOMGlobalObject* JSSVGRect::~JSSVGRect() { JSSVGDynamicPODTypeWrapperCache::forgetWrapper(m_impl.get()); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp index b484fbf..1793c23 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp @@ -148,7 +148,7 @@ JSSVGRenderingIntent::JSSVGRenderingIntent(NonNullPassRefPtr structur JSSVGRenderingIntent::~JSSVGRenderingIntent() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGRenderingIntent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp index d4a6935..591ca64 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp @@ -100,7 +100,7 @@ JSSVGStringList::JSSVGStringList(NonNullPassRefPtr structure, JSDOMGl JSSVGStringList::~JSSVGStringList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGStringList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp index 82cddb6..2f51e56 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp @@ -162,7 +162,7 @@ JSSVGTransform::JSSVGTransform(NonNullPassRefPtr structure, JSDOMGlob JSSVGTransform::~JSSVGTransform() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGTransform::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp index 51c0cca..8ce9342 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp @@ -103,7 +103,7 @@ JSSVGTransformList::JSSVGTransformList(NonNullPassRefPtr structure, J JSSVGTransformList::~JSSVGTransformList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGTransformList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp index 452fc9c..fb3321a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp @@ -142,7 +142,7 @@ JSSVGUnitTypes::JSSVGUnitTypes(NonNullPassRefPtr structure, JSDOMGlob JSSVGUnitTypes::~JSSVGUnitTypes() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGUnitTypes::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp b/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp index 574f44c..7ccffa3 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp @@ -84,7 +84,7 @@ JSScreen::JSScreen(NonNullPassRefPtr structure, JSDOMGlobalObject* gl JSScreen::~JSScreen() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSScreen::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp b/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp index 998b8cf..e0ae01b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp @@ -147,7 +147,7 @@ JSStorage::JSStorage(NonNullPassRefPtr structure, JSDOMGlobalObject* JSStorage::~JSStorage() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSStorage::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp b/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp index ae7011d..b84ab6b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp @@ -136,7 +136,7 @@ JSStyleSheet::JSStyleSheet(NonNullPassRefPtr structure, JSDOMGlobalOb JSStyleSheet::~JSStyleSheet() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSStyleSheet::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp b/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp index 5d07cc1..db3d083 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp @@ -141,7 +141,7 @@ JSStyleSheetList::JSStyleSheetList(NonNullPassRefPtr structure, JSDOM JSStyleSheetList::~JSStyleSheetList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSStyleSheetList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp b/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp index 627ad3b..940498a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp @@ -125,7 +125,7 @@ JSTextMetrics::JSTextMetrics(NonNullPassRefPtr structure, JSDOMGlobal JSTextMetrics::~JSTextMetrics() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSTextMetrics::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp b/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp index 825ca1b..1306ccb 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp @@ -93,7 +93,7 @@ JSTimeRanges::JSTimeRanges(NonNullPassRefPtr structure, JSDOMGlobalOb JSTimeRanges::~JSTimeRanges() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSTimeRanges::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp b/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp index a26425e..10645db 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp @@ -151,7 +151,7 @@ JSTreeWalker::JSTreeWalker(NonNullPassRefPtr structure, JSDOMGlobalOb JSTreeWalker::~JSTreeWalker() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSTreeWalker::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp b/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp index b355874..7616c58 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp @@ -84,7 +84,7 @@ JSValidityState::JSValidityState(NonNullPassRefPtr structure, JSDOMGl JSValidityState::~JSValidityState() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSValidityState::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp b/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp index a084949..94ad1c5 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp @@ -73,7 +73,7 @@ JSVoidCallback::JSVoidCallback(NonNullPassRefPtr structure, JSDOMGlob JSVoidCallback::~JSVoidCallback() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSVoidCallback::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp index bcf8286..0bb2267 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp @@ -120,7 +120,7 @@ JSWebKitCSSMatrix::JSWebKitCSSMatrix(NonNullPassRefPtr structure, JSD JSWebKitCSSMatrix::~JSWebKitCSSMatrix() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSWebKitCSSMatrix::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp index 255df0a..ea88682 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp @@ -78,7 +78,7 @@ JSWebKitPoint::JSWebKitPoint(NonNullPassRefPtr structure, JSDOMGlobal JSWebKitPoint::~JSWebKitPoint() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSWebKitPoint::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp index ea8ff3d..7e48815 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp @@ -122,7 +122,7 @@ JSWebSocket::JSWebSocket(NonNullPassRefPtr structure, JSDOMGlobalObje JSWebSocket::~JSWebSocket() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } void JSWebSocket::markChildren(MarkStack& markStack) @@ -215,7 +215,7 @@ void setJSWebSocketOnopen(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); WebSocket* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnopen(globalObject->createJSAttributeEventListener(value)); @@ -225,7 +225,7 @@ void setJSWebSocketOnmessage(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); WebSocket* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); @@ -235,7 +235,7 @@ void setJSWebSocketOnclose(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); WebSocket* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnclose(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp index 42cc502..14153e2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp @@ -129,7 +129,7 @@ void setJSWorkerOnmessage(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Worker* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp index e29cb32..5b7b105 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp @@ -129,7 +129,6 @@ JSWorkerContext::JSWorkerContext(NonNullPassRefPtr structure, PassRef JSWorkerContext::~JSWorkerContext() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } bool JSWorkerContext::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp index e24d0d6..6046aa6 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp @@ -156,7 +156,7 @@ JSWorkerLocation::JSWorkerLocation(NonNullPassRefPtr structure, JSDOM JSWorkerLocation::~JSWorkerLocation() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSWorkerLocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp index 8efab1e..29c2364 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp @@ -93,7 +93,7 @@ JSWorkerNavigator::JSWorkerNavigator(NonNullPassRefPtr structure, JSD JSWorkerNavigator::~JSWorkerNavigator() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSWorkerNavigator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp index 9927f5e..d81c689 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp @@ -137,7 +137,7 @@ JSXMLHttpRequest::JSXMLHttpRequest(NonNullPassRefPtr structure, JSDOM JSXMLHttpRequest::~JSXMLHttpRequest() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXMLHttpRequest::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -294,7 +294,7 @@ void setJSXMLHttpRequestOnabort(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -304,7 +304,7 @@ void setJSXMLHttpRequestOnerror(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -314,7 +314,7 @@ void setJSXMLHttpRequestOnload(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -324,7 +324,7 @@ void setJSXMLHttpRequestOnloadstart(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnloadstart(globalObject->createJSAttributeEventListener(value)); @@ -334,7 +334,7 @@ void setJSXMLHttpRequestOnprogress(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnprogress(globalObject->createJSAttributeEventListener(value)); @@ -344,7 +344,7 @@ void setJSXMLHttpRequestOnreadystatechange(ExecState* exec, JSObject* thisObject { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnreadystatechange(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp index 30e0d72..6de17c7 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp @@ -153,7 +153,7 @@ JSXMLHttpRequestException::JSXMLHttpRequestException(NonNullPassRefPtrglobalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXMLHttpRequestException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp index bc5fff9..9ca7972 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp @@ -158,7 +158,7 @@ JSXMLHttpRequestUpload::JSXMLHttpRequestUpload(NonNullPassRefPtr stru JSXMLHttpRequestUpload::~JSXMLHttpRequestUpload() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXMLHttpRequestUpload::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -250,7 +250,7 @@ void setJSXMLHttpRequestUploadOnabort(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -260,7 +260,7 @@ void setJSXMLHttpRequestUploadOnerror(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -270,7 +270,7 @@ void setJSXMLHttpRequestUploadOnload(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -280,7 +280,7 @@ void setJSXMLHttpRequestUploadOnloadstart(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnloadstart(globalObject->createJSAttributeEventListener(value)); @@ -290,7 +290,7 @@ void setJSXMLHttpRequestUploadOnprogress(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast(static_cast(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnprogress(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp index e6cdd6b..2fd7e29 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp @@ -147,7 +147,7 @@ JSXMLSerializer::JSXMLSerializer(NonNullPassRefPtr structure, JSDOMGl JSXMLSerializer::~JSXMLSerializer() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXMLSerializer::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp index e25be26..aa8840a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp @@ -158,7 +158,7 @@ JSXPathEvaluator::JSXPathEvaluator(NonNullPassRefPtr structure, JSDOM JSXPathEvaluator::~JSXPathEvaluator() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathEvaluator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp index 3894ac2..fb6a00a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp @@ -148,7 +148,7 @@ JSXPathException::JSXPathException(NonNullPassRefPtr structure, JSDOM JSXPathException::~JSXPathException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp index 9464146..af059df 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp @@ -141,7 +141,7 @@ JSXPathExpression::JSXPathExpression(NonNullPassRefPtr structure, JSD JSXPathExpression::~JSXPathExpression() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathExpression::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp index c3bdef1..7ba29c0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp @@ -79,7 +79,7 @@ JSXPathNSResolver::JSXPathNSResolver(NonNullPassRefPtr structure, JSD JSXPathNSResolver::~JSXPathNSResolver() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathNSResolver::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp index 337f473..d70ad29 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp @@ -171,7 +171,7 @@ JSXPathResult::JSXPathResult(NonNullPassRefPtr structure, JSDOMGlobal JSXPathResult::~JSXPathResult() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathResult::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp b/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp index 7dcd9c9..add8a84 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp @@ -86,7 +86,7 @@ JSXSLTProcessor::JSXSLTProcessor(NonNullPassRefPtr structure, JSDOMGl JSXSLTProcessor::~JSXSLTProcessor() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXSLTProcessor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h b/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h index 11e6af2..568670b 100644 --- a/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h +++ b/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h @@ -31,6 +31,6 @@ #define WebKitVersion_h #define WEBKIT_MAJOR_VERSION 532 -#define WEBKIT_MINOR_VERSION 3 +#define WEBKIT_MINOR_VERSION 4 #endif //WebKitVersion_h diff --git a/src/3rdparty/webkit/WebCore/history/qt/HistoryItemQt.cpp b/src/3rdparty/webkit/WebCore/history/qt/HistoryItemQt.cpp index 098a786..c5fb069 100644 --- a/src/3rdparty/webkit/WebCore/history/qt/HistoryItemQt.cpp +++ b/src/3rdparty/webkit/WebCore/history/qt/HistoryItemQt.cpp @@ -23,10 +23,13 @@ #include "CString.h" #include "FormData.h" -bool WebCore::HistoryItem::restoreState(QDataStream& in, int /*version*/) +bool WebCore::HistoryItem::restoreState(QDataStream& in, int version) { - // there is no different version right now - // switch (version) { + // we only support version 1 for now + + if (version != 1) + return false; + WebCore::String url; WebCore::String title; WebCore::String altTitle; @@ -87,10 +90,12 @@ bool WebCore::HistoryItem::restoreState(QDataStream& in, int /*version*/) return in.status() == QDataStream::Ok; } -QDataStream& WebCore::HistoryItem::saveState(QDataStream& out, int /*version*/) const +QDataStream& WebCore::HistoryItem::saveState(QDataStream& out, int version) const { - // there is no different version right now - // switch (version) { + // we only support version 1 for now. + if (version != 1) + return out; + out << urlString() << title() << alternateTitle() << lastVisitedTime(); out << originalURLString() << referrer() << target() << parent(); out << lastVisitWasHTTPNonGet() << lastVisitWasFailure() << isTargetItem(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp new file mode 100644 index 0000000..dbfed28 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HTMLAllCollection.h" + +#include "Node.h" + +namespace WebCore { + +PassRefPtr HTMLAllCollection::create(PassRefPtr base) +{ + return adoptRef(new HTMLAllCollection(base)); +} + +HTMLAllCollection::HTMLAllCollection(PassRefPtr base) + : HTMLCollection(base, DocAll) +{ +} + +HTMLAllCollection::~HTMLAllCollection() +{ +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h new file mode 100644 index 0000000..1dd3ede --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef HTMLAllCollection_h +#define HTMLAllCollection_h + +#include "HTMLCollection.h" + +namespace WebCore { + +class HTMLAllCollection : public HTMLCollection { +public: + static PassRefPtr create(PassRefPtr); + virtual ~HTMLAllCollection(); + +private: + HTMLAllCollection(PassRefPtr); +}; + +} // namespace WebCore + +#endif // HTMLAllCollection_h diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl new file mode 100644 index 0000000..d36f41e --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + + interface [ + GenerateConstructor, + HasIndexGetter, + HasNameGetter, + CustomCall, + MasqueradesAsUndefined + ] HTMLAllCollection { + readonly attribute unsigned long length; + [Custom] Node item(in unsigned long index); + [Custom] Node namedItem(in DOMString name); + + // FIXME: This should return an HTMLAllCollection. + NodeList tags(in DOMString name); + }; + +} diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp index 335b20f..7bae6e3 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp @@ -172,10 +172,11 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type) if (m_context && !m_context->is3d()) return 0; if (!m_context) { - m_context = new CanvasRenderingContext3D(this); - - // Need to make sure a RenderLayer and compositing layer get created for the Canvas - setNeedsStyleRecalc(SyntheticStyleChange); + m_context = CanvasRenderingContext3D::create(this); + if (m_context) { + // Need to make sure a RenderLayer and compositing layer get created for the Canvas + setNeedsStyleRecalc(SyntheticStyleChange); + } } return m_context.get(); } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCollection.h b/src/3rdparty/webkit/WebCore/html/HTMLCollection.h index b04bcbc..eea1777 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCollection.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLCollection.h @@ -64,6 +64,7 @@ public: protected: HTMLCollection(PassRefPtr base, CollectionType, CollectionCache*); + HTMLCollection(PassRefPtr base, CollectionType); CollectionCache* info() const { return m_info; } void resetCollectionInfo() const; @@ -71,8 +72,6 @@ protected: mutable bool m_idsDone; // for nextNamedItem() private: - HTMLCollection(PassRefPtr base, CollectionType); - virtual Element* itemAfter(Element*) const; virtual unsigned calcLength() const; virtual void updateNameCache() const; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl b/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl index 1ba5ec7..45d1127 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl @@ -34,8 +34,9 @@ module html { [Custom] Node item(in unsigned long index); [Custom] Node namedItem(in DOMString name); - // Extensions +#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C NodeList tags(in DOMString name); +#endif }; } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl b/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl index 3dd7a07..d250741 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl @@ -39,7 +39,7 @@ module html { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // FIXME: This should eventually be available (if they are wanted) for all languages. - attribute [Custom, Deletable] HTMLCollection all; + attribute [Custom, Deletable] HTMLAllCollection all; #endif void clear(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp index ed3405a..f25c908 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp @@ -1549,9 +1549,16 @@ void HTMLInputElement::defaultEventHandler(Event* evt) if (r && r->isTextField()) toRenderTextControl(r)->setEdited(false); } - // Form may never have been present, or may have been destroyed by the change event. - if (form()) - form()->submitClick(evt); + + RefPtr formForSubmission = form(); + // If there is no form and the element is an , then create a temporary form just to be used for submission. + if (!formForSubmission && inputType() == ISINDEX) + formForSubmission = createTemporaryFormForIsIndex(); + + // Form may never have been present, or may have been destroyed by code responding to the change event. + if (formForSubmission) + formForSubmission->submitClick(evt); + evt->setDefaultHandled(); return; } @@ -1569,6 +1576,19 @@ void HTMLInputElement::defaultEventHandler(Event* evt) HTMLFormControlElementWithState::defaultEventHandler(evt); } +PassRefPtr HTMLInputElement::createTemporaryFormForIsIndex() +{ + RefPtr form = new HTMLFormElement(formTag, document()); + form->registerFormElement(this); + form->setMethod("GET"); + if (!document()->baseURL().isEmpty()) { + // We treat the href property of the element as the form action, as per section 7.5 + // "Queries and Indexes" of the HTML 2.0 spec. . + form->setAction(document()->baseURL().string()); + } + return form.release(); +} + bool HTMLInputElement::isURLAttribute(Attribute *attr) const { return (attr->name() == srcAttr); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h index 799d92c..0e2da32 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h @@ -256,6 +256,8 @@ private: virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); } virtual bool isRequiredFormControl() const; + PassRefPtr createTemporaryFormForIsIndex(); + #if ENABLE(DATALIST) HTMLDataListElement* dataList() const; #endif diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp index 11ca3ba..729aceb 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp @@ -247,16 +247,12 @@ void HTMLMediaElement::insertedIntoDocument() scheduleLoad(); } -void HTMLMediaElement::willRemove() -{ - if (m_isFullscreen) - exitFullscreen(); - HTMLElement::willRemove(); -} void HTMLMediaElement::removedFromDocument() { if (m_networkState > NETWORK_EMPTY) pause(); + if (m_isFullscreen) + exitFullscreen(); HTMLElement::removedFromDocument(); } @@ -1678,6 +1674,9 @@ void HTMLMediaElement::userCancelledLoad() void HTMLMediaElement::documentWillBecomeInactive() { + if (m_isFullscreen) + exitFullscreen(); + m_inActiveDocument = false; userCancelledLoad(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h index 0005e07..405f013 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h @@ -57,7 +57,6 @@ public: virtual bool rendererIsNeeded(RenderStyle*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual void insertedIntoDocument(); - virtual void willRemove(); virtual void removedFromDocument(); virtual void attach(); virtual void recalcStyle(StyleChange); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl b/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl index 5f85fcb..a7e191a 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl @@ -21,7 +21,6 @@ module html { // FIXME: The W3C spec says that HTMLOptionsCollection should not have a parent class. - interface [ GenerateNativeConverter, HasCustomIndexSetter, @@ -36,9 +35,9 @@ module html { raises (DOMException); [Custom] void remove(in unsigned long index); -#if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - Node item(in unsigned long index); - Node namedItem(in DOMString name); +#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C + Node item(in unsigned long index); + Node namedItem(in DOMString name); #endif }; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp index 33af997..91285d9 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp @@ -416,13 +416,13 @@ HTMLTokenizer::State HTMLTokenizer::parseNonHTMLText(SegmentedString& src, State return state; } - + HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) { // We are inside a + @@ -44,6 +45,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + @@ -69,7 +72,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - @@ -94,6 +96,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + @@ -110,7 +113,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-
+
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js index 17b02a1..c24d589 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js @@ -143,8 +143,11 @@ var WebInspector = { this.panels.profiles = new WebInspector.ProfilesPanel(); this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType()); } + if (hiddenPanels.indexOf("timeline") === -1 && hiddenPanels.indexOf("timeline") === -1) + this.panels.timeline = new WebInspector.TimelinePanel(); + if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1) - this.panels.storage = new WebInspector.StoragePanel(); + this.panels.storage = new WebInspector.StoragePanel(); }, _loadPreferences: function() @@ -369,6 +372,7 @@ WebInspector.loaded = function() document.body.addStyleClass("platform-" + platform); this._loadPreferences(); + this.pendingDispatches = 0; this.drawer = new WebInspector.Drawer(); this.console = new WebInspector.ConsoleView(this.drawer); @@ -379,13 +383,13 @@ WebInspector.loaded = function() this.domAgent = new WebInspector.DOMAgent(); this.resourceCategories = { - documents: new WebInspector.ResourceCategory(WebInspector.UIString("Documents"), "documents"), - stylesheets: new WebInspector.ResourceCategory(WebInspector.UIString("Stylesheets"), "stylesheets"), - images: new WebInspector.ResourceCategory(WebInspector.UIString("Images"), "images"), - scripts: new WebInspector.ResourceCategory(WebInspector.UIString("Scripts"), "scripts"), - xhr: new WebInspector.ResourceCategory(WebInspector.UIString("XHR"), "xhr"), - fonts: new WebInspector.ResourceCategory(WebInspector.UIString("Fonts"), "fonts"), - other: new WebInspector.ResourceCategory(WebInspector.UIString("Other"), "other") + documents: new WebInspector.ResourceCategory("documents", WebInspector.UIString("Documents"), "rgb(47,102,236)"), + stylesheets: new WebInspector.ResourceCategory("stylesheets", WebInspector.UIString("Stylesheets"), "rgb(157,231,119)"), + images: new WebInspector.ResourceCategory("images", WebInspector.UIString("Images"), "rgb(164,60,255)"), + scripts: new WebInspector.ResourceCategory("scripts", WebInspector.UIString("Scripts"), "rgb(255,121,0)"), + xhr: new WebInspector.ResourceCategory("xhr", WebInspector.UIString("XHR"), "rgb(231,231,10)"), + fonts: new WebInspector.ResourceCategory("fonts", WebInspector.UIString("Fonts"), "rgb(255,82,62)"), + other: new WebInspector.ResourceCategory("other", WebInspector.UIString("Other"), "rgb(186,186,186)") }; this.panels = {}; @@ -456,8 +460,6 @@ WebInspector.loaded = function() // this._updateErrorAndWarningCounts(); var searchField = document.getElementById("search"); - searchField.addEventListener("keydown", this.searchKeyDown.bind(this), false); - searchField.addEventListener("keyup", this.searchKeyUp.bind(this), false); searchField.addEventListener("search", this.performSearch.bind(this), false); // when the search is emptied toolbarElement.addEventListener("mousedown", this.toolbarDragStart, true); @@ -494,7 +496,9 @@ WebInspector.dispatch = function() { function delayDispatch() { WebInspector[methodName].apply(WebInspector, parameters); + WebInspector.pendingDispatches--; } + WebInspector.pendingDispatches++; setTimeout(delayDispatch, 0); } @@ -511,13 +515,19 @@ WebInspector.windowResize = function(event) WebInspector.windowFocused = function(event) { - if (event.target.nodeType === Node.DOCUMENT_NODE) + // Fires after blur, so when focusing on either the main inspector + // or an