diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-09-07 09:55:37 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-09-07 09:55:37 (GMT) |
commit | f27ed1a26d0b68594f13f79be4806b40e489ce14 (patch) | |
tree | 1c58a8a813c9f398a36098b6517eadbe2f47498c | |
parent | 1cac9a68bab207cab3fd3790baec4569a0acd385 (diff) | |
parent | 6b7330ee075a62138f005492a6448059106554af (diff) | |
download | Qt-f27ed1a26d0b68594f13f79be4806b40e489ce14.zip Qt-f27ed1a26d0b68594f13f79be4806b40e489ce14.tar.gz Qt-f27ed1a26d0b68594f13f79be4806b40e489ce14.tar.bz2 |
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
161 files changed, 1774 insertions, 653 deletions
@@ -3874,7 +3874,7 @@ elif [ "$Edition" = "OpenSource" ]; then while true; do echo "You are licensed to use this software under the terms of" echo "the Lesser GNU General Public License (LGPL) versions 2.1." - if [ -e "$relpath/LICENSE.GPL3" ]; then + if [ -f "$relpath/LICENSE.GPL3" ]; then echo "You are also licensed to use this software under the terms of" echo "the GNU General Public License (GPL) versions 3." affix="either" @@ -3886,7 +3886,7 @@ elif [ "$Edition" = "OpenSource" ]; then echo "You have already accepted the terms of the $LicenseType license." acceptance=yes else - if [ -e "$relpath/LICENSE.GPL3" ]; then + if [ -f "$relpath/LICENSE.GPL3" ]; then echo "Type '3' to view the GNU General Public License version 3." fi echo "Type 'L' to view the Lesser GNU General Public License version 2.1." diff --git a/demos/boxes/glbuffers.cpp b/demos/boxes/glbuffers.cpp index a3d26f6..3b16d17 100644 --- a/demos/boxes/glbuffers.cpp +++ b/demos/boxes/glbuffers.cpp @@ -372,7 +372,7 @@ void GLRenderTargetCube::getViewMatrix(QMatrix4x4& mat, int face) {-1.0f, -1.0f, +1.0f}, }; - memset(mat.data(), 0, sizeof(float) * 16); + mat.fill(0.0f); for (int i = 0; i < 3; ++i) mat(i, perm[face][i]) = signs[face][i]; mat(3, 3) = 1.0f; diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp index 7c0d4d8..0975fc5 100644 --- a/demos/boxes/scene.cpp +++ b/demos/boxes/scene.cpp @@ -718,8 +718,6 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) glPushMatrix(); QMatrix4x4 m; m.rotate(m_trackBalls[1].rotation()); - m = m.transposed(); - multMatrix(m); glRotatef(360.0f * i / m_programs.size(), 0.0f, 0.0f, 1.0f); @@ -753,7 +751,6 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) if (-1 != excludeBox) { QMatrix4x4 m; m.rotate(m_trackBalls[0].rotation()); - m = m.transposed(); multMatrix(m); if (glActiveTexture) { @@ -880,7 +877,7 @@ void Scene::renderCubemaps() GLRenderTargetCube::getViewMatrix(mat, face); QVector4D v = QVector4D(-center.x(), -center.y(), -center.z(), 1.0); - mat.setColumn(3, v * mat); + mat.setColumn(3, mat * v); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderBoxes(mat, i); diff --git a/demos/boxes/trackball.cpp b/demos/boxes/trackball.cpp index 9898441..60de6af 100644 --- a/demos/boxes/trackball.cpp +++ b/demos/boxes/trackball.cpp @@ -92,9 +92,9 @@ void TrackBall::move(const QPointF& p, const QQuaternion &transformation) { QLineF delta(m_lastPos, p); m_angularVelocity = 180*delta.length() / (PI*msecs); - m_axis = QVector3D(delta.dy(), -delta.dx(), 0.0f).normalized(); + m_axis = QVector3D(-delta.dy(), delta.dx(), 0.0f).normalized(); m_axis = transformation.rotateVector(m_axis); - m_rotation *= QQuaternion::fromAxisAndAngle(m_axis, delta.length()); + m_rotation = QQuaternion::fromAxisAndAngle(m_axis, 180 / PI * delta.length()) * m_rotation; } break; case Sphere: @@ -113,13 +113,13 @@ void TrackBall::move(const QPointF& p, const QQuaternion &transformation) else currentPos3D.normalize(); - m_axis = QVector3D::crossProduct(currentPos3D, lastPos3D); - float angle = asin(sqrt(QVector3D::dotProduct(m_axis, m_axis))); + m_axis = QVector3D::crossProduct(lastPos3D, currentPos3D); + float angle = 180 / PI * asin(sqrt(QVector3D::dotProduct(m_axis, m_axis))); - m_angularVelocity = 180*angle / (PI*msecs); + m_angularVelocity = angle / msecs; m_axis.normalize(); m_axis = transformation.rotateVector(m_axis); - m_rotation *= QQuaternion::fromAxisAndAngle(m_axis, angle); + m_rotation = QQuaternion::fromAxisAndAngle(m_axis, angle) * m_rotation; } break; } @@ -155,6 +155,6 @@ QQuaternion TrackBall::rotation() const QTime currentTime = QTime::currentTime(); float angle = m_angularVelocity * m_lastTime.msecsTo(currentTime); - return m_rotation * QQuaternion::fromAxisAndAngle(m_axis, angle); + return QQuaternion::fromAxisAndAngle(m_axis, angle) * m_rotation; } diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp index e63417c..455ba0c 100644 --- a/demos/qtdemo/colors.cpp +++ b/demos/qtdemo/colors.cpp @@ -274,6 +274,8 @@ void Colors::parseArgs(int argc, char *argv[]) + "[-low] [-ticker-letters<int>] [-ticker-speed<float>] [-no-ticker-morph] " + "[-ticker-morph-speed<float>] [-ticker-text<string>]"); exit(0); + } else if (s == "-verbose") { + // this option was already handled above } else{ QMessageBox::warning(0, "QtDemo", QString("Unrecognized argument:\n") + s); exit(0); diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp index 12796dc..88eaeb3 100644 --- a/demos/qtdemo/menumanager.cpp +++ b/demos/qtdemo/menumanager.cpp @@ -324,9 +324,10 @@ void MenuManager::launchExample(const QString &name) #ifdef Q_OS_WIN //make sure it finds the dlls on windows - QString curpath = QString::fromLocal8Bit(qgetenv("PATH").constData()); - QString newpath = QString("PATH=%1;%2").arg(QLibraryInfo::location(QLibraryInfo::BinariesPath), curpath); - process->setEnvironment(QStringList(newpath)); + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + env.insert(QLatin1String("PATH"), QLibraryInfo::location(QLibraryInfo::BinariesPath) + + QLatin1Char(';') + env.value(QLatin1String("Path"))); + process->setProcessEnvironment(env); #endif if (info[name]["changedirectory"] != "false"){ diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index e65d569..5791908 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -89,6 +89,8 @@ \o gcc (\l{http:\\www.codesourcery.com}{Codesourcery version)} \row \o Windows CE 5.0 (ARMv4i, x86, MIPS) \o MSVC 2005 WinCE 5.0 Standard (x86, pocket, smart, mipsii) + \row \o Symbian (S60 3.1, 3.2 and 5.0) + \o RVCT, GCCE, WINSCW \endtable \section1 Tier 2 Platforms diff --git a/doc/src/snippets/code/src_corelib_io_qprocess.cpp b/doc/src/snippets/code/src_corelib_io_qprocess.cpp index e15b376..5ebb747 100644 --- a/doc/src/snippets/code/src_corelib_io_qprocess.cpp +++ b/doc/src/snippets/code/src_corelib_io_qprocess.cpp @@ -73,7 +73,7 @@ command1 | command2 QProcess process1; QProcess process2; -process1.setStandardOutputProcess(process2); +process1.setStandardOutputProcess(&process2); process1.start("command1"); process2.start("command2"); diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp index 2c18036..c200c30 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp @@ -404,9 +404,25 @@ public: //! [38] -//! [39] -Q_FLAGS(Options Alignment) -//! [39] +//! [39a] +class QLibrary : public QObject +{ + ... + Q_FLAGS(LoadHint LoadHints) + ... +//! [39a] + +//! [39b] + ... +public: + enum LoadHint { + ResolveAllSymbolsHint = 0x01, + ExportExternalSymbolsHint = 0x02, + LoadArchiveMemberHint = 0x04 + }; + Q_DECLARE_FLAGS(LoadHints, LoadHint) + ... +//! [39b] //! [40] diff --git a/examples/effects/customshader/blureffect.cpp b/examples/effects/customshader/blureffect.cpp index 6fe8e86..f9e046e 100644 --- a/examples/effects/customshader/blureffect.cpp +++ b/examples/effects/customshader/blureffect.cpp @@ -56,10 +56,10 @@ void BlurEffect::adjustForItem() setBlurRadius(radius); } -QRectF BlurEffect::boundingRectFor(const QRectF &rect) const +QRectF BlurEffect::boundingRect() const { const_cast<BlurEffect *>(this)->adjustForItem(); - return QGraphicsBlurEffect::boundingRectFor(rect); + return QGraphicsBlurEffect::boundingRect(); } void BlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) diff --git a/examples/effects/customshader/blureffect.h b/examples/effects/customshader/blureffect.h index 0cafd80..7c12ccf 100644 --- a/examples/effects/customshader/blureffect.h +++ b/examples/effects/customshader/blureffect.h @@ -52,9 +52,9 @@ public: void setBaseLine(qreal y) { m_baseLine = y; } - QRectF boundingRectFor(const QRectF &) const; + QRectF boundingRect() const; - void draw(QPainter *painter, QGraphicsEffectSource*); + void draw(QPainter *painter, QGraphicsEffectSource *source); private: void adjustForItem(); diff --git a/examples/effects/customshader/customshadereffect.h b/examples/effects/customshader/customshadereffect.h index 9ba5f15..6892d96 100644 --- a/examples/effects/customshader/customshadereffect.h +++ b/examples/effects/customshader/customshadereffect.h @@ -43,7 +43,7 @@ #define CUSTOMSHADEREFFECT_H #include <QGraphicsEffect> -#include <QGraphicsShaderEffect> +#include <QtOpenGL/private/qgraphicsshadereffect_p.h> #include <QGraphicsItem> class CustomShaderEffect: public QGraphicsShaderEffect diff --git a/examples/graphicsview/flowlayout/flowlayout.cpp b/examples/graphicsview/flowlayout/flowlayout.cpp index d4fc49d..32a2830 100644 --- a/examples/graphicsview/flowlayout/flowlayout.cpp +++ b/examples/graphicsview/flowlayout/flowlayout.cpp @@ -98,12 +98,10 @@ void FlowLayout::setGeometry(const QRectF &geom) qreal FlowLayout::doLayout(const QRectF &geom, bool applyNewGeometry) const { - QPointF tl = geom.topLeft(); - qreal maxw = geom.width(); - qreal left, top, right, bottom; getContentsMargins(&left, &top, &right, &bottom); - maxw = maxw - left - right; + const qreal maxw = geom.width() - left - right; + qreal x = 0; qreal y = 0; qreal maxRowHeight = 0; @@ -139,9 +137,11 @@ QSizeF FlowLayout::minSize(const QSizeF &constraint) const QSizeF size(0, 0); qreal left, top, right, bottom; getContentsMargins(&left, &top, &right, &bottom); - if (constraint.width() > 0) { // height for width - qreal height = doLayout(QRectF(QPointF(0,0), constraint), false); + if (constraint.width() >= 0) { // height for width + const qreal height = doLayout(QRectF(QPointF(0,0), constraint), false); size = QSizeF(constraint.width(), height); + } else if (constraint.height() >= 0) { // width for height? + // not supported } else { QGraphicsLayoutItem *item; foreach (item, m_items) @@ -153,8 +153,8 @@ QSizeF FlowLayout::minSize(const QSizeF &constraint) const QSizeF FlowLayout::prefSize() const { - qreal left, top, right, bottom; - getContentsMargins(&left, &top, &right, &bottom); + qreal left, right; + getContentsMargins(&left, 0, &right, 0); QGraphicsLayoutItem *item; qreal maxh = 0; @@ -196,15 +196,19 @@ QSizeF FlowLayout::maxSize() const QSizeF FlowLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { + QSizeF sh = constraint; switch (which) { case Qt::PreferredSize: - return prefSize(); + sh = prefSize(); + break; case Qt::MinimumSize: - return minSize(constraint); + sh = minSize(constraint); + break; case Qt::MaximumSize: - return maxSize(); + sh = maxSize(); + break; default: break; } - return constraint; + return sh; } diff --git a/examples/graphicsview/flowlayout/main.cpp b/examples/graphicsview/flowlayout/main.cpp index 206f604..e672ae6 100644 --- a/examples/graphicsview/flowlayout/main.cpp +++ b/examples/graphicsview/flowlayout/main.cpp @@ -50,6 +50,7 @@ int main(int argc, char **argv) QGraphicsView *view = new QGraphicsView(&scene); Window *w = new Window; scene.addItem(w); + view->resize(400, 300); view->show(); return app.exec(); } diff --git a/examples/graphicsview/flowlayout/window.cpp b/examples/graphicsview/flowlayout/window.cpp index 2d98026..017659a 100644 --- a/examples/graphicsview/flowlayout/window.cpp +++ b/examples/graphicsview/flowlayout/window.cpp @@ -49,7 +49,7 @@ Window::Window() { FlowLayout *lay = new FlowLayout; QLatin1String wiseWords("I am not bothered by the fact that I am unknown." - "I am bothered when I do not know others. (Confucius)"); + " I am bothered when I do not know others. (Confucius)"); QString sentence(wiseWords); QStringList words = sentence.split(QLatin1Char(' '), QString::SkipEmptyParts); for (int i = 0; i < words.count(); ++i) { diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h index eeeac6f..594c4dd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h @@ -32,6 +32,7 @@ #include "MacroAssembler.h" #include "Opcode.h" #include "Structure.h" +#include "StructureChain.h" #include <wtf/VectorTraits.h> #define POLYMORPHIC_LIST_CACHE_SIZE 8 diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index ce5518f..711beb4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -521,7 +521,7 @@ PassRefPtr<LabelScope> BytecodeGenerator::newLabelScope(LabelScope::Type type, c m_labelScopes.removeLast(); // Allocate new label scope. - LabelScope scope(type, name, scopeDepth(), newLabel(), type == LabelScope::Loop ? newLabel() : PassRefPtr<Label>()); // Only loops have continue targets. + LabelScope scope(type, name, scopeDepth(), newLabel(), type == LabelScope::Loop ? newLabel() : PassRefPtr<Label>(0)); // Only loops have continue targets. m_labelScopes.append(scope); return &m_labelScopes.last(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp index 06ddefc..29a13ca 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp @@ -34,7 +34,7 @@ namespace JSC { RegisterFile::~RegisterFile() { #if HAVE(MMAP) - munmap(m_buffer, ((m_max - m_start) + m_maxGlobals) * sizeof(Register)); + munmap(reinterpret_cast<char*>(m_buffer), ((m_max - m_start) + m_maxGlobals) * sizeof(Register)); #elif HAVE(VIRTUALALLOC) VirtualFree(m_buffer, 0, MEM_RELEASE); #else diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h index 5a34d11..14e189e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h @@ -105,7 +105,7 @@ namespace JSC { ReturnValueRegister = -4, ArgumentCount = -3, Callee = -2, - OptionalCalleeArguments = -1, + OptionalCalleeArguments = -1 }; enum { ProgramCodeThisRegister = -CallFrameHeaderSize - 1 }; @@ -174,7 +174,7 @@ namespace JSC { size_t bufferLength = (capacity + maxGlobals) * sizeof(Register); #if HAVE(MMAP) - m_buffer = static_cast<Register*>(mmap(0, bufferLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, VM_TAG_FOR_REGISTERFILE_MEMORY, 0)); + m_buffer = reinterpret_cast<Register*>(mmap(0, bufferLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, VM_TAG_FOR_REGISTERFILE_MEMORY, 0)); if (m_buffer == MAP_FAILED) { #if PLATFORM(WINCE) fprintf(stderr, "Could not allocate register file: %d\n", GetLastError()); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index 4a33e67..dab6682 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -285,6 +285,10 @@ void JIT::emit_op_tear_off_arguments(Instruction*) void JIT::emit_op_ret(Instruction* currentInstruction) { +#ifdef QT_BUILD_SCRIPT_LIB + JITStubCall stubCall(this, JITStubs::cti_op_debug_return); + stubCall.call(); +#endif // We could JIT generate the deref, only calling out to C when the refcount hits zero. if (m_codeBlock->needsFullScopeChain()) JITStubCall(this, JITStubs::cti_op_ret_scopeChain).call(); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index f0d3b84..1d39ba4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -73,6 +73,19 @@ namespace JSC { #define SYMBOL_STRING(name) #name #endif +#if PLATFORM(DARWIN) + // Mach-O platform +#define HIDE_SYMBOL(name) ".private_extern _" #name +#elif PLATFORM(AIX) + // IBM's own file format +#define HIDE_SYMBOL(name) ".lglobl " #name +#elif PLATFORM(LINUX) || PLATFORM(FREEBSD) || PLATFORM(OPENBSD) || PLATFORM(SOLARIS) || (PLATFORM(HPUX) && PLATFORM(IA64)) || PLATFORM(SYMBIAN) || PLATFORM(NETBSD) + // ELF platform +#define HIDE_SYMBOL(name) ".hidden " #name +#else +#define HIDE_SYMBOL(name) +#endif + #if COMPILER(GCC) && PLATFORM(X86) // These ASSERTs remind you that, if you change the layout of JITStackFrame, you @@ -83,6 +96,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x1c, JITStackFrame_s asm volatile ( ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushl %ebp" "\n" "movl %esp, %ebp" "\n" @@ -103,6 +117,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" #if !USE(JIT_STUB_ARGUMENT_VA_LIST) "movl %esp, %ecx" "\n" @@ -118,6 +133,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addl $0x1c, %esp" "\n" "popl %ebx" "\n" @@ -141,6 +157,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x48, JITStackFrame_s asm volatile ( ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushq %rbp" "\n" "movq %rsp, %rbp" "\n" @@ -167,6 +184,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "movq %rsp, %rdi" "\n" "call " SYMBOL_STRING(cti_vm_throw) "\n" @@ -182,6 +200,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addq $0x48, %rsp" "\n" "popq %rbx" "\n" @@ -203,6 +222,7 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" ".thumb" "\n" ".thumb_func " SYMBOL_STRING(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" @@ -229,6 +249,7 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" ".thumb" "\n" ".thumb_func " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" @@ -246,6 +267,7 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" ".thumb" "\n" ".thumb_func " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" @@ -591,6 +613,7 @@ namespace JITStubs { ".text" "\n" \ ".align 2" "\n" \ ".globl " SYMBOL_STRING(cti_##op) "\n" \ + HIDE_SYMBOL(cti_##op) "\n" \ ".thumb" "\n" \ ".thumb_func " SYMBOL_STRING(cti_##op) "\n" \ SYMBOL_STRING(cti_##op) ":" "\n" \ @@ -2727,6 +2750,16 @@ DEFINE_STUB_FUNCTION(void, op_debug_catch) debugger->exceptionCatch(DebuggerCallFrame(callFrame), callFrame->codeBlock()->ownerNode()->sourceID()); } } + +DEFINE_STUB_FUNCTION(void, op_debug_return) +{ + STUB_INIT_STACK_FRAME(stackFrame); + CallFrame* callFrame = stackFrame.callFrame; + if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) { + debugger->functionExit(JSValue(), callFrame->codeBlock()->ownerNode()->sourceID()); + } +} + #endif DEFINE_STUB_FUNCTION(EncodedJSValue, vm_throw) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h index 60bf64a..325c3fd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h @@ -223,6 +223,7 @@ namespace JITStubs { extern "C" { void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION); #ifdef QT_BUILD_SCRIPT_LIB void JIT_STUB cti_op_debug_catch(STUB_ARGS_DECLARATION); + void JIT_STUB cti_op_debug_return(STUB_ARGS_DECLARATION); #endif void JIT_STUB cti_op_end(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_jmp_scopes(STUB_ARGS_DECLARATION); diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h b/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h index c256190..a4374d3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h +++ b/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h @@ -27,23 +27,6 @@ namespace JSC { - inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData) - { - ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size)); - globalData->parser->arena().deleteWithArena(deletable); - return deletable; - } - - inline void* ParserArenaDeletable::operator new(size_t size) - { - return fastMalloc(size); - } - - inline void ParserArenaDeletable::operator delete(void* p) - { - fastFree(p); - } - inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData) { globalData->parser->arena().derefWithArena(adoptRef(this)); diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp index 2617506..78c5196 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp @@ -24,6 +24,7 @@ */ #include "config.h" +#include "Parser.h" #include "ParserArena.h" #include "Nodes.h" @@ -57,4 +58,21 @@ void ParserArena::reset() m_refCountedObjects.shrink(0); } +void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData) +{ + ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size)); + globalData->parser->arena().deleteWithArena(deletable); + return deletable; +} + +void* ParserArenaDeletable::operator new(size_t size) +{ + return fastMalloc(size); +} + +void ParserArenaDeletable::operator delete(void* p) +{ + fastFree(p); +} + } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index dddd83d..1268d3d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -506,6 +506,49 @@ static void* getStackBase(void* previousFrame) } } #endif +#if PLATFORM(HPUX) +struct hpux_get_stack_base_data +{ + pthread_t thread; + _pthread_stack_info info; +}; + +static void *hpux_get_stack_base_internal(void *d) +{ + hpux_get_stack_base_data *data = static_cast<hpux_get_stack_base_data *>(d); + + // _pthread_stack_info_np requires the target thread to be suspended + // in order to get information about it + pthread_suspend(data->thread); + + // _pthread_stack_info_np returns an errno code in case of failure + // or zero on success + if (_pthread_stack_info_np(data->thread, &data->info)) { + // failed + return 0; + } + + pthread_continue(data->thread); + return data; +} + +static void *hpux_get_stack_base() +{ + hpux_get_stack_base_data data; + data.thread = pthread_self(); + + // We cannot get the stack information for the current thread + // So we start a new thread to get that information and return it to us + pthread_t other; + pthread_create(&other, 0, hpux_get_stack_base_internal, &data); + + void *result; + pthread_join(other, &result); + if (result) + return data.info.stk_stack_base; + return 0; +} +#endif static inline void* currentThreadStackBase() { @@ -532,10 +575,24 @@ static inline void* currentThreadStackBase() : "=r" (pTib) ); return static_cast<void*>(pTib->StackBase); +#elif PLATFORM(HPUX) + return hpux_get_stack_base(); #elif PLATFORM(SOLARIS) stack_t s; thr_stksegment(&s); return s.ss_sp; +#elif PLATFORM(AIX) + pthread_t thread = pthread_self(); + struct __pthrdsinfo threadinfo; + char regbuf[256]; + int regbufsize = sizeof regbuf; + + if (pthread_getthrds_np(&thread, PTHRDSINFO_QUERY_ALL, + &threadinfo, sizeof threadinfo, + ®buf, ®bufsize) == 0) + return threadinfo.__pi_stackaddr; + + return 0; #elif PLATFORM(OPENBSD) pthread_t thread = pthread_self(); stack_t stack; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h index dc11fee..98e9b68 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h @@ -27,6 +27,7 @@ #include "NativeFunctionWrapper.h" #include "NumberPrototype.h" #include "StringPrototype.h" +#include "StructureChain.h" #include <wtf/HashSet.h> #include <wtf/OwnPtr.h> diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h index b4382f4..67ee9c8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h @@ -24,6 +24,7 @@ #include "CallFrame.h" #include "Identifier.h" #include "Structure.h" +#include "StructureChain.h" #include <wtf/HashSet.h> #include <wtf/Vector.h> diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h index 224164d..6e7984c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h @@ -98,7 +98,7 @@ namespace JSC { JSValue get() const { return m_value; } operator JSValue() const { return m_value; } - JSValue operator->() const { return m_value; } + //JSValue operator->() const { return m_value; } operator bool() const { return m_value; } bool operator!() const { return !m_value; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp index 9f6b0c3..38c086e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp @@ -160,7 +160,7 @@ Structure::~Structure() m_previous->m_transitions.singleTransition = 0; } else { ASSERT(m_previous->m_transitions.table->contains(make_pair(m_nameInPrevious.get(), make_pair(m_attributesInPrevious, m_specificValueInPrevious)))); - m_previous->m_transitions.table->remove(make_pair(m_nameInPrevious.get(), make_pair(m_attributesInPrevious, m_specificValueInPrevious))); + m_previous->m_transitions.table->remove(make_pair<RefPtr<UString::Rep>, std::pair<unsigned,JSCell*> >(m_nameInPrevious.get(), make_pair(m_attributesInPrevious, m_specificValueInPrevious))); } } @@ -394,7 +394,7 @@ PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Struct return existingTransition; } } else { - if (Structure* existingTransition = structure->m_transitions.table->get(make_pair(propertyName.ustring().rep(), make_pair(attributes, specificValue)))) { + if (Structure* existingTransition = structure->m_transitions.table->get(make_pair<RefPtr<UString::Rep>, std::pair<unsigned, JSCell*> >(propertyName.ustring().rep(), make_pair(attributes, specificValue)))) { ASSERT(existingTransition->m_offset != noOffset); offset = existingTransition->m_offset; return existingTransition; @@ -459,9 +459,9 @@ PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, con structure->m_usingSingleTransitionSlot = false; StructureTransitionTable* transitionTable = new StructureTransitionTable; structure->m_transitions.table = transitionTable; - transitionTable->add(make_pair(existingTransition->m_nameInPrevious.get(), make_pair(existingTransition->m_attributesInPrevious, existingTransition->m_specificValueInPrevious)), existingTransition); + transitionTable->add(make_pair<RefPtr<UString::Rep>, std::pair<unsigned, JSCell*> >(existingTransition->m_nameInPrevious.get(), make_pair(existingTransition->m_attributesInPrevious, existingTransition->m_specificValueInPrevious)), existingTransition); } - structure->m_transitions.table->add(make_pair(propertyName.ustring().rep(), make_pair(attributes, specificValue)), transition.get()); + structure->m_transitions.table->add(make_pair<RefPtr<UString::Rep>, std::pair<unsigned, JSCell*> >(propertyName.ustring().rep(), make_pair(attributes, specificValue)), transition.get()); return transition.release(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h index 0de03a3..dcd4e50 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h @@ -30,7 +30,6 @@ #include "JSType.h" #include "JSValue.h" #include "PropertyMapHashTable.h" -#include "StructureChain.h" #include "StructureTransitionTable.h" #include "TypeInfo.h" #include "UString.h" @@ -47,6 +46,7 @@ namespace JSC { class PropertyNameArray; class PropertyNameArrayData; + class StructureChain; class Structure : public RefCounted<Structure> { public: diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp index 85049b1..acebc86 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "StructureChain.h" +#include "Structure.h" #include "JSObject.h" #include "Structure.h" @@ -46,6 +47,11 @@ StructureChain::StructureChain(Structure* head) m_vector[i] = 0; } +PassRefPtr<StructureChain> StructureChain::create(Structure* head) +{ + return adoptRef(new StructureChain(head)); +} + bool StructureChain::isCacheable() const { uint32_t i = 0; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h index c48749d..5990e17 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h @@ -37,7 +37,7 @@ namespace JSC { class StructureChain : public RefCounted<StructureChain> { public: - static PassRefPtr<StructureChain> create(Structure* head) { return adoptRef(new StructureChain(head)); } + static PassRefPtr<StructureChain> create(Structure* head); RefPtr<Structure>* head() { return m_vector.get(); } bool isCacheable() const; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h index 3de5ee6..8ff9170 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h @@ -178,7 +178,10 @@ namespace WTF { HashMap<T, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) { typedef HashMapTranslator<ValueType, ValueTraits, HashFunctions> TranslatorType; - return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); + pair<typename HashTableType::iterator, bool> p = m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); + typename HashMap<T, U, V, W, X>::iterator temp = p.first; + return make_pair<typename HashMap<T, U, V, W, X>::iterator, bool>(temp, p.second); +// return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h index 990670d..ec809e5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h @@ -204,7 +204,12 @@ namespace WTF { template<typename T, typename U, typename V> pair<typename HashSet<T, U, V>::iterator, bool> HashSet<T, U, V>::add(const ValueType& value) { - return m_impl.add(value); + pair<typename HashTable<T, T, IdentityExtractor<T>, U, V, V>::iterator, bool> p = m_impl.add(value); + typename HashSet<T, U, V>::iterator temp = p.first; + pair<typename HashSet<T, U, V>::iterator, bool> p2 = make_pair<typename HashSet<T, U, V>::iterator, bool>(temp, p.second); + // p2.first = p.first; + // p2.second = p.second; + return p2; } template<typename Value, typename HashFunctions, typename Traits> @@ -213,7 +218,8 @@ namespace WTF { HashSet<Value, HashFunctions, Traits>::add(const T& value) { typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter; - return m_impl.template addPassingHashCode<T, T, Adapter>(value, value); + pair<typename HashTableType::iterator, bool> p = m_impl.template addPassingHashCode<T, T, Adapter>(value, value); + return make_pair<iterator, bool>(p.first, p.second); } template<typename T, typename U, typename V> diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h index 01ce804..b8305b5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h @@ -34,7 +34,9 @@ namespace WTF { class Mutex; -typedef void MainThreadFunction(void*); +extern "C" { + typedef void MainThreadFunction(void*); +} void callOnMainThread(MainThreadFunction*, void* context); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h index 12291cc..070b76c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h @@ -41,7 +41,7 @@ namespace WTF { enum MessageQueueWaitResult { MessageQueueTerminated, // Queue was destroyed while waiting for message. MessageQueueTimeout, // Timeout was specified and it expired. - MessageQueueMessageReceived, // A message was successfully received and returned. + MessageQueueMessageReceived // A message was successfully received and returned. }; template<typename DataType> diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index e531a63..fa37d55 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -106,6 +106,9 @@ /* regardless of operating environment */ #if defined(hpux) || defined(__hpux) #define WTF_PLATFORM_HPUX 1 +#ifndef MAP_ANON +#define MAP_ANON MAP_ANONYMOUS +#endif #endif #if defined (__SYMBIAN32__) @@ -301,6 +304,30 @@ #define WTF_PLATFORM_BIG_ENDIAN 1 #endif +/* PLATFORM(HPPA) */ +/* a.k.a. PA-RISC */ +#if defined(__hppa) || defined(__hppa__) +#define WTF_PLATFORM_HPPA 1 +#define WTF_PLATFORM_BIG_ENDIAN 1 +#endif + +/* PLATFORM(IA64) */ +/* a.k.a. Itanium Processor Family, IPF */ +#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) +#define WTF_PLATFORM_IA64 1 + +/* Itanium can be both big- and little-endian + we need to determine at compile time which one it is. + - HP's aCC compiler only compiles big-endian (so HP-UXi is always big-endian) + - GCC defines __BIG_ENDIAN__ for us (default on HP-UX) + - Linux is usually little-endian + - I've never seen AIX or Windows on IA-64, but they should be little-endian too +*/ +#if defined(__BIG_ENDIAN__) || defined(__HP_aCC) +# define WTF_PLATFORM_BIG_ENDIAN 1 +#endif +#endif + /* PLATFORM(WINCE) && PLATFORM(QT) We can not determine the endianess at compile time. For Qt for Windows CE the endianess is specified in the @@ -474,7 +501,7 @@ #endif #if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \ - && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) + && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(AIX) && !PLATFORM(HPUX) #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 #define HAVE_TIMEGM 1 diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h index 1cbebb4..b3ccd3a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h @@ -42,7 +42,7 @@ namespace WTF { }; template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> - class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> { + class RefPtrHashMap { private: typedef KeyTraitsArg KeyTraits; typedef MappedTraitsArg MappedTraits; @@ -67,7 +67,7 @@ namespace WTF { typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator; typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator; - void swap(HashMap&); + void swap(RefPtrHashMap&); int size() const; int capacity() const; @@ -115,109 +115,123 @@ namespace WTF { HashTableType m_impl; }; + template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> + class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> : + public RefPtrHashMap<T, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> + { + }; template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::swap(HashMap& other) + inline void RefPtrHashMap<T, U, V, W, X>::swap(RefPtrHashMap& other) { m_impl.swap(other.m_impl); } template<typename T, typename U, typename V, typename W, typename X> - inline int HashMap<RefPtr<T>, U, V, W, X>::size() const + inline int RefPtrHashMap<T, U, V, W, X>::size() const { return m_impl.size(); } template<typename T, typename U, typename V, typename W, typename X> - inline int HashMap<RefPtr<T>, U, V, W, X>::capacity() const + inline int RefPtrHashMap<T, U, V, W, X>::capacity() const { return m_impl.capacity(); } template<typename T, typename U, typename V, typename W, typename X> - inline bool HashMap<RefPtr<T>, U, V, W, X>::isEmpty() const + inline bool RefPtrHashMap<T, U, V, W, X>::isEmpty() const { return m_impl.isEmpty(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::begin() + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::begin() { return m_impl.begin(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::end() + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::end() { return m_impl.end(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::begin() const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::begin() const { return m_impl.begin(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::end() const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::end() const { return m_impl.end(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::find(const KeyType& key) { return m_impl.find(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::find(RawKeyType key) { return m_impl.template find<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::find(const KeyType& key) const { return m_impl.find(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::find(RawKeyType key) const { return m_impl.template find<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(const KeyType& key) const + inline bool RefPtrHashMap<T, U, V, W, X>::contains(const KeyType& key) const { return m_impl.contains(key); } template<typename T, typename U, typename V, typename W, typename X> - inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(RawKeyType key) const + inline bool RefPtrHashMap<T, U, V, W, X>::contains(RawKeyType key) const { return m_impl.template contains<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) + inline pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) { typedef HashMapTranslator<ValueType, ValueTraits, HashFunctions> TranslatorType; - return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); + pair<typename HashTableType::iterator, bool> p = m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); +// typename RefPtrHashMap<T, U, V, W, X>::iterator temp = p.first; + return make_pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool>( + typename RefPtrHashMap<T, U, V, W, X>::iterator(p.first), p.second); + +// return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(RawKeyType key, const MappedType& mapped) + inline pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::inlineAdd(RawKeyType key, const MappedType& mapped) { - return m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); + pair<typename HashTableType::iterator, bool> p = m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); + return make_pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool>( + typename RefPtrHashMap<T, U, V, W, X>::iterator(p.first), p.second); + + // return m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::set(const KeyType& key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::set(const KeyType& key, const MappedType& mapped) { pair<iterator, bool> result = inlineAdd(key, mapped); if (!result.second) { @@ -228,8 +242,8 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::set(RawKeyType key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::set(RawKeyType key, const MappedType& mapped) { pair<iterator, bool> result = inlineAdd(key, mapped); if (!result.second) { @@ -240,22 +254,22 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::add(const KeyType& key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::add(const KeyType& key, const MappedType& mapped) { return inlineAdd(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::add(RawKeyType key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::add(RawKeyType key, const MappedType& mapped) { return inlineAdd(key, mapped); } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(const KeyType& key) const + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::get(const KeyType& key) const { ValueType* entry = const_cast<HashTableType&>(m_impl).lookup(key); if (!entry) @@ -264,8 +278,8 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - inline HashMap<RefPtr<T>, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + inline RefPtrHashMap<T, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const { ValueType* entry = const_cast<HashTableType&>(m_impl).template lookup<RawKeyType, RawKeyTranslator>(key); if (!entry) @@ -274,14 +288,14 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(RawKeyType key) const + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::get(RawKeyType key) const { return inlineGet(key); } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::remove(iterator it) + inline void RefPtrHashMap<T, U, V, W, X>::remove(iterator it) { if (it.m_impl == m_impl.end()) return; @@ -290,45 +304,45 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::remove(const KeyType& key) + inline void RefPtrHashMap<T, U, V, W, X>::remove(const KeyType& key) { remove(find(key)); } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::remove(RawKeyType key) + inline void RefPtrHashMap<T, U, V, W, X>::remove(RawKeyType key) { remove(find(key)); } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::clear() + inline void RefPtrHashMap<T, U, V, W, X>::clear() { m_impl.clear(); } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(const KeyType& key) + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::take(const KeyType& key) { // This can probably be made more efficient to avoid ref/deref churn. iterator it = find(key); if (it == end()) return MappedTraits::emptyValue(); - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second; + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType result = it->second; remove(it); return result; } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(RawKeyType key) + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::take(RawKeyType key) { // This can probably be made more efficient to avoid ref/deref churn. iterator it = find(key); if (it == end()) return MappedTraits::emptyValue(); - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second; + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType result = it->second; remove(it); return result; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h index 6ce6a3e..56659a8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h @@ -70,30 +70,30 @@ namespace WTF { template <> struct IsPod<long double> { static const bool value = true; }; template <typename P> struct IsPod<P*> { static const bool value = true; }; - template<typename T> class IsConvertibleToInteger { - // Avoid "possible loss of data" warning when using Microsoft's C++ compiler - // by not converting int's to doubles. - template<bool performCheck, typename U> class IsConvertibleToDouble; - template<typename U> class IsConvertibleToDouble<false, U> { - public: - static const bool value = false; - }; + // Avoid "possible loss of data" warning when using Microsoft's C++ compiler + // by not converting int's to doubles. + template<bool performCheck, typename U> class CheckedIsConvertibleToDouble; + template<typename U> class CheckedIsConvertibleToDouble<false, U> { + public: + static const bool value = false; + }; - template<typename U> class IsConvertibleToDouble<true, U> { - typedef char YesType; - struct NoType { - char padding[8]; - }; - - static YesType floatCheck(long double); - static NoType floatCheck(...); - static T& t; - public: - static const bool value = sizeof(floatCheck(t)) == sizeof(YesType); + template<typename U> class CheckedIsConvertibleToDouble<true, U> { + typedef char YesType; + struct NoType { + char padding[8]; }; + static YesType floatCheck(long double); + static NoType floatCheck(...); + static U& t; + public: + static const bool value = sizeof(floatCheck(t)) == sizeof(YesType); + }; + + template<typename T> class IsConvertibleToInteger { public: - static const bool value = IsInteger<T>::value || IsConvertibleToDouble<!IsInteger<T>::value, T>::value; + static const bool value = IsInteger<T>::value || CheckedIsConvertibleToDouble<!IsInteger<T>::value, T>::value; }; template <typename T, typename U> struct IsSameType { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h index e3cb718..7decc4a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h @@ -67,10 +67,11 @@ namespace WTF { template <size_t size, size_t> struct AlignedBuffer { AlignedBufferChar oversizebuffer[size + 64]; - AlignedBufferChar *buffer; - inline AlignedBuffer() : buffer(oversizebuffer) + AlignedBufferChar *buffer() { - buffer += 64 - (reinterpret_cast<size_t>(buffer) & 0x3f); + AlignedBufferChar *ptr = oversizebuffer; + ptr += 64 - (reinterpret_cast<size_t>(ptr) & 0x3f); + return ptr; } }; #endif @@ -128,7 +129,7 @@ namespace WTF { template<typename T> struct VectorMover<false, T> { - static void move(const T* src, const T* srcEnd, T* dst) + static void move(T* src, const T* srcEnd, T* dst) { while (src != srcEnd) { new (dst) T(*src); @@ -137,7 +138,7 @@ namespace WTF { ++src; } } - static void moveOverlapping(const T* src, const T* srcEnd, T* dst) + static void moveOverlapping(T* src, const T* srcEnd, T* dst) { if (src > dst) move(src, srcEnd, dst); @@ -156,11 +157,11 @@ namespace WTF { template<typename T> struct VectorMover<true, T> { - static void move(const T* src, const T* srcEnd, T* dst) + static void move(T* src, const T* srcEnd, T* dst) { memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src)); } - static void moveOverlapping(const T* src, const T* srcEnd, T* dst) + static void moveOverlapping(T* src, const T* srcEnd, T* dst) { memmove(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src)); } @@ -253,12 +254,12 @@ namespace WTF { VectorInitializer<VectorTraits<T>::needsInitialization, VectorTraits<T>::canInitializeWithMemset, T>::initialize(begin, end); } - static void move(const T* src, const T* srcEnd, T* dst) + static void move(T* src, const T* srcEnd, T* dst) { VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::move(src, srcEnd, dst); } - static void moveOverlapping(const T* src, const T* srcEnd, T* dst) + static void moveOverlapping(T* src, const T* srcEnd, T* dst) { VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::moveOverlapping(src, srcEnd, dst); } @@ -440,7 +441,11 @@ namespace WTF { using Base::m_capacity; static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T); + #ifdef WTF_ALIGNED T* inlineBuffer() { return reinterpret_cast<T*>(m_inlineBuffer.buffer); } + #else + T* inlineBuffer() { return reinterpret_cast<T*>(m_inlineBuffer.buffer()); } + #endif AlignedBuffer<m_inlineBufferSize, WTF_ALIGN_OF(T)> m_inlineBuffer; }; diff --git a/src/3rdparty/webkit/WebCore/bridge/npapi.h b/src/3rdparty/webkit/WebCore/bridge/npapi.h index 07fed86..2ff657e 100644 --- a/src/3rdparty/webkit/WebCore/bridge/npapi.h +++ b/src/3rdparty/webkit/WebCore/bridge/npapi.h @@ -350,9 +350,10 @@ typedef enum { NPPVpluginWantsAllNetworkStreams = 18, /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ - NPPVpluginCancelSrcStream = 20, + NPPVpluginCancelSrcStream = 20 #ifdef XP_MACOSX + , /* Used for negotiating drawing models */ NPPVpluginDrawingModel = 1000, /* Used for negotiating event models */ diff --git a/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h b/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h index 58b18e2..08bffa6 100644 --- a/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h +++ b/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h @@ -57,7 +57,7 @@ namespace WebCore { NETWORK_ERR = 19, ABORT_ERR = 20, URL_MISMATCH_ERR = 21, - QUOTA_EXCEEDED_ERR = 22, + QUOTA_EXCEEDED_ERR = 22 }; enum ExceptionType { diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h index 3f8febc..f95f0045 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h +++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h @@ -45,7 +45,7 @@ namespace WebCore { enum MessageDestination { InspectorControllerDestination, - ConsoleDestination, + ConsoleDestination }; class ScriptExecutionContext { diff --git a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp index 9737e92..dcb3326 100644 --- a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp @@ -795,7 +795,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap // FIXME: This is an inefficient way to preserve style on nodes in the paragraph to move. It // shouldn't matter though, since moved paragraphs will usually be quite small. - RefPtr<DocumentFragment> fragment = startOfParagraphToMove != endOfParagraphToMove ? createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotAnnotateForInterchange, true), "") : 0; + RefPtr<DocumentFragment> fragment = startOfParagraphToMove != endOfParagraphToMove ? createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotAnnotateForInterchange, true), "") : PassRefPtr<DocumentFragment>(0); // A non-empty paragraph's style is moved when we copy and move it. We don't move // anything if we're given an empty paragraph, but an empty paragraph can have style diff --git a/src/3rdparty/webkit/WebCore/editing/EditorInsertAction.h b/src/3rdparty/webkit/WebCore/editing/EditorInsertAction.h index 5b732dc..b8b137d 100644 --- a/src/3rdparty/webkit/WebCore/editing/EditorInsertAction.h +++ b/src/3rdparty/webkit/WebCore/editing/EditorInsertAction.h @@ -32,7 +32,7 @@ namespace WebCore { enum EditorInsertAction { EditorInsertActionTyped, EditorInsertActionPasted, - EditorInsertActionDropped, + EditorInsertActionDropped }; } // namespace diff --git a/src/3rdparty/webkit/WebCore/editing/markup.cpp b/src/3rdparty/webkit/WebCore/editing/markup.cpp index 6b6d326..1c737a0 100644 --- a/src/3rdparty/webkit/WebCore/editing/markup.cpp +++ b/src/3rdparty/webkit/WebCore/editing/markup.cpp @@ -970,7 +970,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc Node* body = enclosingNodeWithTag(Position(commonAncestor, 0), bodyTag); // FIXME: Do this for all fully selected blocks, not just the body. Node* fullySelectedRoot = body && *VisibleSelection::selectionFromContentsOfNode(body).toNormalizedRange() == *updatedRange ? body : 0; - RefPtr<CSSMutableStyleDeclaration> fullySelectedRootStyle = fullySelectedRoot ? styleFromMatchedRulesAndInlineDecl(fullySelectedRoot) : 0; + RefPtr<CSSMutableStyleDeclaration> fullySelectedRootStyle = fullySelectedRoot ? styleFromMatchedRulesAndInlineDecl(fullySelectedRoot) : PassRefPtr<CSSMutableStyleDeclaration>(0); if (annotate && fullySelectedRoot) { if (shouldIncludeWrapperForFullySelectedRoot(fullySelectedRoot, fullySelectedRootStyle.get())) specialCommonAncestor = fullySelectedRoot; diff --git a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h index cc3627d..fdd854c 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h +++ b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h @@ -275,7 +275,7 @@ enum CSSPropertyID { CSSPropertyGlyphOrientationVertical = 1268, CSSPropertyKerning = 1269, CSSPropertyTextAnchor = 1270, - CSSPropertyWritingMode = 1271, + CSSPropertyWritingMode = 1271 }; const int firstCSSProperty = 1001; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp index 722f4e2..928a1bf 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp @@ -137,7 +137,7 @@ HTMLParser::HTMLParser(HTMLDocument* doc, bool reportErrors) , m_reportErrors(reportErrors) , m_handlingResidualStyleAcrossBlocks(false) , m_inStrayTableContent(0) - , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : 0) + , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : PassOwnPtr<HTMLParserQuirks>(0)) { } @@ -155,7 +155,7 @@ HTMLParser::HTMLParser(DocumentFragment* frag) , m_reportErrors(false) , m_handlingResidualStyleAcrossBlocks(false) , m_inStrayTableContent(0) - , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : 0) + , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : PassOwnPtr<HTMLParserQuirks>(0)) { if (frag) frag->ref(); diff --git a/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp index 87cb725..812d17b 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp @@ -519,7 +519,7 @@ ArchiveResource* DocumentLoader::archiveResourceForURL(const KURL& url) const PassRefPtr<Archive> DocumentLoader::popArchiveForSubframe(const String& frameName) { - return m_archiveResourceCollection ? m_archiveResourceCollection->popSubframeArchive(frameName) : 0; + return m_archiveResourceCollection ? m_archiveResourceCollection->popSubframeArchive(frameName) : PassRefPtr<Archive>(0); } void DocumentLoader::clearArchiveResources() diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h index 58bf2c0..c41e491 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h @@ -355,7 +355,7 @@ namespace WebCore { enum LocalLoadPolicy { AllowLocalLoadsForAll, // No restriction on local loads. AllowLocalLoadsForLocalAndSubstituteData, - AllowLocalLoadsForLocalOnly, + AllowLocalLoadsForLocalOnly }; static void setLocalLoadPolicy(LocalLoadPolicy); static bool restrictAccessToLocal(); diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h b/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h index c264b47..b3823ba 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h @@ -42,7 +42,7 @@ namespace WebCore { enum PolicyAction { PolicyUse, PolicyDownload, - PolicyIgnore, + PolicyIgnore }; enum FrameLoadType { diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp index dc73353..fd6a8b4 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -772,7 +772,7 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() ASSERT(cacheStorage().isMaximumSizeReached() && m_calledReachedMaxAppCacheSize); } - RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? 0 : m_newestCache; + RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? RefPtr<ApplicationCache>(0) : m_newestCache; setNewestCache(m_cacheBeingUpdated.release()); if (cacheStorage().storeNewestCache(this)) { diff --git a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp index 1322dbb..753c3c3 100644 --- a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp +++ b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp @@ -75,7 +75,7 @@ bool ArchiveFactory::isArchiveMimeType(const String& mimeType) PassRefPtr<Archive> ArchiveFactory::create(SharedBuffer* data, const String& mimeType) { RawDataCreationFunction* function = archiveMIMETypes().get(mimeType); - return function ? function(data) : 0; + return function ? function(data) : PassRefPtr<Archive>(0); } void ArchiveFactory::registerKnownArchiveMIMETypes() diff --git a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.cpp b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.cpp index 691f66a..b6317da 100644 --- a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.cpp +++ b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.cpp @@ -35,17 +35,17 @@ namespace WebCore { PassRefPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const ResourceResponse& response) { - return data ? adoptRef(new ArchiveResource(data, url, response)) : 0; + return data ? adoptRef(new ArchiveResource(data, url, response)) : PassRefPtr<ArchiveResource>(0); } PassRefPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const String& mimeType, const String& textEncoding, const String& frameName) { - return data ? adoptRef(new ArchiveResource(data, url, mimeType, textEncoding, frameName)) : 0; + return data ? adoptRef(new ArchiveResource(data, url, mimeType, textEncoding, frameName)) : PassRefPtr<ArchiveResource>(0); } PassRefPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse& resourceResponse) { - return data ? adoptRef(new ArchiveResource(data, url, mimeType, textEncoding, frameName, resourceResponse)) : 0; + return data ? adoptRef(new ArchiveResource(data, url, mimeType, textEncoding, frameName, resourceResponse)) : PassRefPtr<ArchiveResource>(0); } ArchiveResource::ArchiveResource(PassRefPtr<SharedBuffer> data, const KURL& url, const ResourceResponse& response) diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp index b78291d..7201661 100644 --- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp +++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp @@ -511,7 +511,7 @@ void IconDatabase::setIconDataForIconURL(PassRefPtr<SharedBuffer> dataOriginal, if (!isOpen() || iconURLOriginal.isEmpty()) return; - RefPtr<SharedBuffer> data = dataOriginal ? dataOriginal->copy() : 0; + RefPtr<SharedBuffer> data = dataOriginal ? dataOriginal->copy() : PassRefPtr<SharedBuffer>(0); String iconURL = iconURLOriginal.copy(); Vector<String> pageURLs; diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp index e8f9004..c54aab2 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp @@ -582,7 +582,7 @@ Storage* DOMWindow::localStorage() const return 0; StorageNamespace* localStorage = page->group().localStorage(); - RefPtr<StorageArea> storageArea = localStorage ? localStorage->storageArea(document->securityOrigin()) : 0; + RefPtr<StorageArea> storageArea = localStorage ? localStorage->storageArea(document->securityOrigin()) : PassRefPtr<StorageArea>(0); if (storageArea) { page->inspectorController()->didUseDOMStorage(storageArea.get(), true, m_frame); m_localStorage = Storage::create(m_frame, storageArea.release()); diff --git a/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp b/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp index dad763c..8769a59 100644 --- a/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp +++ b/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp @@ -144,7 +144,7 @@ static inline TransformOperations blendFunc(const AnimationBase* anim, const Tra for (unsigned i = 0; i < size; i++) { RefPtr<TransformOperation> fromOp = (i < fromSize) ? from.operations()[i].get() : 0; RefPtr<TransformOperation> toOp = (i < toSize) ? to.operations()[i].get() : 0; - RefPtr<TransformOperation> blendedOp = toOp ? toOp->blend(fromOp.get(), progress) : (fromOp ? fromOp->blend(0, progress, true) : 0); + RefPtr<TransformOperation> blendedOp = toOp ? toOp->blend(fromOp.get(), progress) : (fromOp ? fromOp->blend(0, progress, true) : PassRefPtr<TransformOperation>(0)); if (blendedOp) result.operations().append(blendedOp); else { diff --git a/src/3rdparty/webkit/WebCore/platform/PlatformKeyboardEvent.h b/src/3rdparty/webkit/WebCore/platform/PlatformKeyboardEvent.h index 4a6bc9e..d9701b7 100644 --- a/src/3rdparty/webkit/WebCore/platform/PlatformKeyboardEvent.h +++ b/src/3rdparty/webkit/WebCore/platform/PlatformKeyboardEvent.h @@ -81,7 +81,7 @@ namespace WebCore { AltKey = 1 << 0, CtrlKey = 1 << 1, MetaKey = 1 << 2, - ShiftKey = 1 << 3, + ShiftKey = 1 << 3 }; Type type() const { return m_type; } diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollTypes.h b/src/3rdparty/webkit/WebCore/platform/ScrollTypes.h index eba9055..b0df470 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollTypes.h +++ b/src/3rdparty/webkit/WebCore/platform/ScrollTypes.h @@ -53,7 +53,7 @@ namespace WebCore { enum ScrollbarControlStateMask { ActiveScrollbarState = 1, EnabledScrollbarState = 1 << 1, - PressedScrollbarState = 1 << 2, + PressedScrollbarState = 1 << 2 }; enum ScrollbarPart { @@ -67,7 +67,7 @@ namespace WebCore { ForwardButtonEndPart = 1 << 6, ScrollbarBGPart = 1 << 7, TrackBGPart = 1 << 8, - AllParts = 0xffffffff, + AllParts = 0xffffffff }; enum ScrollbarButtonsPlacement { diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h index 8b770a1..a3a0493 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h @@ -150,7 +150,7 @@ protected: enum RepetitionCountStatus { Unknown, // We haven't checked the source's repetition count. Uncertain, // We have a repetition count, but it might be wrong (some GIFs have a count after the image data, and will report "loop once" until all data has been decoded). - Certain, // The repetition count is known to be correct. + Certain // The repetition count is known to be correct. }; BitmapImage(NativeImagePtr, ImageObserver* = 0); diff --git a/src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.h b/src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.h index 9c2a9d7..494e2bb 100644 --- a/src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.h +++ b/src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.h @@ -52,7 +52,7 @@ namespace WebCore { DisposeNotSpecified, // Leave frame in framebuffer DisposeKeep, // Leave frame in framebuffer DisposeOverwriteBgcolor, // Clear frame to transparent - DisposeOverwritePrevious, // Clear frame to previous framebuffer contents + DisposeOverwritePrevious // Clear frame to previous framebuffer contents }; #if PLATFORM(SKIA) typedef uint32_t PixelData; diff --git a/src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.h b/src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.h index 9a73cff..b7d4574 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.h +++ b/src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.h @@ -46,7 +46,7 @@ enum ProtectionSpaceAuthenticationScheme { ProtectionSpaceAuthenticationSchemeHTTPDigest = 3, ProtectionSpaceAuthenticationSchemeHTMLForm = 4, ProtectionSpaceAuthenticationSchemeNTLM = 5, - ProtectionSpaceAuthenticationSchemeNegotiate = 6, + ProtectionSpaceAuthenticationSchemeNegotiate = 6 }; class ProtectionSpace { diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleClient.h b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleClient.h index c99be54..b8a8cbb 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleClient.h +++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceHandleClient.h @@ -56,7 +56,7 @@ namespace WebCore { enum CacheStoragePolicy { StorageAllowed, StorageAllowedInMemoryOnly, - StorageNotAllowed, + StorageNotAllowed }; class ResourceHandleClient { diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h b/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h index 2d87d6e..740ebed 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h +++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h @@ -41,7 +41,7 @@ namespace WebCore { UseProtocolCachePolicy, // normal load ReloadIgnoringCacheData, // reload ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data - ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache + ReturnCacheDataDontLoad // results of a post - allow stale data and only use cache }; const int unspecifiedTimeoutInterval = INT_MAX; diff --git a/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h b/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h index 38439ed..4325925 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h +++ b/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h @@ -199,7 +199,7 @@ private: enum StringImplFlags { HasTerminatingNullCharacter, - InTable, + InTable }; unsigned m_length; diff --git a/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h b/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h index 3c74165..36d7c6e 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h +++ b/src/3rdparty/webkit/WebCore/platform/text/TextCodec.h @@ -51,7 +51,7 @@ namespace WebCore { // Encodes the character as en entity as above, but escaped // non-alphanumeric characters. This is used in URLs. // For example, U+6DE would be "%26%231758%3B". - URLEncodedEntitiesForUnencodables, + URLEncodedEntitiesForUnencodables }; typedef char UnencodableReplacementArray[32]; diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginQuirkSet.h b/src/3rdparty/webkit/WebCore/plugins/PluginQuirkSet.h index b652c6e..8183050 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginQuirkSet.h +++ b/src/3rdparty/webkit/WebCore/plugins/PluginQuirkSet.h @@ -45,7 +45,7 @@ namespace WebCore { PluginQuirkDontClipToZeroRectWhenScrolling = 1 << 9, PluginQuirkDontSetNullWindowHandleOnDestroy = 1 << 10, PluginQuirkDontAllowMultipleInstances = 1 << 11, - PluginQuirkRequiresGtkToolKit = 1 << 12, + PluginQuirkRequiresGtkToolKit = 1 << 12 }; class PluginQuirkSet { diff --git a/src/3rdparty/webkit/WebCore/plugins/npapi.cpp b/src/3rdparty/webkit/WebCore/plugins/npapi.cpp index 4135b64..d275a39 100644 --- a/src/3rdparty/webkit/WebCore/plugins/npapi.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/npapi.cpp @@ -171,7 +171,9 @@ void NPN_PopPopupsEnabledState(NPP instance) pluginViewForInstance(instance)->popPopupsEnabledState(); } +extern "C" { void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData) { PluginMainThreadScheduler::scheduler().scheduleCall(instance, func, userData); } +} diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp index 4b6d291..d92746b 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp @@ -3211,7 +3211,7 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle*) void RenderLayer::updateScrollCornerStyle() { RenderObject* actualRenderer = renderer()->node() ? renderer()->node()->shadowAncestorNode()->renderer() : renderer(); - RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(SCROLLBAR_CORNER, actualRenderer->style()) : 0; + RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(SCROLLBAR_CORNER, actualRenderer->style()) : PassRefPtr<RenderStyle>(0); if (corner) { if (!m_scrollCorner) { m_scrollCorner = new (renderer()->renderArena()) RenderScrollbarPart(renderer()->document()); @@ -3227,7 +3227,7 @@ void RenderLayer::updateScrollCornerStyle() void RenderLayer::updateResizerStyle() { RenderObject* actualRenderer = renderer()->node() ? renderer()->node()->shadowAncestorNode()->renderer() : renderer(); - RefPtr<RenderStyle> resizer = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(RESIZER, actualRenderer->style()) : 0; + RefPtr<RenderStyle> resizer = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(RESIZER, actualRenderer->style()) : PassRefPtr<RenderStyle>(0); if (resizer) { if (!m_resizer) { m_resizer = new (renderer()->renderArena()) RenderScrollbarPart(renderer()->document()); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h index 1772c66..541002f 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h @@ -298,7 +298,7 @@ public: enum UpdateLayerPositionsFlag { DoFullRepaint = 1, CheckForRepaint = 1 << 1, - UpdateCompositingLayers = 1 << 2, + UpdateCompositingLayers = 1 << 2 }; typedef unsigned UpdateLayerPositionsFlags; void updateLayerPositions(UpdateLayerPositionsFlags = DoFullRepaint | UpdateCompositingLayers); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.cpp index db24a06..32cea92 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.cpp @@ -183,7 +183,7 @@ void RenderScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy) if (partType == NoPart) return; - RefPtr<RenderStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType, pseudoForScrollbarPart(partType)) : 0; + RefPtr<RenderStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType, pseudoForScrollbarPart(partType)) : PassRefPtr<RenderStyle>(0); bool needRenderer = !destroy && partStyle && partStyle->display() != NONE && partStyle->visibility() == VISIBLE; diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.cpp index 7da9e5a..1d8fca6 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.cpp @@ -28,7 +28,7 @@ namespace WebCore { RenderTextFragment::RenderTextFragment(Node* node, StringImpl* str, int startOffset, int length) - : RenderText(node, str ? str->substring(startOffset, length) : 0) + : RenderText(node, str ? str->substring(startOffset, length) : PassRefPtr<StringImpl>(0)) , m_start(startOffset) , m_end(length) , m_firstLetter(0) diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp index 3a7d3d4..a04b095 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp @@ -214,7 +214,7 @@ void SVGElement::sendSVGLoadEventIfPossible(bool sendParentLoadEvents) event->setTarget(currentTarget); currentTarget->dispatchGenericEvent(event.release()); } - currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : 0; + currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : RefPtr<SVGElement>(0); } } diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.cpp b/src/3rdparty/webkit/WebCore/workers/Worker.cpp index 866687f..22c7d71 100644 --- a/src/3rdparty/webkit/WebCore/workers/Worker.cpp +++ b/src/3rdparty/webkit/WebCore/workers/Worker.cpp @@ -74,7 +74,7 @@ void Worker::postMessage(const String& message, ExceptionCode& ec) void Worker::postMessage(const String& message, MessagePort* messagePort, ExceptionCode& ec) { // Disentangle the port in preparation for sending it to the remote context. - OwnPtr<MessagePortChannel> channel = messagePort ? messagePort->disentangle(ec) : 0; + OwnPtr<MessagePortChannel> channel = messagePort ? messagePort->disentangle(ec) : PassOwnPtr<MessagePortChannel>(0); if (ec) return; m_contextProxy->postMessageToWorkerContext(message, channel.release()); diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h index 6082d0b..07b0b25 100644 --- a/src/corelib/arch/qatomic_windows.h +++ b/src/corelib/arch/qatomic_windows.h @@ -102,9 +102,14 @@ #define QT_INTERLOCKED_CONCAT(prefix, suffix) \ QT_INTERLOCKED_CONCAT_I(prefix, suffix) -// MSVC intrinsics prefix function names with an underscore +// MSVC intrinsics prefix function names with an underscore. Also, if platform +// SDK headers have been included, the Interlocked names may be defined as +// macros. +// To avoid double underscores, we paste the prefix with Interlocked first and +// then the remainder of the function name. #define QT_INTERLOCKED_FUNCTION(name) \ - QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, name) + QT_INTERLOCKED_CONCAT( \ + QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, Interlocked), name) #ifdef QT_INTERLOCKED_NO_VOLATILE # define QT_INTERLOCKED_VOLATILE @@ -127,16 +132,16 @@ extern "C" { - long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedIncrement )(long QT_INTERLOCKED_VOLATILE *); - long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedDecrement )(long QT_INTERLOCKED_VOLATILE *); - long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedCompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long); - long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchange )(long QT_INTERLOCKED_VOLATILE *, long); - long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long); + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment )(long QT_INTERLOCKED_VOLATILE *); + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement )(long QT_INTERLOCKED_VOLATILE *); + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long); + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long); + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long); # if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) - void * QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *); - void * QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *); - __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64); + void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *); + void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *); + __int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64); # endif } @@ -156,7 +161,7 @@ extern "C" { # pragma intrinsic (_InterlockedCompareExchange) # pragma intrinsic (_InterlockedExchangeAdd) -# ifndef _M_IX86 +# if !defined(Q_OS_WINCE) && !defined(_M_IX86) # pragma intrinsic (_InterlockedCompareExchangePointer) # pragma intrinsic (_InterlockedExchangePointer) # pragma intrinsic (_InterlockedExchangeAdd64) @@ -168,26 +173,26 @@ extern "C" { // Interlocked* replacement macros #define QT_INTERLOCKED_INCREMENT(value) \ - QT_INTERLOCKED_FUNCTION(InterlockedIncrement)( \ + QT_INTERLOCKED_FUNCTION( Increment )( \ QT_INTERLOCKED_REMOVE_VOLATILE( value ) ) #define QT_INTERLOCKED_DECREMENT(value) \ - QT_INTERLOCKED_FUNCTION(InterlockedDecrement)( \ + QT_INTERLOCKED_FUNCTION( Decrement )( \ QT_INTERLOCKED_REMOVE_VOLATILE( value ) ) #define QT_INTERLOCKED_COMPARE_EXCHANGE(value, newValue, expectedValue) \ - QT_INTERLOCKED_FUNCTION(InterlockedCompareExchange)( \ + QT_INTERLOCKED_FUNCTION( CompareExchange )( \ QT_INTERLOCKED_REMOVE_VOLATILE( value ), \ newValue, \ expectedValue ) #define QT_INTERLOCKED_EXCHANGE(value, newValue) \ - QT_INTERLOCKED_FUNCTION(InterlockedExchange)( \ + QT_INTERLOCKED_FUNCTION( Exchange )( \ QT_INTERLOCKED_REMOVE_VOLATILE( value ), \ newValue ) #define QT_INTERLOCKED_EXCHANGE_ADD(value, valueToAdd) \ - QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd)( \ + QT_INTERLOCKED_FUNCTION( ExchangeAdd )( \ QT_INTERLOCKED_REMOVE_VOLATILE( value ), \ valueToAdd ) @@ -195,36 +200,36 @@ extern "C" { # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ reinterpret_cast<void *>( \ - QT_INTERLOCKED_FUNCTION(InterlockedCompareExchange)( \ + QT_INTERLOCKED_FUNCTION( CompareExchange )( \ QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ (long)( newValue ), \ (long)( expectedValue ) )) # define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \ - QT_INTERLOCKED_FUNCTION(InterlockedExchange)( \ + QT_INTERLOCKED_FUNCTION( Exchange )( \ QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ (quintptr)( newValue ) ) # define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \ - QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd)( \ + QT_INTERLOCKED_FUNCTION( ExchangeAdd )( \ QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ valueToAdd ) #else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ - QT_INTERLOCKED_FUNCTION(InterlockedCompareExchangePointer)( \ + QT_INTERLOCKED_FUNCTION( CompareExchangePointer )( \ reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \ newValue, \ expectedValue ) # define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \ - QT_INTERLOCKED_FUNCTION(InterlockedExchangePointer)( \ + QT_INTERLOCKED_FUNCTION( ExchangePointer )( \ reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \ newValue ) # define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \ - QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd64)( \ + QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )( \ QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ valueToAdd ) diff --git a/src/corelib/arch/x86_64/qatomic_sun.s b/src/corelib/arch/x86_64/qatomic_sun.s index 4517fe4..37969e6 100644 --- a/src/corelib/arch/x86_64/qatomic_sun.s +++ b/src/corelib/arch/x86_64/qatomic_sun.s @@ -1,43 +1,3 @@ -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! -!! Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -!! Contact: Nokia Corporation (qt-info@nokia.com) -!! -!! This file is part of the QtGui module of the Qt Toolkit. -!! -!! $QT_BEGIN_LICENSE:LGPL$ -!! No Commercial Usage -!! This file contains pre-release code and may not be distributed. -!! You may use this file in accordance with the terms and conditions -!! contained in the Technology Preview License Agreement accompanying -!! this package. -!! -!! GNU Lesser General Public License Usage -!! Alternatively, this file may be used under the terms of the GNU Lesser -!! General Public License version 2.1 as published by the Free Software -!! Foundation and appearing in the file LICENSE.LGPL included in the -!! packaging of this file. Please review the following information to -!! ensure the GNU Lesser General Public License version 2.1 requirements -!! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -!! -!! In addition, as a special exception, Nokia gives you certain -!! additional rights. These rights are described in the Nokia Qt LGPL -!! Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -!! package. -!! -!! If you have questions regarding the use of this file, please contact -!! Nokia at qt-info@nokia.com. -!! -!! -!! -!! -!! -!! -!! -!! -!! $QT_END_LICENSE$ -!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .code64 .globl q_atomic_increment diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index b7934db..9c308a3 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -331,7 +331,7 @@ public: WinTimerVec timerVec; WinTimerDict timerDict; void registerTimer(WinTimerInfo *t); - void unregisterTimer(WinTimerInfo *t); + void unregisterTimer(WinTimerInfo *t, bool closingDown = false); void sendTimerEvent(int timerId); // socket notifiers @@ -557,10 +557,10 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t) qErrnoWarning("QEventDispatcherWin32::registerTimer: Failed to create a timer"); } -void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t) +void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t, bool closingDown) { // mark timer as unused - if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent) + if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent && !closingDown) QAbstractEventDispatcherPrivate::releaseTimerId(t->timerId); if (t->interval == 0) { @@ -1019,8 +1019,8 @@ void QEventDispatcherWin32::closingDown() unregisterSocketNotifier((*(d->sn_except.begin()))->obj); // clean up any timers - while (!d->timerDict.isEmpty()) - unregisterTimer((*(d->timerDict.begin()))->timerId); + for (int i = 0; i < d->timerVec.count(); ++i) + d->unregisterTimer(d->timerVec.at(i), true); } bool QEventDispatcherWin32::event(QEvent *e) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index c0c97b8..e93c6ee 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3965,11 +3965,19 @@ QDebug operator<<(QDebug dbg, const QObject *o) { \relates QObject This macro registers one or several \l{QFlags}{flags types} to the - meta-object system. + meta-object system. It is typically used in a class definition to declare + that values of a given enum can be used as flags and combined using the + bitwise OR operator. - Example: + For example, in QLibrary, the \l{QLibrary::LoadHints}{LoadHints} flag is + declared in the following way: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 39a + + The declaration of the flags themselves is performed in the public section + of the QLibrary class itself, using the \l Q_DECLARE_FLAGS() macro: - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 39 + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 39b \note This macro takes care of registering individual flag values with the meta-object system, so it is unnecessary to use Q_ENUMS() diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 6629a6d..dd64ced 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -67,7 +67,6 @@ \o QGraphicsOpacityEffect - renders the item with an opacity \o QGraphicsPixelizeEffect - pixelizes the item with any pixel size \o QGraphicsGrayscaleEffect - renders the item in shades of gray - \o QGraphicsShaderEffect - renders the item with a pixel shader fragment \endlist \img graphicseffect-effects.png diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b7c2e26..eae3e63 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -303,13 +303,17 @@ drop shadow effects and for decoration objects that follow the parent item's geometry without drawing on top of it. - \value ItemUsesExtendedStyleOption The item makes use of either the - exposedRect or matrix member of the QStyleOptionGraphicsItem. Implementers - of QGraphicsItem subclasses should set that flag if this data is required. - By default, the exposedRect is initialized to the item's boundingRect and - the matrix is untransformed. Enable this flag for more fine-grained values. - Use QStyleOptionGraphicsItem::levelOfDetailFromTransform() for a more - fine-grained value. + \value ItemUsesExtendedStyleOption The item makes use of either + \l{QStyleOptionGraphicsItem::}{exposedRect} or + \l{QStyleOptionGraphicsItem::}{matrix} in QStyleOptionGraphicsItem. By default, + the \l{QStyleOptionGraphicsItem::}{exposedRect} is initialized to the item's + boundingRect() and the \l{QStyleOptionGraphicsItem::}{matrix} is untransformed. + You can enable this flag for the style options to be set up with more + fine-grained values. + Note that QStyleOptionGraphicsItem::levelOfDetail is unaffected by this flag + and always initialized to 1. Use + QStyleOptionGraphicsItem::levelOfDetailFromTransform() if you need a higher + value. \value ItemHasNoContents The item does not paint anything (i.e., calling paint() on the item has no effect). You should set this flag on items that @@ -4766,7 +4770,7 @@ void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(const QPointF &n { Q_ASSERT(inSetPosHelper); - if (!(ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) + if (inDestructor || !(ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) return; // Not clipped by any ancestor. // Find closest clip ancestor and transform. @@ -4776,15 +4780,19 @@ void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(const QPointF &n if (transformData) thisToParentTransform = transformData->computedFullTransform(&thisToParentTransform); QGraphicsItem *clipParent = parent; - while (clipParent && !(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)) { + while (clipParent && !clipParent->d_ptr->inDestructor && !(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)) { thisToParentTransform *= clipParent->d_ptr->transformToParent(); clipParent = clipParent->d_ptr->parent; } - // thisToParentTransform is now the same as q->itemTransform(clipParent), except - // that the new position (which is not yet set on the item) is taken into account. - Q_ASSERT(clipParent); - Q_ASSERT(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); + // Ensure no parents are currently being deleted. This can only + // happen if the item is moved by a dying ancestor. + QGraphicsItem *p = clipParent; + while (p) { + if (p->d_ptr->inDestructor) + return; + p = p->d_ptr->parent; + } // From here everything is calculated in clip parent's coordinates. const QRectF parentBoundingRect(clipParent->boundingRect()); @@ -6846,6 +6854,8 @@ void QGraphicsItem::removeFromIndex() */ void QGraphicsItem::prepareGeometryChange() { + if (d_ptr->inDestructor) + return; if (d_ptr->scene) { d_ptr->scene->d_func()->dirtyGrowingItemsBoundingRect = true; d_ptr->geometryChanged = 1; diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index afabf49..d0f3b99 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -687,11 +687,13 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c Q_D(const QGraphicsWidget); QSizeF sh; if (d->layout) { - sh = d->layout->effectiveSizeHint(which, constraint); + QSizeF marginSize(0,0); if (d->margins) { - sh += QSizeF(d->margins[d->Left] + d->margins[d->Right], + marginSize = QSizeF(d->margins[d->Left] + d->margins[d->Right], d->margins[d->Top] + d->margins[d->Bottom]); } + sh = d->layout->effectiveSizeHint(which, constraint - marginSize); + sh += marginSize; } else { switch (which) { case Qt::MinimumSize: diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 787bbb1..bf826a9 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -393,49 +393,162 @@ void QGraphicsWidgetPrivate::windowFrameMousePressEvent(QGraphicsSceneMouseEvent event->setAccepted(windowData->grabbedSection != Qt::NoSection); } +/*! + Used to calculate the + Precondition: + \a widget should support either hfw or wfh + + If \a heightForWidth is set to false, this function will query the width for height + instead. \a width will then be interpreted as height, \a minh and \a maxh will be interpreted + as minimum width and maximum width. + */ +static qreal minimumHeightForWidth(qreal width, qreal minh, qreal maxh, + const QGraphicsWidget *widget, + bool heightForWidth = true) +{ + qreal minimumHeightForWidth = -1; + const QSizePolicy sp = widget->layout() ? widget->layout()->sizePolicy() : widget->sizePolicy(); + const bool hasHFW = sp.hasHeightForWidth(); + if (hasHFW == heightForWidth) { + minimumHeightForWidth = hasHFW + ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(width, -1)).height() + : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, width)).width(); //"width" is here height! + } else { + // widthForHeight + const qreal constraint = width; + while (maxh - minh > 0.1) { + qreal middle = minh + (maxh - minh)/2; + // ### really bad, if we are a widget with a layout it will call + // layout->effectiveSizeHint(Qt::MiniumumSize), which again will call + // sizeHint three times because of how the cache works + qreal hfw = hasHFW + ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(middle, -1)).height() + : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, middle)).width(); + if (hfw > constraint) { + minh = middle; + } else if (hfw <= constraint) { + maxh = middle; + } + } + minimumHeightForWidth = maxh; + } + return minimumHeightForWidth; +} + +static qreal minimumWidthForHeight(qreal height, qreal minw, qreal maxw, + const QGraphicsWidget *widget) +{ + return minimumHeightForWidth(height, minw, maxw, widget, false); +} + +static QSizeF closestAcceptableSize(const QSizeF &proposed, + const QGraphicsWidget *widget) +{ + const QSizeF current = widget->size(); + + qreal minw = proposed.width(); + qreal maxw = current.width(); + qreal minh = proposed.height(); + qreal maxh = current.height(); + + qreal middlew = maxw; + qreal middleh = maxh; + qreal min_hfw; + min_hfw = minimumHeightForWidth(maxw, minh, maxh, widget); + + do { + if (maxw - minw < 0.1) { + // we still havent found anything, cut off binary search + minw = maxw; + minh = maxh; + } + middlew = minw + (maxw - minw)/2.0; + middleh = minh + (maxh - minh)/2.0; + + min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget); + + if (min_hfw > middleh) { + minw = middlew; + minh = middleh; + } else if (min_hfw <= middleh) { + maxw = middlew; + maxh = middleh; + } + } while (maxw != minw); + + min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget); + + QSizeF result; + if (min_hfw < maxh) { + result = QSizeF(middlew, min_hfw); + } else { + // Needed because of the cut-off we do above. + result = QSizeF(minimumWidthForHeight(maxh, proposed.width(), current.width(), widget), maxh); + } + return result; +} + static void _q_boundGeometryToSizeConstraints(const QRectF &startGeometry, QRectF *rect, Qt::WindowFrameSection section, - const QSizeF &min, const QSizeF &max) + const QSizeF &min, const QSizeF &max, + const QGraphicsWidget *widget) { - int height; - int width; + const QRectF proposedRect = *rect; + qreal width = qBound(min.width(), proposedRect.width(), max.width()); + qreal height = qBound(min.height(), proposedRect.height(), max.height()); + + QSizePolicy sp = widget->sizePolicy(); + if (const QGraphicsLayout *l = widget->layout()) { + sp = l->sizePolicy(); + } + const bool hasHFW = sp.hasHeightForWidth(); // || sp.hasWidthForHeight(); + + const bool widthChanged = proposedRect.width() < widget->size().width(); + const bool heightChanged = proposedRect.height() < widget->size().height(); + + if (hasHFW) { + if (widthChanged || heightChanged) { + const qreal minh = min.height(); + const qreal maxh = max.height(); + const qreal proposedHFW = minimumHeightForWidth(width, minh, maxh, widget); + if (proposedHFW > proposedRect.height()) { + QSizeF effectiveSize = closestAcceptableSize(QSizeF(width, height), widget); + width = effectiveSize.width(); + height = effectiveSize.height(); + } + } + } + switch (section) { case Qt::LeftSection: - width = qRound(qBound(min.width(), rect->width(), max.width())); - rect->setRect(startGeometry.right() - width, startGeometry.top(), - width, startGeometry.height()); + rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(), + qRound(width), startGeometry.height()); break; case Qt::TopLeftSection: - width = qRound(qBound(min.width(), rect->width(), max.width())); - height = qRound(qBound(min.height(), rect->height(), max.height())); - rect->setRect(startGeometry.right() - width, startGeometry.bottom() - height, - width, height); + rect->setRect(startGeometry.right() - qRound(width), startGeometry.bottom() - qRound(height), + qRound(width), qRound(height)); break; case Qt::TopSection: - height = qRound(qBound(min.height(), rect->height(), max.height())); - rect->setRect(startGeometry.left(), startGeometry.bottom() - height, - startGeometry.width(), height); + rect->setRect(startGeometry.left(), startGeometry.bottom() - qRound(height), + startGeometry.width(), qRound(height)); break; case Qt::TopRightSection: - height = qRound(qBound(min.height(), rect->height(), max.height())); - rect->setTop(rect->bottom() - height); - rect->setWidth(qBound(min.width(), rect->width(), max.width())); + rect->setTop(rect->bottom() - qRound(height)); + rect->setWidth(qRound(width)); break; case Qt::RightSection: - rect->setWidth(qBound(min.width(), rect->width(), max.width())); + rect->setWidth(qRound(width)); break; case Qt::BottomRightSection: - rect->setWidth(qBound(min.width(), rect->width(), max.width())); - rect->setHeight(qBound(min.height(), rect->height(), max.height())); + rect->setWidth(qRound(width)); + rect->setHeight(qRound(height)); break; case Qt::BottomSection: - rect->setHeight(qBound(min.height(), rect->height(), max.height())); + rect->setHeight(qRound(height)); break; case Qt::BottomLeftSection: - height = qRound(qBound(min.height(), rect->height(), max.height())); - width = qRound(qBound(min.width(), rect->width(), max.width())); - rect->setRect(startGeometry.right() - width, startGeometry.top(), - width, height); + rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(), + qRound(width), qRound(height)); break; default: break; @@ -506,7 +619,8 @@ void QGraphicsWidgetPrivate::windowFrameMouseMoveEvent(QGraphicsSceneMouseEvent _q_boundGeometryToSizeConstraints(windowData->startGeometry, &newGeometry, windowData->grabbedSection, q->effectiveSizeHint(Qt::MinimumSize), - q->effectiveSizeHint(Qt::MaximumSize)); + q->effectiveSizeHint(Qt::MaximumSize), + q); q->setGeometry(newGeometry); } } diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index fc801ad..5b5cfa1 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1804,12 +1804,12 @@ QItemSelection QListViewPrivate::selection(const QRect &rect) const void QCommonListViewBase::appendHiddenRow(int row) { - dd->hiddenRows.append(dd->model->index(row, 0)); + dd->hiddenRows.append(dd->model->index(row, 0, qq->rootIndex())); } void QCommonListViewBase::removeHiddenRow(int row) { - dd->hiddenRows.remove(dd->hiddenRows.indexOf(dd->model->index(row, 0))); + dd->hiddenRows.remove(dd->hiddenRows.indexOf(dd->model->index(row, 0, qq->rootIndex()))); } void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index a61b6fa..0b282bc 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3648,13 +3648,13 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) \i As mentioned above, enabling touch events means multiple widgets can be receiving touch events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents, this gives you great flexibility in designing multi-touch user interfaces. Be aware of the - implications. For example, is is possible that the user is moving a QSlider with one finger and + implications. For example, it is possible that the user is moving a QSlider with one finger and pressing a QPushButton with another. The signals emitted by these widgets will be interleaved. \i Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or QMenu::exec()) in a QTouchEvent event handler is not supported. Since there are multiple event - recipients, unexpected recursion may cause problems, including but not limited to lost events + recipients, recursion may cause problems, including but not limited to lost events and unexpected infinite recursion. \i QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an diff --git a/src/gui/kernel/qsizepolicy.h b/src/gui/kernel/qsizepolicy.h index 4261dda..eb13788 100644 --- a/src/gui/kernel/qsizepolicy.h +++ b/src/gui/kernel/qsizepolicy.h @@ -64,6 +64,7 @@ private: VMask = HMask << HSize, CTShift = 9, CTSize = 5, + WFHShift = CTShift + CTSize, CTMask = ((0x1 << CTSize) - 1) << CTShift, UnusedShift = CTShift + CTSize, UnusedSize = 2 @@ -199,6 +200,17 @@ private: QSizePolicy(int i) : data(i) { } quint32 data; +/* use bit flags instead, keep it here for improved readability for now + quint32 horzPolicy : 4; + quint32 vertPolicy : 4; + quint32 hfw : 1; + quint32 ctype : 5; + quint32 wfh : 1; + quint32 padding : 1; // we cannot use the highest bit + quint32 horStretch : 8; + quint32 verStretch : 8; +*/ + }; Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes) diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 8e2eb1e..3140af9 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -123,8 +123,8 @@ QT_BEGIN_NAMESPACE emitted. There are XEmbed widgets available for KDE and GTK+. The GTK+ - equivalent of QX11EmbedWidget is GtkPlug. The KDE widget is called - QXEmbed. + equivalent of QX11EmbedWidget is GtkPlug. The corresponding KDE 3 + widget is called QXEmbed. \sa QX11EmbedContainer, {XEmbed Specification} */ @@ -177,8 +177,8 @@ QT_BEGIN_NAMESPACE features such as window activation and focus handling are then lost. - The GTK+ equivalent of QX11EmbedContainer is GtkSocket. The KDE - widget is called QXEmbed. + The GTK+ equivalent of QX11EmbedContainer is GtkSocket. The + corresponding KDE 3 widget is called QXEmbed. \sa QX11EmbedWidget, {XEmbed Specification} */ diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index ab192c5..e9b1bd3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -4953,15 +4953,18 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * if (modeSource && coverage == 255) { // Copy the first texture block - length = image_width; + length = qMin(image_width,length); + int tx = x; while (length) { int l = qMin(image_width - sx, length); if (buffer_size < l) l = buffer_size; - DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x; + DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + tx; const SRC *src = (SRC*)data->texture.scanLine(sy) + sx; + qt_memconvert<DST, SRC>(dest, src, l); length -= l; + tx += l; sx = 0; } @@ -4971,8 +4974,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * // We are dealing with one block of data // - More likely to fit in the cache // - can use memcpy - int copy_image_width = image_width; - length = spans->len - image_width; + int copy_image_width = qMin(image_width, int(spans->len)); + length = spans->len - copy_image_width; DST *src = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x; DST *dest = src + copy_image_width; while (copy_image_width < length) { diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index 04ddd7d..4d8b8c9 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -239,7 +239,7 @@ bool QPaintBuffer::isEmpty() const -void QPaintBuffer::draw(QPainter *painter) const +void QPaintBuffer::draw(QPainter *painter, int frame) const { #ifdef QPAINTBUFFER_DEBUG_DRAW qDebug() << "QPaintBuffer::draw() --------------------------------"; @@ -270,10 +270,10 @@ void QPaintBuffer::draw(QPainter *painter) const ? (QPaintEngineEx *) painter->paintEngine() : 0; if (xengine) { QPaintEngineExReplayer player; - player.draw(*this, painter); + player.draw(*this, painter, frame); } else { QPainterReplayer player; - player.draw(*this, painter); + player.draw(*this, painter, frame); } #ifdef QPAINTBUFFER_DEBUG_DRAW @@ -1035,17 +1035,31 @@ void QPainterReplayer::setupTransform(QPainter *_painter) painter->setTransform(m_world_matrix); } -void QPainterReplayer::draw(const QPaintBuffer &buffer, QPainter *_painter) +void QPainterReplayer::draw(const QPaintBuffer &buffer, QPainter *_painter, int frame) { d = buffer.d_ptr; setupTransform(_painter); - for (int cmdIndex=0; cmdIndex<d->commands.size(); ++cmdIndex) { + int frameStart = (frame == 0) ? 0 : d->frames.at(frame-1); + int frameEnd = (frame == d->frames.size()) ? d->commands.size() : d->frames.at(frame); + + for (int cmdIndex=frameStart; cmdIndex<frameEnd; ++cmdIndex) { const QPaintBufferCommand &cmd = d->commands.at(cmdIndex); process(cmd); } } +void QPaintBuffer::beginNewFrame() +{ + if (!d_ptr->commands.isEmpty()) + d_ptr->frames << d_ptr->commands.size(); +} + +int QPaintBuffer::numFrames() const +{ + return d_ptr->frames.size() + 1; +} + void QPainterReplayer::process(const QPaintBufferCommand &cmd) { switch (cmd.id) { @@ -1721,24 +1735,99 @@ QDataStream &operator>>(QDataStream &stream, QPaintBufferCommand &command) return stream; } +struct QPaintBufferCacheEntry +{ + QVariant::Type type; + quint64 cacheKey; +}; +Q_DECLARE_METATYPE(QPaintBufferCacheEntry); + +QDataStream &operator<<(QDataStream &stream, const QPaintBufferCacheEntry &entry) +{ + return stream << entry.type << entry.cacheKey; +} + +QDataStream &operator>>(QDataStream &stream, QPaintBufferCacheEntry &entry) +{ + return stream >> entry.type >> entry.cacheKey; +} + +static int qRegisterPaintBufferMetaTypes() +{ + qRegisterMetaType<QPaintBufferCacheEntry>(); + qRegisterMetaTypeStreamOperators<QPaintBufferCacheEntry>("QPaintBufferCacheEntry"); + + return 0; // something +} + +Q_CONSTRUCTOR_FUNCTION(qRegisterPaintBufferMetaTypes) + QDataStream &operator<<(QDataStream &stream, const QPaintBuffer &buffer) { + QHash<qint64, QPixmap> pixmaps; + QHash<qint64, QImage> images; + + QVector<QVariant> variants = buffer.d_ptr->variants; + for (int i = 0; i < variants.size(); ++i) { + const QVariant &v = variants.at(i); + if (v.type() == QVariant::Image) { + const QImage image(v.value<QImage>()); + images[image.cacheKey()] = image; + + QPaintBufferCacheEntry entry; + entry.type = QVariant::Image; + entry.cacheKey = image.cacheKey(); + variants[i] = QVariant::fromValue(entry); + } else if (v.type() == QVariant::Pixmap) { + const QPixmap pixmap(v.value<QPixmap>()); + pixmaps[pixmap.cacheKey()] = pixmap; + + QPaintBufferCacheEntry entry; + entry.type = QVariant::Pixmap; + entry.cacheKey = pixmap.cacheKey(); + variants[i] = QVariant::fromValue(entry); + } + } + + stream << pixmaps; + stream << images; + stream << buffer.d_ptr->ints; stream << buffer.d_ptr->floats; - stream << buffer.d_ptr->variants; + stream << variants; stream << buffer.d_ptr->commands; stream << buffer.d_ptr->boundingRect; + stream << buffer.d_ptr->frames; return stream; } QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer) { + QHash<qint64, QPixmap> pixmaps; + QHash<qint64, QImage> images; + + stream >> pixmaps; + stream >> images; + stream >> buffer.d_ptr->ints; stream >> buffer.d_ptr->floats; stream >> buffer.d_ptr->variants; stream >> buffer.d_ptr->commands; stream >> buffer.d_ptr->boundingRect; + stream >> buffer.d_ptr->frames; + + QVector<QVariant> &variants = buffer.d_ptr->variants; + for (int i = 0; i < variants.size(); ++i) { + const QVariant &v = variants.at(i); + if (v.canConvert<QPaintBufferCacheEntry>()) { + QPaintBufferCacheEntry entry = v.value<QPaintBufferCacheEntry>(); + if (entry.type == QVariant::Image) + variants[i] = QVariant(images.value(entry.cacheKey)); + else + variants[i] = QVariant(pixmaps.value(entry.cacheKey)); + } + } return stream; } diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h index b360279..2cb1d7c 100644 --- a/src/gui/painting/qpaintbuffer_p.h +++ b/src/gui/painting/qpaintbuffer_p.h @@ -71,7 +71,10 @@ public: bool isEmpty() const; - void draw(QPainter *painter) const; + void beginNewFrame(); + int numFrames() const; + + void draw(QPainter *painter, int frame = 0) const; void setBoundingRect(const QRectF &rect); QRectF boundingRect() const; @@ -270,6 +273,7 @@ public: QVector<QVariant> variants; QVector<QPaintBufferCommand> commands; + QList<int> frames; QPaintBufferEngine *engine; QRectF boundingRect; @@ -306,7 +310,7 @@ public: void setupTransform(QPainter *painter); void process(const QPaintBufferCommand &cmd); - void draw(const QPaintBuffer &buffer, QPainter *painter); + void draw(const QPaintBuffer &buffer, QPainter *painter, int frame); protected: QPaintBufferPrivate *d; diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index c31a087..b13fb62 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -373,7 +373,11 @@ public: }; -class Q_GUI_EXPORT QClipData { +class +#ifdef Q_WS_QWS +Q_GUI_EXPORT +#endif +QClipData { public: QClipData(int height); ~QClipData(); @@ -480,7 +484,11 @@ private: /******************************************************************************* * QRasterBuffer */ -class Q_GUI_EXPORT QRasterBuffer +class +#ifdef Q_WS_QWS +Q_GUI_EXPORT +#endif +QRasterBuffer { public: QRasterBuffer() : m_width(0), m_height(0), m_buffer(0) { init(); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index a6bea76..263e53e 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7545,10 +7545,9 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, if (!painter) tf |= Qt::TextDontPrint; - int maxUnderlines = 0; + uint maxUnderlines = 0; int numUnderlines = 0; - int underlinePositionStack[32]; - int *underlinePositions = underlinePositionStack; + QVarLengthArray<int, 32> underlinePositions(1); QFontMetricsF fm(fnt); QString text = str; @@ -7557,54 +7556,46 @@ start_lengthVariant: bool hasMoreLengthVariants = false; // compatible behaviour to the old implementation. Replace // tabs by spaces - QChar *chr = text.data() + offset; - QChar *end = text.data() + text.length(); bool has_tab = false; - while (chr != end) { - if (*chr == QLatin1Char('\r') || (singleline && *chr == QLatin1Char('\n'))) { - *chr = QLatin1Char(' '); - } else if (*chr == QLatin1Char('\n')) { - *chr = QChar::LineSeparator; - } else if (*chr == QLatin1Char('&')) { + int old_offset = offset; + for (; offset < text.length(); offset++) { + QChar chr = text.at(offset); + if (chr == QLatin1Char('\r') || (singleline && chr == QLatin1Char('\n'))) { + text[offset] = QLatin1Char(' '); + } else if (chr == QLatin1Char('\n')) { + text[offset] = QChar::LineSeparator; + } else if (chr == QLatin1Char('&')) { ++maxUnderlines; - } else if (*chr == QLatin1Char('\t')) { + } else if (chr == QLatin1Char('\t')) { + if (!expandtabs) { + text[offset] = QLatin1Char(' '); + } else if (!tabarraylen && !tabstops) { + tabstops = qRound(fm.width(QLatin1Char('x'))*8); + } has_tab = true; - } else if (*chr == QChar(ushort(0x9c))) { + } else if (chr == QChar(ushort(0x9c))) { // string with multiple length variants - end = chr; hasMoreLengthVariants = true; break; } - ++chr; - } - if (has_tab) { - if (!expandtabs) { - chr = text.data() + offset; - while (chr != end) { - if (*chr == QLatin1Char('\t')) - *chr = QLatin1Char(' '); - ++chr; - } - } else if (!tabarraylen && !tabstops) { - tabstops = qRound(fm.width(QLatin1Char('x'))*8); - } } - QChar *cout = end; - if (hidemnmemonic || showmnemonic) { - if (maxUnderlines > 32) - underlinePositions = new int[maxUnderlines]; - cout = text.data() + offset; + int length = offset - old_offset; + if ((hidemnmemonic || showmnemonic) && maxUnderlines > 0) { + underlinePositions.resize(maxUnderlines + 1); + + QChar *cout = text.data() + old_offset; QChar *cin = cout; - int l = end - cout; + int l = length; while (l) { if (*cin == QLatin1Char('&')) { ++cin; + --length; --l; if (!l) break; if (*cin != QLatin1Char('&') && !hidemnmemonic) - underlinePositions[numUnderlines++] = cout - text.unicode(); + underlinePositions[numUnderlines++] = cout - text.data() - old_offset; } *cout = *cin; ++cout; @@ -7621,7 +7612,7 @@ start_lengthVariant: qreal height = 0; qreal width = 0; - QString finalText = text.mid(offset, cout - (text.data() + offset)); + QString finalText = text.mid(old_offset, length); QStackTextEngine engine(finalText, fnt); if (option) { engine.option = *option; @@ -7640,7 +7631,7 @@ start_lengthVariant: engine.forceJustification = true; QTextLayout textLayout(&engine); textLayout.setCacheEnabled(true); - textLayout.engine()->underlinePositions = underlinePositions; + textLayout.engine()->underlinePositions = underlinePositions.data(); if (finalText.isEmpty()) { height = fm.height(); @@ -7709,7 +7700,7 @@ start_lengthVariant: QRectF bounds = QRectF(r.x() + xoff, r.y() + yoff, width, height); if (hasMoreLengthVariants && !(tf & Qt::TextLongestVariant) && !r.contains(bounds)) { - offset = end - text.data() + 1; + offset++; goto start_lengthVariant; } if (brect) @@ -7738,9 +7729,6 @@ start_lengthVariant: painter->restore(); } } - - if (underlinePositions != underlinePositionStack) - delete [] underlinePositions; } /*! diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 882e6bc..882f994 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -1286,6 +1286,23 @@ int QPrinter::numCopies() const /*! + Returns the number of copies that will be printed. The default + value is 1. + + This function always returns the actual value specified in the print + dialog or using setNumCopies(). + + \sa setNumCopies(), numCopies(); +*/ +int QPrinter::actualNumCopies() const +{ + Q_D(const QPrinter); + return qt_printerRealNumCopies(d->paintEngine); +} + + + +/*! Sets the number of copies to be printed to \a numCopies. The printer driver reads this setting and prints the specified diff --git a/src/gui/painting/qprinter.h b/src/gui/painting/qprinter.h index 46419f4..16f2182 100644 --- a/src/gui/painting/qprinter.h +++ b/src/gui/painting/qprinter.h @@ -197,6 +197,8 @@ public: void setNumCopies(int); int numCopies() const; + int actualNumCopies() const; + void setPaperSource(PaperSource); PaperSource paperSource() const; diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h index 4cfdbbf..059d772 100644 --- a/src/gui/painting/qrasterizer_p.h +++ b/src/gui/painting/qrasterizer_p.h @@ -65,7 +65,11 @@ struct QSpanData; class QRasterBuffer; class QRasterizerPrivate; -class Q_GUI_EXPORT QRasterizer +class +#ifdef Q_WS_QWS +Q_GUI_EXPORT +#endif +QRasterizer { public: QRasterizer(); diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 41f9ec0..7fefb19 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1882,7 +1882,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, break; case CE_TabBarTabLabel: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { - // ### consider merging this with SE_TabBarTabText QStyleOptionTabV3 tabV2(*tab); QRect tr = tabV2.rect; bool verticalTabs = tabV2.shape == QTabBar::RoundedEast diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index ef1818d..e7ef51a 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -1951,6 +1951,7 @@ void QMacStyle::polish(QWidget* w) w->setWindowOpacity(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5 ? 0.985 : 0.94); if (!w->testAttribute(Qt::WA_SetPalette)) { QPixmap px(64, 64); + px.fill(Qt::white); HIThemeMenuDrawInfo mtinfo; mtinfo.version = qt_mac_hitheme_version; mtinfo.menuType = kThemeMenuTypePopUp; diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index cead2ac..3d8dec6 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3948,7 +3948,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q QFont oldFont = p->font(); if (subRule.hasFont) p->setFont(subRule.font); - if (subRule.hasBox()) { + if (subRule.hasBox() || !subRule.hasNativeBorder()) { tabCopy.rect = ce == CE_TabBarTabShape ? subRule.borderRect(r) : subRule.contentsRect(r); QWindowsStyle::drawControl(ce, &tabCopy, p, w); @@ -5702,6 +5702,15 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c } break; } + case SE_TabBarTabText: + case SE_TabBarTabLeftButton: + case SE_TabBarTabRightButton: { + QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab); + if (subRule.hasBox() || !subRule.hasNativeBorder()) { + return ParentStyle::subElementRect(se, opt, w); + } + break; + } #endif // QT_NO_TABBAR case SE_DockWidgetCloseButton: diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index f252444..a38f276 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1171,7 +1171,7 @@ static void parseShorthandFontProperty(const QVector<Value> &values, QFont *font { font->setStyle(QFont::StyleNormal); font->setWeight(QFont::Normal); - *fontSizeAdjustment = 0; + *fontSizeAdjustment = -255; int i = 0; while (i < values.count()) { diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 1bdaceb..e565d0a 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2521,13 +2521,15 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block) default: html += QLatin1String("<ul"); // ### should not happen } + html += QLatin1String(" style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;"); + if (format.hasProperty(QTextFormat::ListIndent)) { - html += QLatin1String(" style=\"-qt-list-indent: "); + html += QLatin1String(" -qt-list-indent: "); html += QString::number(format.indent()); - html += QLatin1String(";\""); + html += QLatin1Char(';'); } - html += QLatin1Char('>'); + html += QLatin1String("\">"); } html += QLatin1String("<li"); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 2b84c6c..ba9145e 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2245,6 +2245,28 @@ void QTextEngine::indexAdditionalFormats() } } +/* These two helper functions are used to determine whether we need to insert a ZWJ character + between the text that gets truncated and the ellipsis. This is important to get + correctly shaped results for arabic text. +*/ +static bool nextCharJoins(const QString &string, int pos) +{ + while (pos < string.length() && string.at(pos).category() == QChar::Mark_NonSpacing) + ++pos; + if (pos == string.length()) + return false; + return string.at(pos).joining() != QChar::OtherJoining; +} + +static bool prevCharJoins(const QString &string, int pos) +{ + while (pos > 0 && string.at(pos - 1).category() == QChar::Mark_NonSpacing) + --pos; + if (pos == 0) + return false; + return (string.at(pos - 1).joining() == QChar::Dual || string.at(pos - 1).joining() == QChar::Center); +} + QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags) const { // qDebug() << "elidedText; available width" << width.toReal() << "text width:" << this->width(0, layoutData->string.length()).toReal(); @@ -2345,6 +2367,9 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int } while (nextBreak < layoutData->string.length() && currentWidth < availableWidth); + if (nextCharJoins(layoutData->string, pos)) + ellipsisText.prepend(QChar(0x200d) /* ZWJ */); + return layoutData->string.left(pos) + ellipsisText; } else if (mode == Qt::ElideLeft) { QFixed currentWidth; @@ -2362,6 +2387,9 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int } while (nextBreak > 0 && currentWidth < availableWidth); + if (prevCharJoins(layoutData->string, pos)) + ellipsisText.append(QChar(0x200d) /* ZWJ */); + return ellipsisText + layoutData->string.mid(pos); } else if (mode == Qt::ElideMiddle) { QFixed leftWidth; @@ -2391,6 +2419,11 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int && nextRightBreak > 0 && leftWidth + rightWidth < availableWidth); + if (nextCharJoins(layoutData->string, leftPos)) + ellipsisText.prepend(QChar(0x200d) /* ZWJ */); + if (prevCharJoins(layoutData->string, rightPos)) + ellipsisText.append(QChar(0x200d) /* ZWJ */); + return layoutData->string.left(leftPos) + ellipsisText + layoutData->string.mid(rightPos); } diff --git a/src/gui/widgets/qdatetimeedit_p.h b/src/gui/widgets/qdatetimeedit_p.h index 7e1c24d..689b508 100644 --- a/src/gui/widgets/qdatetimeedit_p.h +++ b/src/gui/widgets/qdatetimeedit_p.h @@ -89,7 +89,7 @@ public: QDateTime validateAndInterpret(QString &input, int &, QValidator::State &state, bool fixup = false) const; void clearSection(int index); - virtual QString displayText() const { return edit->displayText(); } // this is from QDateTimeParser + virtual QString displayText() const { return edit->text(); } // this is from QDateTimeParser int absoluteIndex(QDateTimeEdit::Section s, int index) const; int absoluteIndex(const SectionNode &s) const; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index bc01e82..2b2504f 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -306,6 +306,7 @@ static QByteArray proxyAuthenticationKey(const QNetworkProxy &proxy, const QStri case QNetworkProxy::FtpCachingProxy: key.setScheme(QLatin1String("proxy-ftp")); + break; case QNetworkProxy::DefaultProxy: case QNetworkProxy::NoProxy: diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h index 000de07..ee741aa 100644 --- a/src/network/kernel/qhostinfo_p.h +++ b/src/network/kernel/qhostinfo_p.h @@ -47,7 +47,7 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from +// of the QHostInfo class. This header file may change from // version to version without notice, or even be removed. // // We mean it. @@ -180,7 +180,8 @@ class QHostInfoPrivate public: inline QHostInfoPrivate() : err(QHostInfo::NoError), - errorStr(QLatin1String(QT_TRANSLATE_NOOP("QHostInfo", "Unknown error"))) + errorStr(QLatin1String(QT_TRANSLATE_NOOP("QHostInfo", "Unknown error"))), + lookupId(0) { } diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index b85a9d2..98740ba 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -453,6 +453,9 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() peerPort(0), socketEngine(0), cachedSocketDescriptor(-1), +#ifdef Q_OS_LINUX + addToBytesAvailable(0), +#endif readBufferMaxSize(0), readBuffer(QABSTRACTSOCKET_BUFFERSIZE), writeBuffer(QABSTRACTSOCKET_BUFFERSIZE), @@ -461,6 +464,7 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() connectTimer(0), connectTimeElapsed(0), hostLookupId(-1), + socketType(QAbstractSocket::UnknownSocketType), state(QAbstractSocket::UnconnectedState), socketError(QAbstractSocket::UnknownSocketError) { diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index 3e292f9..49605c5 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -47,7 +47,7 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from +// of the QAbstractSocket class. This header file may change from // version to version without notice, or even be removed. // // We mean it. diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 458aa7e..560d31f 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -38,7 +38,7 @@ SOURCES += qgl.cpp \ !contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl) { HEADERS += qglshaderprogram.h \ qglpixmapfilter_p.h \ - qgraphicsshadereffect.h \ + qgraphicsshadereffect_p.h \ qgraphicssystem_gl_p.h \ qwindowsurface_gl_p.h \ qpixmapdata_gl_p.h \ diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index dde4eba..9e0c5f8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -207,9 +207,10 @@ QGLSignalProxy *QGLSignalProxy::instance() \i \link setSampleBuffers() Multisample buffers.\endlink \endlist - You can also specify preferred bit depths for the depth buffer, - alpha buffer, accumulation buffer and the stencil buffer with the - functions: setDepthBufferSize(), setAlphaBufferSize(), + You can also specify preferred bit depths for the color buffer, + depth buffer, alpha buffer, accumulation buffer and the stencil + buffer with the functions: setRedBufferSize(), setGreenBufferSize(), + setBlueBufferSize(), setDepthBufferSize(), setAlphaBufferSize(), setAccumBufferSize() and setStencilBufferSize(). Note that even if you specify that you prefer a 32 bit depth @@ -293,19 +294,20 @@ static inline GLint qgluProject(GLdouble objx, GLdouble objy, GLdouble objz, } /*! - Constructs a QGLFormat object with the factory default settings: + Constructs a QGLFormat object with the following default settings: \list \i \link setDoubleBuffer() Double buffer:\endlink Enabled. \i \link setDepth() Depth buffer:\endlink Enabled. \i \link setRgba() RGBA:\endlink Enabled (i.e., color index disabled). \i \link setAlpha() Alpha channel:\endlink Disabled. \i \link setAccum() Accumulator buffer:\endlink Disabled. - \i \link setStencil() Stencil buffer:\endlink Disabled. + \i \link setStencil() Stencil buffer:\endlink Enabled. \i \link setStereo() Stereo:\endlink Disabled. \i \link setDirectRendering() Direct rendering:\endlink Enabled. \i \link setOverlay() Overlay:\endlink Disabled. \i \link setPlane() Plane:\endlink 0 (i.e., normal plane). - \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. + \i \link setSampleBuffers() Multisample buffers:\endlink Enabled on + OpenGL/ES 2.0, disabled on other platforms. \endlist */ @@ -316,26 +318,26 @@ QGLFormat::QGLFormat() /*! - Creates a QGLFormat object that is a copy of the current \link - defaultFormat() application default format\endlink. + Creates a QGLFormat object that is a copy of the current + defaultFormat(). - If \a options is not 0, this copy is modified by these format - options. The \a options parameter should be \c FormatOption values - OR'ed together. + If \a options is not 0, the default format is modified by the + specified format options. The \a options parameter should be + QGL::FormatOption values OR'ed together. This constructor makes it easy to specify a certain desired format in classes derived from QGLWidget, for example: \snippet doc/src/snippets/code/src_opengl_qgl.cpp 3 - Note that there are \c FormatOption values to turn format settings - both on and off, e.g. \c DepthBuffer and \c NoDepthBuffer, - \c DirectRendering and \c IndirectRendering, etc. + Note that there are QGL::FormatOption values to turn format settings + both on and off, e.g. QGL::DepthBuffer and QGL::NoDepthBuffer, + QGL::DirectRendering and QGL::IndirectRendering, etc. The \a plane parameter defaults to 0 and is the plane which this format should be associated with. Not all OpenGL implementations supports overlay/underlay rendering planes. - \sa defaultFormat(), setOption() + \sa defaultFormat(), setOption(), setPlane() */ QGLFormat::QGLFormat(QGL::FormatOptions options, int plane) @@ -349,13 +351,26 @@ QGLFormat::QGLFormat(QGL::FormatOptions options, int plane) } /*! + \internal +*/ +void QGLFormat::detach() +{ + if (d->ref != 1) { + QGLFormatPrivate *newd = new QGLFormatPrivate(d); + if (!d->ref.deref()) + delete d; + d = newd; + } +} + +/*! Constructs a copy of \a other. */ QGLFormat::QGLFormat(const QGLFormat &other) { - d = new QGLFormatPrivate; - *d = *other.d; + d = other.d; + d->ref.ref(); } /*! @@ -364,7 +379,12 @@ QGLFormat::QGLFormat(const QGLFormat &other) QGLFormat &QGLFormat::operator=(const QGLFormat &other) { - *d = *other.d; + if (d != other.d) { + other.d->ref.ref(); + if (!d->ref.deref()) + delete d; + d = other.d; + } return *this; } @@ -373,7 +393,8 @@ QGLFormat &QGLFormat::operator=(const QGLFormat &other) */ QGLFormat::~QGLFormat() { - delete d; + if (!d->ref.deref()) + delete d; } /*! @@ -649,6 +670,7 @@ int QGLFormat::samples() const */ void QGLFormat::setSamples(int numSamples) { + detach(); if (numSamples < 0) { qWarning("QGLFormat::setSamples: Cannot have negative number of samples per pixel %d", numSamples); return; @@ -676,6 +698,7 @@ void QGLFormat::setSamples(int numSamples) */ void QGLFormat::setSwapInterval(int interval) { + detach(); d->swapInterval = interval; } @@ -721,7 +744,7 @@ void QGLFormat::setOverlay(bool enable) is 0, which means the normal plane. The default for overlay formats is 1, which is the first overlay plane. - \sa setPlane() + \sa setPlane(), defaultOverlayFormat() */ int QGLFormat::plane() const { @@ -743,6 +766,7 @@ int QGLFormat::plane() const */ void QGLFormat::setPlane(int plane) { + detach(); d->pln = plane; } @@ -754,6 +778,7 @@ void QGLFormat::setPlane(int plane) void QGLFormat::setOption(QGL::FormatOptions opt) { + detach(); if (opt & 0xffff) d->opts |= opt; else @@ -783,6 +808,7 @@ bool QGLFormat::testOption(QGL::FormatOptions opt) const */ void QGLFormat::setDepthBufferSize(int size) { + detach(); if (size < 0) { qWarning("QGLFormat::setDepthBufferSize: Cannot set negative depth buffer size %d", size); return; @@ -809,6 +835,7 @@ int QGLFormat::depthBufferSize() const */ void QGLFormat::setRedBufferSize(int size) { + detach(); if (size < 0) { qWarning("QGLFormat::setRedBufferSize: Cannot set negative red buffer size %d", size); return; @@ -837,6 +864,7 @@ int QGLFormat::redBufferSize() const */ void QGLFormat::setGreenBufferSize(int size) { + detach(); if (size < 0) { qWarning("QGLFormat::setGreenBufferSize: Cannot set negative green buffer size %d", size); return; @@ -865,6 +893,7 @@ int QGLFormat::greenBufferSize() const */ void QGLFormat::setBlueBufferSize(int size) { + detach(); if (size < 0) { qWarning("QGLFormat::setBlueBufferSize: Cannot set negative blue buffer size %d", size); return; @@ -892,6 +921,7 @@ int QGLFormat::blueBufferSize() const */ void QGLFormat::setAlphaBufferSize(int size) { + detach(); if (size < 0) { qWarning("QGLFormat::setAlphaBufferSize: Cannot set negative alpha buffer size %d", size); return; @@ -918,6 +948,7 @@ int QGLFormat::alphaBufferSize() const */ void QGLFormat::setAccumBufferSize(int size) { + detach(); if (size < 0) { qWarning("QGLFormat::setAccumBufferSize: Cannot set negative accumulate buffer size %d", size); return; @@ -942,6 +973,7 @@ int QGLFormat::accumBufferSize() const */ void QGLFormat::setStencilBufferSize(int size) { + detach(); if (size < 0) { qWarning("QGLFormat::setStencilBufferSize: Cannot set negative stencil buffer size %d", size); return; @@ -1195,7 +1227,7 @@ void QGLFormat::setDefaultFormat(const QGLFormat &f) /*! Returns the default QGLFormat for overlay contexts. - The factory default overlay format is: + The default overlay format is: \list \i \link setDoubleBuffer() Double buffer:\endlink Disabled. \i \link setDepth() Depth buffer:\endlink Disabled. @@ -1206,6 +1238,7 @@ void QGLFormat::setDefaultFormat(const QGLFormat &f) \i \link setStereo() Stereo:\endlink Disabled. \i \link setDirectRendering() Direct rendering:\endlink Enabled. \i \link setOverlay() Overlay:\endlink Disabled. + \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. \i \link setPlane() Plane:\endlink 1 (i.e., first overlay plane). \endlist @@ -1256,7 +1289,12 @@ bool operator==(const QGLFormat& a, const QGLFormat& b) { return (int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize - && a.d->depthSize == b.d->depthSize; + && a.d->depthSize == b.d->depthSize + && a.d->redSize == b.d->redSize + && a.d->greenSize == b.d->greenSize + && a.d->blueSize == b.d->blueSize + && a.d->numSamples == b.d->numSamples + && a.d->swapInterval == b.d->swapInterval; } diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 1d9f623..0d72469 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -255,6 +255,8 @@ public: private: QGLFormatPrivate *d; + void detach(); + friend Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&); friend Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&); }; @@ -277,7 +279,6 @@ public: bool isSharing() const; void reset(); - // ### Qt 5: make format() return a const ref instead QGLFormat format() const; QGLFormat requestedFormat() const; void setFormat(const QGLFormat& format); @@ -403,10 +404,6 @@ private: #endif friend class QGLFramebufferObject; friend class QGLFramebufferObjectPrivate; -#ifdef Q_WS_WIN - friend bool qt_resolve_GLSL_functions(QGLContext *ctx); - friend bool qt_createGLSLProgram(QGLContext *ctx, GLuint &program, const char *shader_src, GLuint &shader); -#endif private: Q_DISABLE_COPY(QGLContext) }; @@ -447,7 +444,6 @@ public: bool doubleBuffer() const; void swapBuffers(); - // ### Qt 5: make format() return a const ref instead QGLFormat format() const; void setFormat(const QGLFormat& format); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 72ec35e..d4b7597 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -59,6 +59,7 @@ #include "QtCore/qthread.h" #include "QtCore/qthreadstorage.h" #include "QtCore/qhash.h" +#include "QtCore/qatomic.h" #include "private/qwidget_p.h" #include "qcache.h" @@ -127,7 +128,9 @@ QT_END_INCLUDE_NAMESPACE class QGLFormatPrivate { public: - QGLFormatPrivate() { + QGLFormatPrivate() + : ref(1) + { opts = QGL::DoubleBuffer | QGL::DepthBuffer | QGL::Rgba | QGL::DirectRendering | QGL::StencilBuffer; #if defined(QT_OPENGL_ES_2) opts |= QGL::SampleBuffers; @@ -137,6 +140,22 @@ public: numSamples = -1; swapInterval = -1; } + QGLFormatPrivate(const QGLFormatPrivate *other) + : ref(1), + opts(other->opts), + pln(other->pln), + depthSize(other->depthSize), + accumSize(other->accumSize), + stencilSize(other->stencilSize), + redSize(other->redSize), + greenSize(other->greenSize), + blueSize(other->blueSize), + alphaSize(other->alphaSize), + numSamples(other->numSamples), + swapInterval(other->swapInterval) + { + } + QAtomicInt ref; QGL::FormatOptions opts; int pln; int depthSize; diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index a03e627..94e3930 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -97,7 +97,7 @@ public: \i \link setSamples() Number of samples per pixels.\endlink \i \link setAttachment() Depth and/or stencil attachments.\endlink \i \link setTextureTarget() Texture target.\endlink - \i \link setInternalFormat() Internal format.\endlink + \i \link setInternalTextureFormat() Internal texture format.\endlink \endlist Note that the desired attachments or number of samples per pixels might not @@ -115,7 +115,7 @@ public: By default the format specifies a non-multisample framebuffer object with no attachments, texture target \c GL_TEXTURE_2D, and internal format \c GL_RGBA8. - \sa samples(), attachment(), target(), internalFormat() + \sa samples(), attachment(), target(), internalTextureFormat() */ #ifndef QT_OPENGL_ES @@ -234,23 +234,24 @@ GLenum QGLFramebufferObjectFormat::textureTarget() const } /*! - Sets the internal format of a framebuffer object's texture or multisample - framebuffer object's color buffer to \a internalFormat. + Sets the internal format of a framebuffer object's texture or + multisample framebuffer object's color buffer to + \a internalTextureFormat. - \sa internalFormat() + \sa internalTextureFormat() */ -void QGLFramebufferObjectFormat::setInternalFormat(GLenum internalFormat) +void QGLFramebufferObjectFormat::setInternalTextureFormat(GLenum internalTextureFormat) { - d->internal_format = internalFormat; + d->internal_format = internalTextureFormat; } /*! Returns the internal format of a framebuffer object's texture or multisample framebuffer object's color buffer. - \sa setInternalFormat() + \sa setInternalTextureFormat() */ -GLenum QGLFramebufferObjectFormat::internalFormat() const +GLenum QGLFramebufferObjectFormat::internalTextureFormat() const { return d->internal_format; } @@ -263,16 +264,16 @@ void QGLFramebufferObjectFormat::setTextureTarget(QMacCompatGLenum target) } /*! \internal */ -void QGLFramebufferObjectFormat::setInternalFormat(QMacCompatGLenum internalFormat) +void QGLFramebufferObjectFormat::setInternalTextureFormat(QMacCompatGLenum internalTextureFormat) { - d->internal_format = internalFormat; + d->internal_format = internalTextureFormat; } #endif class QGLFramebufferObjectPrivate { public: - QGLFramebufferObjectPrivate() : depth_stencil_buffer(0), valid(false), bound(false), ctx(0), previous_fbo(0), engine(0) {} + QGLFramebufferObjectPrivate() : depth_stencil_buffer(0), valid(false), ctx(0), previous_fbo(0), engine(0) {} ~QGLFramebufferObjectPrivate() {} void init(const QSize& sz, QGLFramebufferObject::Attachment attachment, @@ -286,7 +287,6 @@ public: QSize size; QGLFramebufferObjectFormat format; uint valid : 1; - uint bound : 1; QGLFramebufferObject::Attachment fbo_attachment; QGLContext *ctx; // for Windows extension ptrs GLuint previous_fbo; @@ -479,7 +479,7 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At format.setTextureTarget(target); format.setSamples(int(samples)); format.setAttachment(fbo_attachment); - format.setInternalFormat(internal_format); + format.setInternalTextureFormat(internal_format); } /*! @@ -636,7 +636,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, const QGLFramebuff : d_ptr(new QGLFramebufferObjectPrivate) { Q_D(QGLFramebufferObject); - d->init(size, format.attachment(), format.textureTarget(), format.internalFormat(), format.samples()); + d->init(size, format.attachment(), format.textureTarget(), format.internalTextureFormat(), format.samples()); } /*! \overload @@ -649,7 +649,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, const QGLFrame : d_ptr(new QGLFramebufferObjectPrivate) { Q_D(QGLFramebufferObject); - d->init(QSize(width, height), format.attachment(), format.textureTarget(), format.internalFormat(), format.samples()); + d->init(QSize(width, height), format.attachment(), format.textureTarget(), format.internalTextureFormat(), format.samples()); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS @@ -791,7 +791,7 @@ bool QGLFramebufferObject::bind() Q_D(QGLFramebufferObject); QGL_FUNC_CONTEXT; glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->fbo); - d->bound = d->valid = d->checkFramebufferStatus(); + d->valid = d->checkFramebufferStatus(); const QGLContext *context = QGLContext::currentContext(); if (d->valid && context) { // Save the previous setting to automatically restore in release(). @@ -822,7 +822,6 @@ bool QGLFramebufferObject::release() return false; Q_D(QGLFramebufferObject); QGL_FUNC_CONTEXT; - d->bound = false; const QGLContext *context = QGLContext::currentContext(); if (context) { @@ -1101,7 +1100,7 @@ QGLFramebufferObject::Attachment QGLFramebufferObject::attachment() const bool QGLFramebufferObject::isBound() const { Q_D(const QGLFramebufferObject); - return d->bound; + return d->ctx->d_ptr->current_fbo == d->fbo; } /*! diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h index ad14e50..ec1ae7d 100644 --- a/src/opengl/qglframebufferobject.h +++ b/src/opengl/qglframebufferobject.h @@ -151,12 +151,12 @@ public: void setTextureTarget(GLenum target); GLenum textureTarget() const; - void setInternalFormat(GLenum internalFormat); - GLenum internalFormat() const; + void setInternalTextureFormat(GLenum internalTextureFormat); + GLenum internalTextureFormat() const; #ifdef Q_MAC_COMPAT_GL_FUNCTIONS void setTextureTarget(QMacCompatGLenum target); - void setInternalFormat(QMacCompatGLenum internalFormat); + void setInternalTextureFormat(QMacCompatGLenum internalTextureFormat); #endif private: diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 56e5baa..68db9c0 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -324,7 +324,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const filter->setSource(generateBlurShader(radius(), quality() == Qt::SmoothTransformation)); QGLFramebufferObjectFormat format; - format.setInternalFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB)); + format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB)); QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(src.size(), format); if (!fbo) diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index f1558d1..f733109 100644 --- a/src/opengl/qgraphicsshadereffect.cpp +++ b/src/opengl/qgraphicsshadereffect.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgraphicsshadereffect.h" +#include "qgraphicsshadereffect_p.h" #if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) #include "qglshaderprogram.h" #include "gl2paintengineex/qglcustomshaderstage_p.h" @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE -/*! +/*# \class QGraphicsShaderEffect \brief The QGraphicsShaderEffect class is the base class for creating custom GLSL shader effects in a QGraphicsScene. @@ -175,7 +175,7 @@ public: #endif }; -/*! +/*# Constructs a shader effect and attaches it to \a parent. */ QGraphicsShaderEffect::QGraphicsShaderEffect(QObject *parent) @@ -183,7 +183,7 @@ QGraphicsShaderEffect::QGraphicsShaderEffect(QObject *parent) { } -/*! +/*# Destroys this shader effect. */ QGraphicsShaderEffect::~QGraphicsShaderEffect() @@ -194,7 +194,7 @@ QGraphicsShaderEffect::~QGraphicsShaderEffect() #endif } -/*! +/*# Returns the source code for the pixel shader fragment for this shader effect. The default is a shader that copies its incoming pixmap directly to the output with no effect @@ -208,7 +208,7 @@ QByteArray QGraphicsShaderEffect::pixelShaderFragment() const return d->pixelShaderFragment; } -/*! +/*# Sets the source code for the pixel shader fragment for this shader effect to \a code. @@ -238,7 +238,7 @@ void QGraphicsShaderEffect::setPixelShaderFragment(const QByteArray& code) } } -/*! +/*# \reimp */ void QGraphicsShaderEffect::draw(QPainter *painter, QGraphicsEffectSource *source) @@ -277,7 +277,7 @@ void QGraphicsShaderEffect::draw(QPainter *painter, QGraphicsEffectSource *sourc #endif } -/*! +/*# Sets the custom uniform variables on this shader effect to be dirty. The setUniforms() function will be called the next time the shader program corresponding to this effect is used. @@ -296,7 +296,7 @@ void QGraphicsShaderEffect::setUniformsDirty() #endif } -/*! +/*# Sets custom uniform variables on the current GL context when \a program is about to be used by the paint engine. diff --git a/src/opengl/qgraphicsshadereffect.h b/src/opengl/qgraphicsshadereffect_p.h index a186074..a313846 100644 --- a/src/opengl/qgraphicsshadereffect.h +++ b/src/opengl/qgraphicsshadereffect_p.h @@ -39,8 +39,19 @@ ** ****************************************************************************/ -#ifndef QGRAPHICSSHADEREFFECT_H -#define QGRAPHICSSHADEREFFECT_H +#ifndef QGRAPHICSSHADEREFFECT_P_H +#define QGRAPHICSSHADEREFFECT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// #include <QtGui/qgraphicseffect.h> @@ -80,4 +91,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QGRAPHICSSHADEREFFECT_H +#endif // QGRAPHICSSHADEREFFECT_P_H diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index b6f5012..d63d2ad 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -84,7 +84,7 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize if (format.samples() == requestFormat.samples() && format.attachment() == requestFormat.attachment() && format.textureTarget() == requestFormat.textureTarget() - && format.internalFormat() == requestFormat.internalFormat()) + && format.internalTextureFormat() == requestFormat.internalTextureFormat()) { // choose the fbo with a matching format and the closest size if (!candidate || areaDiff(requestSize, candidate) > areaDiff(requestSize, fbo)) @@ -467,7 +467,7 @@ QPaintEngine* QGLPixmapData::paintEngine() const QGLFramebufferObjectFormat format; format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); format.setSamples(4); - format.setInternalFormat(GLenum(m_hasAlpha ? GL_RGBA : GL_RGB)); + format.setInternalTextureFormat(GLenum(m_hasAlpha ? GL_RGBA : GL_RGB)); m_renderFbo = qgl_fbo_pool()->acquire(size(), format); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index f974938..a85b9ae 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -569,7 +569,7 @@ void QGLWindowSurface::updateGeometry() QGLFramebufferObjectFormat format; format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); - format.setInternalFormat(GLenum(GL_RGBA)); + format.setInternalTextureFormat(GLenum(GL_RGBA)); format.setTextureTarget(target); if (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 6535d65..2630348 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -925,12 +925,12 @@ void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) { - quint32 blittingFlags = alpha ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; + DFBSurfaceBlittingFlags blittingFlags = alpha ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; if (opacity != 255) { blittingFlags |= DSBLIT_BLEND_COLORALPHA; } surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); - surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blittingFlags)); + surface->SetBlittingFlags(surface, blittingFlags); } static inline uint ALPHA_MUL(uint x, uint a) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 211e8a5..84a74c9 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -79,6 +79,7 @@ public: IDirectFBScreen *dfbScreen; #ifdef QT_NO_DIRECTFB_WM IDirectFBSurface *primarySurface; + QColor backgroundColor; #endif #ifndef QT_NO_DIRECTFB_LAYER IDirectFBDisplayLayer *dfbLayer; @@ -94,7 +95,6 @@ public: #if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE IDirectFBImageProvider *imageProvider; #endif - QColor backgroundColor; IDirectFBSurface *cursorSurface; qint64 cursorImageKey; @@ -1277,10 +1277,9 @@ bool QDirectFBScreen::connect(const QString &displaySpec) if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive)) printDirectFBInfo(d_ptr->dfb, surface); #endif -#ifndef QT_NO_DIRECTFB_WM +#ifdef QT_DIRECTFB_WM surface->Release(surface); -#endif - +#else QRegExp backgroundColorRegExp(QLatin1String("bgcolor=?(.+)")); backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive); if (displayArgs.indexOf(backgroundColorRegExp) != -1) { @@ -1288,6 +1287,11 @@ bool QDirectFBScreen::connect(const QString &displaySpec) } if (!d_ptr->backgroundColor.isValid()) d_ptr->backgroundColor = Qt::green; + d_ptr->primarySurface->Clear(d_ptr->primarySurface, d_ptr->backgroundColor.red(), + d_ptr->backgroundColor.green(), d_ptr->backgroundColor.blue(), + d_ptr->backgroundColor.alpha()); + d_ptr->primarySurface->Flip(d_ptr->primarySurface, 0, d_ptr->flipFlags); +#endif return true; } @@ -1568,11 +1572,6 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion ®ion) #endif } -void QDirectFBScreen::erase(const QRegion ®ion) -{ - solidFill(d_ptr->backgroundColor, region); -} - QImage::Format QDirectFBScreen::alphaPixmapFormat() const { return d_ptr->alphaPixmapFormat; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 0ce7a53..46d06ef 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -215,7 +215,6 @@ public: void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, const QRegion ®ion, const QPoint &offset); void releaseDFBSurface(IDirectFBSurface *surface); - void erase(const QRegion ®ion); using QScreen::depth; static int depth(DFBSurfacePixelFormat format); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 61cfec51..b1ffe69 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -43,6 +43,7 @@ #include "qdirectfbscreen.h" #include "qdirectfbpaintengine.h" +#include <private/qwidget_p.h> #include <qwidget.h> #include <qwindowsystem_qws.h> #include <qpaintdevice.h> @@ -247,10 +248,6 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) updateFormat(); QWSWindowSurface::setGeometry(rect); -#ifdef QT_NO_DIRECTFB_WM - if (oldRect.isEmpty()) - screen->exposeRegion(screen->region(), 0); -#endif } QByteArray QDirectFBWindowSurface::permanentState() const @@ -319,48 +316,48 @@ inline bool isWidgetOpaque(const QWidget *w) return false; } - -void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, +void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { - // hw: make sure opacity information is updated before compositing - if (QWidget *win = window()) { + QWidget *win = window(); + if (!win) + return; - const bool opaque = isWidgetOpaque(win); - if (opaque != isOpaque()) { - SurfaceFlags flags = surfaceFlags(); - if (opaque) { - flags |= Opaque; - } else { - flags &= ~Opaque; - } - setSurfaceFlags(flags); + QWExtra *extra = qt_widget_private(widget)->extraData(); + if (extra && extra->proxyWidget) + return; + + // hw: make sure opacity information is updated before compositing + const bool opaque = isWidgetOpaque(win); + if (opaque != isOpaque()) { + SurfaceFlags flags = surfaceFlags(); + if (opaque) { + flags |= Opaque; + } else { + flags &= ~Opaque; } + setSurfaceFlags(flags); + } #ifndef QT_NO_DIRECTFB_WM - const quint8 winOpacity = quint8(win->windowOpacity() * 255); - quint8 opacity; + const quint8 winOpacity = quint8(win->windowOpacity() * 255); + quint8 opacity; - if (dfbWindow) { - dfbWindow->GetOpacity(dfbWindow, &opacity); - if (winOpacity != opacity) - dfbWindow->SetOpacity(dfbWindow, winOpacity); - } -#endif + if (dfbWindow) { + dfbWindow->GetOpacity(dfbWindow, &opacity); + if (winOpacity != opacity) + dfbWindow->SetOpacity(dfbWindow, winOpacity); } +#endif const QRect windowGeometry = QDirectFBWindowSurface::geometry(); #ifdef QT_NO_DIRECTFB_WM if (mode == Offscreen) { - QRegion r = region; - r.translate(offset + windowGeometry.topLeft()); - screen->exposeRegion(r, 0); - } else { - screen->flipSurface(dfbSurface, flipFlags, region, offset); - } -#else - screen->flipSurface(dfbSurface, flipFlags, region, offset); + screen->exposeRegion(region.translated(offset + geometry().topLeft()), 0); + + } else #endif + screen->flipSurface(dfbSurface, flipFlags, region, offset); #ifdef QT_DIRECTFB_TIMING enum { Secs = 3 }; diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp index 36a8df1..bbb6536 100644 --- a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp +++ b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp @@ -57,30 +57,35 @@ public: ~QTraceWindowSurface(); QPaintDevice *paintDevice(); + void beginPaint(const QRegion &rgn); void endPaint(const QRegion &rgn); + bool scroll(const QRegion &area, int dx, int dy); + private: QPaintBuffer *buffer; + QList<QRegion> updates; - QFile *outputFile; - QDataStream *out; - - int frameId; + qulonglong winId; }; QTraceWindowSurface::QTraceWindowSurface(QWidget *widget) : QRasterWindowSurface(widget) , buffer(0) - , outputFile(0) - , out(0) - , frameId(0) + , winId(0) { } QTraceWindowSurface::~QTraceWindowSurface() { - delete out; - delete outputFile; + if (buffer) { + QFile outputFile(QString(QLatin1String("qtgraphics-%0.trace")).arg(winId)); + if (outputFile.open(QIODevice::WriteOnly)) { + QDataStream out(&outputFile); + out << *buffer << updates; + } + delete buffer; + } } QPaintDevice *QTraceWindowSurface::paintDevice() @@ -92,28 +97,33 @@ QPaintDevice *QTraceWindowSurface::paintDevice() return buffer; } -void QTraceWindowSurface::endPaint(const QRegion &rgn) +void QTraceWindowSurface::beginPaint(const QRegion &rgn) { - if (!out) { - outputFile = new QFile(QString(QLatin1String("qtgraphics-%0.trace")).arg((qulonglong)window()->winId())); - if (outputFile->open(QIODevice::WriteOnly)) - out = new QDataStream(outputFile); - } + // ensure paint buffer is created + paintDevice(); + buffer->beginNewFrame(); + + QRasterWindowSurface::beginPaint(rgn); +} +void QTraceWindowSurface::endPaint(const QRegion &rgn) +{ QPainter p(QRasterWindowSurface::paintDevice()); - buffer->draw(&p); + buffer->draw(&p, buffer->numFrames()-1); p.end(); - if (out) { - *out << frameId++; - *out << (qulonglong)window()->winId(); - *out << geometry(); - *out << rgn; - *out << *buffer; - } + winId = (qulonglong)window()->winId(); + + updates << rgn; - delete buffer; - buffer = 0; + QRasterWindowSurface::endPaint(rgn); +} + +bool QTraceWindowSurface::scroll(const QRegion &, int, int) +{ + // TODO: scrolling should also be streamed and replayed + // to test scrolling performance + return false; } QTraceGraphicsSystem::QTraceGraphicsSystem() diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index 333a415..13bc6a6 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -146,11 +146,7 @@ void QScriptEngineAgentPrivate::returnEvent(const JSC::DebuggerCallFrame& frame, { Q_UNUSED(frame); Q_UNUSED(lineno); -#if ENABLE(JIT) - functionExit(JSC::JSValue(), sourceID); -#else Q_UNUSED(sourceID); -#endif } void QScriptEngineAgentPrivate::exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler) diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index bd5d161..ecfb060 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -610,7 +610,7 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c if (i < (int)scriptArgs.size()) actual = engine->scriptValueFromJSCValue(scriptArgs.at(i)); else - actual = QScriptValue::QScriptValue(QScriptValue::UndefinedValue); + actual = QScriptValue(QScriptValue::UndefinedValue); QScriptMetaType argType = mtd.argumentType(i); int tid = -1; QVariant v; diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 6187e6b..7bbe122 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -908,8 +908,9 @@ bool QDB2Result::fetchFirst() SQL_FETCH_FIRST, 0); if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) { - setLastError(qMakeError(QCoreApplication::translate("QDB2Result", "Unable to fetch first"), - QSqlError::StatementError, d)); + if(r!= SQL_NO_DATA) + setLastError(qMakeError(QCoreApplication::translate("QDB2Result", "Unable to fetch first"), + QSqlError::StatementError, d)); return false; } setAt(0); diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index e2c3d92..35b8595 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -810,24 +810,27 @@ static bool resolveColor(const QStringRef &colorStr, QColor &color, QSvgHandler case 'r': { - // starts with "rgb(" - if (colorStrTr == QLatin1String("rgb(")) { + // starts with "rgb(", ends with ")" and consists of at least 7 characters "rgb(,,)" + if (colorStrTr.length() >= 7 && colorStrTr.at(colorStrTr.length() - 1) == QLatin1Char(')') + && QStringRef(colorStrTr.string(), colorStrTr.position(), 4) == QLatin1String("rgb(")) { const QChar *s = colorStrTr.constData() + 4; QVector<qreal> compo = parseNumbersList(s); //1 means that it failed after reaching non-parsable //character which is going to be "%" if (compo.size() == 1) { - const QChar *s = colorStrTr.constData() + 4; + s = colorStrTr.constData() + 4; compo = parsePercentageList(s); - compo[0] *= (qreal)2.55; - compo[1] *= (qreal)2.55; - compo[2] *= (qreal)2.55; + for (int i = 0; i < compo.size(); ++i) + compo[i] *= (qreal)2.55; } - color = QColor(int(compo[0]), - int(compo[1]), - int(compo[2])); - return true; + if (compo.size() == 3) { + color = QColor(int(compo[0]), + int(compo[1]), + int(compo[2])); + return true; + } + return false; } } break; diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 9d23c8b..1ab7401 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -113,8 +113,12 @@ namespace QTest QTEST_ASSERT(false); } QSpontaneKeyEvent::setSpontaneous(&me); - if (!qApp->notify(widget, &me)) - QTest::qWarn("Mouse event not accepted by receiving widget"); + if (!qApp->notify(widget, &me)) { + static const char *mouseActionNames[] = + { "MousePress", "MouseRelease", "MouseClick", "MouseDClick", "MouseMove" }; + QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving widget"); + QTest::qWarn(warning.arg(QString::fromLatin1(mouseActionNames[static_cast<int>(action)])).toAscii().data()); + } } diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt index 1a6cfeb..72ec3c5 100644 --- a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt @@ -1,8 +1,8 @@ -.*/lupdate/testdata/good/lacksqobject/main.cpp:17: Class 'B' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:58: Class 'B' lacks Q_OBJECT macro -.*/lupdate/testdata/good/lacksqobject/main.cpp:24: Class 'C' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:65: Class 'C' lacks Q_OBJECT macro -.*/lupdate/testdata/good/lacksqobject/main.cpp:37: Class 'nsB::B' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:78: Class 'nsB::B' lacks Q_OBJECT macro -.*/lupdate/testdata/good/lacksqobject/main.cpp:43: Class 'nsB::C' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:84: Class 'nsB::C' lacks Q_OBJECT macro diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp index e1fca6e..0f7f9fb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp @@ -1,3 +1,4 @@ + /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result index de2c45a..b328e90 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result @@ -4,22 +4,22 @@ <context> <name>FindDialog</name> <message> - <location filename="finddialog.cpp" line="19"/> + <location filename="finddialog.cpp" line="85"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="29"/> + <location filename="finddialog.cpp" line="135"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="31"/> + <location filename="finddialog.cpp" line="137"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="33"/> + <location filename="finddialog.cpp" line="139"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result index 4012182..cfd11b1 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result @@ -8,22 +8,22 @@ <translation type="obsolete">Skriv inn teksten du soker etter</translation> </message> <message> - <location filename="finddialog.cpp" line="18"/> + <location filename="finddialog.cpp" line="88"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="28"/> + <location filename="finddialog.cpp" line="138"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="30"/> + <location filename="finddialog.cpp" line="140"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="finddialog.cpp" line="32"/> + <location filename="finddialog.cpp" line="142"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result index 4c5f74d..1a2244b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result @@ -4,18 +4,18 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="15"/> + <location filename="project.ui" line="57"/> <source>Qt Assistant - Find Text</source> <oldsource>Qt Assistant - Find text</oldsource> <translation type="unfinished">Qt Assistant - Finn tekst</translation> </message> <message> - <location filename="project.ui" line="18"/> + <location filename="project.ui" line="60"/> <source>300px</source> <translation>300px</translation> </message> <message> - <location filename="project.ui" line="21"/> + <location filename="project.ui" line="63"/> <source>401 pixels</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui index d022101..1d8a716 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui @@ -1,6 +1,7 @@ <ui version="4.0" > <author></author> - <comment>********************************************************************* + <comment> +********************************************************************* ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) @@ -39,7 +40,8 @@ ** ** $QT_END_LICENSE$ ** -*********************************************************************</comment> +********************************************************************* +</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result index ec1f02f..a7ae155 100644 --- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result @@ -4,9 +4,9 @@ <context> <name>context</name> <message> - <location filename="finddialog.cpp" line="43"/> - <location filename="finddialog.cpp" line="48"/> - <location filename="main.cpp" line="47"/> + <location filename="finddialog.cpp" line="42"/> + <location filename="finddialog.cpp" line="47"/> + <location filename="main.cpp" line="46"/> <source>just a message</source> <extracomment>This is one comment ---------- diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result index bb5b739..c1a34bd 100644 --- a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result @@ -30,7 +30,7 @@ <context> <name>Outer::Middle1::Different</name> <message> - <location filename="main.cpp" line="106/> + <location filename="main.cpp" line="106"/> <source>different namespaced class def</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 9e4e319..d63c7c3 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -4,14 +4,14 @@ <context> <name></name> <message id="this_a_id"> - <location filename="main.cpp" line="185"/> + <location filename="main.cpp" line="226"/> <source>This is supposed to be quoted " newline backslashed \ stuff.</source> <extracomment>again an extra comment, this time for id-based NOOP</extracomment> <translation type="unfinished"></translation> </message> <message id="this_another_id" numerus="yes"> - <location filename="main.cpp" line="189"/> + <location filename="main.cpp" line="230"/> <source>This needs to be here. Really.</source> <translation type="unfinished"> <numerusform></numerusform> @@ -259,7 +259,7 @@ backslashed \ stuff.</source> <context> <name>TestingTake17</name> <message id="this_is_an_id"> - <location filename="main.cpp" line="170"/> + <location filename="main.cpp" line="211"/> <source>something cool</source> <extracomment>random comment</extracomment> <translation type="unfinished"></translation> @@ -267,12 +267,12 @@ backslashed \ stuff.</source> <extra-loc-layout_id>fooish_bar</extra-loc-layout_id> </message> <message> - <location filename="main.cpp" line="172"/> + <location filename="main.cpp" line="213"/> <source>less cool</source> <translation type="unfinished"></translation> </message> <message id="another_id"> - <location filename="main.cpp" line="175"/> + <location filename="main.cpp" line="216"/> <source>even more cool</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt index e3f7926..8d057d8 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt @@ -1,7 +1,7 @@ -.*/lupdate/testdata/good/parsecpp2/main.cpp:10: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:51: Excess closing brace .* -.*/lupdate/testdata/good/parsecpp2/main.cpp:14: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:55: Excess closing brace .* -.*/lupdate/testdata/good/parsecpp2/main.cpp:20: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:61: Excess closing brace .* -.*/lupdate/testdata/good/parsecpp2/main.cpp:24: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:65: Excess closing brace .* diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result index 7f665f4..93adae4 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -4,12 +4,12 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="15"/> + <location filename="project.ui" line="48"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message utf8="true"> - <location filename="project.ui" line="18"/> + <location filename="project.ui" line="51"/> <source>Finn tekst - Der Bjørn möchte auch mal.</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result index c15b986..e356921 100644 --- a/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result @@ -4,18 +4,18 @@ <context> <name>Foo</name> <message> - <location filename="main.cpp" line="46"/> + <location filename="main.cpp" line="45"/> <source>XXX</source> <comment>YYY</comment> <translation type="unfinished"></translation> </message> <message> - <location filename="main.cpp" line="51"/> + <location filename="main.cpp" line="50"/> <source>CTOR</source> <translation type="unfinished"></translation> </message> <message> - <location filename="main.cpp" line="56"/> + <location filename="main.cpp" line="55"/> <source>BAR</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result index b86edae..5c3c21c 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result @@ -4,22 +4,22 @@ <context> <name>FindDialog</name> <message> - <location filename="sub/finddialog.cpp" line="85"/> + <location filename="sub/finddialog.cpp" line="57"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="135"/> + <location filename="sub/finddialog.cpp" line="66"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="137"/> + <location filename="sub/finddialog.cpp" line="68"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="139"/> + <location filename="sub/finddialog.cpp" line="70"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result index 835b3e0..95a34fa 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result @@ -4,32 +4,32 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="55"/> + <location filename="project.ui" line="57"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message> - <location filename="project.ui" line="58"/> + <location filename="project.ui" line="60"/> <source>Finn tekst</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="85"/> + <location filename="sub/finddialog.cpp" line="57"/> <source>Enter the text you want to find.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="135"/> + <location filename="sub/finddialog.cpp" line="66"/> <source>Search reached end of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="137"/> + <location filename="sub/finddialog.cpp" line="68"/> <source>Search reached start of the document</source> <translation type="unfinished"></translation> </message> <message> - <location filename="sub/finddialog.cpp" line="139"/> + <location filename="sub/finddialog.cpp" line="70"/> <source>Text not found</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui index 709b3e8..d25001f 100644 --- a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui @@ -1,6 +1,7 @@ <ui version="4.0" > <author></author> -<comment>********************************************************************* +<comment> +********************************************************************* ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) @@ -39,7 +40,8 @@ ** ** $QT_END_LICENSE$ ** -*********************************************************************</comment> +********************************************************************* +</comment> <exportmacro></exportmacro> <class>FindDialog</class> <widget class="QWidget" name="FindDialog" > diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index be33862..0773184 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -879,12 +879,12 @@ void tst_QComboBox::hide() { testWidget->addItem("foo"); testWidget->showPopup(); - QTest::qWait(500); //allow combobox effect to complete - QVERIFY(testWidget->view()); - QVERIFY(testWidget->view()->isVisible()); + QTest::qWait(200); //allow combobox effect to complete + QTRY_VERIFY(testWidget->view()); + QTRY_VERIFY(testWidget->view()->isVisible()); testWidget->hidePopup(); - QTest::qWait(500); //allow combobox effect to complete - QVERIFY(!testWidget->view()->isVisible()); + QTest::qWait(200); //allow combobox effect to complete + QTRY_VERIFY(!testWidget->view()->isVisible()); testWidget->hide(); QVERIFY(!testWidget->isVisible()); } diff --git a/tests/auto/qfiledialog/qfiledialog.pro b/tests/auto/qfiledialog/qfiledialog.pro index bea7716..058acc5 100644 --- a/tests/auto/qfiledialog/qfiledialog.pro +++ b/tests/auto/qfiledialog/qfiledialog.pro @@ -16,3 +16,12 @@ wince*|symbian: { symbian:TARGET.EPOCHEAPSIZE="0x100 0x1000000" symbian:HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h + +wince*: { + DEFINES += SRCDIR=\\\"./\\\" +} symbian: { + TARGET.UID3 = 0xE0340003 + DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x","")) +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 161efe0..67be797 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -297,7 +297,8 @@ void tst_QFiledialog::filesSelectedSignal() QNonNativeFileDialog fd; fd.setViewMode(QFileDialog::List); fd.setOptions(QFileDialog::DontUseNativeDialog); - fd.setDirectory(QDir::homePath()); + QDir testDir(SRCDIR"/../../.."); + fd.setDirectory(testDir); QFETCH(QFileDialog::FileMode, fileMode); fd.setFileMode(fileMode); QSignalSpy spyFilesSelected(&fd, SIGNAL(filesSelected(const QStringList &))); diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index 3a2d90f..5d4c520 100644 --- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp @@ -180,7 +180,7 @@ void tst_QFontMetrics::elidedText() QFETCH(QString, text); QFontMetrics fm(font); int w = fm.width(text); - QString newtext = fm.elidedText(text,Qt::ElideRight,w, 0); + QString newtext = fm.elidedText(text,Qt::ElideRight,w+1, 0); QCOMPARE(text,newtext); // should not elide newtext = fm.elidedText(text,Qt::ElideRight,w-1, 0); QVERIFY(text != newtext); // should elide @@ -212,10 +212,10 @@ void tst_QFontMetrics::elidedMultiLength() QFontMetrics fm = QFontMetrics(QFont()); int width_long = fm.width(text1_long); QCOMPARE(fm.elidedText(text1,Qt::ElideRight, 8000), text1_long); - QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long), text1_long); + QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long + 1), text1_long); QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long - 1), text1_short); int width_short = fm.width(text1_short); - QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short), text1_short); + QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short + 1), text1_short); QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short - 1), text1_small); // Not even wide enough for "small" - should use ellipsis diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 77e32ef..650c1ca 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -79,6 +79,7 @@ private slots: void glWidgetReparent(); void stackedFBOs(); void colormap(); + void fboFormat(); }; tst_QGL::tst_QGL() @@ -230,9 +231,15 @@ void tst_QGL::getSetCheck() // bool QGLFormat::sampleBuffers() // void QGLFormat::setSampleBuffers(bool) +#if !defined(QT_OPENGL_ES_2) QCOMPARE(false, obj1.sampleBuffers()); QVERIFY(!obj1.testOption(QGL::SampleBuffers)); QVERIFY(obj1.testOption(QGL::NoSampleBuffers)); +#else + QCOMPARE(true, obj1.sampleBuffers()); + QVERIFY(obj1.testOption(QGL::SampleBuffers)); + QVERIFY(!obj1.testOption(QGL::NoSampleBuffers)); +#endif obj1.setSampleBuffers(false); QCOMPARE(false, obj1.sampleBuffers()); QVERIFY(obj1.testOption(QGL::NoSampleBuffers)); @@ -402,6 +409,154 @@ void tst_QGL::getSetCheck() obj1.setPlane(TEST_INT_MAX); QCOMPARE(TEST_INT_MAX, obj1.plane()); + // operator== and operator!= for QGLFormat + QGLFormat format1; + QGLFormat format2; + + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + format1.setDoubleBuffer(false); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setDoubleBuffer(false); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setDepthBufferSize(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setDepthBufferSize(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setAccumBufferSize(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setAccumBufferSize(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setRedBufferSize(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setRedBufferSize(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setGreenBufferSize(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setGreenBufferSize(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setBlueBufferSize(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setBlueBufferSize(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setAlphaBufferSize(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setAlphaBufferSize(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setStencilBufferSize(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setStencilBufferSize(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setSamples(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setSamples(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setSwapInterval(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setSwapInterval(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + format1.setPlane(8); + QVERIFY(!(format1 == format2)); + QVERIFY(format1 != format2); + format2.setPlane(8); + QVERIFY(format1 == format2); + QVERIFY(!(format1 != format2)); + + // Copy constructor and assignment for QGLFormat. + QGLFormat format3(format1); + QGLFormat format4; + QVERIFY(format1 == format3); + QVERIFY(format1 != format4); + format4 = format1; + QVERIFY(format1 == format4); + + // Check that modifying a copy doesn't affect the original. + format3.setRedBufferSize(16); + format4.setPlane(16); + QCOMPARE(format1.redBufferSize(), 8); + QCOMPARE(format1.plane(), 8); + + // Check the QGLFormat constructor that takes an option list. + QGLFormat format5 + (QGL::DepthBuffer | QGL::StereoBuffers | QGL::ColorIndex, 3); + QVERIFY(format5.depth()); + QVERIFY(format5.stereo()); + QVERIFY(format5.doubleBuffer()); // From defaultFormat() + QVERIFY(!format5.hasOverlay()); // From defaultFormat() + QVERIFY(!format5.rgba()); + QCOMPARE(format5.plane(), 3); + + // The default format should be the same as QGLFormat(). + QVERIFY(QGLFormat::defaultFormat() == QGLFormat()); + + // Modify the default format and check that it was changed. + QGLFormat::setDefaultFormat(format1); + QVERIFY(QGLFormat::defaultFormat() == format1); + + // Restore the default format. + QGLFormat::setDefaultFormat(QGLFormat()); + QVERIFY(QGLFormat::defaultFormat() == QGLFormat()); + + // Check the default overlay format's expected values. + QGLFormat overlay(QGLFormat::defaultOverlayFormat()); + QCOMPARE(overlay.depthBufferSize(), -1); + QCOMPARE(overlay.accumBufferSize(), -1); + QCOMPARE(overlay.redBufferSize(), -1); + QCOMPARE(overlay.greenBufferSize(), -1); + QCOMPARE(overlay.blueBufferSize(), -1); + QCOMPARE(overlay.alphaBufferSize(), -1); + QCOMPARE(overlay.samples(), -1); + QCOMPARE(overlay.swapInterval(), -1); + QCOMPARE(overlay.plane(), 1); + QVERIFY(!overlay.sampleBuffers()); + QVERIFY(!overlay.doubleBuffer()); + QVERIFY(!overlay.depth()); + QVERIFY(!overlay.rgba()); + QVERIFY(!overlay.alpha()); + QVERIFY(!overlay.accum()); + QVERIFY(!overlay.stencil()); + QVERIFY(!overlay.stereo()); + QVERIFY(overlay.directRendering()); // Only option that should be on. + QVERIFY(!overlay.hasOverlay()); // Overlay doesn't need an overlay! + + // Modify the default overlay format and check that it was changed. + QGLFormat::setDefaultOverlayFormat(format1); + QVERIFY(QGLFormat::defaultOverlayFormat() == format1); + + // Restore the default overlay format. + QGLFormat::setDefaultOverlayFormat(overlay); + QVERIFY(QGLFormat::defaultOverlayFormat() == overlay); + MyGLContext obj2(obj1); // bool QGLContext::windowCreated() // void QGLContext::setWindowCreated(bool) @@ -1224,5 +1379,60 @@ void tst_QGL::colormap() QCOMPARE(cmap4.size(), 256); } +#ifndef QT_OPENGL_ES +#define DEFAULT_FORMAT GL_RGBA8 +#else +#define DEFAULT_FORMAT GL_RGBA +#endif + +#ifndef GL_TEXTURE_3D +#define GL_TEXTURE_3D 0x806F +#endif + +#ifndef GL_RGB16 +#define GL_RGB16 0x8054 +#endif + +void tst_QGL::fboFormat() +{ + // Check the initial conditions. + QGLFramebufferObjectFormat format1; + QCOMPARE(format1.samples(), 0); + QVERIFY(format1.attachment() == QGLFramebufferObject::NoAttachment); + QCOMPARE(int(format1.textureTarget()), int(GL_TEXTURE_2D)); + QCOMPARE(int(format1.internalTextureFormat()), int(DEFAULT_FORMAT)); + + // Modify the values and re-check. + format1.setSamples(8); + format1.setAttachment(QGLFramebufferObject::CombinedDepthStencil); + format1.setTextureTarget(GL_TEXTURE_3D); + format1.setInternalTextureFormat(GL_RGB16); + QCOMPARE(format1.samples(), 8); + QVERIFY(format1.attachment() == QGLFramebufferObject::CombinedDepthStencil); + QCOMPARE(int(format1.textureTarget()), int(GL_TEXTURE_3D)); + QCOMPARE(int(format1.internalTextureFormat()), int(GL_RGB16)); + + // Make copies and check that they are the same. + QGLFramebufferObjectFormat format2(format1); + QGLFramebufferObjectFormat format3; + QCOMPARE(format2.samples(), 8); + QVERIFY(format2.attachment() == QGLFramebufferObject::CombinedDepthStencil); + QCOMPARE(int(format2.textureTarget()), int(GL_TEXTURE_3D)); + QCOMPARE(int(format2.internalTextureFormat()), int(GL_RGB16)); + format3 = format1; + QCOMPARE(format3.samples(), 8); + QVERIFY(format3.attachment() == QGLFramebufferObject::CombinedDepthStencil); + QCOMPARE(int(format3.textureTarget()), int(GL_TEXTURE_3D)); + QCOMPARE(int(format3.internalTextureFormat()), int(GL_RGB16)); + + // Modify the copies and check that the original is unchanged. + format2.setSamples(9); + format3.setTextureTarget(GL_TEXTURE_2D); + QCOMPARE(format1.samples(), 8); + QVERIFY(format1.attachment() == QGLFramebufferObject::CombinedDepthStencil); + QCOMPARE(int(format1.textureTarget()), int(GL_TEXTURE_3D)); + QCOMPARE(int(format1.internalTextureFormat()), int(GL_RGB16)); +} + QTEST_MAIN(tst_QGL) #include "tst_qgl.moc" diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index aa1f2b8..77c2d45 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -292,6 +292,7 @@ private slots: void activate(); void setActivePanelOnInactiveScene(); void activationOnShowHide(); + void moveWhileDeleting(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -1239,6 +1240,7 @@ void tst_QGraphicsItem::selected() QVERIFY(!item->isSelected()); // Click inside and check that it's selected + QTest::mouseMove(view.viewport()); QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item->scenePos())); QCOMPARE(item->values.size(), 11); QCOMPARE(item->values.last(), true); @@ -1246,7 +1248,6 @@ void tst_QGraphicsItem::selected() // Click outside and check that it's not selected QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item->scenePos() + QPointF(item->boundingRect().width(), item->boundingRect().height()))); - QCOMPARE(item->values.size(), 12); QCOMPARE(item->values.last(), false); QVERIFY(!item->isSelected()); @@ -8103,5 +8104,64 @@ void tst_QGraphicsItem::activationOnShowHide() QVERIFY(otherItem->isActive()); } +class MoveWhileDying : public QGraphicsRectItem +{ +public: + MoveWhileDying(QGraphicsItem *parent = 0) + : QGraphicsRectItem(parent) + { } + ~MoveWhileDying() + { + foreach (QGraphicsItem *c, childItems()) { + foreach (QGraphicsItem *cc, c->childItems()) { + cc->moveBy(10, 10); + } + c->moveBy(10, 10); + } + if (QGraphicsItem *p = parentItem()) { p->moveBy(10, 10); } + } +}; + +void tst_QGraphicsItem::moveWhileDeleting() +{ + QGraphicsScene scene; + QGraphicsRectItem *rect = new QGraphicsRectItem; + MoveWhileDying *silly = new MoveWhileDying(rect); + QGraphicsRectItem *child = new QGraphicsRectItem(silly); + scene.addItem(rect); + delete rect; // don't crash! + + rect = new QGraphicsRectItem; + silly = new MoveWhileDying(rect); + child = new QGraphicsRectItem(silly); + + QGraphicsView view(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(125); + + delete rect; + + rect = new QGraphicsRectItem; + rect->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + silly = new MoveWhileDying(rect); + child = new QGraphicsRectItem(silly); + + QTest::qWait(125); + + delete rect; + + rect = new MoveWhileDying; + rect->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + child = new QGraphicsRectItem(rect); + silly = new MoveWhileDying(child); + + QTest::qWait(125); + + delete rect; +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 03054f9..d1193bd 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -157,6 +157,7 @@ private slots: void shortcutsDeletion(); void painterStateProtectionOnWindowFrame(); void ensureClipping(); + void respectHFW(); // Task fixes void task236127_bspTreeIndexFails(); @@ -2543,6 +2544,84 @@ void tst_QGraphicsWidget::ensureClipping() QVERIFY(scene.drawnItems.contains(childitem)); } +class HFWWidget : public QGraphicsWidget +{ +public: + HFWWidget() : QGraphicsWidget(0, Qt::Window) + { + QSizePolicy sp; + sp.setHeightForWidth(true); + setSizePolicy(sp); + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + { + Q_UNUSED(option); + Q_UNUSED(widget); + qreal w = rect().width(); + QRectF box(0, 0, w, 2400/w); + painter->drawRoundRect(box); + painter->drawLine(box.topLeft(), box.bottomRight()); + painter->drawLine(box.bottomLeft(), box.topRight()); + } + +protected: + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const + { + qreal w = constraint.width(); + switch (which) { + case Qt::MinimumSize: + if (w >= 0 && constraint.height() < 0) { + // keep the same area of 60x40 = 2400 + return QSizeF(w, 2400.0/w); + } else { + return QSizeF(10, 10); + } + break; + case Qt::PreferredSize: + return QSizeF(48.989794, 48.989794); + default: + break; + } + return QGraphicsWidget::sizeHint(which, constraint); + } +}; + +void tst_QGraphicsWidget::respectHFW() +{ + QGraphicsScene scene; + HFWWidget *window = new HFWWidget; + scene.addItem(window); + QGraphicsView *view = new QGraphicsView(&scene); + view->resize(400, 400); + view->setSceneRect(-100, -100, 300,300); + + view->show(); + window->setGeometry(0, 0, 70, 70); + + { // here we go - simulate a interactive resize of the window + QTest::qWait(200); + QTest::mouseMove(view, view->mapFromScene(71, 71)); // bottom right corner + QTest::qWait(200); + + QTest::mousePress(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(71, 71), 200); + view->grabMouse(); + // move both mouse cursor and set correct event in order to emulate resize + QTest::mouseMove(view->viewport(), view->mapFromScene(60, 30), 200); + QMouseEvent e = QMouseEvent(QEvent::MouseMove, + view->mapFromScene(60, 20), + Qt::NoButton, + Qt::LeftButton, + Qt::NoModifier); + QApplication::sendEvent(view->viewport(), &e); + view->releaseMouse(); + } + QTest::qWait(200); + const QSizeF winSize = window->size(); + qreal minHFW = window->effectiveSizeHint(Qt::MinimumSize, QSizeF(winSize.width(), -1)).height(); + QVERIFY(qAbs(minHFW - winSize.height()) < 1); +} + QTEST_MAIN(tst_QGraphicsWidget) #include "tst_qgraphicswidget.moc" diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp index dc013b9..1ef77c0 100644 --- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp @@ -1155,7 +1155,7 @@ void tst_QItemDelegate::task257859_finalizeEdit() view.edit(index); QTest::qWait(30); - QList<QWidget*> lineEditors = qFindChildren<QWidget *>(view.viewport()); + QList<QLineEdit *> lineEditors = qFindChildren<QLineEdit *>(view.viewport()); QCOMPARE(lineEditors.count(), 1); QPointer<QWidget> editor = lineEditors.at(0); diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 2281fb7..c598aeb 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -424,6 +424,18 @@ void tst_QListView::hideRows() view.setRowHidden(0, false); QVERIFY(!view.isRowHidden(0)); + QStandardItemModel sim(0); + QStandardItem *root = new QStandardItem("Root row"); + for (int i=0;i<5;i++) + root->appendRow(new QStandardItem(QString("Row %1").arg(i))); + sim.appendRow(root); + view.setModel(&sim); + view.setRootIndex(root->index()); + QVERIFY(!view.isRowHidden(0)); + view.setRowHidden(0, true); + QVERIFY(view.isRowHidden(0)); + view.setRowHidden(0, false); + QVERIFY(!view.isRowHidden(0)); } diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index 8c4415c..78ba46b 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -1835,7 +1835,10 @@ void tst_QMdiSubWindow::setFont() newFont.setBold(true); subWindow->setFont(newFont); qApp->processEvents(); - QCOMPARE(subWindow->font(), newFont); + const QFont &swFont = subWindow->font(); + QCOMPARE(swFont.family(), newFont.family()); + QCOMPARE(swFont.pointSize(), newFont.pointSize()); + QCOMPARE(swFont.weight(), newFont.weight()); QImage newTitleBar = QPixmap::grabWidget(subWindow, titleBarRect).toImage(); QVERIFY(newTitleBar != originalTitleBar); diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index 89be43f..aa64f13 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -105,6 +105,8 @@ private slots: void testCustomPageSizes(); void printDialogCompleter(); + void testActualNumCopies(); + private: }; @@ -959,5 +961,12 @@ void tst_QPrinter::printDialogCompleter() #endif } +void tst_QPrinter::testActualNumCopies() +{ + QPrinter p; + p.setNumCopies(15); + QCOMPARE(p.actualNumCopies(), 15); +} + QTEST_MAIN(tst_QPrinter) #include "tst_qprinter.moc" diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 8fe6839..3d1cbe8 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -177,6 +177,21 @@ struct ScriptEngineEvent value(exception), hasExceptionHandler(hasHandler) { } + static QString typeToQString(Type t) + { + switch (t) { + case ScriptEngineEvent::ScriptLoad: return "ScriptLoad"; + case ScriptEngineEvent::ScriptUnload: return "ScriptUnload"; + case ScriptEngineEvent::ContextPush: return "ContextPush"; + case ScriptEngineEvent::ContextPop: return "ContextPop"; + case ScriptEngineEvent::FunctionEntry: return "FunctionEntry"; + case ScriptEngineEvent::FunctionExit: return "FunctionExit"; + case ScriptEngineEvent::PositionChange: return "PositionChange"; + case ScriptEngineEvent::ExceptionThrow: return "ExceptionThrow"; + case ScriptEngineEvent::ExceptionCatch: return "ExceptionCatch"; + case ScriptEngineEvent::DebuggerInvocationRequest: return "DebuggerInvocationRequest"; + } + } }; class ScriptEngineSpy : public QScriptEngineAgent, public QList<ScriptEngineEvent> @@ -1834,7 +1849,7 @@ void tst_QScriptEngineAgent::eventOrder_functions() eng.evaluate("foo('ciao')"); - //QCOMPARE(spy->count(), 45); + QCOMPARE(spy->count(), 45); // load QCOMPARE(spy->at(25).type, ScriptEngineEvent::ScriptLoad); @@ -1875,33 +1890,21 @@ void tst_QScriptEngineAgent::eventOrder_functions() // bar() exit QCOMPARE(spy->at(39).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(39).scriptId, spy->at(21).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(39).value.isError()); // restore context QCOMPARE(spy->at(40).type, ScriptEngineEvent::ContextPop); // foo() exit QCOMPARE(spy->at(41).type, ScriptEngineEvent::FunctionExit); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "script ID for function exit is not correct when JIT is enabled", Continue); QCOMPARE(spy->at(41).scriptId, spy->at(0).scriptId); QVERIFY(spy->at(41).value.isError()); // restore context QCOMPARE(spy->at(42).type, ScriptEngineEvent::ContextPop); // evaluate() exit QCOMPARE(spy->at(43).type, ScriptEngineEvent::FunctionExit); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "script ID for function exit is not correct when JIT is enabled", Continue); QCOMPARE(spy->at(43).scriptId, spy->at(26).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(43).value.isError()); // unload - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "wrong event type when JIT is enabled", Continue); QCOMPARE(spy->at(44).type, ScriptEngineEvent::ScriptUnload); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "wrong script ID when JIT is enabled", Continue); QCOMPARE(spy->at(44).scriptId, spy->at(25).scriptId); } delete spy; @@ -1958,8 +1961,6 @@ void tst_QScriptEngineAgent::eventOrder_signalsHandling() emit testSignal(123); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "too many events reported when JIT is enabled", Abort); QCOMPARE(spy->count(), 14); // new context QCOMPARE(spy->at(4).type, ScriptEngineEvent::ContextPush); diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index deebb1b..36b17ed 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -381,6 +381,9 @@ void tst_QSqlQuery::char1SelectUnicode() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + if(db.driverName().startsWith("QDB2")) + QSKIP("Needs someone with more Unicode knowledge than I have to fix", SkipSingle); + if ( db.driver()->hasFeature( QSqlDriver::Unicode ) ) { QString uniStr( QChar( 0xfb50 ) ); QSqlQuery q( db ); @@ -1613,6 +1616,8 @@ void tst_QSqlQuery::prepare_bind_exec() CHECK_DATABASE( db ); if(db.driverName().startsWith("QIBASE") && (db.databaseName() == "silence.nokia.troll.no:c:\\ibase\\testdb_ascii" || db.databaseName() == "/opt/interbase/qttest.gdb")) QSKIP("Can't transliterate extended unicode to ascii", SkipSingle); + if(db.driverName().startsWith("QDB2")) + QSKIP("Needs someone with more Unicode knowledge than I have to fix", SkipSingle); { // new scope for SQLITE diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 55b6e96..499d4e0 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -828,7 +828,8 @@ void tst_QStyleSheetStyle::hoverColors() widgets << new QLabel("<b>TESTING</b>"); foreach (QWidget *widget, widgets) { - QDialog frame; + //without Qt::X11BypassWindowManagerHint the window manager may move the window after we moved the cursor + QDialog frame(0, Qt::X11BypassWindowManagerHint); QLayout* layout = new QGridLayout; QLineEdit* dummy = new QLineEdit; diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 1835373..0c1d334 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -100,6 +100,9 @@ private slots: void task240325(); + void stylesheetFont_data(); + void stylesheetFont(); + void toHtml_data(); void toHtml(); void toHtml2(); @@ -571,6 +574,63 @@ void tst_QTextDocument::task240325() } } +void tst_QTextDocument::stylesheetFont_data() +{ + QTest::addColumn<QString>("stylesheet"); + QTest::addColumn<QFont>("font"); + + { + QFont font; + font.setBold(true); + font.setPixelSize(64); + + QTest::newRow("Regular font specification") + << "font-size: 64px; font-weight: bold;" + << font; + } + + + { + QFont font; + font.setBold(true); + font.setPixelSize(64); + + QTest::newRow("Shorthand font specification") + << "font: normal bold 64px Arial;" + << font; + } + +} + +void tst_QTextDocument::stylesheetFont() +{ + QFETCH(QString, stylesheet); + QFETCH(QFont, font); + + QString html = QString::fromLatin1("<html>" + "<body>" + "<div style=\"%1\" >" + "Foobar" + "</div>" + "</body>" + "</html>").arg(stylesheet); + + qDebug() << html; + doc->setHtml(html); + QCOMPARE(doc->blockCount(), 1); + + // First and only block + QTextBlock block = doc->firstBlock(); + + QString text = block.text(); + QCOMPARE(text, QString::fromLatin1("Foobar")); + + QFont actualFont = block.charFormat().font(); + + QCOMPARE(actualFont.bold(), font.bold()); + QCOMPARE(actualFont.pixelSize(), font.pixelSize()); +} + void tst_QTextDocument::noundo_moreIsModified() { doc->setUndoRedoEnabled(false); @@ -1128,7 +1188,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("lists") << QTextDocumentFragment(&doc) << QString("EMPTYBLOCK") + - QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li DEFAULTBLOCKSTYLE>Blah</li></ul>"); + QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li DEFAULTBLOCKSTYLE>Blah</li></ul>"); } { @@ -1151,7 +1211,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("charfmt-for-list-item") << QTextDocumentFragment(&doc) << QString("EMPTYBLOCK") + - QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li style=\" color:#0000ff;\" DEFAULTBLOCKSTYLE><span style=\" color:#ff0000;\">Blah</span></li></ul>"); + QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li style=\" color:#0000ff;\" DEFAULTBLOCKSTYLE><span style=\" color:#ff0000;\">Blah</span></li></ul>"); } { @@ -1181,7 +1241,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("list-indent") << QTextDocumentFragment(&doc) << QString("EMPTYBLOCK") + - QString("<ul style=\"-qt-list-indent: 4;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>"); + QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 4;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>"); } { @@ -1445,6 +1505,20 @@ void tst_QTextDocument::toHtml_data() "\n<p OPENDEFAULTBLOCKSTYLE page-break-before:always; page-break-after:always;\">Bar</p>" "\n<table border=\"1\" style=\" page-break-after:always;\" cellspacing=\"2\">\n<tr>\n<td></td></tr></table>"); } + + { + CREATE_DOC_AND_CURSOR(); + + QTextListFormat listFmt; + listFmt.setStyle(QTextListFormat::ListDisc); + + cursor.insertList(listFmt); + cursor.insertText("Blah"); + + QTest::newRow("list-ul-margin") << QTextDocumentFragment(&doc) + << QString("EMPTYBLOCK") + + QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>"); + } } void tst_QTextDocument::toHtml() diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 57502c7..36fce76 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -87,6 +87,7 @@ private slots: void restartedTimerFiresTooSoon(); void timerFiresOnlyOncePerProcessEvents_data(); void timerFiresOnlyOncePerProcessEvents(); + void timerIdPersistsAfterThreadExit(); }; class TimerHelper : public QObject @@ -562,5 +563,44 @@ void tst_QTimer::timerFiresOnlyOncePerProcessEvents() QCOMPARE(longSlot.count, 1); } +class TimerIdPersistsAfterThreadExitThread : public QThread +{ +public: + QTimer *timer; + int timerId, returnValue; + + TimerIdPersistsAfterThreadExitThread() + : QThread(), timer(0), timerId(-1), returnValue(-1) + { } + ~TimerIdPersistsAfterThreadExitThread() + { + delete timer; + } + + void run() + { + QEventLoop eventLoop; + timer = new QTimer; + connect(timer, SIGNAL(timeout()), &eventLoop, SLOT(quit())); + timer->start(100); + timerId = timer->timerId(); + returnValue = eventLoop.exec(); + } +}; + +void tst_QTimer::timerIdPersistsAfterThreadExit() +{ + TimerIdPersistsAfterThreadExitThread thread; + thread.start(); + QVERIFY(thread.wait(30000)); + QCOMPARE(thread.returnValue, 0); + + // even though the thread has exited, and the event dispatcher destroyed, the timer is still + // "active", meaning the timer id should NOT be reused (i.e. the event dispatcher should not + // have unregistered it) + int timerId = thread.startTimer(100); + QVERIFY((timerId & 0xffffff) != (thread.timerId & 0xffffff)); +} + QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 6709807..fae4b26 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -2042,7 +2042,7 @@ void tst_QTreeView::scrollTo() view.show(); view.setVerticalScrollMode(QAbstractItemView::ScrollPerItem); //some styles change that in Polish - + view.resize(300, 200); //view.verticalScrollBar()->setValue(0); @@ -2055,7 +2055,7 @@ void tst_QTreeView::scrollTo() QCOMPARE(view.verticalScrollBar()->value(), 5); view.scrollTo(model.index(60, 60, QModelIndex())); - + CHECK_VISIBLE(60,60); view.scrollTo(model.index(60, 30, QModelIndex())); CHECK_VISIBLE(60,30); @@ -3059,12 +3059,12 @@ void tst_QTreeView::task216717_updateChildren() tree.refreshed = false; QTreeWidgetItem *parent = new QTreeWidgetItem(QStringList() << "parent"); tree.addTopLevelItem(parent); - QTest::qWait(100); - QVERIFY(tree.refreshed); + QTest::qWait(10); + QTRY_VERIFY(tree.refreshed); tree.refreshed = false; parent->addChild(new QTreeWidgetItem(QStringList() << "child")); - QTest::qWait(100); - QVERIFY(tree.refreshed); + QTest::qWait(10); + QTRY_VERIFY(tree.refreshed); } @@ -3259,7 +3259,7 @@ void tst_QTreeView::task202039_closePersistentEditor() view.closePersistentEditor(current); QVERIFY(view.indexWidget(current) == 0); - //here was the bug: closing the persistent editor would not reset the state + //here was the bug: closing the persistent editor would not reset the state //and it was impossible to go into editinon again QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.visualRect(current).center()); QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, view.visualRect(current).center()); @@ -3313,7 +3313,7 @@ void tst_QTreeView::task244304_clickOnDecoration() QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, rect.topLeft()+QPoint(-rect.left()/2,rect.height()/2)); QVERIFY(!view.currentIndex().isValid()); QVERIFY(view.isExpanded(item0.index())); - + rect = view.visualRect(item1.index()); //the item has no decoration, it should get selected QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, rect.topLeft()+QPoint(-rect.left()/2,rect.height()/2)); diff --git a/tests/auto/uiloader/baseline/css_tab_border.ui b/tests/auto/uiloader/baseline/css_tab_border.ui new file mode 100644 index 0000000..cefb9d8 --- /dev/null +++ b/tests/auto/uiloader/baseline/css_tab_border.ui @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>379</width> + <height>277</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <property name="styleSheet"> + <string notr="true">#tabWidget QTabBar::tab { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, + stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); + border: 2px solid #C4C4C3; + border-bottom-color: #C2C7CB; /* same as the pane color */ + border-top-left-radius: 4px; + border-top-right-radius: 4px; + padding: 2px; + } + +#tabWidget_2 QTabBar::tab { + border: 3px solid red; + } + +#tabWidget_3 QTabBar::tab { + margin: 5px; + } + + +</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>1</number> + </property> + <property name="tabsClosable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + <item> + <widget class="QTabWidget" name="tabWidget_2"> + <property name="currentIndex"> + <number>1</number> + </property> + <property name="tabsClosable"> + <bool>false</bool> + </property> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + <item> + <widget class="QTabWidget" name="tabWidget_3"> + <property name="currentIndex"> + <number>1</number> + </property> + <property name="tabsClosable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="tab_5"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_6"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.cpp b/tests/manual/qtabletevent/device_information/tabletwidget.cpp index 15a3d80..684f2a5 100644 --- a/tests/manual/qtabletevent/device_information/tabletwidget.cpp +++ b/tests/manual/qtabletevent/device_information/tabletwidget.cpp @@ -47,6 +47,7 @@ TabletWidget::TabletWidget() { QPalette newPalette = palette(); newPalette.setColor(QPalette::Window, Qt::white); + newPalette.setColor(QPalette::WindowText, Qt::black); setPalette(newPalette); qApp->installEventFilter(this); resetAttributes(); diff --git a/tools/qttracereplay/main.cpp b/tools/qttracereplay/main.cpp index 970531b..34508e2 100644 --- a/tools/qttracereplay/main.cpp +++ b/tools/qttracereplay/main.cpp @@ -45,12 +45,6 @@ #include <private/qpaintengineex_p.h> #include <private/qpaintbuffer_p.h> -struct Frame -{ - QRegion updateRegion; - QPaintBuffer *buffer; -}; - class ReplayWidget : public QWidget { Q_OBJECT @@ -63,7 +57,9 @@ public slots: void updateRect(); private: - QList<Frame> frames; + QList<QRegion> updates; + QPaintBuffer buffer; + int currentFrame; int currentIteration; QTime timer; @@ -74,7 +70,7 @@ private: void ReplayWidget::updateRect() { - update(frames.at(currentFrame).updateRegion); + update(updates.at(currentFrame)); } void ReplayWidget::paintEvent(QPaintEvent *) @@ -83,10 +79,10 @@ void ReplayWidget::paintEvent(QPaintEvent *) // p.setClipRegion(frames.at(currentFrame).updateRegion); - frames.at(currentFrame).buffer->draw(&p); + buffer.draw(&p, currentFrame); ++currentFrame; - if (currentFrame >= frames.size()) { + if (currentFrame >= buffer.numFrames()) { currentFrame = 0; ++currentIteration; @@ -116,15 +112,13 @@ void ReplayWidget::paintEvent(QPaintEvent *) stddev = qSqrt(stddev / iterationTimes.size()); qSort(iterationTimes.begin(), iterationTimes.end()); - qreal median = iterationTimes.at(iterationTimes.size() / 2); - if ((iterationTimes.size() % 1) == 1) - median = (median + iterationTimes.at(iterationTimes.size() / 2 - 1)) * 0.5; + uint median = iterationTimes.at(iterationTimes.size() / 2); stddev = 100 * stddev / mean; if (iterationTimes.size() >= 10 || stddev < 4) { - printf("%s, iterations: %d, frames: %d, min(ms): %d, median(ms): %f, stddev: %f %%, max(fps): %f\n", qPrintable(filename), - iterationTimes.size(), frames.size(), min, median, stddev, 1000. * frames.size() / min); + printf("%s, iterations: %d, frames: %d, min(ms): %d, median(ms): %d, stddev: %f %%, max(fps): %f\n", qPrintable(filename), + iterationTimes.size(), updates.size(), min, median, stddev, 1000. * updates.size() / min); deleteLater(); return; } @@ -146,34 +140,12 @@ ReplayWidget::ReplayWidget(const QString &filename_) QRect bounds; if (file.open(QIODevice::ReadOnly)) { QDataStream in(&file); - - while (true) { - int frameId; - in >> frameId; - - if (in.status() != QDataStream::Ok) - break; - - qulonglong windowId; - QRegion rgn; - - in >> windowId; - - Frame frame; - frame.buffer = new QPaintBuffer; - - in >> bounds; - - in >> frame.updateRegion; - in >> *frame.buffer; - - frames << frame; - } + in >> buffer >> updates; } - qDebug() << "Read" << frames.size() << "frames"; + qDebug() << "Read paint buffer with" << buffer.numFrames() << "frames"; - resize(bounds.size()); + resize(buffer.boundingRect().size().toSize()); setAutoFillBackground(false); setAttribute(Qt::WA_NoSystemBackground); |