From 9c4bfd1dbdda1a073be12cf6212492abc7e9472b Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 25 Mar 2010 16:36:32 +1000 Subject: Unicode fixes for ODBC SQL Driver. Better unicode handling detection, plus turn off unicode if FreeTDS, plus handling of returning strings under non-unicode scenarios. Task-number: QTBUG-8846 Reviewed-by: Justin McPherson --- src/sql/drivers/odbc/qsql_odbc.cpp | 155 ++++++++++++++++++++++++++++--------- 1 file changed, 117 insertions(+), 38 deletions(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index e75c19d..1506c3c 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -131,11 +131,10 @@ class QODBCDriverPrivate public: enum DefaultCase{Lower, Mixed, Upper, Sensitive}; QODBCDriverPrivate() - : hEnv(0), hDbc(0), useSchema(false), disconnectCount(0), isMySqlServer(false), - isMSSqlServer(false), hasSQLFetchScroll(true), hasMultiResultSets(false), - isQuoteInitialized(false), quote(QLatin1Char('"')) + : hEnv(0), hDbc(0), unicode(false), useSchema(false), disconnectCount(0), isMySqlServer(false), + isMSSqlServer(false), isFreeTDSDriver(false), hasSQLFetchScroll(true), + hasMultiResultSets(false), isQuoteInitialized(false), quote(QLatin1Char('"')) { - unicode = false; } SQLHANDLE hEnv; @@ -146,6 +145,7 @@ public: int disconnectCount; bool isMySqlServer; bool isMSSqlServer; + bool isFreeTDSDriver; bool hasSQLFetchScroll; bool hasMultiResultSets; @@ -172,7 +172,10 @@ public: QODBCPrivate(QODBCDriverPrivate *dpp) : hStmt(0), useSchema(false), hasSQLFetchScroll(true), driverPrivate(dpp), userForwardOnly(false) { - unicode = false; + unicode = dpp->unicode; + useSchema = dpp->useSchema; + disconnectCount = dpp->disconnectCount; + hasSQLFetchScroll = dpp->hasSQLFetchScroll; } inline void clearValues() @@ -374,44 +377,88 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni } else { colSize++; // make sure there is room for more than the 0 termination } - r = SQLGetData(hStmt, - column+1, - SQL_C_TCHAR, - NULL, - 0, - &lengthIndicator); - if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && lengthIndicator > 0) - colSize = lengthIndicator/sizeof(SQLTCHAR) + 1; - QVarLengthArray buf(colSize); - while (true) { + if(unicode) { r = SQLGetData(hStmt, column+1, SQL_C_TCHAR, - (SQLPOINTER)buf.data(), - colSize*sizeof(SQLTCHAR), + NULL, + 0, &lengthIndicator); - if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { - if (lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL) { + if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && lengthIndicator > 0) + colSize = lengthIndicator/sizeof(SQLTCHAR) + 1; + QVarLengthArray buf(colSize); + memset(buf.data(), 0, colSize*sizeof(SQLTCHAR)); + while (true) { + r = SQLGetData(hStmt, + column+1, + SQL_C_TCHAR, + (SQLPOINTER)buf.data(), + colSize*sizeof(SQLTCHAR), + &lengthIndicator); + if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { + if (lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL) { + fieldVal.clear(); + break; + } + // if SQL_SUCCESS_WITH_INFO is returned, indicating that + // more data can be fetched, the length indicator does NOT + // contain the number of bytes returned - it contains the + // total number of bytes that CAN be fetched + // colSize-1: remove 0 termination when there is more data to fetch + int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator/sizeof(SQLTCHAR); + fieldVal += fromSQLTCHAR(buf, rSize); + if (lengthIndicator < (unsigned int)colSize*sizeof(SQLTCHAR)) { + // workaround for Drivermanagers that don't return SQL_NO_DATA + break; + } + } else if (r == SQL_NO_DATA) { + break; + } else { + qWarning() << "qGetStringData: Error while fetching data (" << qWarnODBCHandle(SQL_HANDLE_STMT, hStmt) << ')'; fieldVal.clear(); break; } - // if SQL_SUCCESS_WITH_INFO is returned, indicating that - // more data can be fetched, the length indicator does NOT - // contain the number of bytes returned - it contains the - // total number of bytes that CAN be fetched - // colSize-1: remove 0 termination when there is more data to fetch - int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator/sizeof(SQLTCHAR); - fieldVal += fromSQLTCHAR(buf, rSize); - if (lengthIndicator < (unsigned int)colSize*sizeof(SQLTCHAR)) { - // workaround for Drivermanagers that don't return SQL_NO_DATA + } + } else { + r = SQLGetData(hStmt, + column+1, + SQL_C_CHAR, + NULL, + 0, + &lengthIndicator); + if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && lengthIndicator > 0) + colSize = lengthIndicator + 1; + QVarLengthArray buf(colSize); + while (true) { + r = SQLGetData(hStmt, + column+1, + SQL_C_CHAR, + (SQLPOINTER)buf.data(), + colSize, + &lengthIndicator); + if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { + if (lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL) { + fieldVal.clear(); + break; + } + // if SQL_SUCCESS_WITH_INFO is returned, indicating that + // more data can be fetched, the length indicator does NOT + // contain the number of bytes returned - it contains the + // total number of bytes that CAN be fetched + // colSize-1: remove 0 termination when there is more data to fetch + int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator; + fieldVal += QString::fromUtf8((const char *)buf.constData(), rSize); + if (lengthIndicator < (unsigned int)colSize) { + // workaround for Drivermanagers that don't return SQL_NO_DATA + break; + } + } else if (r == SQL_NO_DATA) { + break; + } else { + qWarning() << "qGetStringData: Error while fetching data (" << qWarnODBCHandle(SQL_HANDLE_STMT, hStmt) << ')'; + fieldVal.clear(); break; } - } else if (r == SQL_NO_DATA) { - break; - } else { - qWarning() << "qGetStringData: Error while fetching data (" << qWarnODBCHandle(SQL_HANDLE_STMT, hStmt) << ')'; - fieldVal.clear(); - break; } } return fieldVal; @@ -866,10 +913,6 @@ QODBCResult::QODBCResult(const QODBCDriver * db, QODBCDriverPrivate* p) : QSqlResult(db) { d = new QODBCPrivate(p); - d->unicode = p->unicode; - d->useSchema = p->useSchema; - d->disconnectCount = p->disconnectCount; - d->hasSQLFetchScroll = p->hasSQLFetchScroll; } QODBCResult::~QODBCResult() @@ -1846,6 +1889,7 @@ bool QODBCDriver::open(const QString & db, SQLSMALLINT cb; QVarLengthArray connOut(1024); + memset(connOut.data(), 0, connOut.size() * sizeof(SQLTCHAR)); r = SQLDriverConnect(d->hDbc, NULL, #ifdef UNICODE @@ -1943,6 +1987,7 @@ void QODBCDriverPrivate::checkUnicode() NULL); if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WCHAR)) { unicode = true; + return; } r = SQLGetInfo(hDbc, @@ -1952,6 +1997,7 @@ void QODBCDriverPrivate::checkUnicode() NULL); if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WVARCHAR)) { unicode = true; + return; } r = SQLGetInfo(hDbc, @@ -1961,7 +2007,25 @@ void QODBCDriverPrivate::checkUnicode() NULL); if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WLONGVARCHAR)) { unicode = true; + return; + } + SQLHANDLE hStmt; + r = SQLAllocHandle(SQL_HANDLE_STMT, + hDbc, + &hStmt); + + r = SQLExecDirect(hStmt, toSQLTCHAR(QLatin1String("select 'test'")).data(), SQL_NTS); + if(r == SQL_SUCCESS) { + r = SQLFetch(hStmt); + if(r == SQL_SUCCESS) { + QVarLengthArray buffer(10); + r = SQLGetData(hStmt, 1, SQL_C_WCHAR, buffer.data(), buffer.size() * sizeof(SQLWCHAR), NULL); + if(r == SQL_SUCCESS && fromSQLTCHAR(buffer) == QLatin1String("test")) { + unicode = true; + } + } } + r = SQLFreeHandle(SQL_HANDLE_STMT, hStmt); } bool QODBCDriverPrivate::checkDriver() const @@ -2053,6 +2117,21 @@ void QODBCDriverPrivate::checkSqlServer() isMySqlServer = serverType.contains(QLatin1String("mysql"), Qt::CaseInsensitive); isMSSqlServer = serverType.contains(QLatin1String("Microsoft SQL Server"), Qt::CaseInsensitive); } + r = SQLGetInfo(hDbc, + SQL_DRIVER_NAME, + serverString.data(), + serverString.size() * sizeof(SQLTCHAR), + &t); + if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { + QString serverType; +#ifdef UNICODE + serverType = fromSQLTCHAR(serverString, t/sizeof(SQLTCHAR)); +#else + serverType = QString::fromUtf8((const char *)serverString.constData(), t); +#endif + isFreeTDSDriver = serverType.contains(QLatin1String("tdsodbc"), Qt::CaseInsensitive); + unicode = isFreeTDSDriver == false; + } } void QODBCDriverPrivate::checkHasSQLFetchScroll() -- cgit v0.12 From 194bbeed0152d541527059bb0f1dae60a8573912 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 25 Mar 2010 16:44:32 +1000 Subject: Fix ODBC compilation for ODBC versions < 3.5 Task-number: QTBUG-8488 Reviewed-by: Justin McPherson --- src/sql/drivers/odbc/qsql_odbc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 1506c3c..f41a914 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -352,7 +352,9 @@ static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, const T* p, bool isSi #endif case SQL_CHAR: case SQL_VARCHAR: +#if (ODBCVER >= 0x0350) case SQL_GUID: +#endif case SQL_LONGVARCHAR: type = QVariant::String; break; -- cgit v0.12 From 92607e19c79fcdfb82e42fa45353004f85d1adf9 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 25 Mar 2010 16:50:32 +1000 Subject: Sql Autotest cleanup and tweaking. --- tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 178 +++++++++++++++-------------- tests/auto/qsqlquery/tst_qsqlquery.cpp | 9 +- 2 files changed, 95 insertions(+), 92 deletions(-) diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index f837564..f3c2c09 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -44,7 +44,7 @@ #include #include #include - +#include #include "../qsqldatabase/tst_databases.h" @@ -122,7 +122,7 @@ void tst_Q3SqlCursor::generic_data(const QString &engine) { if ( dbs.fillTestTable(engine) == 0 ) { if(engine.isEmpty()) - QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); else QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); } @@ -131,7 +131,7 @@ void tst_Q3SqlCursor::generic_data(const QString &engine) void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) { if ( !db.isValid() ) - return; + return; QSqlQuery q( db ); if (tst_Databases::isSqlServer(db)) { @@ -143,20 +143,20 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) // please never ever change this table; otherwise fix all tests ;) if ( tst_Databases::isMSAccess( db ) ) { - QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null," - "t_char char(40), t_numeric number, primary key (id, t_varchar) )" )); + QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null," + "t_char char(40), t_numeric number, primary key (id, t_varchar) )" )); } else { - QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null," - "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar) )" )); + QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null," + "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar) )" )); } if ( tst_Databases::isSqlServer( db ) ) { - //workaround for SQL SERVER since he can store unicode only in nvarchar fields - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, " - "t_varchar nvarchar(80) not null, t_char nchar(80) )" )); + //workaround for SQL SERVER since he can store unicode only in nvarchar fields + QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, " + "t_varchar nvarchar(80) not null, t_char nchar(80) )" )); } else { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, " - "t_varchar varchar(100) not null," "t_char char(100))" )); + QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, " + "t_varchar varchar(100) not null," "t_char char(100))" )); } if (tst_Databases::isMSAccess(db)) { @@ -169,7 +169,7 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) void tst_Q3SqlCursor::dropTestTables( QSqlDatabase db ) { if ( !db.isValid() ) - return; + return; QStringList tableNames; tableNames << qtest << qTableName( "qtest_unicode", __FILE__ ) @@ -183,7 +183,7 @@ void tst_Q3SqlCursor::dropTestTables( QSqlDatabase db ) void tst_Q3SqlCursor::populateTestTables( QSqlDatabase db ) { if (!db.isValid()) - return; + return; QSqlQuery q( db ); q.exec( "delete from " + qtest ); //not fatal @@ -200,21 +200,21 @@ void tst_Q3SqlCursor::initTestCase() dbs.open(); for ( QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it ) { - QSqlDatabase db = QSqlDatabase::database( (*it) ); - CHECK_DATABASE( db ); + QSqlDatabase db = QSqlDatabase::database( (*it) ); + CHECK_DATABASE( db ); - dropTestTables( db ); //in case of leftovers - createTestTables( db ); - populateTestTables( db ); + dropTestTables( db ); //in case of leftovers + createTestTables( db ); + populateTestTables( db ); } } void tst_Q3SqlCursor::cleanupTestCase() { for ( QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it ) { - QSqlDatabase db = QSqlDatabase::database( (*it) ); - CHECK_DATABASE( db ); - dropTestTables( db ); + QSqlDatabase db = QSqlDatabase::database( (*it) ); + CHECK_DATABASE( db ); + dropTestTables( db ); } dbs.close(); @@ -230,9 +230,9 @@ void tst_Q3SqlCursor::cleanup() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); if ( QTest::currentTestFailed() ) { - //since Oracle ODBC totally craps out on error, we init again - db.close(); - db.open(); + //since Oracle ODBC totally craps out on error, we init again + db.close(); + db.open(); } } @@ -244,10 +244,10 @@ void tst_Q3SqlCursor::copyConstructor() Q3SqlCursor cur2; { - Q3SqlCursor cur( qtest, true, db ); - QVERIFY_SQL(cur, select( cur.index( QString("id") ) )); - cur2 = Q3SqlCursor( cur ); - // let "cur" run out of scope... + Q3SqlCursor cur( qtest, true, db ); + QVERIFY_SQL(cur, select( cur.index( QString("id") ) )); + cur2 = Q3SqlCursor( cur ); + // let "cur" run out of scope... } QSqlRecord* rec = cur2.primeUpdate(); @@ -256,8 +256,8 @@ void tst_Q3SqlCursor::copyConstructor() int i = 0; while ( cur2.next() ) { - QVERIFY( cur2.value("id").toInt() == i ); - i++; + QVERIFY( cur2.value("id").toInt() == i ); + i++; } } @@ -271,8 +271,8 @@ void tst_Q3SqlCursor::value() QVERIFY_SQL(cur, select( cur.index( QString("id") ) )); int i = 0; while ( cur.next() ) { - QCOMPARE(cur.value("id").toInt(), i); - i++; + QCOMPARE(cur.value("id").toInt(), i); + i++; } } @@ -285,11 +285,11 @@ void tst_Q3SqlCursor::primaryIndex() Q3SqlCursor cur( qtest, true, db ); QSqlIndex index = cur.primaryIndex(); if ( tst_Databases::isMSAccess( db ) ) { - QCOMPARE( index.fieldName(1).upper(), QString( "ID" ) ); - QCOMPARE( index.fieldName(0).upper(), QString( "T_VARCHAR" ) ); + QCOMPARE( index.fieldName(1).upper(), QString( "ID" ) ); + QCOMPARE( index.fieldName(0).upper(), QString( "T_VARCHAR" ) ); } else { - QCOMPARE( index.fieldName(0).upper(), QString( "ID" ) ); - QCOMPARE( index.fieldName(1).upper(), QString( "T_VARCHAR" ) ); + QCOMPARE( index.fieldName(0).upper(), QString( "ID" ) ); + QCOMPARE( index.fieldName(1).upper(), QString( "T_VARCHAR" ) ); } QVERIFY(!index.isDescending(0)); QVERIFY(!index.isDescending(1)); @@ -308,10 +308,10 @@ void tst_Q3SqlCursor::insert() // check that primeInsert returns a valid QSqlRecord QCOMPARE( (int)irec->count(), 4 ); if ( ( irec->field( 0 ).type() != QVariant::Int ) && - ( irec->field( 0 ).type() != QVariant::String ) && + ( irec->field( 0 ).type() != QVariant::String ) && ( irec->field( 0 ).type() != QVariant::Double ) ) { - QFAIL( QString( "Wrong datatype %1 for field 'ID'" - " (expected Int or String)" ).arg( QVariant::typeToName( irec->field( 0 ).type() ) ) ); + QFAIL( QString( "Wrong datatype %1 for field 'ID'" + " (expected Int or String)" ).arg( QVariant::typeToName( irec->field( 0 ).type() ) ) ); } QCOMPARE( QVariant::typeToName( irec->field( 1 ).type() ), QVariant::typeToName( QVariant::String ) ); QCOMPARE( QVariant::typeToName( irec->field( 2 ).type() ), QVariant::typeToName( QVariant::String ) ); @@ -327,7 +327,9 @@ void tst_Q3SqlCursor::insert() irec->setValue( "t_char", "SomeChar" ); irec->setValue( "t_numeric", 400.400 ); - QCOMPARE( cur.insert(), 1 ); + QSet validReturns(QSet() << -1 << 1); + + QVERIFY( validReturns.contains(cur.insert()) ); // restore old test-tables populateTestTables( db ); @@ -338,6 +340,7 @@ void tst_Q3SqlCursor::insertSpecial() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + QSet validReturns(QSet() << -1 << 1); Q3SqlCursor cur( qtest, true, db ); QSqlRecord* irec = cur.primeInsert(); @@ -355,25 +358,25 @@ void tst_Q3SqlCursor::insertSpecial() // INSERT the strings QStringList::Iterator it; for ( it = strings.begin(); it != strings.end(); ++it ) { - QSqlRecord* irec = cur.primeInsert(); - QVERIFY( irec != 0 ); - irec->setValue( "id", i ); - irec->setValue( "t_varchar", (*it) ); - irec->setValue( "t_char", (*it) ); - irec->setValue( "t_numeric", (double)i ); - ++i; - QCOMPARE( cur.insert(), 1 ); + QSqlRecord* irec = cur.primeInsert(); + QVERIFY( irec != 0 ); + irec->setValue( "id", i ); + irec->setValue( "t_varchar", (*it) ); + irec->setValue( "t_char", (*it) ); + irec->setValue( "t_numeric", (double)i ); + ++i; + QVERIFY( validReturns.contains(cur.insert()) ); } QVERIFY( cur.select( "id >= 800 and id < 900" ) ); int i2 = 800; while( cur.next() ) { - QCOMPARE( cur.value( "id" ).toInt(), i2 ); - QCOMPARE( cur.value( "t_varchar" ).toString().stripWhiteSpace(), strings.at( i2 - 800 ) ); - QCOMPARE( cur.value( "t_char" ).toString().stripWhiteSpace(), strings.at( i2 - 800 ) ); - QCOMPARE( cur.value( "t_numeric" ).toDouble(), (double)i2 ); - ++i2; + QCOMPARE( cur.value( "id" ).toInt(), i2 ); + QCOMPARE( cur.value( "t_varchar" ).toString().stripWhiteSpace(), strings.at( i2 - 800 ) ); + QCOMPARE( cur.value( "t_char" ).toString().stripWhiteSpace(), strings.at( i2 - 800 ) ); + QCOMPARE( cur.value( "t_numeric" ).toDouble(), (double)i2 ); + ++i2; } QCOMPARE( i, i2 ); @@ -385,6 +388,7 @@ void tst_Q3SqlCursor::batchInsert() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + QSet validReturns(QSet() << -1 << 1); QSqlQuery q( db ); q.exec( "delete from " + qtest ); @@ -393,16 +397,16 @@ void tst_Q3SqlCursor::batchInsert() int i = 0; for ( ; i < 100; ++i ) { - QSqlRecord* irec = cur.primeInsert(); - Q_ASSERT( irec ); - irec->setValue( "id", i ); - irec->setValue( "t_varchar", "blah" ); - irec->setValue( "t_char", "blah" ); - irec->setValue( "t_numeric", 1.1 ); - if ( db.driverName().startsWith( "QSQLITE" ) ) { - QVERIFY( cur.insert( true ) ); - } else { - QCOMPARE( cur.insert( true ), 1 ); + QSqlRecord* irec = cur.primeInsert(); + Q_ASSERT( irec ); + irec->setValue( "id", i ); + irec->setValue( "t_varchar", "blah" ); + irec->setValue( "t_char", "blah" ); + irec->setValue( "t_numeric", 1.1 ); + if ( db.driverName().startsWith( "QSQLITE" ) ) { + QVERIFY( cur.insert( true ) ); + } else { + QVERIFY( validReturns.contains(cur.insert( true )) ); } } @@ -413,18 +417,18 @@ void tst_Q3SqlCursor::batchInsert() irec->setValue( "t_varchar", "blah" ); irec->setValue( "t_char", "blah" ); irec->setValue( "t_numeric", 1.1 ); - if ( db.driverName().startsWith( "QSQLITE" ) ) { - QVERIFY( cur.insert( false ) ); - } else { - QCOMPARE( cur.insert( false ), 1 ); + if ( db.driverName().startsWith( "QSQLITE" ) ) { + QVERIFY( cur.insert( false ) ); + } else { + QVERIFY( validReturns.contains(cur.insert( false )) ); } } i = 0; QVERIFY_SQL(q, exec( "select * from " + qtest + " order by id" )); while ( q.next() ) { - QCOMPARE( q.value( 0 ).toInt(), i ); - i++; + QCOMPARE( q.value( 0 ).toInt(), i ); + i++; } QCOMPARE( i, 200 ); @@ -436,7 +440,7 @@ static QString dumpUtf8( const QString& str ) { QString res; for ( int i = 0; i < (int)str.length(); ++i ) { - res += "0x" + QString::number( str[ i ].unicode(), 16 ) + ' '; + res += "0x" + QString::number( str[ i ].unicode(), 16 ) + ' '; } return res; } @@ -448,7 +452,7 @@ void tst_Q3SqlCursor::insertORA() CHECK_DATABASE( db ); if (tst_Databases::getOraVersion(db) < 9) - QSKIP("Need Oracle >= 9", SkipSingle); + QSKIP("Need Oracle >= 9", SkipSingle); /****** CHARSET TEST ******/ @@ -466,8 +470,8 @@ void tst_Q3SqlCursor::insertORA() QVERIFY_SQL(cur, select()); QVERIFY( cur.next() ); if ( cur.value( "t_char" ).toString() != val1 ) - qDebug( QString( "Wrong value for t_char: expected '%1', got '%2'" ).arg( val1 ).arg( - cur.value( "t_char" ).toString() ) ); + qDebug( QString( "Wrong value for t_char: expected '%1', got '%2'" ).arg( val1 ).arg( + cur.value( "t_char" ).toString() ) ); static const unsigned short utf8arr[] = { 0xd792,0xd79c,0xd792,0xd79c,0xd799,0x00 }; static const QString utf8str = QString::fromUcs2( utf8arr ); @@ -524,7 +528,7 @@ void tst_Q3SqlCursor::unicode() static const QString utf8str = QString::fromUtf8( "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει." ); if ( !db.driver()->hasFeature( QSqlDriver::Unicode ) ) { - QSKIP( "DBMS not Unicode capable", SkipSingle ); + QSKIP( "DBMS not Unicode capable", SkipSingle ); } // ascii in the data storage, can't transliterate properly. invalid test. if(db.driverName().startsWith("QIBASE") && (db.databaseName() == "silence.nokia.troll.no:c:\\ibase\\testdb_ascii" || db.databaseName() == "/opt/interbase/qttest.gdb")) @@ -640,11 +644,11 @@ void tst_Q3SqlCursor::select() QSqlIndex idx = cur4.primaryIndex( false ); QCOMPARE( (int)idx.count(), 2 ); if ( tst_Databases::isMSAccess( db ) ) { - QCOMPARE( idx.field( 1 ).name().upper(), QString("ID") ); - QCOMPARE( idx.field( 0 ).name().upper(), QString("T_VARCHAR") ); + QCOMPARE( idx.field( 1 ).name().upper(), QString("ID") ); + QCOMPARE( idx.field( 0 ).name().upper(), QString("T_VARCHAR") ); } else { - QCOMPARE( idx.field( 0 ).name().upper(), QString("ID") ); - QCOMPARE( idx.field( 1 ).name().upper(), QString("T_VARCHAR") ); + QCOMPARE( idx.field( 0 ).name().upper(), QString("ID") ); + QCOMPARE( idx.field( 1 ).name().upper(), QString("T_VARCHAR") ); } #ifdef QT_DEBUG @@ -688,17 +692,18 @@ void tst_Q3SqlCursor::updateNoPK() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - + QSet validReturns(QSet() << -1 << 1); + QSqlQuery q(db); QVERIFY_SQL(q, exec("create table " + qTableName( "qtestPK", __FILE__ ) + " (id int, name varchar(20), num numeric)")); - + Q3SqlCursor cur(qTableName("qtestPK", __FILE__), true, db); QSqlRecord* rec = cur.primeInsert(); Q_ASSERT(rec); rec->setNull(0); rec->setNull(1); rec->setNull(2); - QVERIFY_SQL(cur, insert() == 1); + QVERIFY(validReturns.contains(cur.insert())); if (!db.driver()->hasFeature(QSqlDriver::PreparedQueries)) { // Only QPSQL, QMYSQL, QODBC and QOCI drivers currently use escape identifiers for column names @@ -713,8 +718,8 @@ void tst_Q3SqlCursor::updateNoPK() + " values (NULL,NULL,NULL)"); QCOMPARE(cur.lastQuery(), query); } else { - QCOMPARE(cur.lastQuery(), QString::fromLatin1("insert into " + qTableName("qtestPK", __FILE__) + - " (\"id\",\"name\",\"num\") values (NULL,NULL,NULL)")); + QCOMPARE(cur.lastQuery(), QString::fromLatin1("insert into " + qTableName("qtestPK", __FILE__) + + " (\"id\",\"name\",\"num\") values (NULL,NULL,NULL)")); } } @@ -733,7 +738,7 @@ void tst_Q3SqlCursor::updateNoPK() qTableName("qtestPK", __FILE__) + ".num IS NULL"; if (!db.driver()->hasFeature(QSqlDriver::PreparedQueries)) { if (!db.driverName().startsWith("QSQLITE")) { - QCOMPARE(cur.lastQuery(), expect); + QCOMPARE(cur.lastQuery(), expect); } } QVERIFY(cur.select(cur.index(QString("id")))); @@ -750,6 +755,7 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() { QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + QSet validReturns(QSet() << -1 << 1); // The bugfix (and this test) depends on QSqlDriver::escapeIdentifier(...) // to be implemented, which is currently only the case for the @@ -778,7 +784,7 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() { r->setValue("firsT NaMe", "Kong"); r->setValue("lastNaMe", "Harald"); - QVERIFY(cur.insert() == 1); + QVERIFY(validReturns.contains(cur.insert())); cur.select(); cur.next(); diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index b9ab73f..db3a929 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -1137,17 +1137,14 @@ void tst_QSqlQuery::last() QVERIFY( q.last() ); - if ( !tst_Databases::isMSAccess( db ) ) - // Access doesn't return the correct position - QCOMPARE( q.at(), ( i-1 ) ); + QSet validReturns(QSet() << -1 << i-1); + QVERIFY( validReturns.contains(q.at()) ); QSqlQuery q2( "select * from " + qtest, db ); QVERIFY( q2.last() ); - if ( !tst_Databases::isMSAccess( db ) ) - // Access doesn't return the correct position - QCOMPARE( q.at(), ( i-1 ) ); + QVERIFY( validReturns.contains(q.at()) ); } void tst_QSqlQuery::seek() -- cgit v0.12 From e38aef4eee8c6a32bd30632576aee17a3d333c2e Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 11 Mar 2010 13:27:17 +0100 Subject: Doc: Fix links in the ActiveQt framework, and also link to the tools. --- doc/src/frameworks-technologies/activeqt.qdoc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/src/frameworks-technologies/activeqt.qdoc b/doc/src/frameworks-technologies/activeqt.qdoc index 67b9bb3..5e8473f 100644 --- a/doc/src/frameworks-technologies/activeqt.qdoc +++ b/doc/src/frameworks-technologies/activeqt.qdoc @@ -57,6 +57,7 @@ \brief An overview of Qt's ActiveX and COM integration on Windows. \ingroup platform-specific + \ingroup frameworks-technologies \keyword ActiveQt Qt's ActiveX and COM support allows Qt for Windows developers to: @@ -69,19 +70,23 @@ controls. \endlist - The ActiveQt framework consists of two modules: + The ActiveQt framework consists of two frameworks: \list - \o The \l QAxContainer module is a static - library implementing QObject and QWidget subclasses, QAxObject and - QAxWidget, that act as containers for COM objects and ActiveX - controls. - \o The \l QAxServer module is a static library that implements + \o The \l{Using ActiveX controls and COM objects in Qt}{QAxContainer} + module is a static library implementing QObject and QWidget subclasses, + QAxObject and QAxWidget, that act as containers for COM objects and + ActiveX controls. + \o The \l{Building ActiveX servers and controls with Qt}{QAxServer} + module is a static library that implements functionality for in-process and executable COM servers. This module provides the QAxAggregated, QAxBindable and QAxFactory classes. \endlist + A set of \l{Tools for ActiveQt}{tools} is provided to simplify the + developing and building of Qt projects that use ActiveX. + To build the static libraries, change into the \c activeqt directory (usually \c QTDIR/src/activeqt), and run \c qmake and your make tool in both the \c container and the \c control subdirectory. -- cgit v0.12 From 80cf88a395d61c2dee83d484c91f24437be0c0e0 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 25 Mar 2010 12:50:48 +0200 Subject: QMessageBox is smaller than native MessageBox Messageboxes are smaller than native ones. This is due to that native ones have a lot of empty space. To fix this, we define a new custom pixel metrics that is the minimum height of one text line messagebox (aka AknPopUp) on the native side. Then we ensure that the QMessageBox is at least of this height. Additionally we do some minor styling for QMessageBox: - the corners graphics are now as rounded as on native side - the font is set to match the native side - the top margin space is doubled for dialogs, which is rather good approximation of native side Task-number: QTBUG-4875 Reviewed-by: Janne Anttila --- src/gui/dialogs/qmessagebox.cpp | 14 ++++++++++++++ src/gui/styles/qs60style.cpp | 35 +++++++++++++++++++++------------- src/gui/styles/qs60style.h | 3 ++- src/gui/styles/qs60style_p.h | 6 +++--- src/gui/styles/qs60style_s60.cpp | 16 ++++++++++------ util/s60pixelmetrics/pixel_metrics.cpp | 11 +++++++++-- util/s60pixelmetrics/pixel_metrics.h | 4 +++- util/s60pixelmetrics/pm_mapperapp.cpp | 9 ++++++--- 8 files changed, 69 insertions(+), 29 deletions(-) diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index bd2df9c..ccc925c 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -65,6 +65,10 @@ #include #include +#ifndef QT_NO_STYLE_S60 +#include +#endif + #ifdef Q_WS_WINCE extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp extern bool qt_wince_is_smartphone();//defined in qguifunctions_wince.cpp @@ -353,6 +357,16 @@ void QMessageBoxPrivate::updateSize() int height = (layout->hasHeightForWidth()) ? layout->totalHeightForWidth(width) : layout->totalMinimumSize().height(); + +#ifndef QT_NO_STYLE_S60 + QS60Style *s60Style = 0; + s60Style = qobject_cast(QApplication::style()); + + //use custom pixel metric to deduce the minimum height of the messagebox + if (s60Style) + height = qMax(height, s60Style->pixelMetric((QStyle::PixelMetric)PM_MessageBoxHeight)); +#endif + q->setFixedSize(width, height); QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); } diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index af37e6e..2c665fb 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -50,6 +50,7 @@ #include "qcalendarwidget.h" #include "qdial.h" #include "qdialog.h" +#include "qmessagebox.h" #include "qgroupbox.h" #include "qheaderview.h" #include "qlist.h" @@ -91,10 +92,10 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,16,"QVGA Landscape"}, -{320,240,1,16,"QVGA Portrait"}, -{360,640,1,16,"NHD Landscape"}, -{640,360,1,16,"NHD Portrait"}, +{240,320,1,17,"QVGA Landscape"}, +{320,240,1,17,"QVGA Portrait"}, +{360,640,1,17,"NHD Landscape"}, +{640,360,1,17,"NHD Portrait"}, {352,800,1,12,"E90 Landscape"} // *** End of generated data *** }; @@ -103,11 +104,11 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,0,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,0,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,0,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,0,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,0,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1} +{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,0,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1, 106}, +{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,0,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1, 106}, +{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,0,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, +{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,0,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, +{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,0,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1, 106} // *** End of generated data *** }; @@ -126,7 +127,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed}, {SE_FrameLineEdit, QS60StyleEnums::SP_QsnFrInputCenter}, {SE_ListHighlight, QS60StyleEnums::SP_QsnFrListCenter}, - {SE_OptionsMenu, QS60StyleEnums::SP_QsnFrPopupCenter}, + {SE_PopupBackground, QS60StyleEnums::SP_QsnFrPopupCenter}, {SE_SettingsList, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_TableItem, QS60StyleEnums::SP_QsnFrCaleCenter}, {SE_TableHeaderItem, QS60StyleEnums::SP_QsnFrCaleHeadingCenter}, @@ -249,8 +250,8 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, case SE_ListHighlight: drawFrame(SF_ListHighlight, painter, rect, flags | SF_PointNorth); break; - case SE_OptionsMenu: - drawFrame(SF_OptionsMenu, painter, rect, flags | SF_PointNorth); + case SE_PopupBackground: + drawFrame(SF_PopupBackground, painter, rect, flags | SF_PointNorth); break; case SE_SettingsList: drawFrame(SF_SettingsList, painter, rect, flags | SF_PointNorth); @@ -636,6 +637,8 @@ void QS60StylePrivate::setFont(QWidget *widget) const fontCategory = QS60StyleEnums::FC_Secondary; } else if (qobject_cast(widget)){ fontCategory = QS60StyleEnums::FC_Title; + } else if (qobject_cast(widget)){ + fontCategory = QS60StyleEnums::FC_Primary; } if (fontCategory != QS60StyleEnums::FC_Undefined) { const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont) @@ -2215,7 +2218,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) && option->palette.window().texture().cacheKey() == QS60StylePrivate::m_themePalette->window().texture().cacheKey()) - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_OptionsMenu, painter, option->rect, flags); + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, option->rect, flags); else commonStyleDraws = true; } @@ -2400,6 +2403,12 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const else if (metric == PM_LayoutRightMargin) metricValue = QS60StylePrivate::pixelMetric(PM_LayoutLeftMargin); } + + if (widget && (metric == PM_LayoutTopMargin)) + if (widget->windowType() == Qt::Dialog) + //double the top layout margin for dialogs, it is very close to real value + //without having to define custom pixel metric + metricValue *= 2; return metricValue; } diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index af17843..c878538 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -58,7 +58,8 @@ enum { PM_FrameCornerWidth = QStyle::PM_CustomBase + 1, PM_FrameCornerHeight, PM_BoldLineWidth, - PM_ThinLineWidth + PM_ThinLineWidth, + PM_MessageBoxHeight }; class QS60StylePrivate; diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 8bb2f7b..6ce4960 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE const int MAX_NON_CUSTOM_PIXELMETRICS = 92; -const int CUSTOMVALUESCOUNT = 4; +const int CUSTOMVALUESCOUNT = 5; const int MAX_PIXELMETRICS = MAX_NON_CUSTOM_PIXELMETRICS + CUSTOMVALUESCOUNT; @@ -411,7 +411,7 @@ public: SE_TabBarTabWestActive, SE_TabBarTabWestInactive, SE_ListHighlight, - SE_OptionsMenu, + SE_PopupBackground, SE_SettingsList, SE_TableItem, SE_TableHeaderItem, @@ -432,7 +432,7 @@ public: SF_ButtonPressed, SF_FrameLineEdit, SF_ListHighlight, - SF_OptionsMenu, + SF_PopupBackground, SF_SettingsList, SF_TableItem, SF_TableHeaderItem, diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 75ed0c7..1138d20 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -983,16 +983,20 @@ TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameEl switch(frameElement) { case QS60StylePrivate::SF_PanelBackground: // panel should have slightly slimmer border to enable thin line of background graphics between closest component - widthShrink = widthShrink-2; - heightShrink = heightShrink-2; + widthShrink = widthShrink - 2; + heightShrink = heightShrink - 2; break; case QS60StylePrivate::SF_ToolTip: - widthShrink = widthShrink>>1; - heightShrink = heightShrink>>1; + widthShrink = widthShrink >> 1; + heightShrink = heightShrink >> 1; break; case QS60StylePrivate::SF_ListHighlight: - widthShrink = widthShrink-2; - heightShrink = heightShrink-2; + widthShrink = widthShrink - 2; + heightShrink = heightShrink - 2; + break; + case QS60StylePrivate::SF_PopupBackground: + widthShrink = widthShrink + 5; + heightShrink = heightShrink + 5; break; default: break; diff --git a/util/s60pixelmetrics/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp index beb785e..814e185 100644 --- a/util/s60pixelmetrics/pixel_metrics.cpp +++ b/util/s60pixelmetrics/pixel_metrics.cpp @@ -50,7 +50,7 @@ // so that we can keep dynamic and static values inline. // Please adjust version data if correcting dynamic PM calculations. const TInt KPMMajorVersion = 1; -const TInt KPMMinorVersion = 16; +const TInt KPMMinorVersion = 17; TPixelMetricsVersion PixelMetrics::Version() { @@ -869,7 +869,7 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) // The difference of center piece from border tell the frame width. if ( value == QStyle::PM_FocusFrameHMargin) { - //use topleft for horizontal as S60 uses different values for right and left borders + //use topleft for horizontal as S60 uses different values for right and left borders value = listSinglePaneText.TextRect().iTl.iX - highlightRect.Rect().iTl.iX; } else @@ -1003,6 +1003,13 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) case QStyle::PM_Custom_ThinLineWidth: value = 1; break; + case QStyle::PM_Custom_MessageBoxHeight: + { + TAknLayoutRect popupRect; + popupRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::popup_window_general(0)); + value = popupRect.Rect().Height(); + } + break; case QStyle::PM_ButtonShiftHorizontal: case QStyle::PM_ButtonShiftVertical: value = 0; diff --git a/util/s60pixelmetrics/pixel_metrics.h b/util/s60pixelmetrics/pixel_metrics.h index 3536c0e..4b0f57e 100644 --- a/util/s60pixelmetrics/pixel_metrics.h +++ b/util/s60pixelmetrics/pixel_metrics.h @@ -185,7 +185,9 @@ NONSHARABLE_CLASS( QStyle ) // Bold line width PM_Custom_BoldLineWidth, // Thin line width - PM_Custom_ThinLineWidth + PM_Custom_ThinLineWidth, + // Height of a popup info messagebox + PM_Custom_MessageBoxHeight }; }; diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp index acc6137..a88499d 100644 --- a/util/s60pixelmetrics/pm_mapperapp.cpp +++ b/util/s60pixelmetrics/pm_mapperapp.cpp @@ -155,7 +155,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) Exit(); break; case ECmdSwitchOutput: - { + { HBufC* buffer = HBufC::NewLC( 100 ); TPtr bufferPtr = buffer->Des(); TBool last = ETrue; @@ -166,7 +166,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) else bufferPtr.Append(_L("screen.")); ShowL( *buffer, last ); - } + } break; case ECmdStatus: { @@ -323,7 +323,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) TInt myValue = KErrNotFound; for (;;) { - if (index==QStyle::PM_Custom_ThinLineWidth) + if (index==QStyle::PM_Custom_MessageBoxHeight) { last = ETrue; } @@ -656,6 +656,9 @@ void CPixelMetricsMapperAppUi::ShowSingleValueL(TInt& aPixelMetric, TInt& aValue case QStyle::PM_Custom_BoldLineWidth: bufferPtr.Append(_L("C_BoldLineWidth: ")); break; + case QStyle::PM_Custom_MessageBoxHeight: + bufferPtr.Append(_L("C_MsgBoxHeight: ")); + break; default: bufferPtr.Append(_L("Default: ")); break; -- cgit v0.12 From d7fe2d90fe5a1ac5a29a5bc65eb5657d4d539563 Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 25 Mar 2010 10:58:57 +0000 Subject: Symbian event loop priority drop not used in Symbian^4 The priority drop hack used in the Symbian version of Qt's event dispatcher is not needed from Symbian^4, as the viewsrv panics, which it was designed to prevent, are disabled. This change disables the priority drop code when Qt is compiled in a Symbian^4 environment, using the SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS define as a key. This will improve system and performance predictability, as app priorities will be more stable. It also gives a slight performance boost to app startup in the order of 10ms. Reviewed-by: Jason Barron --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 191be6c..ca44264 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -50,6 +50,13 @@ QT_BEGIN_NAMESPACE +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS +// when the system UI is Qt based, priority drop is not needed as CPU starved processes will not be killed. +#undef QT_SYMBIAN_PRIORITY_DROP +#else +#define QT_SYMBIAN_PRIORITY_DROP +#endif + #define WAKE_UP_PRIORITY CActive::EPriorityStandard #define TIMER_PRIORITY CActive::EPriorityHigh #define NULLTIMER_PRIORITY CActive::EPriorityLow @@ -697,6 +704,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla bool handledSymbianEvent = false; m_interrupt = false; +#ifdef QT_SYMBIAN_PRIORITY_DROP /* * This QTime variable is used to measure the time it takes to finish * the event loop. If we take too long in the loop, other processes @@ -714,6 +722,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla } timeState = FirstRun; TProcessPriority priority; +#endif while (1) { if (block) { @@ -727,10 +736,12 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla CActiveScheduler::Current()->WaitForAnyRequest(); } +#ifdef QT_SYMBIAN_PRIORITY_DROP if (timeState == SubsequentRun) { time.start(); timeState = TimeStarted; } +#endif TInt error; handledSymbianEvent = CActiveScheduler::RunIfReady(error, KMinTInt); @@ -747,6 +758,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla break; } block = false; +#ifdef QT_SYMBIAN_PRIORITY_DROP if (timeState == TimeStarted && time.elapsed() > 100) { priority = m_processHandle.Priority(); m_processHandle.SetPriority(EPriorityBackground); @@ -759,6 +771,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla } if (timeState == FirstRun) timeState = SubsequentRun; +#endif }; emit awake(); -- cgit v0.12 From 32c6e01bf00bc45363685eb10c51e8b68b4fde89 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 25 Mar 2010 14:01:34 +0200 Subject: Fix for submenu placement for QMenus in Symbian. Task-number: QTBUG-5992 Reviewed-By: Sami Merila --- src/gui/styles/qs60style.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 2c665fb..65191a4 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2389,13 +2389,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const if (metricValue == KNotFound) metricValue = QCommonStyle::pixelMetric(metric, option, widget); - if (metric == PM_SubMenuOverlap && widget) { - const QMenu *menu = qobject_cast(widget); - if (menu && menu->activeAction() && menu->activeAction()->menu()) { - const int menuWidth = menu->activeAction()->menu()->sizeHint().width(); - metricValue = -menuWidth; - } - } //if layout direction is mirrored, switch left and right border margins if (option && option->direction == Qt::RightToLeft) { if (metric == PM_LayoutLeftMargin) -- cgit v0.12 From 96ac1964b827ef01ef2edb6411ecb7540ed76ce2 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 25 Mar 2010 14:27:56 +0100 Subject: Prevents a useless repaint with QGraphicsItem cache mode. No repaint is triggered anymore when setting the cache mode to DeviceCoordinateMode when already using that mode. Also added an autotest for checking repaints when setting cache modes. Task-number: QTBUG-9391 Reviewed-by: ahanssen --- src/gui/graphicsview/qgraphicsitem.cpp | 3 +- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 73 ++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index f110a5c..1b707b0 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1883,7 +1883,8 @@ void QGraphicsItem::setCacheMode(CacheMode mode, const QSize &logicalCacheSize) d_ptr->cacheMode = mode; bool noVisualChange = (mode == NoCache && lastMode == NoCache) || (mode == NoCache && lastMode == DeviceCoordinateCache) - || (mode == DeviceCoordinateCache && lastMode == NoCache); + || (mode == DeviceCoordinateCache && lastMode == NoCache) + || (mode == DeviceCoordinateCache && lastMode == DeviceCoordinateCache); if (mode == NoCache) { d_ptr->removeExtraItemCache(); } else { diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 75fb337..2b507cb 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -384,6 +384,7 @@ private slots: void tabChangesFocus(); void tabChangesFocus_data(); void cacheMode(); + void cacheMode2(); void updateCachedItemAfterMove(); void deviceTransform_data(); void deviceTransform(); @@ -6926,6 +6927,78 @@ void tst_QGraphicsItem::cacheMode() QCOMPARE(testerChild2->repaints, 6); } +void tst_QGraphicsItem::cacheMode2() +{ + QGraphicsScene scene(0, 0, 100, 100); + QGraphicsView view(&scene); + view.resize(150, 150); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + + // Increase the probability of window activation + // not causing another repaint of test items. + QTest::qWait(50); + + EventTester *tester = new EventTester; + scene.addItem(tester); + QTest::qWait(10); + QTRY_COMPARE(tester->repaints, 1); + + // Switching from NoCache to NoCache (no repaint) + tester->setCacheMode(QGraphicsItem::NoCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 1); + + // Switching from NoCache to DeviceCoordinateCache (no repaint) + tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 1); + + // Switching from DeviceCoordinateCache to DeviceCoordinateCache (no repaint) + tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 1); + + // Switching from DeviceCoordinateCache to NoCache (no repaint) + tester->setCacheMode(QGraphicsItem::NoCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 1); + + // Switching from NoCache to ItemCoordinateCache (repaint) + tester->setCacheMode(QGraphicsItem::ItemCoordinateCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 2); + + // Switching from ItemCoordinateCache to ItemCoordinateCache (no repaint) + tester->setCacheMode(QGraphicsItem::ItemCoordinateCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 2); + + // Switching from ItemCoordinateCache to ItemCoordinateCache with different size (repaint) + tester->setCacheMode(QGraphicsItem::ItemCoordinateCache, QSize(100, 100)); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 3); + + // Switching from ItemCoordinateCache to NoCache (repaint) + tester->setCacheMode(QGraphicsItem::NoCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 4); + + // Switching from DeviceCoordinateCache to ItemCoordinateCache (repaint) + tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 4); + tester->setCacheMode(QGraphicsItem::ItemCoordinateCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 5); + + // Switching from ItemCoordinateCache to DeviceCoordinateCache (repaint) + tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + QTest::qWait(50); + QTRY_COMPARE(tester->repaints, 6); +} + void tst_QGraphicsItem::updateCachedItemAfterMove() { // A simple item that uses ItemCoordinateCache -- cgit v0.12 From 9a11225c71748ccd6ff7e5a3c1f8d8670e699ca8 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 25 Mar 2010 14:32:10 +0100 Subject: Correct documentation for ObjectReplacementCharacter and ReplacementCh. Reviewed-by: Marius Storm-Olsen --- src/corelib/tools/qchar.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 08cb863..3635e7b 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -381,8 +381,12 @@ QT_BEGIN_NAMESPACE \value Null A QChar with this value isNull(). \value Nbsp Non-breaking space. - \value ReplacementCharacter - \value ObjectReplacementCharacter The character shown when a font has no glyph for a certain codepoint. The square character is normally used. + \value ReplacementCharacter The character shown when a font has no glyph + for a certain codepoint. A special question mark character is often + used. Codecs use this codepoint when input data cannot be + represented in Unicode. + \value ObjectReplacementCharacter Used to represent an object such as an + image when such objects cannot be presented. \value ByteOrderMark \value ByteOrderSwapped \value ParagraphSeparator -- cgit v0.12 From 656c02f128c56177c48b3de47f7b1e17dbbfa4d3 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 25 Mar 2010 14:52:53 +0100 Subject: QNAM HTTP: Fix crazy crash when exiting application This fixes a crash in tst_qnetworkreply and in some QtWebKit based browsers. It was related to adding a QPointer on an already deleted QHttpNetworkConnection object. By converting an existing normal pointer to a QPointer we set it a 0-pointer and are safe. https://bugs.webkit.org/show_bug.cgi?id=36290 Reviewed-by: joao Reviewed-by: gabi --- src/network/access/qhttpnetworkconnectionchannel.cpp | 2 +- src/network/access/qhttpnetworkconnectionchannel_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 82bc14f..0804498 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -939,7 +939,7 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket errorCode = QNetworkReply::UnknownNetworkError; break; } - QPointer that = connection; + QPointer that = connection; QString errorString = connection->d_func()->errorDetail(errorCode, socket, socket->errorString()); if (send2Reply) { if (reply) { diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index 5032d2b..6ec47c1 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -138,7 +138,7 @@ public: {} void setConnection(QHttpNetworkConnection *c) {connection = c;} - QHttpNetworkConnection *connection; + QPointer connection; void init(); void close(); -- cgit v0.12 From cc22a14f3d2159a8f760b44e3fe1636a3721ce95 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 25 Mar 2010 16:18:52 +0100 Subject: tst_qnetworkreply: Fix side effect, add another test Fix a test that had a side effect. But actually do the side effect in the last test: Have a QNetworkReply that is parented to the application so it gets destructed after the QNetworkAccessManager. Reviewed-by: gabi --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 261e613..71ee2d0 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -275,6 +275,9 @@ private Q_SLOTS: void ignoreSslErrorsListWithSlot_data(); void ignoreSslErrorsListWithSlot(); #endif + + // NOTE: This test must be last! + void parentingRepliesToTheApp(); }; QT_BEGIN_NAMESPACE @@ -3831,7 +3834,7 @@ void tst_QNetworkReply::httpConnectionCount() for (int i = 0; i < 10; i++) { QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/" + QString::number(i))); QNetworkReply* reply = manager.get(request); - reply->setParent(this); + reply->setParent(&server); } int pendingConnectionCount = 0; @@ -4105,5 +4108,13 @@ void tst_QNetworkReply::ignoreSslErrorsListWithSlot() #endif // QT_NO_OPENSSL +// NOTE: This test must be last testcase in tst_qnetworkreply! +void tst_QNetworkReply::parentingRepliesToTheApp() +{ + QNetworkRequest request (QUrl("http://" + QtNetworkSettings::serverName())); + manager.get(request)->setParent(this); // parent to this object + manager.get(request)->setParent(qApp); // parent to the app +} + QTEST_MAIN(tst_QNetworkReply) #include "tst_qnetworkreply.moc" -- cgit v0.12 From 43e1cffb16c2eea54392f5c56210b10abb2f044e Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 25 Mar 2010 17:01:45 +0100 Subject: QNAM HTTP: Symbian compile fix --- src/network/access/qhttpnetworkconnectionchannel_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index 6ec47c1..4a2f8ad 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -65,6 +65,7 @@ #include #include +#include "qhttpnetworkconnection_p.h" #ifndef QT_NO_HTTP -- cgit v0.12 From 7c36400a998b6d4cff34d7cb783f8e228a3e3621 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 26 Mar 2010 08:14:45 +1000 Subject: Fix OpenVG build on non-Symbian platforms. Reviewed-by: trustme --- src/openvg/qpixmapdata_vg.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index d602790..7efec2b 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -45,8 +45,10 @@ #include "qvg_p.h" #include "qvgimagepool_p.h" +#if defined(Q_OS_SYMBIAN) #include #include +#endif #ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE #include typedef EGLImageKHR (*pfnEglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*); -- cgit v0.12 From 1e8eb507a7624a1847f3da067f45d1637d47150a Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 26 Mar 2010 08:27:02 +1000 Subject: Fix another off-by-1 error in OpenVG image painting. Off in the vertical direction this time; previously was horizontal. Task-number: QT-2999 Reviewed-by: Jason Barron --- src/openvg/qpaintengine_vg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 4a97a6f..ce6e21b 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -538,7 +538,7 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) // adds 0.5 to each co-ordinate. QTransform viewport2(1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, - 0.0f, devh, 1.0f); + 0.0f, devh + 1, 1.0f); imageTransform = transform * viewport2; // Calculate the scaling factor to use for turning cosmetic pens -- cgit v0.12 From c3a7d812d3cf30d23049cfd355c6290a7985f81d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 25 Mar 2010 12:12:01 +0200 Subject: Enable armcc version specific compler options for Symbian VERSION_FLAGS.ARMCC variable is used in symbian.conf to define supported armcc compiler version flags. Values given to this variable must be directly usable as ifdef flags in mmp. QMAKE_CXXFLAGS. variables can now be used to add compiler options to specific compiler versions. Note that options added via QMAKE_CXXFLAGS.ARMCC flag will apply to all versions of armcc compiler. Task-number: QTBUG-8685 Reviewed-by: Iain --- mkspecs/common/symbian/symbian.conf | 5 ++++- qmake/generators/symbian/symmake.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index c39b39d..d66d227 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -26,10 +26,13 @@ QMAKE_CFLAGS_RELEASE = QMAKE_CFLAGS_DEBUG = QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses + +VERSION_FLAGS.ARMCC = ARMCC_4_0 QMAKE_CXX = g++ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS.CW = -QMAKE_CXXFLAGS.ARMCC = --visibility_inlines_hidden +QMAKE_CXXFLAGS.ARMCC = --visibility_inlines_hidden +QMAKE_CXXFLAGS.ARMCC_4_0 = --import_all_vtbl QMAKE_CXXFLAGS.GCCE = -fvisibility-inlines-hidden QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 1470a12..e1256d8 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -1246,6 +1246,16 @@ void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) t << MMP_OPTION_CW " " << cw << endl; if (!armcc.isEmpty()) t << MMP_OPTION_ARMCC " " << armcc << endl; + + foreach(QString armccVersion, project->values("VERSION_FLAGS.ARMCC")) { + QStringList currentValues = project->values("QMAKE_CXXFLAGS." + armccVersion); + if (currentValues.size()) { + t << "#if defined(" << armccVersion << ")" << endl; + t << MMP_OPTION_ARMCC " " << currentValues.join(" ") << endl; + t << "#endif" << endl; + } + } + if (!gcce.isEmpty()) t << MMP_OPTION_GCCE " " << gcce << endl; -- cgit v0.12 From aaf0f47930a44f5f36bb825e10a5067eeced6718 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 26 Mar 2010 10:41:35 +0200 Subject: Changed pkg_prerules to not use default_deployment for vendor ID Demos and examples used default_deployment to define vendor ID pkg rule, which is not what default_deployment should be used for. As these are supposed to serve as examples for developers, changed these declarations to use another deployment item. Reviewed-by: TrustMe --- demos/symbianpkgrules.pri | 3 ++- examples/symbianpkgrules.pri | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/demos/symbianpkgrules.pri b/demos/symbianpkgrules.pri index c511836..68a82cd 100644 --- a/demos/symbianpkgrules.pri +++ b/demos/symbianpkgrules.pri @@ -10,6 +10,7 @@ vendorinfo = \ ":\"Nokia, Qt\"" \ " " -default_deployment.pkg_prerules += vendorinfo +demos_deployment.pkg_prerules += vendorinfo +DEPLOYMENT += demos_deployment isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg diff --git a/examples/symbianpkgrules.pri b/examples/symbianpkgrules.pri index 35edbfb..a1b6634 100644 --- a/examples/symbianpkgrules.pri +++ b/examples/symbianpkgrules.pri @@ -10,6 +10,7 @@ vendorinfo = \ ":\"Nokia, Qt\"" \ " " -default_deployment.pkg_prerules += vendorinfo +examples_deployment.pkg_prerules += vendorinfo +DEPLOYMENT += examples_deployment isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg -- cgit v0.12 From ea0f3f7db1d62b2ee94addbeb991061bc2811745 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 26 Mar 2010 14:09:47 +0200 Subject: QS60Style cannot draw transparency to UI element border areas Due to incorrect initialization of CFbsBitmap, graphic frames (9-part, or 3-part ones) are drawn with white non-transparent rect below them. Initialization corrected. Task-number: QT-3185 Reviewed-by: Janne Anttila --- src/gui/styles/qs60style_s60.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 1138d20..97cf919 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -859,11 +859,9 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr User::LeaveIfError(bitmapDev->CreateContext(bitmapGc)); CleanupStack::PushL(bitmapGc); -#ifndef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE frame->LockHeap(); memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4); // 4: argb bytes frame->UnlockHeap(); -#endif const TRect outerRect(TPoint(0, 0), targetSize); const TRect innerRect = innerRectFromElement(frameElement, outerRect); -- cgit v0.12 From 0d5c68c7e4f31300ac6736203cea4f67e8b825b5 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 26 Mar 2010 14:53:30 +0200 Subject: QInputContextFactory::languages implementation for Symbian. Task-number: QTBUG-6851 Reviewed-by: Sami Merila --- src/gui/inputmethod/inputmethod.pri | 2 +- src/gui/inputmethod/qinputcontextfactory.cpp | 47 +++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/gui/inputmethod/inputmethod.pri b/src/gui/inputmethod/inputmethod.pri index 6d9f748..02e3e57 100644 --- a/src/gui/inputmethod/inputmethod.pri +++ b/src/gui/inputmethod/inputmethod.pri @@ -26,6 +26,6 @@ mac:!embedded { symbian:contains(QT_CONFIG, s60) { HEADERS += inputmethod/qcoefepinputcontext_p.h SOURCES += inputmethod/qcoefepinputcontext_s60.cpp - LIBS += -lfepbase + LIBS += -lfepbase -lakninputlanguage } diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp index 501a36e..d47e343 100644 --- a/src/gui/inputmethod/qinputcontextfactory.cpp +++ b/src/gui/inputmethod/qinputcontextfactory.cpp @@ -73,6 +73,7 @@ #endif #ifdef Q_WS_S60 #include "qcoefepinputcontext_p.h" +#include "akninputlanguageinfo.h" #endif #include "private/qfactoryloader_p.h" @@ -198,6 +199,42 @@ QStringList QInputContextFactory::keys() return result; } +#if defined(Q_WS_S60) +/*! + \internal + + This function contains pure Symbian exception handling code for + getting S60 language list. + Returned object ownership is transfered to caller. +*/ +static CAknInputLanguageList* s60LangListL() +{ + CAknInputLanguageInfo *langInfo = AknInputLanguageInfoFactory::CreateInputLanguageInfoL(); + CleanupStack::PushL(langInfo); + // In rare phone there is more than 7 languages installed -> use 7 as an array granularity + CAknInputLanguageList *langList = new (ELeave) CAknInputLanguageList(7); + CleanupStack::PushL(langList); + langInfo->AppendAvailableLanguagesL(langList); + CleanupStack::Pop(langList); + CleanupStack::PopAndDestroy(langInfo); + return langList; +} + +/*! + \internal + + This function utility function return S60 language list. + Returned object ownership is transfered to caller. +*/ +static CAknInputLanguageList* s60LangList() +{ + CAknInputLanguageList *langList = NULL; + TRAP_IGNORE(langList = s60LangListL()); + q_check_ptr(langList); + return langList; +} +#endif + /*! Returns the languages supported by the QInputContext object specified by \a key. @@ -229,7 +266,15 @@ QStringList QInputContextFactory::languages( const QString &key ) #endif #if defined(Q_WS_S60) if (key == QLatin1String("coefep")) - return QStringList(QString()); + { + CAknInputLanguageList *langList = s60LangList(); + int count = langList->Count(); + for (int i = 0; i < count; ++i) + { + result.append(QString(qt_symbianLocaleName(langList->At(i)->LanguageCode()))); + } + delete langList; + } #endif #if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS) Q_UNUSED(key); -- cgit v0.12 From fc6cbc103be7eb77d692fb2975397c656b6a939b Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Fri, 26 Mar 2010 14:39:23 +0100 Subject: Fix compile error on Symbian 9.1, caused in network/access. RVCT has trouble when QPointer is instantiated on classes with inlined constructors/functions. Compile fix for 43e1cffb16c2eea54392f5c56210b10abb2f044e, cc22a14f3d2159a8f760b44e3fe1636a3721ce95 and 656c02f128c56177c48b3de47f7b1e17dbbfa4d3 Reviewed-by: Peter Hartmann Reviewed-by: Prasanth --- .../access/qhttpnetworkconnectionchannel.cpp | 30 ++++++++++++++++++++++ .../access/qhttpnetworkconnectionchannel_p.h | 17 +++--------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 0804498..bc7684a 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -58,6 +58,28 @@ QT_BEGIN_NAMESPACE // TODO: Put channel specific stuff here so it does not polute qhttpnetworkconnection.cpp +QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel() + : socket(0) + , state(IdleState) + , reply(0) + , written(0) + , bytesTotal(0) + , resendCurrent(false) + , lastStatus(0) + , pendingEncrypt(false) + , reconnectAttempts(2) + , authMehtod(QAuthenticatorPrivate::None) + , proxyAuthMehtod(QAuthenticatorPrivate::None) +#ifndef QT_NO_OPENSSL + , ignoreAllSslErrors(false) +#endif + , pipeliningSupported(PipeliningSupportUnknown) + , connection(0) +{ + // Inlining this function in the header leads to compiler error on + // release-armv5, on at least timebox 9.2 and 10.1. +} + void QHttpNetworkConnectionChannel::init() { #ifndef QT_NO_OPENSSL @@ -994,8 +1016,16 @@ void QHttpNetworkConnectionChannel::_q_encryptedBytesWritten(qint64 bytes) sendRequest(); // otherwise we do nothing } + #endif +void QHttpNetworkConnectionChannel::setConnection(QHttpNetworkConnection *c) +{ + // Inlining this function in the header leads to compiler error on + // release-armv5, on at least timebox 9.2 and 10.1. + connection = c; +} + QT_END_NAMESPACE #include "moc_qhttpnetworkconnectionchannel_p.cpp" diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index 4a2f8ad..51cb5e8 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -81,7 +81,6 @@ QT_BEGIN_NAMESPACE class QHttpNetworkRequest; class QHttpNetworkReply; class QByteArray; -class QHttpNetworkConnection; #ifndef HttpMessagePair typedef QPair HttpMessagePair; @@ -128,17 +127,9 @@ public: QList alreadyPipelinedRequests; - QHttpNetworkConnectionChannel() : socket(0), state(IdleState), reply(0), written(0), bytesTotal(0), resendCurrent(false), - lastStatus(0), pendingEncrypt(false), reconnectAttempts(2), - authMehtod(QAuthenticatorPrivate::None), proxyAuthMehtod(QAuthenticatorPrivate::None) -#ifndef QT_NO_OPENSSL - , ignoreAllSslErrors(false) -#endif - , pipeliningSupported(PipeliningSupportUnknown) - , connection(0) - {} - - void setConnection(QHttpNetworkConnection *c) {connection = c;} + QHttpNetworkConnectionChannel(); + + void setConnection(QHttpNetworkConnection *c); QPointer connection; void init(); @@ -188,8 +179,6 @@ public: #endif }; - - QT_END_NAMESPACE #endif // QT_NO_HTTP -- cgit v0.12 From a8af0e05b30cc4ec26f58378cd5a4e11b20cf9bd Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Fri, 26 Mar 2010 08:23:58 -0700 Subject: Fix linking error The #include "moc_qgraphicswidget.cpp" is superfluous and caused these link errors: .obj/debug-shared-emb-x86_64/moc_qgraphicswidget.o:(.data.rel.ro+0x0): multiple definition of `QGraphicsWidget::staticMetaObject' .obj/debug-shared-emb-x86_64/qgraphicswidget.o:(.data.rel.ro+0x0): first defined here .obj/debug-shared-emb-x86_64/moc_qgraphicswidget.o: In function `QGraphicsWidget::metaObject() const': Presumably this only happens when you have a stale moc file sitting around but it's a bug none-the-less. Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicswidget.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index a091347..131ee87 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -342,7 +342,7 @@ void QGraphicsWidget::resize(const QSizeF &size) A side effect of calling this function is that the widget will receive a move event and a resize event. Also, if the widget has a layout assigned, the layout will activate. - + \sa geometry(), resize() */ void QGraphicsWidget::setGeometry(const QRectF &rect) @@ -574,7 +574,7 @@ void QGraphicsWidget::getWindowFrameMargins(qreal *left, qreal *top, qreal *righ void QGraphicsWidget::unsetWindowFrameMargins() { Q_D(QGraphicsWidget); - if ((d->windowFlags & Qt::Window) && (d->windowFlags & Qt::WindowType_Mask) != Qt::Popup && + if ((d->windowFlags & Qt::Window) && (d->windowFlags & Qt::WindowType_Mask) != Qt::Popup && (d->windowFlags & Qt::WindowType_Mask) != Qt::ToolTip && !(d->windowFlags & Qt::FramelessWindowHint)) { QStyleOptionTitleBar bar; d->initStyleOptionTitleBar(&bar); @@ -1151,7 +1151,7 @@ bool QGraphicsWidget::sceneEvent(QEvent *event) Returns true if \a event has been recognized and processed; otherwise, returns false. - + \sa event() */ bool QGraphicsWidget::windowFrameEvent(QEvent *event) @@ -1208,7 +1208,7 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) const QRectF r = windowFrameRect(); if (!r.contains(pos)) return Qt::NoSection; - + const qreal left = r.left(); const qreal top = r.top(); const qreal right = r.right(); @@ -2335,6 +2335,4 @@ void QGraphicsWidget::dumpFocusChain() QT_END_NAMESPACE -#include "moc_qgraphicswidget.cpp" - #endif //QT_NO_GRAPHICSVIEW -- cgit v0.12 From e9538ced914739129681362dea03ebc323602126 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 26 Mar 2010 16:27:04 +0100 Subject: Reverts using composition mode when using DeviceCoordinateMode cache. Going back to always blitting the newly painted areas to the cache (and not blending it like before). To avoid painting artifacts when the item is rotated and when it uses DeviceCoordinateMode cache mode, the entire cache is always repainted in that case. Task-number: QTBUG-7863 Reviewed-by: trustme --- src/gui/graphicsview/qgraphicsscene.cpp | 13 ++++++------- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 18 +++++++++++------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 6934abc..6581727 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4285,12 +4285,7 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion & if (!subPix.isNull()) { // Blit the subpixmap into the main pixmap. pixmapPainter.begin(pix); - if (item->cacheMode() == QGraphicsItem::DeviceCoordinateCache - && itemToPixmap.type() > QTransform::TxTranslate) { - pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceAtop); - } else { - pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source); - } + pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source); pixmapPainter.setClipRegion(pixmapExposed); pixmapPainter.drawPixmap(br.topLeft(), subPix); pixmapPainter.end(); @@ -4456,6 +4451,8 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte } // Create or reuse offscreen pixmap, possibly scroll/blit from the old one. + // If the world transform is rotated we always recreate the cache to avoid + // wrong blending. bool pixModified = false; QGraphicsItemCache::DeviceData *deviceData = &itemCache->deviceData[widget]; bool invertable = true; @@ -4463,7 +4460,9 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte if (invertable) diff *= painter->worldTransform(); deviceData->lastTransform = painter->worldTransform(); - if (!invertable || diff.type() > QTransform::TxTranslate) { + if (!invertable + || diff.type() > QTransform::TxTranslate + || painter->worldTransform().type() > QTransform::TxScale) { pixModified = true; itemCache->allExposed = true; itemCache->exposed.clear(); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 2b507cb..6725159 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6825,6 +6825,9 @@ void tst_QGraphicsItem::cacheMode() QTRY_COMPARE(tester->repaints, 4); QCOMPARE(testerChild->repaints, 4); QCOMPARE(testerChild2->repaints, 3); + tester->resetTransform(); + testerChild->resetTransform(); + testerChild2->resetTransform(); // Explicit update causes a repaint. tester->update(0, 0, 5, 5); @@ -6898,23 +6901,24 @@ void tst_QGraphicsItem::cacheMode() // because the parent is rotated with a perspective. testerChild->setPos(1, 1); QTest::qWait(25); - QTRY_COMPARE(tester->repaints, 10); + QTRY_COMPARE(tester->repaints, 11); QCOMPARE(testerChild->repaints, 10); QCOMPARE(testerChild2->repaints, 5); + tester->resetTransform(); // Make a huge item tester->setGeometry(QRectF(-4000, -4000, 8000, 8000)); QTest::qWait(25); - QTRY_COMPARE(tester->repaints, 11); - QCOMPARE(testerChild->repaints, 10); + QTRY_COMPARE(tester->repaints, 12); + QCOMPARE(testerChild->repaints, 11); QCOMPARE(testerChild2->repaints, 5); // Move the large item - will cause a repaint as the // cache is clipped. tester->setPos(5, 0); QTest::qWait(25); - QTRY_COMPARE(tester->repaints, 12); - QCOMPARE(testerChild->repaints, 10); + QTRY_COMPARE(tester->repaints, 13); + QCOMPARE(testerChild->repaints, 11); QCOMPARE(testerChild2->repaints, 5); // Hiding and showing should invalidate the cache @@ -6922,8 +6926,8 @@ void tst_QGraphicsItem::cacheMode() QTest::qWait(25); tester->show(); QTest::qWait(25); - QTRY_COMPARE(tester->repaints, 13); - QCOMPARE(testerChild->repaints, 11); + QTRY_COMPARE(tester->repaints, 14); + QCOMPARE(testerChild->repaints, 12); QCOMPARE(testerChild2->repaints, 6); } -- cgit v0.12 From 96d6bff54942be11458801edc5c59e2cf646253c Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Fri, 26 Mar 2010 11:08:12 -0700 Subject: QDirectFBPixmap can handle NoOpaqueDetection. We don't need to do the conversion using QImage when NoOpaqueDetection is specified. Reviewed-by: muthu --- src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 4219f6f..f2fd699 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -307,7 +307,7 @@ void QDirectFBPixmapData::fromImage(const QImage &img, imageFormat = screen->pixelFormat(); } QImage image; - if (flags != Qt::AutoColor) { + if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { image = img.convertToFormat(imageFormat, flags); flags = Qt::AutoColor; } else if (img.format() == QImage::Format_RGB32) { -- cgit v0.12 From ec401f7a4c682b3ccdbc64edb4aa9881830b45cf Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Fri, 26 Mar 2010 11:17:39 -0700 Subject: Refactor QDirectFBPixmap::fromImage slightly Clean up the function a little and make sure I don't call QImage::hasAlphaChannel twice for opaque images. Reviewed-by: muthu --- .../gfxdrivers/directfb/qdirectfbpixmap.cpp | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index f2fd699..80366d1 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -290,27 +290,22 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { - if (img.depth() == 1 || img.format() == QImage::Format_RGB32) { - fromImage(img.convertToFormat(screen->alphaPixmapFormat()), flags); - return; - } - - if (img.hasAlphaChannel() + if (img.depth() == 1) { + alpha = true; #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION - && (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) -#endif - ) { + } else if (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) { alpha = true; - imageFormat = screen->alphaPixmapFormat(); - } else { - alpha = false; - imageFormat = screen->pixelFormat(); +#else + } else if (img.hasAlphaChannel()) { + alpha = true; +#endif } + imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); QImage image; if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { image = img.convertToFormat(imageFormat, flags); flags = Qt::AutoColor; - } else if (img.format() == QImage::Format_RGB32) { + } else if (img.format() == QImage::Format_RGB32 || img.depth() == 1) { image = img.convertToFormat(imageFormat, flags); } else { image = img; -- cgit v0.12 From 51a444a789ff5f3ba72d3f817f4cdf427d2ff91d Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 29 Mar 2010 08:01:09 +0200 Subject: Use QSKIP rather than commenting a failure. Reviewed-by:TrustMe --- tests/auto/qfiledialog/tst_qfiledialog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index f246750..9adb4fc 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -547,6 +547,9 @@ void tst_QFiledialog::completer() // ### FIXME: This will fail on Symbian on some tests and some environments until the file engine and QFileSystemModel // are fixed to properly capitalize paths, so that some folders are not duplicated in QFileSystemModel. +#if defined(Q_OS_SYMBIAN) + QSKIP("This will fail on Symbian on some tests and some environments until the file engine and QFileSystemModel are fixed to properly capitalize paths") +#endif QTRY_COMPARE(cModel->rowCount(), expected); } QT_CATCH(...) { qDeleteAll(files); -- cgit v0.12 From 780f0cf58d93babd4bbfb5d3d00156a96fc7dacb Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 29 Mar 2010 17:26:33 +1000 Subject: Export QGLContextResource for use with Qt/3D --- src/opengl/qgl_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 80217c0..191131e 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -578,7 +578,7 @@ inline GLenum qt_gl_preferredTextureTarget() } // One resource per group of shared contexts. -class Q_AUTOTEST_EXPORT QGLContextResource +class Q_OPENGL_EXPORT QGLContextResource { public: typedef void (*FreeFunc)(void *); -- cgit v0.12 From 83232d804cade8efee70b0cd992d21d7ca73f399 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 29 Mar 2010 12:51:50 +0300 Subject: QS60Style: very tall QSpinBox's buttons hide lineEdit If the spinbox is very tall considering its width (ratio 2:1), the spinbuttons can easily hide the lineEdit when they are scaled up. For example QSize(200, 100) QSpinBox does not have any lineEdit at all, since spinbuttons are scaled up to be 100*100 squares and deployed side-by-side. As a fix, once spinbuttons occupy half of the total width of spinbox, they stop growing. For very tall spinboxes, spinbuttons are deployed one top of the other, to make the lineEdit bigger. Task-number: QTBUG-9321 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 65191a4..000696c 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2626,14 +2626,22 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple const int frameThickness = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; const int buttonMargin = spinbox->frame ? 2 : 0; const int buttonContentWidth = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin; + // Spinbox buttons should be no larger than one fourth of total width. + // Thus, side-by-side buttons would take half of the total width. + const int maxSize = qMax(spinbox->rect.width() / 4, buttonContentWidth); QSize buttonSize; - buttonSize.setHeight(qMax(8, spinbox->rect.height() - frameThickness)); + buttonSize.setHeight(qMin(maxSize, qMax(8, spinbox->rect.height() - frameThickness))); //width should at least be equal to height buttonSize.setWidth(qMax(buttonSize.height(), buttonContentWidth)); buttonSize = buttonSize.expandedTo(QApplication::globalStrut()); - const int y = frameThickness + spinbox->rect.y(); - const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - 2 * buttonSize.width(); + // Normally spinbuttons should be side-by-side, but if spinbox grows very big + // and spinbuttons reach their maximum size, they can be deployed one top of the other. + const bool sideBySide = (buttonSize.height() * 2 < spinbox->rect.height()) ? false : true; + const int y = frameThickness + spinbox->rect.y() + + (spinbox->rect.height() - (sideBySide ? 1 : 2) * buttonSize.height()) / 2; + const int x = spinbox->rect.x() + + spinbox->rect.width() - frameThickness - (sideBySide ? 2 : 1) * buttonSize.width(); switch (scontrol) { case SC_SpinBoxUp: @@ -2644,7 +2652,9 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple case SC_SpinBoxDown: if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) return QRect(); - ret = QRect(x + buttonSize.width(), y, buttonSize.width(), buttonSize.height()); + ret = QRect(x + (sideBySide ? buttonSize.width() : 0), + y + (sideBySide ? 0 : buttonSize.height()), + buttonSize.width(), buttonSize.height()); break; case SC_SpinBoxEditField: if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) @@ -2787,11 +2797,10 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con break; case SE_LineEditContents: { // in S60 the input text box doesn't start from line Edit's TL, but - // a bit indented. - QRect lineEditRect = opt->rect; - const int adjustment = opt->rect.height() >> 2; - lineEditRect.adjust(adjustment, 0, 0, 0); - ret = lineEditRect; + // a bit indented (8 pixels). + const int KLineEditDefaultIndention = 8; + ret = visualRect( + opt->direction, opt->rect, opt->rect.adjusted(KLineEditDefaultIndention, 0, 0, 0)); } break; case SE_TabBarTearIndicator: -- cgit v0.12 From 96e55b0693b7917dd56cedf95b3205cd20c7b651 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 29 Mar 2010 13:13:05 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( bd724fb2f716336a8a4b54cd2edc96851a5a26a4 ) Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2010-03-22 Jakub Wieczorek Reviewed by Simon Hausmann. [Qt] Don't construct a QLineEdit every time when painting a text field https://bugs.webkit.org/show_bug.cgi?id=36373 Add a simple benchmark covering this area. * tests/benchmarks/painting/tst_painting.cpp: (tst_Painting::textAreas): 2010-03-22 Yi Shen Reviewed by Simon Hausmann. https://bugs.webkit.org/show_bug.cgi?id=35933 [Qt] [Symbian] Can not backward select (highlight) text using virtual keyboard Make sure the selection start index is smaller than the selection end index. * Api/qwebpage.cpp: (QWebPagePrivate::inputMethodEvent): * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::inputMethods): 2010-03-25 Yael Aharon Reviewed by Kenneth Rohde Christiansen. [Qt] QtLauncher crashes on Mac OS and Linux when exiting with QGraphicsView mode enabled https://bugs.webkit.org/show_bug.cgi?id=35251 Followed the way QWebView registers for the signal QWebPage::destroyed(), to prevent QGraphicsWebView from referencing QWebPage after it was deleted. * Api/qgraphicswebview.cpp: (QGraphicsWebViewPrivate::_q_pageDestroyed): (QGraphicsWebView::setPage): * Api/qgraphicswebview.h: 2010-03-23 David Leong Reviewed by Laszlo Gombos. Build fix for Symbian Def file. * symbian/eabi/QtWebKitu.def: 2010-03-18 Joe Ligman Reviewed by Simon Hausmann. [Qt] New API scrollRecursively has several problems. https://bugs.webkit.org/show_bug.cgi?id=35873 Remove scrollRecursively from the Qt 4.7 API Update the internal API to accept a hit test position for nested scrolling * Api/qwebframe.cpp: (webframe_scrollOverflow): (qtwebkit_webframe_scrollRecursively): * Api/qwebframe.h: * Api/qwebframe_p.h: * tests/qwebframe/tst_qwebframe.cpp: 2009-12-18 Joe Ligman Reviewed by Kenneth Rohde Christiansen. [Qt] Add new API to QWebFrame to scrollRecursively starting with any css overflow then checking current frame and then ancestors https://bugs.webkit.org/show_bug.cgi?id=32668 * Api/qwebframe.cpp: (QWebFramePrivate::scrollOverflow): (QWebFrame::scrollRecursively): * Api/qwebframe.h: * Api/qwebframe_p.h: * tests/qwebframe/qwebframe.qrc: * tests/qwebframe/testiframe.html: Added. * tests/qwebframe/testiframe2.html: Added. * tests/qwebframe/tst_qwebframe.cpp: --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 181 +++++++++++++++++++++ src/3rdparty/webkit/WebCore/config.h | 2 + src/3rdparty/webkit/WebCore/css/CSSParser.cpp | 8 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp | 3 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h | 20 ++- .../webkit/WebCore/dom/XMLTokenizerLibxml2.cpp | 59 +++---- .../webkit/WebCore/html/HTMLFormElement.cpp | 2 + .../webkit/WebCore/html/HTMLImageElement.cpp | 24 +++ .../webkit/WebCore/html/HTMLImageElement.h | 7 +- .../webkit/WebCore/html/HTMLInputElement.cpp | 7 +- src/3rdparty/webkit/WebCore/html/HTMLParser.cpp | 3 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp | 8 +- .../webkit/WebCore/platform/qt/RenderThemeQt.cpp | 10 +- .../webkit/WebCore/platform/qt/RenderThemeQt.h | 4 + .../webkit/WebCore/rendering/RenderText.cpp | 11 +- .../webkit/WebKit/qt/Api/qgraphicswebview.cpp | 9 + .../webkit/WebKit/qt/Api/qgraphicswebview.h | 1 + src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 36 ++-- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 4 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 84 ++++++++++ .../webkit/WebKit/qt/symbian/eabi/QtWebKitu.def | 4 +- .../qt/tests/benchmarks/painting/tst_painting.cpp | 27 +++ .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 67 -------- .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 20 +++ 25 files changed, 468 insertions(+), 135 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 9dac2f8..414ba17 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - aa40cdb9595eb15a68e7be03322f973aa613a8f9 + bd724fb2f716336a8a4b54cd2edc96851a5a26a4 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 0a444bc..10aa0f2 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,184 @@ +2010-03-22 Jakub Wieczorek + + Reviewed by Simon Hausmann. + + [Qt] Don't construct a QLineEdit every time when painting a text field + https://bugs.webkit.org/show_bug.cgi?id=36373 + + Instead, keep one instance per RenderTheme around. + + * platform/qt/RenderThemeQt.cpp: + (WebCore::findFrameLineWidth): + +2010-03-26 Janne Koskinen + + Reviewed by Laszlo Gombos. + + Don't undefine SKIP_STATIC_CONSTRUCTORS_ON_GCC for Symbian HW targets. + https://bugs.webkit.org/show_bug.cgi?id=34081 + + Defining StringImpl instances as globals will cause a crash on process exit as + StringImpl::Remove expects TLS which was already deleted at time of exiting main and ends up + constructing one exiting thread. + + * config.h: + +2010-02-02 Alexey Proskuryakov + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=34076 + Crash in mangleme in WebCore::Element::getAttribute + + Test: fast/forms/misplaced-img-form-registration.html + + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::registerImgElement): Assert that the same image isn't added + to vector again. + (WebCore::HTMLFormElement::removeImgElement): Similarly, assert that we're removing something + that's actually registered. + + * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::~HTMLImageElement): If parser fails + to insert the image element, then there will be no removed from tree notification either, + need to unregister right away. + +2010-01-25 Alexey Proskuryakov + + Rubber-stamped by Geoffrey Garen. + + https://bugs.webkit.org/show_bug.cgi?id=34076 + An image remains accessible via form.property syntax after being removed from document. + + Fix crashing regression tests (tables/mozilla/bugs/bug4527.html et al.) + + * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::insertedIntoTree): Remove incorrect + assertions added in the previous patch - it's mot true that m_for is always a parent; table + parsing can reparent the image element, but m_form still needs to be set. + +2010-01-25 Alexey Proskuryakov + + Reviewed by Geoffrey Garen. + + https://bugs.webkit.org/show_bug.cgi?id=34076 + An image remains accessible via form.property syntax after being removed from document. + + Tests: fast/forms/removed-image-as-property.html + fast/forms/reparented-image-as-property.html + + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::~HTMLImageElement): This is called during GC - not a good time + to make observable changes to DOM. + (WebCore::HTMLImageElement::insertedIntoTree): This is the right place to do any work that + depends on connectedness to some ancestor. We still allow for m_form to be set via constructor, + which happens during parsing. + (WebCore::HTMLImageElement::removedFromTree): Ditto. + + * html/HTMLImageElement.h: Added removedFromTree/insertedIntoTree, moved removedFromDocument + and insertedIntoDocument to private section, as they shouldn't be called directly. + +2009-12-08 Brady Eidson + + Reviewed by Darin Adler. + + Navigating to a cached page can result in accessing a destroyed HTMLInputElement. + and https://webkit.org/b/32293 + + Test: fast/loader/input-element-page-cache-crash.html + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::parseMappedAttribute): Make sure to unregister for the activation + callback after the new m_autocomplete setting has been stored so the unregistration actually + takes place. + +2009-12-13 Dan Bernstein + + Reviewed by Simon Fraser. + + Crash at HTMLParser::popOneBlockCommon() after + handling misnested residual style tags + + Test: fast/parser/residual-style-close-ref-clone.html + + * html/HTMLParser.cpp: + (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks): Gave the + block stack a strong reference to the cloned residual style element. + +2009-12-23 Dan Bernstein + + Reviewed by Darin Adler. + + First line of text cannot be selected + https://bugs.webkit.org/show_bug.cgi?id=32749 + + Test: fast/text/remove-zero-length-run.html + + * rendering/RenderText.cpp: + (WebCore::RenderText::positionLineBox): Changed code that assumed that if a box was being + removed, it was the only box in the RenderText. Instead, correctly preserve the list of + text boxes. + (WebCore::RenderText::checkConsistency): Updated for earlier rename. + +2009-12-10 Oliver Hunt + + Reviewed by Alexey Proskuryakov. + + Crash in XMLTokenizer::popCurrentNode if window.close() is called during parsing + https://bugs.webkit.org/show_bug.cgi?id=31576 + + Add a RefCounted wrapper object around xmlParserCtxtPtr so we can + maintain it's lifetime more effectively. + + Test: fast/parser/xhtml-close-while-parsing.xhtml + + * dom/XMLTokenizer.cpp: + (WebCore::XMLTokenizer::popCurrentNode): + * dom/XMLTokenizer.h: + (WebCore::XMLParserContext::context): + (WebCore::XMLParserContext::XMLParserContext): + (WebCore::XMLTokenizer::context): + * dom/XMLTokenizerLibxml2.cpp: + (WebCore::XMLParserContext::createStringParser): + (WebCore::XMLParserContext::createMemoryParser): + (WebCore::XMLParserContext::~XMLParserContext): + (WebCore::XMLTokenizer::~XMLTokenizer): + (WebCore::XMLTokenizer::doWrite): + (WebCore::XMLTokenizer::initializeParserContext): + (WebCore::XMLTokenizer::doEnd): + (WebCore::XMLTokenizer::lineNumber): + (WebCore::XMLTokenizer::columnNumber): + (WebCore::XMLTokenizer::stopParsing): + (WebCore::parseXMLDocumentFragment): + (WebCore::parseAttributes): + +2009-11-09 Anders Carlsson + + Reviewed by Darin Adler and Dan Bernstein. + + + https://bugs.webkit.org/show_bug.cgi?id=31277 + + When an object tag's style changes (for example when child nodes are added/removed), + reuse its Frame (if it has one) instead of creating multiple Frames. + + Test: fast/dom/HTMLObjectElement/children-changed.html + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::requestObject): + +2009-12-05 Adam Langley + + Reviewed by Adam Barth. + + Check that a CSS format() argument is of a valid type. + + https://bugs.webkit.org/show_bug.cgi?id=31815 + http://code.google.com/p/chromium/issues/detail?id=28582 + + Test: fast/css/url-format-non-string.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseFontFaceSrc): + 2010-03-19 Miikka Heikkinen Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/config.h b/src/3rdparty/webkit/WebCore/config.h index 62a7f60a..003acbe 100644 --- a/src/3rdparty/webkit/WebCore/config.h +++ b/src/3rdparty/webkit/WebCore/config.h @@ -144,7 +144,9 @@ #if PLATFORM(SYMBIAN) #undef WIN32 #undef _WIN32 +#if COMPILER(WINSCW) #undef SKIP_STATIC_CONSTRUCTORS_ON_GCC +#endif #define USE_SYSTEM_MALLOC 1 #define U_HAVE_INT8_T 0 #define U_HAVE_INT16_T 0 diff --git a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp index 6024a5b..7750a80 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp @@ -3328,6 +3328,12 @@ bool CSSParser::parseFontWeight(bool important) return false; } +static bool isValidFormatFunction(CSSParserValue* val) +{ + CSSParserValueList* args = val->function->args; + return equalIgnoringCase(val->function->name, "format(") && (args->current()->unit == CSSPrimitiveValue::CSS_STRING || args->current()->unit == CSSPrimitiveValue::CSS_IDENT); +} + bool CSSParser::parseFontFaceSrc() { RefPtr values(CSSValueList::createCommaSeparated()); @@ -3355,7 +3361,7 @@ bool CSSParser::parseFontFaceSrc() CSSParserValue* a = args->current(); uriValue.clear(); parsedValue = CSSFontFaceSrcValue::createLocal(a->string); - } else if (equalIgnoringCase(val->function->name, "format(") && allowFormat && uriValue) { + } else if (allowFormat && uriValue && isValidFormatFunction(val)) { expectComma = true; allowFormat = false; uriValue->setFormat(args->current()->string); diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp index 30d39e0..56f8ff4 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp @@ -91,7 +91,8 @@ void XMLTokenizer::pushCurrentNode(Node* n) void XMLTokenizer::popCurrentNode() { - ASSERT(m_currentNode); + if (!m_currentNode) + return; ASSERT(m_currentNodeStack.size()); if (m_currentNode != m_doc) diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h index a83e73a..3bd15c8 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h @@ -52,6 +52,23 @@ namespace WebCore { class PendingCallbacks; class ScriptElement; +#if !USE(QXMLSTREAM) + class XMLParserContext : public RefCounted { + public: + static PassRefPtr createMemoryParser(xmlSAXHandlerPtr, void*, const char*); + static PassRefPtr createStringParser(xmlSAXHandlerPtr, void*); + ~XMLParserContext(); + xmlParserCtxtPtr context() const { return m_context; } + + private: + XMLParserContext(xmlParserCtxtPtr context) + : m_context(context) + { + } + xmlParserCtxtPtr m_context; + }; +#endif + class XMLTokenizer : public Tokenizer, public CachedResourceClient { public: XMLTokenizer(Document*, FrameView* = 0); @@ -146,7 +163,8 @@ public: QXmlStreamReader m_stream; bool m_wroteText; #else - xmlParserCtxtPtr m_context; + xmlParserCtxtPtr context() const { return m_context ? m_context->context() : 0; }; + RefPtr m_context; OwnPtr m_pendingCallbacks; Vector m_bufferedText; #endif diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp index 9aa0961..42c8b9b 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp @@ -465,7 +465,7 @@ static void errorFunc(void*, const char*, ...) static bool didInit = false; -static xmlParserCtxtPtr createStringParser(xmlSAXHandlerPtr handlers, void* userData) +PassRefPtr XMLParserContext::createStringParser(xmlSAXHandlerPtr handlers, void* userData) { if (!didInit) { xmlInitParser(); @@ -482,12 +482,12 @@ static xmlParserCtxtPtr createStringParser(xmlSAXHandlerPtr handlers, void* user const unsigned char BOMHighByte = *reinterpret_cast(&BOM); xmlSwitchEncoding(parser, BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE); - return parser; + return adoptRef(new XMLParserContext(parser)); } // Chunk should be encoded in UTF-8 -static xmlParserCtxtPtr createMemoryParser(xmlSAXHandlerPtr handlers, void* userData, const char* chunk) +PassRefPtr XMLParserContext::createMemoryParser(xmlSAXHandlerPtr handlers, void* userData, const char* chunk) { if (!didInit) { xmlInitParser(); @@ -518,8 +518,8 @@ static xmlParserCtxtPtr createMemoryParser(xmlSAXHandlerPtr handlers, void* user parser->str_xmlns = xmlDictLookup(parser->dict, BAD_CAST "xmlns", 5); parser->str_xml_ns = xmlDictLookup(parser->dict, XML_XML_NAMESPACE, 36); parser->_private = userData; - - return parser; + + return adoptRef(new XMLParserContext(parser)); } // -------------------------------- @@ -609,6 +609,13 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) m_defaultNamespaceURI = parentElement->namespaceURI(); } +XMLParserContext::~XMLParserContext() +{ + if (m_context->myDoc) + xmlFreeDoc(m_context->myDoc); + xmlFreeParserCtxt(m_context); +} + XMLTokenizer::~XMLTokenizer() { clearCurrentNodeStack(); @@ -616,15 +623,16 @@ XMLTokenizer::~XMLTokenizer() m_doc->deref(); if (m_pendingScript) m_pendingScript->removeClient(this); - if (m_context) - xmlFreeParserCtxt(m_context); } void XMLTokenizer::doWrite(const String& parseString) { if (!m_context) initializeParserContext(); - + + // Protect the libxml context from deletion during a callback + RefPtr context = m_context; + // libXML throws an error if you try to switch the encoding for an empty string. if (parseString.length()) { // Hack around libxml2's lack of encoding overide support by manually @@ -633,15 +641,15 @@ void XMLTokenizer::doWrite(const String& parseString) // and switch encodings, causing the parse to fail. const UChar BOM = 0xFEFF; const unsigned char BOMHighByte = *reinterpret_cast(&BOM); - xmlSwitchEncoding(m_context, BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE); + xmlSwitchEncoding(context->context(), BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE); XMLTokenizerScope scope(m_doc->docLoader()); - xmlParseChunk(m_context, reinterpret_cast(parseString.characters()), sizeof(UChar) * parseString.length(), 0); + xmlParseChunk(context->context(), reinterpret_cast(parseString.characters()), sizeof(UChar) * parseString.length(), 0); } if (m_doc->decoder() && m_doc->decoder()->sawError()) { // If the decoder saw an error, report it as fatal (stops parsing) - handleError(fatal, "Encoding error", lineNumber(), columnNumber()); + handleError(fatal, "Encoding error", context->context()->input->line, context->context()->input->col); } return; @@ -1277,9 +1285,9 @@ void XMLTokenizer::initializeParserContext(const char* chunk) XMLTokenizerScope scope(m_doc->docLoader()); if (m_parsingFragment) - m_context = createMemoryParser(&sax, this, chunk); + m_context = XMLParserContext::createMemoryParser(&sax, this, chunk); else - m_context = createStringParser(&sax, this); + m_context = XMLParserContext::createStringParser(&sax, this); } void XMLTokenizer::doEnd() @@ -1300,12 +1308,9 @@ void XMLTokenizer::doEnd() // Tell libxml we're done. { XMLTokenizerScope scope(m_doc->docLoader()); - xmlParseChunk(m_context, 0, 0, 1); + xmlParseChunk(context(), 0, 0, 1); } - if (m_context->myDoc) - xmlFreeDoc(m_context->myDoc); - xmlFreeParserCtxt(m_context); m_context = 0; } } @@ -1334,18 +1339,19 @@ void* xmlDocPtrForString(DocLoader* docLoader, const String& source, const Strin int XMLTokenizer::lineNumber() const { - return m_context ? m_context->input->line : 1; + return context() ? context()->input->line : 1; } int XMLTokenizer::columnNumber() const { - return m_context ? m_context->input->col : 1; + return context() ? context()->input->col : 1; } void XMLTokenizer::stopParsing() { Tokenizer::stopParsing(); - xmlStopParser(m_context); + if (context()) + xmlStopParser(context()); } void XMLTokenizer::resumeParsing() @@ -1384,17 +1390,17 @@ bool parseXMLDocumentFragment(const String& chunk, DocumentFragment* fragment, E CString chunkAsUtf8 = chunk.utf8(); tokenizer.initializeParserContext(chunkAsUtf8.data()); - xmlParseContent(tokenizer.m_context); + xmlParseContent(tokenizer.context()); tokenizer.endDocument(); // Check if all the chunk has been processed. - long bytesProcessed = xmlByteConsumed(tokenizer.m_context); + long bytesProcessed = xmlByteConsumed(tokenizer.context()); if (bytesProcessed == -1 || ((unsigned long)bytesProcessed) != chunkAsUtf8.length()) return false; // No error if the chunk is well formed or it is not but we have no error. - return tokenizer.m_context->wellFormed || xmlCtxtGetLastError(tokenizer.m_context) == 0; + return tokenizer.context()->wellFormed || xmlCtxtGetLastError(tokenizer.context()) == 0; } // -------------------------------- @@ -1437,12 +1443,9 @@ HashMap parseAttributes(const String& string, bool& attrsOK) memset(&sax, 0, sizeof(sax)); sax.startElementNs = attributesStartElementNsHandler; sax.initialized = XML_SAX2_MAGIC; - xmlParserCtxtPtr parser = createStringParser(&sax, &state); + RefPtr parser = XMLParserContext::createStringParser(&sax, &state); String parseString = ""; - xmlParseChunk(parser, reinterpret_cast(parseString.characters()), parseString.length() * sizeof(UChar), 1); - if (parser->myDoc) - xmlFreeDoc(parser->myDoc); - xmlFreeParserCtxt(parser); + xmlParseChunk(parser->context(), reinterpret_cast(parseString.characters()), parseString.length() * sizeof(UChar), 1); attrsOK = state.gotAttributes; return state.attributes; } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp index ace0f2f..a74ff83 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp @@ -515,11 +515,13 @@ bool HTMLFormElement::isURLAttribute(Attribute* attr) const void HTMLFormElement::registerImgElement(HTMLImageElement* e) { + ASSERT(imgElements.find(e) == notFound); imgElements.append(e); } void HTMLFormElement::removeImgElement(HTMLImageElement* e) { + ASSERT(imgElements.find(e) != notFound); removeFromVector(imgElements, e); } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLImageElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLImageElement.cpp index d353073..3db6811 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLImageElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLImageElement.cpp @@ -209,6 +209,30 @@ void HTMLImageElement::removedFromDocument() HTMLElement::removedFromDocument(); } +void HTMLImageElement::insertedIntoTree(bool deep) +{ + if (!m_form) { + // m_form can be non-null if it was set in constructor. + for (Node* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) { + if (ancestor->hasTagName(formTag)) { + m_form = static_cast(ancestor); + m_form->registerImgElement(this); + break; + } + } + } + + HTMLElement::insertedIntoTree(deep); +} + +void HTMLImageElement::removedFromTree(bool deep) +{ + if (m_form) + m_form->removeImgElement(this); + m_form = 0; + HTMLElement::removedFromTree(deep); +} + int HTMLImageElement::width(bool ignorePendingStylesheets) const { if (!renderer()) { diff --git a/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h b/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h index f58574d..14e5fa3 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h @@ -45,8 +45,6 @@ public: virtual void attach(); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); virtual bool canStartSelection() const { return false; } @@ -105,6 +103,11 @@ public: virtual void addSubresourceAttributeURLs(ListHashSet&) const; private: + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + virtual void insertedIntoTree(bool deep); + virtual void removedFromTree(bool deep); + HTMLImageLoader m_imageLoader; String usemap; bool ismap; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp index f25c908..652bc40 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp @@ -701,12 +701,15 @@ void HTMLInputElement::parseMappedAttribute(MappedAttribute *attr) m_autocomplete = Off; registerForActivationCallbackIfNeeded(); } else { - if (m_autocomplete == Off) - unregisterForActivationCallbackIfNeeded(); + bool needsToUnregister = m_autocomplete == Off; + if (attr->isEmpty()) m_autocomplete = Uninitialized; else m_autocomplete = On; + + if (needsToUnregister) + unregisterForActivationCallbackIfNeeded(); } } else if (attr->name() == typeAttr) { setInputType(attr->value()); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp index 1cb47ae..99c66de 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp @@ -1275,7 +1275,8 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem) prevMaxElem->next = elem; ASSERT(newNodePtr); prevMaxElem->node = newNodePtr; - prevMaxElem->didRefNode = false; + newNodePtr->ref(); + prevMaxElem->didRefNode = true; } else delete elem; } diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp index a85dcf5..7d857d4 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp @@ -1260,9 +1260,11 @@ bool FrameLoader::requestObject(RenderPart* renderer, const String& url, const A ASSERT(renderer->node()->hasTagName(objectTag) || renderer->node()->hasTagName(embedTag)); HTMLPlugInElement* element = static_cast(renderer->node()); - - // FIXME: OK to always make a new frame? When does the old frame get removed? - return loadSubframe(element, completedURL, frameName, m_outgoingReferrer); + + // If the plug-in element already contains a subframe, requestFrame will re-use it. Otherwise, + // it will create a new frame and set it as the RenderPart's widget, causing what was previously + // in the widget to be torn down. + return requestFrame(element, completedURL, frameName); } bool FrameLoader::shouldUsePlugin(const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback) diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index 37a6408..298d840 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -126,6 +126,7 @@ PassRefPtr RenderTheme::themeForPage(Page* page) RenderThemeQt::RenderThemeQt(Page* page) : RenderTheme() , m_page(page) + , m_lineEdit(0) { QPushButton button; button.setAttribute(Qt::WA_MacSmallSize); @@ -142,6 +143,7 @@ RenderThemeQt::RenderThemeQt(Page* page) RenderThemeQt::~RenderThemeQt() { delete m_fallbackStyle; + delete m_lineEdit; } // for some widget painting, we need to fallback to Windows style @@ -207,11 +209,13 @@ bool RenderThemeQt::supportsControlTints() const return true; } -static int findFrameLineWidth(QStyle* style) +int RenderThemeQt::findFrameLineWidth(QStyle* style) const { - QLineEdit lineEdit; + if (!m_lineEdit) + m_lineEdit = new QLineEdit(); + QStyleOptionFrameV2 opt; - return style->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, &lineEdit); + return style->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, m_lineEdit); } static QRect inflateButtonRect(const QRect& originalRect, QStyle* style) diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h index 13fb42f..64921b1 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h @@ -27,6 +27,7 @@ #include QT_BEGIN_NAMESPACE +class QLineEdit; class QPainter; class QWidget; QT_END_NAMESPACE @@ -140,6 +141,8 @@ private: void setButtonPadding(RenderStyle*) const; void setPopupPadding(RenderStyle*) const; + int findFrameLineWidth(QStyle* style) const; + QStyle* fallbackStyle() const; Page* m_page; @@ -150,6 +153,7 @@ private: QString m_buttonFontFamily; QStyle* m_fallbackStyle; + mutable QLineEdit* m_lineEdit; }; class StylePainter { diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderText.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderText.cpp index 40c3d75..88a05e5 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderText.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderText.cpp @@ -1047,8 +1047,15 @@ void RenderText::positionLineBox(InlineBox* box) if (!s->len()) { // We want the box to be destroyed. s->remove(); + if (m_firstTextBox == s) + m_firstTextBox = s->nextTextBox(); + else + s->prevTextBox()->setNextLineBox(s->nextTextBox()); + if (m_lastTextBox == s) + m_lastTextBox = s->prevTextBox(); + else + s->nextTextBox()->setPreviousLineBox(s->prevTextBox()); s->destroy(renderArena()); - m_firstTextBox = m_lastTextBox = 0; return; } @@ -1349,7 +1356,7 @@ void RenderText::checkConsistency() const #ifdef CHECK_CONSISTENCY const InlineTextBox* prev = 0; for (const InlineTextBox* child = m_firstTextBox; child != 0; child = child->nextTextBox()) { - ASSERT(child->object() == this); + ASSERT(child->renderer() == this); ASSERT(child->prevTextBox() == prev); prev = child; } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index a80c5d3..490ada1 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -65,6 +65,7 @@ public: void _q_doLoadFinished(bool success); void _q_updateMicroFocus(); + void _q_pageDestroyed(); QGraphicsWebView* q; QWebPage* page; @@ -97,6 +98,12 @@ void QGraphicsWebViewPrivate::_q_updateMicroFocus() #endif } +void QGraphicsWebViewPrivate::_q_pageDestroyed() +{ + page = 0; + q->setPage(0); +} + void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) { q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll)); @@ -454,6 +461,8 @@ void QGraphicsWebView::setPage(QWebPage* page) this, SIGNAL(linkClicked(QUrl))); connect(d->page, SIGNAL(microFocusChanged()), this, SLOT(_q_updateMicroFocus())); + connect(d->page, SIGNAL(destroyed()), + this, SLOT(_q_pageDestroyed())); } /*! diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h index f983ae4..1b02f35 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h @@ -135,6 +135,7 @@ protected: private: Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) Q_PRIVATE_SLOT(d, void _q_updateMicroFocus()) + Q_PRIVATE_SLOT(d, void _q_pageDestroyed()) QGraphicsWebViewPrivate* const d; friend class QGraphicsWebViewPrivate; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index e4c2afc..710e11b 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -324,15 +324,12 @@ void QWebFramePrivate::renderPrivate(QPainter *painter, QWebFrame::RenderLayer l } } -static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy) +static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const QPoint& pos) { if (!frame || !frame->document() || !frame->eventHandler()) return false; - Node* node = frame->document()->focusedNode(); - if (!node) - node = frame->document()->elementFromPoint(frame->eventHandler()->currentMousePosition().x(), - frame->eventHandler()->currentMousePosition().y()); + Node* node = frame->document()->elementFromPoint(pos.x(), pos.y()); if (!node) return false; @@ -363,6 +360,10 @@ static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy) return (scrolledHorizontal || scrolledVertical); } + + + + /*! \class QWebFrame \since 4.4 @@ -1047,27 +1048,24 @@ void QWebFrame::scroll(int dx, int dy) } /*! - \since 4.7 \internal Scrolls nested frames starting at this frame, \a dx pixels to the right and \a dy pixels downward. Both \a dx and \a dy may be negative. First attempts - to scroll elements with CSS overflow followed by this frame. If this + to scroll elements with CSS overflow at position pos, followed by this frame. If this frame doesn't scroll, attempts to scroll the parent - - \sa QWebFrame::scroll */ -bool QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy) +void QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy, const QPoint& pos) { Frame* frame = QWebFramePrivate::core(qFrame); - bool scrolledHorizontal = false; - bool scrolledVertical = false; - bool scrolledOverflow = webframe_scrollOverflow(frame, dx, dy); - - if (!scrolledOverflow) { - if (!frame || !frame->view()) - return false; + if (!frame || !frame->view()) + return; + + if (!webframe_scrollOverflow(frame, dx, dy, pos)) { do { + bool scrolledHorizontal = false; + bool scrolledVertical = false; + IntSize scrollOffset = frame->view()->scrollOffset(); IntPoint maxScrollOffset = frame->view()->maximumScrollPosition(); @@ -1083,12 +1081,12 @@ bool QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int d if (scrolledHorizontal || scrolledVertical) { frame->view()->scrollBy(IntSize(dx, dy)); - return true; + return; } + frame = frame->tree()->parent(); } while (frame && frame->view()); } - return (scrolledHorizontal || scrolledVertical || scrolledOverflow); } /*! diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index a289ec0..97a4e4e 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -1248,8 +1248,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) #if QT_VERSION >= 0x040600 case QInputMethodEvent::Selection: { if (renderTextControl) { - renderTextControl->setSelectionStart(a.start); - renderTextControl->setSelectionEnd(a.start + a.length); + renderTextControl->setSelectionStart(qMin(a.start, (a.start + a.length))); + renderTextControl->setSelectionEnd(qMax(a.start, (a.start + a.length))); } break; } diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index a5441cd..64726c2 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,87 @@ +2010-03-22 Jakub Wieczorek + + Reviewed by Simon Hausmann. + + [Qt] Don't construct a QLineEdit every time when painting a text field + https://bugs.webkit.org/show_bug.cgi?id=36373 + + Add a simple benchmark covering this area. + + * tests/benchmarks/painting/tst_painting.cpp: + (tst_Painting::textAreas): + +2010-03-22 Yi Shen + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=35933 + [Qt] [Symbian] Can not backward select (highlight) text using virtual keyboard + Make sure the selection start index is smaller than the selection end index. + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2010-03-25 Yael Aharon + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QtLauncher crashes on Mac OS and Linux when exiting with QGraphicsView mode enabled + https://bugs.webkit.org/show_bug.cgi?id=35251 + + Followed the way QWebView registers for the signal QWebPage::destroyed(), to prevent + QGraphicsWebView from referencing QWebPage after it was deleted. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::_q_pageDestroyed): + (QGraphicsWebView::setPage): + * Api/qgraphicswebview.h: + +2010-03-23 David Leong + + Reviewed by Laszlo Gombos. + + Build fix for Symbian Def file. + + * symbian/eabi/QtWebKitu.def: + +2010-03-18 Joe Ligman + + Reviewed by Simon Hausmann. + + [Qt] New API scrollRecursively has several problems. + https://bugs.webkit.org/show_bug.cgi?id=35873 + + Remove scrollRecursively from the Qt 4.7 API + Update the internal API to accept a hit test position + for nested scrolling + + * Api/qwebframe.cpp: + (webframe_scrollOverflow): + (qtwebkit_webframe_scrollRecursively): + * Api/qwebframe.h: + * Api/qwebframe_p.h: + * tests/qwebframe/tst_qwebframe.cpp: + +2009-12-18 Joe Ligman + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Add new API to QWebFrame to scrollRecursively starting with any css overflow + then checking current frame and then ancestors + https://bugs.webkit.org/show_bug.cgi?id=32668 + + * Api/qwebframe.cpp: + (QWebFramePrivate::scrollOverflow): + (QWebFrame::scrollRecursively): + * Api/qwebframe.h: + * Api/qwebframe_p.h: + * tests/qwebframe/qwebframe.qrc: + * tests/qwebframe/testiframe.html: Added. + * tests/qwebframe/testiframe2.html: Added. + * tests/qwebframe/tst_qwebframe.cpp: + 2010-03-21 Kristian Amlie Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def index 5dd2e20..cfa8f7f 100644 --- a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -693,5 +693,5 @@ EXPORTS _Z23qt_networkAccessAllowedb @ 692 NONAME _Z25qt_resumeActiveDOMObjectsP9QWebFrame @ 693 NONAME _Z26qt_suspendActiveDOMObjectsP9QWebFrame @ 694 NONAME - _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameii @ 695 NONAME - + _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameii @ 695 NONAME ABSENT + _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameiiRK6QPoint @ 715 NONAME diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp index f4531fd..fc5b8e3 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -59,6 +60,7 @@ public Q_SLOTS: private Q_SLOTS: void paint_data(); void paint(); + void textAreas(); private: QWebView* m_view; @@ -105,5 +107,30 @@ void tst_Painting::paint() } } +void tst_Painting::textAreas() +{ + m_view->load(QUrl("data:text/html;")); + ::waitForSignal(m_view, SIGNAL(loadFinished(bool))); + + QWebElement bodyElement = m_page->mainFrame()->findFirstElement("body"); + + int count = 100; + while (count--) { + QString markup(""); + bodyElement.appendInside(markup); + } + + /* force a layout */ + QWebFrame* mainFrame = m_page->mainFrame(); + mainFrame->toPlainText(); + + QPixmap pixmap(mainFrame->contentsSize()); + QBENCHMARK { + QPainter painter(&pixmap); + mainFrame->render(&painter, QRect(QPoint(0, 0), mainFrame->contentsSize())); + painter.end(); + } +} + QTEST_MAIN(tst_Painting) #include "tst_painting.moc" 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 609f8b4..8cc7953 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -606,7 +606,6 @@ private slots: void scrollPosition(); void evaluateWillCauseRepaint(); void qObjectWrapperWithSameIdentity(); - void scrollRecursively(); private: QString evalJS(const QString&s) { @@ -2825,71 +2824,5 @@ void tst_QWebFrame::qObjectWrapperWithSameIdentity() QCOMPARE(mainFrame->toPlainText(), QString("test2")); } -bool QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy); - -void tst_QWebFrame::scrollRecursively() -{ - // The test content is - // a nested frame set - // The main frame scrolls - // and has two children - // an iframe and a div overflow - // both scroll - QWebView webView; - QWebPage* webPage = webView.page(); - QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool))); - QUrl url = QUrl("qrc:///testiframe.html"); - webPage->mainFrame()->load(url); - QTRY_COMPARE(loadSpy.count(), 1); - - QList children = webPage->mainFrame()->childFrames(); - QVERIFY(children.count() == 1); - - // 1st test - // call scrollRecursively over mainframe - // verify scrolled - // verify scroll postion changed - QPoint scrollPosition(webPage->mainFrame()->scrollPosition()); - QVERIFY(qtwebkit_webframe_scrollRecursively(webPage->mainFrame(), 10, 10)); - QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition()); - - // 2nd test - // call scrollRecursively over child iframe - // verify scrolled - // verify child scroll position changed - // verify parent's scroll position did not change - scrollPosition = webPage->mainFrame()->scrollPosition(); - QPoint childScrollPosition = children.at(0)->scrollPosition(); - QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), 10, 10)); - QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition()); - QVERIFY(childScrollPosition != children.at(0)->scrollPosition()); - - // 3rd test - // call scrollRecursively over div overflow - // verify scrolled == true - // verify parent and child frame's scroll postion did not change - QWebElement div = webPage->mainFrame()->documentElement().findFirst("#content1"); - QMouseEvent evpres(QEvent::MouseMove, div.geometry().center(), Qt::NoButton, Qt::NoButton, Qt::NoModifier); - webPage->event(&evpres); - scrollPosition = webPage->mainFrame()->scrollPosition(); - childScrollPosition = children.at(0)->scrollPosition(); - QVERIFY(qtwebkit_webframe_scrollRecursively(webPage->mainFrame(), 5, 5)); - QVERIFY(childScrollPosition == children.at(0)->scrollPosition()); - QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition()); - - // 4th test - // call scrollRecursively twice over childs iframe - // verify scrolled == true first time - // verify parent's scroll == true second time - // verify parent and childs scroll position changed - childScrollPosition = children.at(0)->scrollPosition(); - QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), -10, -10)); - QVERIFY(childScrollPosition != children.at(0)->scrollPosition()); - scrollPosition = webPage->mainFrame()->scrollPosition(); - QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), -10, -10)); - QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition()); - -} - QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" 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 0e04acc..55ee42a 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1451,6 +1451,26 @@ void tst_QWebPage::inputMethods() variant = page->inputMethodQuery(Qt::ImCurrentSelection); QString selectionValue = variant.value(); QCOMPARE(selectionValue, QString("eb")); + + //Set selection with negative length + inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 6, -5, QVariant()); + QInputMethodEvent eventSelection2("",inputAttributes); + page->event(&eventSelection2); + + //ImAnchorPosition + variant = page->inputMethodQuery(Qt::ImAnchorPosition); + anchorPosition = variant.toInt(); + QCOMPARE(anchorPosition, 1); + + //ImCursorPosition + variant = page->inputMethodQuery(Qt::ImCursorPosition); + cursorPosition = variant.toInt(); + QCOMPARE(cursorPosition, 6); + + //ImCurrentSelection + variant = page->inputMethodQuery(Qt::ImCurrentSelection); + selectionValue = variant.value(); + QCOMPARE(selectionValue, QString("tWebK")); #endif //ImSurroundingText -- cgit v0.12 From 01c5c585ea0839730e213ac414c191ce40bfe321 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 29 Mar 2010 13:58:12 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( c39615d8e78f083b23f34ac24cf7d3a7ce765122 ) Changes in WebKit/qt since the last update: * https://bugs.webkit.org/show_bug.cgi?id=34262 -- Accept XHTML MP content type as XHTML content --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 13 +++++++++++++ src/3rdparty/webkit/WebCore/platform/MIMETypeRegistry.cpp | 2 -- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 414ba17..5bc2492 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - bd724fb2f716336a8a4b54cd2edc96851a5a26a4 + c39615d8e78f083b23f34ac24cf7d3a7ce765122 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 10aa0f2..76374f3 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2010-03-29 Laszlo Gombos + + Reviewed for the Qt 4.6 branch by Simon Hausmann. + + Accept XHTML-MP content type as XHTML content + https://bugs.webkit.org/show_bug.cgi?id=34262 + + Enable processing XHTML-MP mime type as an XHTML document + even if XHTML-MP support is not enabled. + + * platform/MIMETypeRegistry.cpp: + (WebCore::initializeSupportedNonImageMimeTypes): + 2010-03-22 Jakub Wieczorek Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/platform/MIMETypeRegistry.cpp b/src/3rdparty/webkit/WebCore/platform/MIMETypeRegistry.cpp index 609a1b0..758863c 100644 --- a/src/3rdparty/webkit/WebCore/platform/MIMETypeRegistry.cpp +++ b/src/3rdparty/webkit/WebCore/platform/MIMETypeRegistry.cpp @@ -200,9 +200,7 @@ static void initializeSupportedNonImageMimeTypes() "text/", "application/xml", "application/xhtml+xml", -#if ENABLE(XHTMLMP) "application/vnd.wap.xhtml+xml", -#endif "application/rss+xml", "application/atom+xml", #if ENABLE(SVG) -- cgit v0.12 From 43e67759246cbdbe5ff337877d14b45e4f33e040 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 29 Mar 2010 15:36:43 +0200 Subject: Compile with MSVC 2005 and 2003 when no platform SDK is used Reviewed-by: Eskil --- src/gui/text/qfontengine_win.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index a133b48..d126a2e 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -39,6 +39,11 @@ ** ****************************************************************************/ +#if _WIN32_WINNT < 0x0500 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 +#endif + #include "qfontengine_p.h" #include "qtextengine_p.h" #include -- cgit v0.12 From 32a182c25104e6e49fc965a168957acff52a2b53 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 29 Mar 2010 14:44:00 +0100 Subject: Fixed bitfield-related crash on Symbian WINSCW When running on WINSCW, the nativePaintMode variable was becoming corrupted. The point at which this corruption occurs is unclear, but it can be reproduced as follows: 1. Launch qmediaplayer 2. In the Phonon::MMF::DsaVideoOutput constructor, the nativePaintMode flag is set to QWExtra::ZeroFill 3. Open a video clip 4. During start of playback, QSymbianControl::Draw is called on the native control corresponding to the DsaVideoOutput object. This checks the value of nativePaintMode; it does not match any of the valid NativePaintMode values, so an assertion fails. This crash does not occur on target, suggesting that the cause may be an error in the WINSCW compiler. Although the C++ standard allows bitfields to have boolean, integral or enumeration type, the latter is not permitted by C99. Neither increasing the number of bits allocated to nativePaintMode, nor changing it position in the list of platform-specific bitfields has any effect. After making nativePaintMode into a normal field rather than a bitfield, the crash no longer happens. Note that, since bitfields must be kept together, nativePaintMode is moved to the end of the structure. --- src/gui/kernel/qwidget_p.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 1bbc057..555647c 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -233,6 +233,15 @@ struct QWExtra { uint activated : 1; // RWindowBase::Activated has been called /** + * If this bit is set, each native widget receives the signals from the + * Symbian control immediately before and immediately after draw ops are + * sent to the window server for this control: + * void beginNativePaintEvent(const QRect &paintRect); + * void endNativePaintEvent(const QRect &paintRect); + */ + uint receiveNativePaintEvents : 1; + + /** * Defines the behaviour of QSymbianControl::Draw. */ enum NativePaintMode { @@ -257,16 +266,7 @@ struct QWExtra { Default = Blit }; - NativePaintMode nativePaintMode : 2; - - /** - * If this bit is set, each native widget receives the signals from the - * Symbian control immediately before and immediately after draw ops are - * sent to the window server for this control: - * void beginNativePaintEvent(const QRect &paintRect); - * void endNativePaintEvent(const QRect &paintRect); - */ - uint receiveNativePaintEvents : 1; + NativePaintMode nativePaintMode; #endif }; -- cgit v0.12 From 38af39aceb419e4b2eb248761fddaec92184c0f7 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 29 Mar 2010 15:55:13 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( e9151b11e974f0aa47fd40c225f88f35ced91496 ) Changes in WebKit/qt since the last update: * r56546 - https://bugs.webkit.org/show_bug.cgi?id=35112 -- [Qt] Windowed netscape plugins don't work with QGraphicsWebView on Symbian --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 19 +++++++++++++++++ .../plugins/symbian/PluginContainerSymbian.cpp | 8 ++++---- .../plugins/symbian/PluginContainerSymbian.h | 7 +++++-- .../WebCore/plugins/symbian/PluginViewSymbian.cpp | 24 +++++++++++++++------- 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 5bc2492..a8889b3 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - c39615d8e78f083b23f34ac24cf7d3a7ce765122 + e9151b11e974f0aa47fd40c225f88f35ced91496 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 76374f3..2bd506b 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,22 @@ +2010-03-25 yael aharon + + Reviewed by Laszlo Gombos. + + [Qt] Windowed netscape plugins don't work with QGraphicsWebView on Symbian + https://bugs.webkit.org/show_bug.cgi?id=35112 + + Add a proxy widget when loading a QWidget based plugin in a QGraphicsWebView. + + * plugins/symbian/PluginContainerSymbian.cpp: + (PluginContainerSymbian::PluginContainerSymbian): + (PluginContainerSymbian::focusInEvent): + * plugins/symbian/PluginContainerSymbian.h: + (WebCore::PluginContainerSymbian::proxy): + * plugins/symbian/PluginViewSymbian.cpp: + (WebCore::PluginView::updatePluginWidget): + (WebCore::PluginView::platformStart): + (WebCore::PluginView::platformDestroy): + 2010-03-29 Laszlo Gombos Reviewed for the Qt 4.6 branch by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.cpp b/src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.cpp index aece0e4..b839870 100644 --- a/src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.cpp @@ -32,12 +32,12 @@ using namespace WebCore; -PluginContainerSymbian::PluginContainerSymbian(PluginView* view, QWidget* parent) - : m_parent(parent) +PluginContainerSymbian::PluginContainerSymbian(PluginView* view, QWidget* parent, QGraphicsProxyWidget* proxy) + : QWidget(parent) , m_pluginView(view) + , m_proxy(proxy) , m_hasPendingGeometryChange(false) { - setParent(m_parent); } PluginContainerSymbian::~PluginContainerSymbian() @@ -62,7 +62,7 @@ void PluginContainerSymbian::adjustGeometry() } } -void PluginContainerSymbian::focusInEvent(QFocusEvent* event) +void PluginContainerSymbian::focusInEvent(QFocusEvent*) { if (Page* page = m_pluginView->parentFrame()->page()) page->focusController()->setActive(true); diff --git a/src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.h b/src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.h index fce4a71..fead872 100644 --- a/src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.h +++ b/src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.h @@ -22,6 +22,8 @@ #include +class QGraphicsProxyWidget; + namespace WebCore { class PluginView; @@ -29,18 +31,19 @@ namespace WebCore { class PluginContainerSymbian : public QWidget { Q_OBJECT public: - PluginContainerSymbian(PluginView*, QWidget* parent); + PluginContainerSymbian(PluginView*, QWidget* parent, QGraphicsProxyWidget* proxy = 0); ~PluginContainerSymbian(); void requestGeometry(const QRect&, const QRegion& clip = QRegion()); void adjustGeometry(); + QGraphicsProxyWidget* proxy() { return m_proxy; } protected: virtual void focusInEvent(QFocusEvent*); virtual void focusOutEvent(QFocusEvent*); private: PluginView* m_pluginView; - QWidget* m_parent; + QGraphicsProxyWidget* m_proxy; QRect m_windowRect; QRegion m_clipRegion; bool m_hasPendingGeometryChange; diff --git a/src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp b/src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp index cf69723..86f5f6c 100644 --- a/src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp @@ -52,6 +52,8 @@ #include "runtime.h" #include "runtime_root.h" #include "QWebPageClient.h" +#include "qgraphicswebview.h" +#include #include #include #include @@ -84,6 +86,7 @@ void PluginView::updatePluginWidget() IntRect oldClipRect = m_clipRect; m_windowRect = IntRect(frameView->contentsToWindow(frameRect().location()), frameRect().size()); + m_clipRect = windowClipRect(); m_clipRect.move(-m_windowRect.x(), -m_windowRect.y()); if (m_windowRect == oldWindowRect && m_clipRect == oldClipRect) @@ -425,12 +428,15 @@ bool PluginView::platformStart() if (m_isWindowed) { QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); - // FIXME this will not work for QGraphicsView. - // But we cannot use winId because it will create a window and on S60, - // QWidgets should not create a window. - Q_ASSERT(qobject_cast(client->pluginParent())); - setPlatformWidget(new PluginContainerSymbian(this, - qobject_cast(client->pluginParent()))); + QGraphicsProxyWidget* proxy = 0; + if (QGraphicsWebView *webView = qobject_cast(client->pluginParent())) + proxy = new QGraphicsProxyWidget(webView); + + PluginContainerSymbian* container = new PluginContainerSymbian(this, proxy ? 0 : client->ownerWidget(), proxy); + setPlatformWidget(container); + if (proxy) + proxy->setWidget(container); + m_npWindow.type = NPWindowTypeWindow; m_npWindow.window = (void*)platformPluginWidget(); @@ -446,7 +452,11 @@ bool PluginView::platformStart() void PluginView::platformDestroy() { - delete platformPluginWidget(); + QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); + if (QGraphicsWebView *webView = qobject_cast(client->pluginParent())) + delete static_cast(platformPluginWidget())->proxy(); + else + delete platformPluginWidget(); } void PluginView::halt() -- cgit v0.12 From 0c5524e73848b95276f13c384d2c711188936deb Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 29 Mar 2010 14:55:24 +0100 Subject: Fixed crash in Phonon MMF backend during application shutdown During application shutdown, DsaVideoPlayer::handleVideoWindowChanged is called. At this point, the application's main window has been closed and therefore QApplication::activeWindow() returns 0. This leads to a crash. This patch ensures that a null return value from QApplication::activeWindow(), and the resulting zero value of DsaVideoPlayer::m_window, are handled gracefully. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/videoplayer_dsa.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp index 21cdb16..732d2d9 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp @@ -162,7 +162,10 @@ void MMF::DsaVideoPlayer::prepareCompleted() void MMF::DsaVideoPlayer::handleVideoWindowChanged() { if (!m_window) { - m_window = QApplication::activeWindow()->effectiveWinId()->DrawableWindow(); + if (QWidget *window = QApplication::activeWindow()) + m_window = window->effectiveWinId()->DrawableWindow(); + else + m_window = 0; m_videoScreenRect = TRect(); } @@ -213,6 +216,9 @@ void MMF::DsaVideoPlayer::handleParametersChanged(VideoParameters parameters) TRACE_CONTEXT(DsaVideoPlayer::handleParametersChanged, EVideoInternal); TRACE_ENTRY_0(); + if (!m_window) + return; + #ifndef QT_NO_DEBUG getDsaRegion(m_wsSession, *m_window); #endif -- cgit v0.12 From 15ecc59edab06a21fb7d724af13ca544decbc0eb Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 29 Mar 2010 19:01:26 +0200 Subject: Adding QFontDatabase::removeAllApplicationFonts() It was missing and not covered by the standard autotests, so its missing was not detected for quite some time. Task-number: QTBUG-8423 Reviewed-By: Shane Kearns --- src/gui/text/qfontdatabase_s60.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 87a73df..fceb401 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -332,6 +332,11 @@ bool QFontDatabase::removeApplicationFont(int handle) return false; } +bool QFontDatabase::removeAllApplicationFonts() +{ + return false; +} + bool QFontDatabase::supportsThreadedFontRendering() { return false; -- cgit v0.12 From 3d3af93505f7b90e399aab4c8fa2bceae18fedf6 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 29 Mar 2010 19:01:48 +0200 Subject: Exporting QFontDatabase::removeAllApplicationFonts() It was missing and not covered by the standard autotests, so its missing was not detected for quite some time. Task-number: QTBUG-8423 Reviewed-By: Shane Kearns --- src/s60installs/bwins/QtGuiu.def | 1 + src/s60installs/eabi/QtGuiu.def | 1 + 2 files changed, 2 insertions(+) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 8e758d0..6a4f07b 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12601,4 +12601,5 @@ EXPORTS ?setPixelFormat@QEglProperties@@QAEXW4Format@QImage@@@Z @ 12600 NONAME ABSENT ; void QEglProperties::setPixelFormat(enum QImage::Format) ?currentContext@QEglContext@@CAPAV1@W4API@QEgl@@@Z @ 12601 NONAME ABSENT ; class QEglContext * QEglContext::currentContext(enum QEgl::API) ?errorString@QEglContext@@SA?AVQString@@H@Z @ 12602 NONAME ABSENT ; class QString QEglContext::errorString(int) + ?removeAllApplicationFonts@QFontDatabase@@SA_NXZ @12603 ; NONAME ; bool QFontDatabase::removeAllApplicationFonts() diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 373f66d..a3fc452 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -11805,4 +11805,5 @@ EXPORTS _ZN24QImagePixmapCleanupHooks34executePixmapDataModificationHooksEP11QPixmapData @ 11804 NONAME _ZN9QS60Style10timerEventEP11QTimerEvent @ 11805 NONAME _ZN9QS60Style11eventFilterEP7QObjectP6QEvent @ 11806 NONAME + _ZN13QFontDatabase25removeAllApplicationFontsEv @ 11807 NONAME -- cgit v0.12 From 966768a637a607abd9c26917e62be994c397864f Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 30 Mar 2010 10:48:47 +0200 Subject: Fix a crash in QGtkStyle when theme not available subElementRect failed to verify that the theme was resolved before accessing certain data structures. Reviewed-by: ogoffart Task-number: QTBUG-9240 --- src/gui/styles/qgtkstyle.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index b5f052b..ddae3d8 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -3398,6 +3398,9 @@ QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, Q_D(const QGtkStyle); QRect r = QCleanlooksStyle::subElementRect(element, option, widget); + if (!d->isThemeAvailable()) + return r; + switch (element) { case SE_ProgressBarLabel: case SE_ProgressBarContents: -- cgit v0.12