diff options
187 files changed, 2681 insertions, 869 deletions
diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0 index 8e3b97a..27c6774 100644 --- a/dist/changes-4.8.0 +++ b/dist/changes-4.8.0 @@ -65,6 +65,7 @@ QtCore - optimised performance of QFileInfo, QDir, QDirIterator, these classes now share metadata and access the filesystem less - QFile: new open() overloads allow control over whether QFile should close an adopted file handle or not - Fix QProcess emitting two started signals on X11 [QTBUG-7039] + - QLocale: added locale dependent to{Upper,Lower} string conversions QtGui ----- @@ -88,6 +89,8 @@ QtGui - Fixed several bidi reordering bugs. - Make HTML exported from QTextDocument containing empty lines more compliant. - Include font pixel size when exporting HTML from QTextDocument. + - QPainter: Added a fast stroking algorithm for thin (< 1px wide) aliased and antialiased + lines, giving a huge improvement in drawing speed for certain cases - Fixed a rare race condition when showing toplevel windows on X11 - Accessibility: Fix potential crash in QDockWidget. - Accessibility: Fix crash when asking for relations of child accessibles. @@ -134,6 +137,10 @@ QtScript -------- - Deprecated qScriptValueFromQMetaObject, qScriptValueToValue, qScriptValueFromValue +QtDBus +------ + - Added a method that returns the local machine ID + QtSql ----- - Update sqlite to 3.7.7.1 @@ -299,6 +306,8 @@ Qt for Windows CE * Fix handling of DEFINES from .prl files. (QTBUG-16024) * Fix the language settings generated Windows resource files. (QTBUG-12249) + * Implemented "aux" template that allows making use of the INSTALLS variable + without building anything. Needed for projects with QML entry point. - configure * The endianness for Windows is always set to little endian. diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index d89ca53..cecccf6 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -46,7 +46,7 @@ Qt applications. \section1 Getting Started \list -\o \l{Intro to Qt Quick}{Introduction to Qt Quick} +\o \l{Introduction to Qt Quick} \o \l{QML for Qt Programmers}{QML Programming for Qt Programmers} \o \l{Getting Started Programming with QML} diff --git a/doc/src/declarative/qtquick-intro.qdoc b/doc/src/declarative/qtquick-intro.qdoc index bdad2c3..4cd5db3 100644 --- a/doc/src/declarative/qtquick-intro.qdoc +++ b/doc/src/declarative/qtquick-intro.qdoc @@ -27,7 +27,7 @@ /*! \page qml-intro.html -\title Intro to Qt Quick +\title Introduction to Qt Quick Qt Quick is a collection of technologies that are designed to help developers create the kind of intuitive, modern, and fluid user interfaces that are diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 2490374..9680aa2 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -40,7 +40,7 @@ \o \l{How to Learn Qt} \o \l{Introduction to Qt Quick}{Qt Quick} \o \l{Qt Whitepaper}{Qt C++ Framework} - \o \l{Intro to Qt Quick}{Qt Quick} + \o \l{Introduction to Qt Quick}{Qt Quick} \o \l{external: Qt Mobility Manual}{Qt Mobility} \o \l{Qt WebKit} \endlist diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 9d47695..ba59c37 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -334,8 +334,8 @@ \section2 Advanced Text Layout Engine - Qt for Windows CE supports TrueType® and raster fonts. Qt also has - extended Unicode support and right-to-left languages. Qt’s rich text + Qt for Windows CE supports TrueType and raster fonts. Qt also has + extended Unicode support and right-to-left languages. Qt's rich text engine adds capabilities for complex text layouts including tables, path tracing and text which flows around shapes. @@ -373,7 +373,7 @@ by embedded Linux. You can use Qt to create highly memory efficient devices and applications that have completely unique user experiences. - Qt runs anywhere Linux runs. Qt’s intuitive API means fewer lines of + Qt runs anywhere Linux runs. Qt's intuitive API means fewer lines of code and higher level functionality in less time. Use the code from one single code-base and rebuild for all \l{Supported Platforms} {supported platforms}. @@ -410,7 +410,7 @@ frame buffer} that will match the physical device display, pixel for pixel. This gives the developer a realistic testing infrastructure testing on the desktop where the frame buffer simulates the physical - device display’s width, height and color depth. + device display's width, height and color depth. \section2 Inter-Process Communication (IPC) @@ -421,7 +421,7 @@ \section2 Extended Font Format Qt supports a wide range of font formats on embedded Linux including: - TrueType®, Postscript® Type1 and Qt pre-rendered fonts. Qt has + TrueType, Postscript Type1 and Qt pre-rendered fonts. Qt has extended Unicode support including automatic data extraction at build time and automatic update at runtime. @@ -681,7 +681,7 @@ \group platform-details Qt is a cross-platform application and UI framework. Using Qt, - you can write web-enabled applications once and deploy them + you can write GUI applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code. diff --git a/doc/src/qt-features.qdoc b/doc/src/qt-features.qdoc new file mode 100644 index 0000000..0ae00b0 --- /dev/null +++ b/doc/src/qt-features.qdoc @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qt-overview.html + \title Qt Features Overview + + This document provides a summary of the most important features of Qt, + providing links to other pages in the documentation that cover these + features in more detail. It is not intended to be a comprehensive + guide to Qt's features. + + \section1 Fundamental Technologies in Qt + + Qt is built upon a set of core technologies, provided by the \l QtCore + and \l QtGui modules. These include the following: + + \list + \o \l{The Tulip Container Classes}, a set of template container classes. + \o \l{The Arthur Paint System}, the Qt 4 painting framework. + \o \l{The Interview Framework}, a model/view architecture for item views + and the \l{QtSQL Module}, which also uses this architecture. + \o \l{The Scribe Classes}, a framework for creating text documents, + performing low-level text layout and writing OpenDocument files. + \o A collection of \l{Qt Widget Gallery}{common desktop widgets}, styled + to fit in on each supported platform. + \o \l{The Qt 4 Main Window Classes}, a main window, toolbar, menu, and + docking architecture. + \o The \l{Graphics View} framework provides a canvas for producing + interactive graphics. + \o The \l{QtNetwork Module} provides support for TCP, UDP and local + sockets that are integrated with Qt's event model, including support + for Secure Socket Layer (SSL) communications, + \l{QNetworkProxy}{network proxy} servers and + \l{Bearer Management}{network bearer management}. + \o Enhanced \l{qt4-threads.html}{thread support} allows + \l{Signals & Slots}{signal-slot} connections across threads and + per-thread event loops. + Additionally, \l{Thread Support in Qt}{a framework for concurrent programming} + using Qt paradigms makes common threading tasks easier. + \o A \l{resource system} for embedding images and other resource files + into executable files makes it easier to deploy applications. + \o A \l{QTestLib Manual}{unit testing framework} for Qt applications and + libraries. + \endlist + + The mature classes provided by these technologies have been used to build + robust, cross-platform desktop applications. They are augmented by a number + of additional technologies and improvements that have appeared over the + lifetime of Qt 4. + + \section1 Graphical User Interfaces + + \div{class="float-right"} + \inlineimage gtk-tabwidget.png + \enddiv + \div{class="float-right"} + \inlineimage gtk-progressbar.png + \br + \inlineimage gtk-checkbox.png + \br + \inlineimage plastique-combobox.png + \br + \inlineimage plastique-radiobutton.png + \enddiv + + Alongside the support for traditional desktop user interfaces, Qt includes + support for declarative UI development with \l{Qt Quick}, a set of + technologies for creating fluid, dynamic user interfaces. A starting point + for exploring this approach can be found in the \l{Introduction to Qt Quick} + guide. + + Qt provides a range of standard user interface elements, called widgets, + for each supported platform. Widgets can be used as containers for other + widgets, as windows, and as regular controls that the user interacts with. + Where the platform supports it, widgets can be made to appear partially + transparent, and may be styled with \l{Qt Style Sheets}. + + Support for \l{QTouchEvent}{touch input} and \l{Gestures Programming}{gestures} + enable widgets to be used to create intuitive user interfaces for + touch-enabled devices. + + User interfaces can also be created dynamically at run-time with the + features provided by the \l{QtUiTools} module. + + A selection of available widgets are shown in the \l{Qt Widget Gallery}. + An introduction to the concepts behind widgets can be found in the + \l{Widgets Tutorial}. + + \clearfloat + \section1 Painting, Printing and Rendering + + \div{class="float-left"} + \inlineimage qpainter-affinetransformations.png + \enddiv + + Widgets are just one of many kinds of paint device that Qt can render onto. + This support for unified painting makes it possible for applications to use + the same painting code for different tasks, as well as allowing Qt to be + extended to support additional file formats. + + Qt provides support for common bitmap image formats, + \l{QtSvg Module}{Scalable Vector Graphics} (SVG) drawings and animations, + Postscript and Portable Document Format (PDF) files. Postscript and PDF are + integrated with \l{Printing with Qt}{Qt's printing system}, which also + allows printed output to be previewed. + + Interactive graphics can be created with the + \l{The Animation Framework}{animation framework}, allowing animations to be + used with both widgets and graphics items. Animations can be used with the + \l{The State Machine Framework}{state machine framework}, which provides a + way to express application logic and integrate it with the user interface. + Animations can be enhanced with a collection of + \l{QGraphicsEffect}{graphics effects} that operate on graphics items and + can be applied individually or combined to create more complex effects. + + Qt supports integration with \l{QtOpenGL}{OpenGL} on a number of levels, + providing convenience functions for handling textures and colors, as well + as providing support for pixel and sample buffers. Future support for + higher level 3D integration is provided by Qt3D enablers which include + \l{QMatrix4x4}{matrix multiplication}, \l{QQuaternion}{quaternions}, and an + API for \l{QGLShader}{vertex and fragment shaders}. + + Two APIs are provided for multimedia. The + \l{Phonon Overview}{Phonon Multimedia Framework} has traditionally been + used on desktop platforms. A set of + \l{QtMultimedia Module}{multimedia services} provides low-level access to + the system's audio system and is often used on mobile devices. + + \clearfloat + \section1 Infrastructure + + \div{class="float-right"} + \inlineimage qtscript-context2d.png + \enddiv + + Facilities for Inter-Process Communication (IPC) and Remote Procedure + Calling (RPC) mechanisms are available on platforms that support the + \l{intro-to-dbus.html}{D-Bus} message bus system. + + An \l{Undo Framework}{Undo framework} based on the + \l{Books about GUI Design#Design Patterns}{Command pattern} is designed to + enable a consistent approach to handling data in editing applications. + + The \l{QtScript} and \l{QtScriptTools} modules provide support for + application scripting and debugging using the ECMAScript language. + + The \l{QtHelp Module} provides the foundations of an interactive help + system that can be used in conjunction with Qt Creator or integrated into + applications directly. + + XML handling is supported in a number of places in Qt. The \l QtCore module + provides classes for reading and writing XML streams. The \l QtXmlPatterns + module includes XQuery, XPath and XSLT support, providing facilities for + XML processing beyond that supported by the QtXml module, which contains + SAX and DOM parsers. XML schema validation in the QtXmlPatterns module + covers large parts of version 1.0 of the specification. + + \clearfloat + \section1 Web Client Integration + + Integration between \l{Webkit in Qt}{Qt and WebKit} makes it possible for + developers to use a fully-featured Web browser engine to display documents + and access online services. Developers can access the browser's environment + to create documents and run scripts within one or more browser widgets. + + A \l{QWebElement}{DOM access API} for QtWebKit provides a cleaner and safer + way to access elements and structures of Web pages without the use of + JavaScript. + + \section1 Further Reading + + Many of the technologies mentioned here, as well as other, more specific + features, are listed in the \l{What's New in Qt 4} document. A complete + list of Qt's modules can be found on the \l{All Modules} page, which + also includes more domain-specific technologies. + + The tools that are supplied with Qt are covered by the listing in the + \l{Qt's Tools} document. +*/ diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 17dc1af..01103a8 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -138,7 +138,7 @@ In Qt 4.4: \list - \o \l{Webkit in QT}{Qt WebKit integration}, making it possible for developers + \o \l{WebKit in Qt}{Qt WebKit integration}, making it possible for developers to use a fully-featured Web browser to display documents and access online services. \o A multimedia API provided by the \l{Phonon Overview}{Phonon Multimedia Framework}. @@ -707,7 +707,6 @@ introduced in Qt 4.7. \sincelist 4.7 - */ /*! diff --git a/examples/opengl/cube/mainwidget.h b/examples/opengl/cube/mainwidget.h index c6da29f..eb509d0 100644 --- a/examples/opengl/cube/mainwidget.h +++ b/examples/opengl/cube/mainwidget.h @@ -48,8 +48,10 @@ #include <QQuaternion> #include <QVector2D> +QT_BEGIN_NAMESPACE class QBasicTimer; class QGLShaderProgram; +QT_END_NAMESPACE class GeometryEngine; diff --git a/examples/webkit/simplewebplugin/csvfactory.h b/examples/webkit/simplewebplugin/csvfactory.h index e3013b1..0168dc2 100644 --- a/examples/webkit/simplewebplugin/csvfactory.h +++ b/examples/webkit/simplewebplugin/csvfactory.h @@ -44,10 +44,10 @@ #include <QNetworkRequest> #include <QWebPluginFactory> -QT_BEGIN_NAMESPACE class QNetworkAccessManager; class QNetworkReply; -QT_END_NAMESPACE + +QT_BEGIN_NAMESPACE //! [plugin factory] class CSVFactory : public QWebPluginFactory @@ -66,4 +66,6 @@ private: }; //! [plugin factory] +QT_END_NAMESPACE + #endif diff --git a/examples/webkit/webftpclient/ftpreply.h b/examples/webkit/webftpclient/ftpreply.h index ca0a271..65c8c66 100644 --- a/examples/webkit/webftpclient/ftpreply.h +++ b/examples/webkit/webftpclient/ftpreply.h @@ -46,6 +46,10 @@ #include <QUrlInfo> #include <QFtp> +QT_BEGIN_NAMESPACE +class QFtp; +QT_END_NAMESPACE + //! [class definition] class FtpReply : public QNetworkReply { diff --git a/examples/webkit/webftpclient/ftpview.h b/examples/webkit/webftpclient/ftpview.h index 544c0a9..ae4f9c1 100644 --- a/examples/webkit/webftpclient/ftpview.h +++ b/examples/webkit/webftpclient/ftpview.h @@ -41,6 +41,9 @@ #include <QWebView> class Downloader; +QT_BEGIN_NAMESPACE +class QNetworkAccessManager; +QT_END_NAMESPACE class FtpView : public QWebView { diff --git a/examples/widgets/orientation/mainwindow.h b/examples/widgets/orientation/mainwindow.h index 745497c..29ccf06 100644 --- a/examples/widgets/orientation/mainwindow.h +++ b/examples/widgets/orientation/mainwindow.h @@ -46,6 +46,10 @@ #include "ui_landscape.h" #include "ui_portrait.h" +class QAbstractButton; + +QT_BEGIN_NAMESPACE + //! [0] class MainWindow : public QWidget { @@ -68,4 +72,6 @@ private: }; //! [0] +QT_END_NAMESPACE + #endif // MAINWINDOW_H diff --git a/mkspecs/features/help.prf b/mkspecs/features/help.prf index 15685e7..99521af 100644 --- a/mkspecs/features/help.prf +++ b/mkspecs/features/help.prf @@ -1,4 +1,4 @@ INCLUDEPATH = $$QMAKE_INCDIR_QT/QtHelp $$INCLUDEPATH -QT += xml sql +QT += sql qtAddLibrary(QtHelp) diff --git a/mkspecs/features/link_pkgconfig.prf b/mkspecs/features/link_pkgconfig.prf index a3dbd1f..91683f6 100644 --- a/mkspecs/features/link_pkgconfig.prf +++ b/mkspecs/features/link_pkgconfig.prf @@ -5,8 +5,21 @@ for(PKGCONFIG_LIB, $$list($$unique(PKGCONFIG))) { # don't proceed if the .pro asks for a package we don't have! !packagesExist($$PKGCONFIG_LIB):error("Package $$PKGCONFIG_LIB not found") - QMAKE_CXXFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB) - QMAKE_CFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB) + PKGCONFIG_CFLAGS = $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB) + + PKGCONFIG_INCLUDEPATH = $$find(PKGCONFIG_CFLAGS, ^-I.*) + PKGCONFIG_INCLUDEPATH ~= s/^-I(.*)/\\1/g + + PKGCONFIG_DEFINES = $$find(PKGCONFIG_CFLAGS, ^-D.*) + PKGCONFIG_DEFINES ~= s/^-D(.*)/\\1/g + + PKGCONFIG_CFLAGS ~= s/^-[ID].*//g + + INCLUDEPATH *= $$PKGCONFIG_INCLUDEPATH + DEFINES *= $$PKGCONFIG_DEFINES + + QMAKE_CXXFLAGS += $$PKGCONFIG_CFLAGS + QMAKE_CFLAGS += $$PKGCONFIG_CFLAGS LIBS += $$system($$PKG_CONFIG --libs $$PKGCONFIG_LIB) } diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index f50afc3..0b201b8 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1524,8 +1524,8 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCEventTool &tool) { xml << tag(tool.EventName) - << attrTagS(_Command, tool.CommandLine.join(vcxCommandSeparator())) - << attrTagS(_Message, tool.Description) + << tag(_Command) << valueTag(tool.CommandLine.join(vcxCommandSeparator())) + << tag(_Message) << valueTag(tool.Description) << closetag(tool.EventName); } diff --git a/qmake/option.cpp b/qmake/option.cpp index 31372ab..c3e89de 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -750,64 +750,11 @@ qmakeAddCacheClear(qmakeCacheClearFunc func, void **data) cache_items.append(new QMakeCacheClearItem(func, data)); } -#ifdef Q_OS_WIN -# include <windows.h> - -QT_USE_NAMESPACE -#endif - QString qmake_libraryInfoFile() { - QString ret; -#if defined( Q_OS_WIN ) - wchar_t module_name[MAX_PATH]; - GetModuleFileName(0, module_name, MAX_PATH); - QFileInfo filePath = QString::fromWCharArray(module_name); - ret = filePath.filePath(); -#else - QString argv0 = QFile::decodeName(QByteArray(Option::application_argv0)); - QString absPath; - - if (!argv0.isEmpty() && argv0.at(0) == QLatin1Char('/')) { - /* - If argv0 starts with a slash, it is already an absolute - file path. - */ - absPath = argv0; - } else if (argv0.contains(QLatin1Char('/'))) { - /* - If argv0 contains one or more slashes, it is a file path - relative to the current directory. - */ - absPath = QDir::current().absoluteFilePath(argv0); - } else { - /* - Otherwise, the file path has to be determined using the - PATH environment variable. - */ - QByteArray pEnv = qgetenv("PATH"); - QDir currentDir = QDir::current(); - QStringList paths = QString::fromLocal8Bit(pEnv.constData()).split(QLatin1String(":")); - for (QStringList::const_iterator p = paths.constBegin(); p != paths.constEnd(); ++p) { - if ((*p).isEmpty()) - continue; - QString candidate = currentDir.absoluteFilePath(*p + QLatin1Char('/') + argv0); - QFileInfo candidate_fi(candidate); - if (candidate_fi.exists() && !candidate_fi.isDir()) { - absPath = candidate; - break; - } - } - } - - absPath = QDir::cleanPath(absPath); - - QFileInfo fi(absPath); - ret = fi.exists() ? fi.canonicalFilePath() : QString(); -#endif - if(!ret.isEmpty()) - ret = QDir(QFileInfo(ret).absolutePath()).filePath("qt.conf"); - return ret; + if(!Option::qmake_abslocation.isEmpty()) + return QDir(QFileInfo(Option::qmake_abslocation).absolutePath()).filePath("qt.conf"); + return QString(); } QT_END_NAMESPACE diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index a560e52..34446ae 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -dda59e50379214c098f365a39c4d64b39ced427e +64cce100215c71575f19ca0b090c65fa97d4ba10 diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 5f97e57..bc11b4d 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,26 +1,3 @@ -2011-08-26 Ademar de Souza Reis Jr. <ademar.reis@openbossa.org> - - [Qt] libwebcore.a source is compiled without -fvisibility=hidden - -fvisibility-inlines-hidden - https://bugs.webkit.org/show_bug.cgi?id=65470 - - Patch by Holger Freyther <zecke@selfish.org> - Rubberstamped by Andreas Kling. - - (qtwebkit-2.2 only by now) - - WTF_USE_EXPORT_MACROS is still not enabled on trunk because there are - pending issues with WebKit2, but it appears to be safe to enable this - on QtWebKit, so this change is being added to the qtwebkit-2.2 branch. - - The patch also adds CONFIG += hide_symbols and on Unix, += - bsymbolic_functions, which should help reduce the library binary size. - - Testing this is quite easy, so if there's any problem we'll soon - know. :-) - - * Source/WebKit.pri: - 2011-08-06 Aron Rosenberg <arosenberg@logitech.com> Reviewed by Benjamin Poulain. diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog index 010e66a..9cda920 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog @@ -1,23 +1,61 @@ -2011-08-26 Ademar de Souza Reis Jr. <ademar.reis@openbossa.org> +2011-05-23 Thouraya ANDOLSI <thouraya.andolsi@st.com> - [Qt] libwebcore.a source is compiled without -fvisibility=hidden - -fvisibility-inlines-hidden - https://bugs.webkit.org/show_bug.cgi?id=65470 + Reviewed by Gavin Barraclough. + + [SH4] AssemblerLabel does not name a type + https://bugs.webkit.org/show_bug.cgi?id=59927 - Patch by Holger Freyther <zecke@selfish.org> - Rubberstamped by Andreas Kling. + SH4Assembler.h file shoold be included before AbstractMacroAssembler.h. + + * assembler/MacroAssemblerSH4.h: + +2011-06-28 Pierre Rossi <pierre.rossi@gmail.com> + + Reviewed by Eric Seidel. - (qtwebkit-2.2 only by now) + Warnings in JSC's JIT on 32 bit + https://bugs.webkit.org/show_bug.cgi?id=63259 + + Fairly straightforward, just use ASSERT_JIT_OFFSET_UNUSED when it applies. + + * jit/JITPropertyAccess32_64.cpp: + (JSC::JIT::emit_op_method_check): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::emit_op_put_by_id): - WTF_USE_EXPORT_MACROS is still not enabled on trunk because there are - pending issues with WebKit2, but it appears to be safe to enable this - on QtWebKit, so this change is being added to the qtwebkit-2.2 branch. +2011-08-30 Ademar de Souza Reis Jr. <ademar.reis@openbossa.org> - The patch also adds CONFIG += hide_symbols and on Unix, += - bsymbolic_functions, which should help reduce the library binary size. + [Qt] Do not unconditionally use pkg-config in .pro files + https://bugs.webkit.org/show_bug.cgi?id=67055 + + Reviewed by Andreas Kling. + + Original patch from Rohan McGovern <rohan.mcgovern@nokia.com> + + Using the first pkg-config in PATH is prone to errors when cross + compiling inside the Qt repository (using Qt's build-system). + + This patch protect calls for pkg-config with + !contains(QT_CONFIG, no-pkg-config). no-pkg-config is added to + QT_CONFIG by Qt's 'configure' when cross-compiling on systems + without pkg-config. + + The respective change in Qt's configure has been submited already. + + No new tests as this is just a build change. + + * wtf/wtf.pri: protect pkg-config calls + +2011-08-28 Jonathan Liu <net147@gmail.com> + + Fix build error when compiling with MinGW-w64 by disabling JIT + on Windows 64-bit + https://bugs.webkit.org/show_bug.cgi?id=61235 + + Reviewed by Gavin Barraclough. - Testing this is quite easy, so if there's any problem we'll soon - know. :-) + The fixed mmap executable allocator for JIT on x86_64 requires + sys/mman.h which is not available on Windows. * wtf/Platform.h: diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h index 5ef7b20..9036f0f 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h +++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h @@ -29,8 +29,8 @@ #if ENABLE(ASSEMBLER) && CPU(SH4) -#include "AbstractMacroAssembler.h" #include "SH4Assembler.h" +#include "AbstractMacroAssembler.h" #include <wtf/Assertions.h> namespace JSC { diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp index f18e277..c88e9ad 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp +++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp @@ -225,9 +225,9 @@ void JIT::emit_op_method_check(Instruction* currentInstruction) move(TrustedImm32(JSValue::CellTag), regT1); Jump match = jump(); - ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoObj), patchOffsetMethodCheckProtoObj); + ASSERT_JIT_OFFSET_UNUSED(protoObj, differenceBetween(info.structureToCompare, protoObj), patchOffsetMethodCheckProtoObj); ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoStructureToCompare), patchOffsetMethodCheckProtoStruct); - ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, putFunction), patchOffsetMethodCheckPutFunction); + ASSERT_JIT_OFFSET_UNUSED(putFunction, differenceBetween(info.structureToCompare, putFunction), patchOffsetMethodCheckPutFunction); // Link the failure cases here. structureCheck.link(this); @@ -436,9 +436,9 @@ void JIT::compileGetByIdHotPath() loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT2); DataLabel32 displacementLabel1 = loadPtrWithAddressOffsetPatch(Address(regT2, patchGetByIdDefaultOffset), regT0); // payload - ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel1), patchOffsetGetByIdPropertyMapOffset1); + ASSERT_JIT_OFFSET_UNUSED(displacementLabel1, differenceBetween(hotPathBegin, displacementLabel1), patchOffsetGetByIdPropertyMapOffset1); DataLabel32 displacementLabel2 = loadPtrWithAddressOffsetPatch(Address(regT2, patchGetByIdDefaultOffset), regT1); // tag - ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel2), patchOffsetGetByIdPropertyMapOffset2); + ASSERT_JIT_OFFSET_UNUSED(displacementLabel2, differenceBetween(hotPathBegin, displacementLabel2), patchOffsetGetByIdPropertyMapOffset2); Label putResult(this); ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, putResult), patchOffsetGetByIdPutResult); @@ -514,8 +514,8 @@ void JIT::emit_op_put_by_id(Instruction* currentInstruction) END_UNINTERRUPTED_SEQUENCE(sequencePutById); - ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel1), patchOffsetPutByIdPropertyMapOffset1); - ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel2), patchOffsetPutByIdPropertyMapOffset2); + ASSERT_JIT_OFFSET_UNUSED(displacementLabel1, differenceBetween(hotPathBegin, displacementLabel1), patchOffsetPutByIdPropertyMapOffset1); + ASSERT_JIT_OFFSET_UNUSED(displacementLabel2, differenceBetween(hotPathBegin, displacementLabel2), patchOffsetPutByIdPropertyMapOffset2); } void JIT::emitSlow_op_put_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h index 8309acc..a8298c4 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h @@ -1014,8 +1014,8 @@ #define ENABLE_JIT 0 #endif -/* JIT is not implemented for 64 bit on MSVC */ -#if !defined(ENABLE_JIT) && COMPILER(MSVC) && CPU(X86_64) +/* JIT is not implemented for Windows 64-bit */ +#if !defined(ENABLE_JIT) && OS(WINDOWS) && CPU(X86_64) #define ENABLE_JIT 0 #endif @@ -1221,11 +1221,7 @@ since most ports try to support sub-project independence, adding new headers to WTF causes many ports to break, and so this way we can address the build breakages one port at a time. */ -#if PLATFORM(QT) -#define WTF_USE_EXPORT_MACROS 1 -#else #define WTF_USE_EXPORT_MACROS 0 -#endif #if PLATFORM(QT) || PLATFORM(GTK) #define WTF_USE_UNIX_DOMAIN_SOCKETS 1 diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wtf.pri b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wtf.pri index 5af613e..ccc2f60 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wtf.pri +++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wtf.pri @@ -42,7 +42,7 @@ SOURCES += \ wtf/unicode/UTF8.cpp linux-*:!contains(DEFINES, USE_QTMULTIMEDIA=1) { - !contains(QT_CONFIG, no-pkg-config):system(pkg-config --exists glib-2.0 gio-2.0 gstreamer-0.10) { + !contains(QT_CONFIG, no-pkg-config):system(pkg-config --exists glib-2.0 gio-2.0 gstreamer-0.10): { DEFINES += ENABLE_GLIB_SUPPORT=1 PKGCONFIG += glib-2.0 gio-2.0 CONFIG += link_pkgconfig diff --git a/src/3rdparty/webkit/Source/WebCore/ChangeLog b/src/3rdparty/webkit/Source/WebCore/ChangeLog index 41d2ba7..da9d1b2 100644..100755 --- a/src/3rdparty/webkit/Source/WebCore/ChangeLog +++ b/src/3rdparty/webkit/Source/WebCore/ChangeLog @@ -1,3 +1,332 @@ +2011-09-12 Adam Klein <adamk@chromium.org> + + Fix out-of-bounds access in Gradient::sortStopsIfNecessary + https://bugs.webkit.org/show_bug.cgi?id=67958 + + Reviewed by Darin Adler. + + Reported by Valgrind in http://crbug.com/77049. + + The errant code was added as an optimization in r67804. + This patch reverts that one, as all parties agree that the optimization + doesn't seem worthwhile, and there clearly aren't any tests covering + the special case. + + No new tests, as existing tests should cover the remaining call to + |std::stable_sort|. + + * platform/graphics/Gradient.cpp: + (WebCore::Gradient::sortStopsIfNecessary): + +2011-09-09 Dominic Mazzoni <dmazzoni@google.com> + + Assert being hit in AccessibilityRenderObject::addChildren() + https://bugs.webkit.org/show_bug.cgi?id=61805 + + Reviewed by Chris Fleizach. + + Fix nextSibling and previousSibling to handle adjacent continuations + properly, otherwise nodes end up appearing in the accessibility + tree twice (or a debug assertion could be raised). + + Test: accessibility/adjacent-continuations-cause-assertion-failure.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::previousSibling): + (WebCore::AccessibilityRenderObject::nextSibling): + +2011-09-08 Abhishek Arya <inferno@chromium.org> + + :before content rendering issues with list markers and run-ins. + https://bugs.webkit.org/show_bug.cgi?id=67735 + + 1) Remove the isAnonymous checks for run-in detection since the + run-in can belong to a node. + 2) When the parent has block children, then the list marker will + be enclosed in an anonymous block. In that case, for going to the + next list marker, we need to traverse one level up. We don't need + this check when searching for generated run-in (loop 2), since we + know parent will have inline children, so the list marker wont be + enclosed in an anonymous block. + + Reviewed by Dave Hyatt. + + Tests: fast/lists/list-marker-before-content-table.html + fast/runin/runin-generated-before-content.html + + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::beforePseudoElementRenderer): + +2011-09-10 Ken Buchanan <kenrb@chromium.org> + + Crash due to bad data in SVGDocumentExtensions m_pendingResources + https://bugs.webkit.org/show_bug.cgi?id=67488 + + Reviewed by Nikolas Zimmermann. + + Resolving a crash condition caused by the deletion of + elements while pending resource entries for those elements are still + recorded. + + * rendering/svg/RenderSVGResourceContainer.cpp: + (WebCore::RenderSVGResourceContainer::registerResource) + * svg/SVGDocumentExtensions.h: + (WebCore::SVGDocumentExtensions::isElementInPendingResources) + * svg/SVGDocumentExtensions.cpp: + (WebCore::SVGDocumentExtensions::addPendingResource) + (WebCore::SVGDocumentExtensions::isElementInPendingResources) + (WebCore::SVGDocumentExtensions::removeElementFromPendingResources) + * svg/SVGStyledElement.h: + (WebCore::SVGStyledElement::clearHasPendingResourcesIfPossible) + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::buildPendingResourcesIfNeeded) + (WebCore::SVGStyledElement::clearHasPendingResourcesIfPossible) + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::svgAttributeChanged) + +2011-09-08 Alexey Proskuryakov <ap@apple.com> + + REGRESSION (r66874): Missing RefPtr in ScriptController + https://bugs.webkit.org/show_bug.cgi?id=67748 + + Reviewed by Adam Barth. + + * bindings/ScriptControllerBase.cpp: (WebCore::ScriptController::executeScript): + +2011-09-06 Abhishek Arya <inferno@chromium.org> + + Style not propagated to anonymous boxes and anonymous + inline-blocks. + https://bugs.webkit.org/show_bug.cgi?id=67364 + + Reviewed by James Robinson. + + Share propagateStyleToAnonymousChildren with RenderBlock::styleDidChange. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::styleDidChange): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::propagateStyleToAnonymousChildren): + * rendering/RenderObject.h: + +2011-09-04 Abhishek Arya <inferno@chromium.org> + + Style not propagated to anonymous boxes and anonymous + inline-blocks. + https://bugs.webkit.org/show_bug.cgi?id=67364 + + Reviewed by James Robinson. + + Tests: fast/ruby/ruby-block-style-not-updated-with-before-after-content.html + fast/ruby/ruby-block-style-not-updated.html + fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html + fast/ruby/ruby-inline-style-not-updated.html + fast/table/table-row-style-not-updated-with-after-content.html + fast/table/table-row-style-not-updated-with-before-content.html + fast/table/table-row-style-not-updated.html + fast/table/table-style-not-updated.html + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::propagateStyleToAnonymousChildren): + * rendering/RenderObject.h: + (WebCore::RenderObject::isBeforeAfterContent): + * rendering/RenderRuby.cpp: + (WebCore::RenderRubyAsInline::styleDidChange): + (WebCore::RenderRubyAsBlock::styleDidChange): + * rendering/RenderRuby.h: + * rendering/RenderTable.cpp: + (WebCore::RenderTable::styleDidChange): + * rendering/RenderTableRow.cpp: + (WebCore::RenderTableRow::styleDidChange): + (WebCore::RenderTableRow::addChild): + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::styleDidChange): + (WebCore::RenderTableSection::addChild): + * rendering/RenderTableSection.h: + +2011-09-05 Abhishek Arya <inferno@chromium.org> + + Crash in RenderObjectChildList::destroyLeftOverChildren() + https://bugs.webkit.org/show_bug.cgi?id=64753 + + Reviewed by James Robinson. + + If any of the ancestors between column span element and containing + column's block is a continuation, then don't attempt to render the + column span by splitting the block into continuations. + + Test: fast/multicol/column-span-parent-continuation-crash.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::columnsBlockForSpanningElement): + +2011-08-30 Abhishek Arya <inferno@chromium.org> + + Removed m_owner accessed in custom scrollbars. + https://bugs.webkit.org/show_bug.cgi?id=64737 + + Reviewed by David Hyatt. + + Problem does not reproduce in DRT, even with Eventhandler tricks + and gc(). So, adding a manual test. + + * manual-tests/custom-scrollbar-renderer-removed-crash.html: Added. + * page/FrameView.cpp: + (WebCore::FrameView::clearOwningRendererForCustomScrollbars): + * page/FrameView.h: + * rendering/RenderBox.cpp: + (WebCore::RenderBox::willBeDestroyed): when this renderbox is getting + destroyed, clear the custom scrollbar in this frameview having this renderbox + as its owning renderer. + * rendering/RenderScrollbar.cpp: + (WebCore::RenderScrollbar::getScrollbarPseudoStyle): fix the null check. + +2011-09-04 Abhishek Arya <inferno@chromium.org> + + Crash in Range::processAncestorsAndTheirSiblings. + https://bugs.webkit.org/show_bug.cgi?id=67556 + + Reviewed by Ryosuke Niwa. + + Create a temporary RefPtr Node vector to keep all the ancestor's + childs so that we don't access removed child nodes. + + Test: fast/dom/Range/range-delete-contents-event-fire-crash.html + + * dom/Range.cpp: + (WebCore::Range::processContents): + (WebCore::Range::processAncestorsAndTheirSiblings): + +2011-08-30 Adam Barth <abarth@webkit.org> + + Flaky crash with JavaScript URLs + https://bugs.webkit.org/show_bug.cgi?id=66360 + + Reviewed by Nate Chapin. + + This patch teaches DocumentWriter::begin to make a copy of the URL + before beginning a new document to avoid a crash. + + Test: fast/loader/javascript-url-iframe-crash.html + + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::begin): + +2011-08-30 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Emit last progress notification before calling dispatchDidFinishLoad + https://bugs.webkit.org/show_bug.cgi?id=28851 + + Reviewed by Adam Barth. + + Original patch by Xan Lopez. Change FrameLoader to dispatch the notifications in + a more natural sequence. + + Test: http/tests/loading/progress-finished-callback.html + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::checkLoadCompleteForThisFrame): + +2011-08-22 Nate Chapin <japhet@chromium.org> + + Unload events can crash us when they blank out + a parent frame. + https://bugs.webkit.org/show_bug.cgi?id=64741 + + Reviewed by Adam Barth. + + Test: fast/loader/document-destruction-within-unload.html + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::stopLoading): Prevent unload events + from going into infinite recursion. + (WebCore::FrameLoader::setDocumentLoader): Ensure we don't + let set m_documentLoader to a DocumentLoader with a null Frame*. + (WebCore::FrameLoader::detachChildren): Save off a vector of + children to detach, rather than doing it inline. + +2011-08-30 Abhishek Arya <inferno@chromium.org> + + Style not updated for table parts in :before, :after content. + https://bugs.webkit.org/show_bug.cgi?id=66141 + + Reviewed by Dave Hyatt. + + Tests: fast/table/table-before-child-style-update.html + fast/table/table-row-before-child-style-update.html + + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::updateBeforeAfterContent): + +2011-08-25 Abhishek Arya <inferno@chromium.org> + + Incorrect layout of :before and :after content, with display + table, table-row and table-cell. + https://bugs.webkit.org/show_bug.cgi?id=66699 + + Reviewed by David Hyatt. + + Tests: fast/table/table-after-child-in-table.html + fast/table/table-before-child-in-table.html + fast/table/table-cell-after-child-in-block.html + fast/table/table-cell-after-child-in-table.html + fast/table/table-cell-before-child-in-block.html + fast/table/table-cell-before-child-in-table.html + fast/table/table-row-after-child-in-block.html + fast/table/table-row-after-child-in-table.html + fast/table/table-row-before-child-in-block.html + fast/table/table-row-before-child-in-table.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::addChildIgnoringAnonymousColumnBlocks): + Fix the looping condition to detect :after child correctly. + isAnonymousBlock() does not apply to tables, instead + using isAnonymous(). + * rendering/RenderTableRow.cpp: + (WebCore::RenderTableRow::addChild): Don't add the new child + in the generatedContainer with :before, :after content. + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::addChild): Don't add the new child + in the generatedContainer with :before, :after content. + +2011-08-29 Abhishek Arya <inferno@chromium.org> + + Crash in InlineBox::deleteLine due to accessing removed + renderer. + https://bugs.webkit.org/show_bug.cgi?id=66015 + + Reviewed by Simon Fraser. + + Test: fast/block/line-layout/inline-box-wrapper-crash.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::positionLineBox): Make sure that the + previous inline box wrapper is destroyed properly, before + setting a new one. + +2011-08-30 Ademar de Souza Reis Jr. <ademar.reis@openbossa.org> + + [Qt] Do not unconditionally use pkg-config in .pro files + https://bugs.webkit.org/show_bug.cgi?id=67055 + + Reviewed by Andreas Kling. + + Original patch from Rohan McGovern <rohan.mcgovern@nokia.com> + + Using the first pkg-config in PATH is prone to errors when cross + compiling inside the Qt repository (using Qt's build-system). + + This patch protect calls for pkg-config with + !contains(QT_CONFIG, no-pkg-config). no-pkg-config is added to + QT_CONFIG by Qt's 'configure' when cross-compiling on systems + without pkg-config. + + The respective change in Qt's configure has been submited already. + + No new tests as this is just a build change. + + * features.pri: protect pkg-config calls + 2011-08-25 Ademar de Souza Reis Jr. <ademar.reis@openbossa.org> [Qt] Enable password echo on Symbian builds diff --git a/src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityRenderObject.cpp index 25078c5..9725a6b 100644 --- a/src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -302,8 +302,12 @@ AccessibilityObject* AccessibilityRenderObject::previousSibling() const // Case 2: Anonymous block parent of the end of a continuation - skip all the way to before // the parent of the start, since everything in between will be linked up via the continuation. - else if (m_renderer->isAnonymousBlock() && firstChildIsInlineContinuation(m_renderer)) - previousSibling = startOfContinuations(m_renderer->firstChild())->parent()->previousSibling(); + else if (m_renderer->isAnonymousBlock() && firstChildIsInlineContinuation(m_renderer)) { + RenderObject* firstParent = startOfContinuations(m_renderer->firstChild())->parent(); + while (firstChildIsInlineContinuation(firstParent)) + firstParent = startOfContinuations(firstParent->firstChild())->parent(); + previousSibling = firstParent->previousSibling(); + } // Case 3: The node has an actual previous sibling else if (RenderObject* ps = m_renderer->previousSibling()) @@ -340,8 +344,12 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const // Case 2: Anonymous block parent of the start of a continuation - skip all the way to // after the parent of the end, since everything in between will be linked up via the continuation. - else if (m_renderer->isAnonymousBlock() && lastChildHasContinuation(m_renderer)) - nextSibling = endOfContinuations(m_renderer->lastChild())->parent()->nextSibling(); + else if (m_renderer->isAnonymousBlock() && lastChildHasContinuation(m_renderer)) { + RenderObject* lastParent = endOfContinuations(m_renderer->lastChild())->parent(); + while (lastChildHasContinuation(lastParent)) + lastParent = endOfContinuations(lastParent->lastChild())->parent(); + nextSibling = lastParent->nextSibling(); + } // Case 3: node has an actual next sibling else if (RenderObject* ns = m_renderer->nextSibling()) diff --git a/src/3rdparty/webkit/Source/WebCore/bindings/ScriptControllerBase.cpp b/src/3rdparty/webkit/Source/WebCore/bindings/ScriptControllerBase.cpp index 4190637..254a6c2 100644 --- a/src/3rdparty/webkit/Source/WebCore/bindings/ScriptControllerBase.cpp +++ b/src/3rdparty/webkit/Source/WebCore/bindings/ScriptControllerBase.cpp @@ -59,6 +59,8 @@ ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode) bool wasInExecuteScript = m_inExecuteScript; m_inExecuteScript = true; + RefPtr<Frame> protect(m_frame); // Script execution can destroy the frame, and thus the ScriptController. + ScriptValue result = evaluate(sourceCode); if (!wasInExecuteScript) { diff --git a/src/3rdparty/webkit/Source/WebCore/dom/Range.cpp b/src/3rdparty/webkit/Source/WebCore/dom/Range.cpp index 0c247c2..4f8ad85 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/Range.cpp +++ b/src/3rdparty/webkit/Source/WebCore/dom/Range.cpp @@ -51,6 +51,8 @@ using namespace std; static WTF::RefCountedLeakCounter rangeCounter("Range"); #endif +typedef Vector<RefPtr<Node> > NodeVector; + inline Range::Range(PassRefPtr<Document> ownerDocument) : m_ownerDocument(ownerDocument) , m_start(m_ownerDocument) @@ -665,8 +667,6 @@ static inline unsigned lengthOfContentsInNode(Node* node) PassRefPtr<DocumentFragment> Range::processContents(ActionType action, ExceptionCode& ec) { - typedef Vector<RefPtr<Node> > NodeVector; - RefPtr<DocumentFragment> fragment; if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) fragment = DocumentFragment::create(m_ownerDocument.get()); @@ -880,9 +880,14 @@ PassRefPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node // FIXME: This assertion may fail if DOM is modified during mutation event // FIXME: Share code with Range::processNodes ASSERT(!firstChildInAncestorToProcess || firstChildInAncestorToProcess->parentNode() == ancestor); - RefPtr<Node> next; - for (Node* child = firstChildInAncestorToProcess.get(); child; child = next.get()) { - next = direction == ProcessContentsForward ? child->nextSibling() : child->previousSibling(); + + NodeVector nodes; + for (Node* child = firstChildInAncestorToProcess.get(); child; + child = (direction == ProcessContentsForward) ? child->nextSibling() : child->previousSibling()) + nodes.append(child); + + for (NodeVector::const_iterator it = nodes.begin(); it != nodes.end(); it++) { + Node* child = it->get(); switch (action) { case DELETE_CONTENTS: ancestor->removeChild(child, ec); diff --git a/src/3rdparty/webkit/Source/WebCore/features.pri b/src/3rdparty/webkit/Source/WebCore/features.pri index 3e397a1..f04d0b4 100644 --- a/src/3rdparty/webkit/Source/WebCore/features.pri +++ b/src/3rdparty/webkit/Source/WebCore/features.pri @@ -168,7 +168,7 @@ symbian|maemo5|maemo6 { DEFINES += WTF_USE_QTKIT=1 DEFINES -= WTF_USE_QTKIT=0 } else: linux-*:!contains(DEFINES, USE_QTMULTIMEDIA=1) { - !contains(QT_CONFIG, no-pkg-config):system(pkg-config --exists glib-2.0 gio-2.0 gstreamer-0.10) { + !contains(QT_CONFIG, no-pkg-config):system(pkg-config --exists glib-2.0 gio-2.0 gstreamer-0.10): { DEFINES -= ENABLE_VIDEO=0 DEFINES += ENABLE_VIDEO=1 DEFINES += WTF_USE_GSTREAMER=1 diff --git a/src/3rdparty/webkit/Source/WebCore/loader/DocumentWriter.cpp b/src/3rdparty/webkit/Source/WebCore/loader/DocumentWriter.cpp index 2fc02d1..cbce0d3 100644 --- a/src/3rdparty/webkit/Source/WebCore/loader/DocumentWriter.cpp +++ b/src/3rdparty/webkit/Source/WebCore/loader/DocumentWriter.cpp @@ -106,12 +106,17 @@ PassRefPtr<Document> DocumentWriter::createDocument(const KURL& url) return DOMImplementation::createDocument(m_mimeType, m_frame, url, m_frame->inViewSourceMode()); } -void DocumentWriter::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) +void DocumentWriter::begin(const KURL& urlReference, bool dispatch, SecurityOrigin* origin) { // We need to take a reference to the security origin because |clear| // might destroy the document that owns it. RefPtr<SecurityOrigin> forcedSecurityOrigin = origin; + // We grab a local copy of the URL because it's easy for callers to supply + // a URL that will be deallocated during the execution of this function. + // For example, see <https://bugs.webkit.org/show_bug.cgi?id=66360>. + KURL url = urlReference; + // Create a new document before clearing the frame, because it may need to // inherit an aliased security context. RefPtr<Document> document = createDocument(url); diff --git a/src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.cpp b/src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.cpp index 1b046b3..4bef249 100644 --- a/src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.cpp +++ b/src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.cpp @@ -1880,6 +1880,20 @@ void FrameLoader::setDocumentLoader(DocumentLoader* loader) m_documentLoader->detachFromFrame(); m_documentLoader = loader; + + // The following abomination is brought to you by the unload event. + // The detachChildren() call above may trigger a child frame's unload event, + // which could do something obnoxious like call document.write("") on + // the main frame, which results in detaching children while detaching children. + // This can cause the new m_documentLoader to be detached from its Frame*, but still + // be alive. To make matters worse, DocumentLoaders with a null Frame* aren't supposed + // to happen when they're still alive (and many places below us on the stack think the + // DocumentLoader is still usable). Ergo, we reattach loader to its Frame, and pretend + // like nothing ever happened. + if (m_documentLoader && !m_documentLoader->frame()) { + ASSERT(!m_documentLoader->isLoading()); + m_documentLoader->setFrame(m_frame); + } } void FrameLoader::setPolicyDocumentLoader(DocumentLoader* loader) @@ -2506,14 +2520,15 @@ void FrameLoader::checkLoadCompleteForThisFrame() if (m_stateMachine.creatingInitialEmptyDocument() || !m_stateMachine.committedFirstRealDocumentLoad()) return; + if (Page* page = m_frame->page()) + page->progress()->progressCompleted(m_frame); + const ResourceError& error = dl->mainDocumentError(); if (!error.isNull()) m_client->dispatchDidFailLoad(error); else m_client->dispatchDidFinishLoad(); - if (Page* page = m_frame->page()) - page->progress()->progressCompleted(m_frame); return; } @@ -2589,12 +2604,14 @@ void FrameLoader::frameLoadCompleted() void FrameLoader::detachChildren() { - // FIXME: Is it really necessary to do this in reverse order? - Frame* previous; - for (Frame* child = m_frame->tree()->lastChild(); child; child = previous) { - previous = child->tree()->previousSibling(); - child->loader()->detachFromParent(); - } + typedef Vector<RefPtr<Frame> > FrameVector; + FrameVector childrenToDetach; + childrenToDetach.reserveCapacity(m_frame->tree()->childCount()); + for (Frame* child = m_frame->tree()->lastChild(); child; child = child->tree()->previousSibling()) + childrenToDetach.append(child); + FrameVector::iterator end = childrenToDetach.end(); + for (FrameVector::iterator it = childrenToDetach.begin(); it != end; it++) + (*it)->loader()->detachFromParent(); } void FrameLoader::closeAndRemoveChild(Frame* child) diff --git a/src/3rdparty/webkit/Source/WebCore/page/FrameView.cpp b/src/3rdparty/webkit/Source/WebCore/page/FrameView.cpp index 3dadbf3..ef72fb7 100644 --- a/src/3rdparty/webkit/Source/WebCore/page/FrameView.cpp +++ b/src/3rdparty/webkit/Source/WebCore/page/FrameView.cpp @@ -2277,6 +2277,23 @@ bool FrameView::hasCustomScrollbars() const return false; } +void FrameView::clearOwningRendererForCustomScrollbars(RenderBox* box) +{ + const HashSet<RefPtr<Widget> >* viewChildren = children(); + HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end(); + for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) { + Widget* widget = current->get(); + if (widget->isScrollbar()) { + Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); + if (scrollbar->isCustomScrollbar()) { + RenderScrollbar* customScrollbar = toRenderScrollbar(scrollbar); + if (customScrollbar->owningRenderer() == box) + customScrollbar->clearOwningRenderer(); + } + } + } +} + FrameView* FrameView::parentFrameView() const { if (Widget* parentView = parent()) { diff --git a/src/3rdparty/webkit/Source/WebCore/page/FrameView.h b/src/3rdparty/webkit/Source/WebCore/page/FrameView.h index fafebfe..b151cfc 100644 --- a/src/3rdparty/webkit/Source/WebCore/page/FrameView.h +++ b/src/3rdparty/webkit/Source/WebCore/page/FrameView.h @@ -267,6 +267,8 @@ public: virtual bool shouldSuspendScrollAnimations() const; + void clearOwningRendererForCustomScrollbars(RenderBox*); + protected: virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); virtual void scrollContentsSlowPath(const IntRect& updateRect); diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/Gradient.cpp b/src/3rdparty/webkit/Source/WebCore/platform/graphics/Gradient.cpp index 7e3984f..fc7b741 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/Gradient.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/Gradient.cpp @@ -124,10 +124,6 @@ void Gradient::sortStopsIfNecessary() if (!m_stops.size()) return; - // Shortcut for the ideal case (ordered 2-stop gradient) - if (m_stops.size() == 2 && compareStops(*m_stops.begin(), *m_stops.end())) - return; - std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); } diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderBlock.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderBlock.cpp index 39c0469..4ad1bfe 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderBlock.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderBlock.cpp @@ -241,21 +241,7 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty } } - // FIXME: We could save this call when the change only affected non-inherited properties - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (child->isAnonymousBlock()) { - RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style()); - if (style()->specifiesColumns()) { - if (child->style()->specifiesColumns()) - newStyle->inheritColumnPropertiesFrom(style()); - if (child->style()->columnSpan()) - newStyle->setColumnSpan(true); - } - newStyle->setDisplay(BLOCK); - child->setStyle(newStyle.release()); - } - } - + propagateStyleToAnonymousChildren(true); m_lineHeight = -1; // Update pseudos for :before and :after now. @@ -654,8 +640,22 @@ RenderBlock* RenderBlock::columnsBlockForSpanningElement(RenderObject* newChild) && !newChild->isInline() && !isAnonymousColumnSpanBlock()) { if (style()->specifiesColumns()) columnsBlockAncestor = this; - else if (!isInline() && parent() && parent()->isRenderBlock()) + else if (!isInline() && parent() && parent()->isRenderBlock()) { columnsBlockAncestor = toRenderBlock(parent())->containingColumnsBlock(false); + + if (columnsBlockAncestor) { + // Make sure that none of the parent ancestors have a continuation. + // If yes, we do not want split the block into continuations. + RenderObject* curr = this; + while (curr && curr != columnsBlockAncestor) { + if (curr->isRenderBlock() && toRenderBlock(curr)->continuation()) { + columnsBlockAncestor = 0; + break; + } + curr = curr->parent(); + } + } + } } return columnsBlockAncestor; } @@ -665,10 +665,10 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, // Make sure we don't append things after :after-generated content if we have it. if (!beforeChild) { RenderObject* lastRenderer = lastChild(); - if (isAfterContent(lastRenderer)) + while (lastRenderer && lastRenderer->isAnonymous() && !isAfterContent(lastRenderer)) + lastRenderer = lastRenderer->lastChild(); + if (lastRenderer && isAfterContent(lastRenderer)) beforeChild = lastRenderer; - else if (lastRenderer && lastRenderer->isAnonymousBlock() && isAfterContent(lastRenderer->lastChild())) - beforeChild = lastRenderer->lastChild(); } // If the requested beforeChild is not one of our children, then this is because diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderBox.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderBox.cpp index 9c2aa48..f052ee7 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderBox.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderBox.cpp @@ -204,6 +204,11 @@ void RenderBox::destroy() if (style() && (style()->logicalHeight().isPercent() || style()->logicalMinHeight().isPercent() || style()->logicalMaxHeight().isPercent())) RenderBlock::removePercentHeightDescendant(this); + // If this renderer is owning renderer for the frameview's custom scrollbars, + // we need to clear it from the scrollbar. See webkit bug 64737. + if (style() && style()->hasPseudoStyle(SCROLLBAR) && frame() && frame()->view()) + frame()->view()->clearOwningRendererForCustomScrollbars(this); + RenderBoxModelObject::destroy(); } @@ -1372,6 +1377,8 @@ void RenderBox::positionLineBox(InlineBox* box) box->destroy(renderArena()); } else if (isReplaced()) { setLocation(lroundf(box->x()), lroundf(box->y())); + if (m_inlineBoxWrapper) + deleteLineBoxWrapper(); m_inlineBoxWrapper = box; } } diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.cpp index a81e668..c1f5ba0 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.cpp @@ -1811,6 +1811,24 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldSt } } +void RenderObject::propagateStyleToAnonymousChildren(bool blockChildrenOnly) +{ + // FIXME: We could save this call when the change only affected non-inherited properties. + for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { + if (blockChildrenOnly ? child->isAnonymousBlock() : child->isAnonymous() && !child->isBeforeOrAfterContent()) { + RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style()); + if (style()->specifiesColumns()) { + if (child->style()->specifiesColumns()) + newStyle->inheritColumnPropertiesFrom(style()); + if (child->style()->columnSpan()) + newStyle->setColumnSpan(true); + } + newStyle->setDisplay(blockChildrenOnly ? BLOCK : child->style()->display()); + child->setStyle(newStyle.release()); + } + } +} + void RenderObject::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers) { // Optimize the common case diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.h b/src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.h index 44ee43c..2ba0114 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.h +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.h @@ -322,8 +322,10 @@ public: inline bool isBeforeContent() const; inline bool isAfterContent() const; + inline bool isBeforeOrAfterContent() const; static inline bool isBeforeContent(const RenderObject* obj) { return obj && obj->isBeforeContent(); } static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); } + static inline bool isBeforeOrAfterContent(const RenderObject* obj) { return obj && obj->isBeforeOrAfterContent(); } bool childrenInline() const { return m_childrenInline; } void setChildrenInline(bool b = true) { m_childrenInline = b; } @@ -791,6 +793,7 @@ protected: virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); // Overrides should call the superclass at the start virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false); void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide, Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false); @@ -932,6 +935,11 @@ inline bool RenderObject::isAfterContent() const return true; } +inline bool RenderObject::isBeforeOrAfterContent() const +{ + return isBeforeContent() || isAfterContent(); +} + inline void RenderObject::setNeedsLayout(bool b, bool markParents) { bool alreadyNeededLayout = m_needsLayout; diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderObjectChildList.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderObjectChildList.cpp index ff9ff15..28703c5 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderObjectChildList.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderObjectChildList.cpp @@ -271,7 +271,12 @@ RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj do { // Skip list markers and generated run-ins first = first->firstChild(); - while (first && (first->isListMarker() || (first->isRenderInline() && first->isRunIn() && first->isAnonymous()))) + while (first && first->isListMarker()) { + if (first->parent() != owner && first->parent()->isAnonymousBlock()) + first = first->parent(); + first = first->nextSibling(); + } + while (first && first->isRenderInline() && first->isRunIn()) first = first->nextSibling(); } while (first && first->isAnonymous() && first->style()->styleType() == NOPSEUDO); @@ -293,7 +298,7 @@ RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj // We still need to skip any list markers that could exist before the run-in. while (first && first->isListMarker()) first = first->nextSibling(); - if (first && first->style()->styleType() == BEFORE && first->isRenderInline() && first->isRunIn() && first->isAnonymous()) + if (first && first->style()->styleType() == BEFORE && first->isRenderInline() && first->isRunIn()) return first; } return 0; @@ -388,6 +393,21 @@ void RenderObjectChildList::updateBeforeAfterContent(RenderObject* owner, Pseudo if (!beforeAfterParent) return; + // When beforeAfterParent is not equal to child (e.g. in tables), + // we need to create new styles inheriting from pseudoElementStyle + // on all the intermediate parents (leaving their display same). + if (beforeAfterParent != child) { + RenderObject* curr = beforeAfterParent; + while (curr && curr != child) { + ASSERT(curr->isAnonymous()); + RefPtr<RenderStyle> newStyle = RenderStyle::create(); + newStyle->inheritFrom(pseudoElementStyle); + newStyle->setDisplay(curr->style()->display()); + curr->setStyle(newStyle); + curr = curr->parent(); + } + } + // Note that if we ever support additional types of generated content (which should be way off // in the future), this code will need to be patched. for (RenderObject* genChild = beforeAfterParent->firstChild(); genChild; genChild = genChild->nextSibling()) { diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.cpp index e0137de..41604d6 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.cpp @@ -119,6 +119,12 @@ RenderRubyAsInline::~RenderRubyAsInline() { } +void RenderRubyAsInline::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderInline::styleDidChange(diff, oldStyle); + propagateStyleToAnonymousChildren(); +} + void RenderRubyAsInline::addChild(RenderObject* child, RenderObject* beforeChild) { // Insert :before and :after content before/after the RenderRubyRun(s) @@ -220,6 +226,12 @@ RenderRubyAsBlock::~RenderRubyAsBlock() { } +void RenderRubyAsBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderBlock::styleDidChange(diff, oldStyle); + propagateStyleToAnonymousChildren(); +} + void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild) { // Insert :before and :after content before/after the RenderRubyRun(s) diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.h b/src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.h index 24ac0db..2ab964c 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.h +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.h @@ -59,6 +59,9 @@ public: virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); virtual void removeChild(RenderObject* child); +protected: + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + private: virtual bool isRuby() const { return true; } virtual const char* renderName() const { return "RenderRuby (inline)"; } @@ -75,6 +78,9 @@ public: virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); virtual void removeChild(RenderObject* child); +protected: + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + private: virtual bool isRuby() const { return true; } virtual const char* renderName() const { return "RenderRuby (block)"; } diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbar.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbar.cpp index 962024c..7a75b2e 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbar.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbar.cpp @@ -149,7 +149,7 @@ ScrollbarPart RenderScrollbar::partForStyleResolve() PassRefPtr<RenderStyle> RenderScrollbar::getScrollbarPseudoStyle(ScrollbarPart partType, PseudoId pseudoId) { - if (!m_owner) + if (!owningRenderer()) return 0; s_styleResolvePart = partType; diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderTable.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderTable.cpp index 4e90ffc..73b0801 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderTable.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderTable.cpp @@ -73,6 +73,7 @@ RenderTable::~RenderTable() void RenderTable::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderBlock::styleDidChange(diff, oldStyle); + propagateStyleToAnonymousChildren(); ETableLayout oldTableLayout = oldStyle ? oldStyle->tableLayout() : TAUTO; diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableRow.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableRow.cpp index 2edcfc4..686bc3a 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableRow.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableRow.cpp @@ -74,10 +74,10 @@ void RenderTableRow::updateBeforeAndAfterContent() void RenderTableRow::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderBox::styleDidChange(diff, oldStyle); + propagateStyleToAnonymousChildren(); if (parent()) updateBeforeAndAfterContent(); - } void RenderTableRow::addChild(RenderObject* child, RenderObject* beforeChild) @@ -90,7 +90,7 @@ void RenderTableRow::addChild(RenderObject* child, RenderObject* beforeChild) RenderObject* last = beforeChild; if (!last) last = lastChild(); - if (last && last->isAnonymous() && last->isTableCell()) { + if (last && last->isAnonymous() && last->isTableCell() && !last->isBeforeOrAfterContent()) { if (beforeChild == last) beforeChild = last->firstChild(); last->addChild(child, beforeChild); @@ -98,7 +98,7 @@ void RenderTableRow::addChild(RenderObject* child, RenderObject* beforeChild) } // If beforeChild is inside an anonymous cell, insert into the cell. - if (last && !last->isTableCell() && last->parent() && last->parent()->isAnonymous()) { + if (last && !last->isTableCell() && last->parent() && last->parent()->isAnonymous() && !last->parent()->isBeforeOrAfterContent()) { last->parent()->addChild(child, beforeChild); return; } diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.cpp index 6b080b8..7d414a0 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.cpp @@ -74,6 +74,12 @@ RenderTableSection::~RenderTableSection() clearGrid(); } +void RenderTableSection::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderBox::styleDidChange(diff, oldStyle); + propagateStyleToAnonymousChildren(); +} + void RenderTableSection::destroy() { RenderTable* recalcTable = table(); @@ -96,7 +102,7 @@ void RenderTableSection::addChild(RenderObject* child, RenderObject* beforeChild RenderObject* last = beforeChild; if (!last) last = lastChild(); - if (last && last->isAnonymous()) { + if (last && last->isAnonymous() && !last->isBeforeOrAfterContent()) { if (beforeChild == last) beforeChild = last->firstChild(); last->addChild(child, beforeChild); @@ -108,7 +114,7 @@ void RenderTableSection::addChild(RenderObject* child, RenderObject* beforeChild RenderObject* lastBox = last; while (lastBox && lastBox->parent()->isAnonymous() && !lastBox->isTableRow()) lastBox = lastBox->parent(); - if (lastBox && lastBox->isAnonymous()) { + if (lastBox && lastBox->isAnonymous() && !lastBox->isBeforeOrAfterContent()) { lastBox->addChild(child, beforeChild); return; } diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.h b/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.h index cc969e8..db6edc2 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.h +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.h @@ -118,6 +118,9 @@ public: int getBaseline(int row) { return m_grid[row].baseline; } +protected: + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + private: virtual RenderObjectChildList* virtualChildren() { return children(); } virtual const RenderObjectChildList* virtualChildren() const { return children(); } diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderWidget.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderWidget.cpp index 97444cd..5a00374 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderWidget.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderWidget.cpp @@ -143,6 +143,11 @@ void RenderWidget::destroy() if (style() && (style()->logicalHeight().isPercent() || style()->logicalMinHeight().isPercent() || style()->logicalMaxHeight().isPercent())) RenderBlock::removePercentHeightDescendant(this); + // If this renderer is owning renderer for the frameview's custom scrollbars, + // we need to clear it from the scrollbar. See webkit bug 64737. + if (style() && style()->hasPseudoStyle(SCROLLBAR) && frame() && frame()->view()) + frame()->view()->clearOwningRendererForCustomScrollbars(this); + if (hasLayer()) { layer()->clearClipRects(); setHasLayer(false); diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp index 79e8e1e..db4027b 100644 --- a/src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp +++ b/src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp @@ -168,7 +168,7 @@ void RenderSVGResourceContainer::registerResource() const SVGDocumentExtensions::SVGPendingElements::const_iterator end = clients->end(); for (SVGDocumentExtensions::SVGPendingElements::const_iterator it = clients->begin(); it != end; ++it) { ASSERT((*it)->hasPendingResources()); - (*it)->setHasPendingResources(false); + (*it)->clearHasPendingResourcesIfPossible(); RenderObject* renderer = (*it)->renderer(); if (!renderer) continue; diff --git a/src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.cpp b/src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.cpp index d74f646..4b339ca 100644..100755 --- a/src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.cpp +++ b/src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.cpp @@ -227,7 +227,7 @@ void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyled m_pendingResources.add(id, set); } - element->setHasPendingResources(true); + element->setHasPendingResources(); } bool SVGDocumentExtensions::hasPendingResources(const AtomicString& id) const @@ -238,6 +238,24 @@ bool SVGDocumentExtensions::hasPendingResources(const AtomicString& id) const return m_pendingResources.contains(id); } +bool SVGDocumentExtensions::isElementInPendingResources(SVGStyledElement* element) const +{ + ASSERT(element); + + if (m_pendingResources.isEmpty()) + return false; + + HashMap<AtomicString, SVGPendingElements*>::const_iterator end = m_pendingResources.end(); + for (HashMap<AtomicString, SVGPendingElements*>::const_iterator it = m_pendingResources.begin(); it != end; ++it) { + SVGPendingElements* elements = it->second; + ASSERT(elements); + + if (elements->contains(element)) + return true; + } + return false; +} + void SVGDocumentExtensions::removeElementFromPendingResources(SVGStyledElement* element) { ASSERT(element); @@ -245,8 +263,6 @@ void SVGDocumentExtensions::removeElementFromPendingResources(SVGStyledElement* if (m_pendingResources.isEmpty() || !element->hasPendingResources()) return; - element->setHasPendingResources(false); - Vector<AtomicString> toBeRemoved; HashMap<AtomicString, SVGPendingElements*>::iterator end = m_pendingResources.end(); for (HashMap<AtomicString, SVGPendingElements*>::iterator it = m_pendingResources.begin(); it != end; ++it) { @@ -259,6 +275,8 @@ void SVGDocumentExtensions::removeElementFromPendingResources(SVGStyledElement* toBeRemoved.append(it->first); } + element->clearHasPendingResourcesIfPossible(); + if (toBeRemoved.isEmpty()) return; diff --git a/src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.h b/src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.h index a66b066..8ad44f8 100644..100755 --- a/src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.h +++ b/src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.h @@ -81,6 +81,7 @@ public: // For instance, dynamically build gradients / patterns / clippers... void addPendingResource(const AtomicString& id, SVGStyledElement*); bool hasPendingResources(const AtomicString& id) const; + bool isElementInPendingResources(SVGStyledElement*) const; void removeElementFromPendingResources(SVGStyledElement*); PassOwnPtr<SVGPendingElements> removePendingResource(const AtomicString& id); }; diff --git a/src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.cpp b/src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.cpp index c1a6449..0693eb0 100644..100755 --- a/src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.cpp +++ b/src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.cpp @@ -380,7 +380,7 @@ void SVGStyledElement::insertedIntoDocument() for (SVGDocumentExtensions::SVGPendingElements::const_iterator it = clients->begin(); it != end; ++it) { ASSERT((*it)->hasPendingResources()); (*it)->buildPendingResource(); - (*it)->setHasPendingResources(false); + (*it)->clearHasPendingResourcesIfPossible(); } } @@ -453,9 +453,15 @@ bool SVGStyledElement::hasPendingResources() const return hasRareSVGData() && rareSVGData()->hasPendingResources(); } -void SVGStyledElement::setHasPendingResources(bool value) +void SVGStyledElement::setHasPendingResources() { - ensureRareSVGData()->setHasPendingResources(value); + ensureRareSVGData()->setHasPendingResources(true); +} + +void SVGStyledElement::clearHasPendingResourcesIfPossible() +{ + if (!document()->accessSVGExtensions()->isElementInPendingResources(this)) + ensureRareSVGData()->setHasPendingResources(false); } AffineTransform SVGStyledElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const diff --git a/src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.h b/src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.h index f48513c..fdad347 100644..100755 --- a/src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.h +++ b/src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.h @@ -53,7 +53,8 @@ public: void setInstanceUpdatesBlocked(bool); bool hasPendingResources() const; - void setHasPendingResources(bool); + void setHasPendingResources(); + void clearHasPendingResourcesIfPossible(); AnimatedAttributeType animatedPropertyTypeForCSSProperty(const QualifiedName&); static bool isAnimatableCSSProperty(const QualifiedName&); diff --git a/src/3rdparty/webkit/Source/WebCore/svg/SVGUseElement.cpp b/src/3rdparty/webkit/Source/WebCore/svg/SVGUseElement.cpp index d8f9674..7de1f4c 100644 --- a/src/3rdparty/webkit/Source/WebCore/svg/SVGUseElement.cpp +++ b/src/3rdparty/webkit/Source/WebCore/svg/SVGUseElement.cpp @@ -172,11 +172,11 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) const SVGDocumentExtensions::SVGPendingElements::const_iterator end = clients->end(); for (SVGDocumentExtensions::SVGPendingElements::const_iterator it = clients->begin(); it != end; ++it) { ASSERT((*it)->hasPendingResources()); - (*it)->setHasPendingResources(false); + (*it)->clearHasPendingResourcesIfPossible(); } m_resourceId = String(); - setHasPendingResources(false); + clearHasPendingResourcesIfPossible(); } invalidateShadowTree(); diff --git a/src/3rdparty/webkit/Source/WebKit.pri b/src/3rdparty/webkit/Source/WebKit.pri index be1c7b7..5bd9577 100644 --- a/src/3rdparty/webkit/Source/WebKit.pri +++ b/src/3rdparty/webkit/Source/WebKit.pri @@ -2,9 +2,6 @@ contains(QT_CONFIG, qpa)|contains(QT_CONFIG, embedded): CONFIG += embedded -contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols -unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions - # Detect that we are building as a standalone package by the presence of # either the generated files directory or as part of the Qt package through # QTDIR_build diff --git a/src/3rdparty/webkit/Source/WebKit/qt/ChangeLog b/src/3rdparty/webkit/Source/WebKit/qt/ChangeLog index 0bca4b2..32428f1 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/Source/WebKit/qt/ChangeLog @@ -1,3 +1,68 @@ +2011-09-06 Ademar de Souza Reis Jr. <ademar.reis@openbossa.org> + + [Qt][Symbian] REGRESSION[94105] DumpRenderTree.exe doesn't build on Symbian + https://bugs.webkit.org/show_bug.cgi?id=67644 + + Reviewed by Csaba Osztrogonác. + + * symbian/eabi/QtWebKitu.def: add missing entry for + FrameLoaderClientQt::dumpProgressFinishedCallback(bool) + +2011-08-31 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + [Qt] Unskip API test for load signals order + https://bugs.webkit.org/show_bug.cgi?id=67285 + + Reviewed by Andreas Kling. + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadSignalsOrder): + +2011-08-30 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Emit last progress notification before calling dispatchDidFinishLoad + https://bugs.webkit.org/show_bug.cgi?id=28851 + + Reviewed by Adam Barth. + + Add infrastructure to dump progressFinishedNotification callback in DRT. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::dumpProgressFinishedCallback): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::postProgressFinishedNotification): + * WebCoreSupport/FrameLoaderClientQt.h: + +2011-09-02 Jade Han <jade.han@nokia.com> + + [Qt][Symbian] REGRESSION(93235) Missing .def update + https://bugs.webkit.org/show_bug.cgi?id=67307 + + Reviewed by Laszlo Gombos. + + * symbian/eabi/QtWebKitu.def: + +2011-08-12 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + [Qt] Add test for correct order of load signals in QWebPage + https://bugs.webkit.org/show_bug.cgi?id=66016 + + Reviewed by Benjamin Poulain. + + Add API test to ensure the order of load signals: loadStarted() needs to be emitted + first, then loadProgress(100), followed by loadFinished(). + + The test is skipped since this right now is broken, the bug + https://bugs.webkit.org/show_bug.cgi?id=28851 tracks one possible way to fix. + + * tests/qwebpage/tst_qwebpage.cpp: + (SpyForLoadSignalsOrder::SpyForLoadSignalsOrder): + (SpyForLoadSignalsOrder::isFinished): + (SpyForLoadSignalsOrder::onLoadProgress): + (tst_QWebPage::loadSignalsOrder_data): + (tst_QWebPage::loadSignalsOrder): + 2011-08-25 Ademar de Souza Reis Jr. <ademar.reis@openbossa.org> Unreviewed QtWebKit.pro fix for when building inside Qt diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 2fc8e84..5d4bf6d 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -677,6 +677,11 @@ void DumpRenderTreeSupportQt::dumpFrameLoader(bool b) FrameLoaderClientQt::dumpFrameLoaderCallbacks = b; } +void DumpRenderTreeSupportQt::dumpProgressFinishedCallback(bool b) +{ + FrameLoaderClientQt::dumpProgressFinishedCallback = b; +} + void DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(bool b) { FrameLoaderClientQt::dumpUserGestureInFrameLoaderCallbacks = b; diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 7040ea1..f485cb5 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -163,6 +163,7 @@ public: static QString plainText(const QVariant& rng); static void dumpFrameLoader(bool b); + static void dumpProgressFinishedCallback(bool); static void dumpUserGestureInFrameLoader(bool b); static void dumpResourceLoadCallbacks(bool b); static void dumpResourceResponseMIMETypes(bool b); diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 8971fc4..5e0a2e6 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -170,6 +170,7 @@ static QString drtDescriptionSuitableForTestResult(const RefPtr<WebCore::Node> n namespace WebCore { bool FrameLoaderClientQt::dumpFrameLoaderCallbacks = false; +bool FrameLoaderClientQt::dumpProgressFinishedCallback = false; bool FrameLoaderClientQt::dumpUserGestureInFrameLoaderCallbacks = false; bool FrameLoaderClientQt::dumpResourceLoadCallbacks = false; bool FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = false; @@ -586,6 +587,9 @@ void FrameLoaderClientQt::postProgressEstimateChangedNotification() void FrameLoaderClientQt::postProgressFinishedNotification() { + if (dumpProgressFinishedCallback) + printf("postProgressFinishedNotification\n"); + // Send a mousemove event to: // (1) update the cursor to change according to whatever is underneath the mouse cursor right now; // (2) display the tool tip if the mouse hovers a node which has a tool tip. diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 1be365d..1b9d3b8 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -247,6 +247,7 @@ public: const KURL& lastRequestedUrl() const { return m_lastRequestedUrl; } static bool dumpFrameLoaderCallbacks; + static bool dumpProgressFinishedCallback; static bool dumpUserGestureInFrameLoaderCallbacks; static bool dumpResourceLoadCallbacks; static bool dumpResourceResponseMIMETypes; diff --git a/src/3rdparty/webkit/Source/WebKit/qt/symbian/eabi/QtWebKitu.def b/src/3rdparty/webkit/Source/WebKit/qt/symbian/eabi/QtWebKitu.def index d948de4..b67d3f8 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/src/3rdparty/webkit/Source/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -878,3 +878,6 @@ EXPORTS _ZN8QDRTNodeD1Ev @ 877 NONAME
_ZN8QDRTNodeD2Ev @ 878 NONAME
_ZN8QDRTNodeaSERKS_ @ 879 NONAME
+ _ZN23DumpRenderTreeSupportQt21injectInternalsObjectEP9QWebFrame @ 880 NONAME
+ _ZN23DumpRenderTreeSupportQt20resetInternalsObjectEP9QWebFrame @ 881 NONAME
+ _ZN23DumpRenderTreeSupportQt28dumpProgressFinishedCallbackEb @ 882 NONAME
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 893c284..6102102 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -28,6 +28,7 @@ #include <QMainWindow> #include <QMenu> #include <QPushButton> +#include <QStateMachine> #include <QStyle> #include <QtTest/QtTest> #include <QTextCharFormat> @@ -155,6 +156,8 @@ private slots: void navigatorCookieEnabled(); void deleteQWebViewTwice(); void renderOnRepaintRequestedShouldNotRecurse(); + void loadSignalsOrder_data(); + void loadSignalsOrder(); #ifdef Q_OS_MAC void macCopyUnicodeToClipboard(); @@ -3065,5 +3068,57 @@ void tst_QWebPage::renderOnRepaintRequestedShouldNotRecurse() QVERIFY(::waitForSignal(&r, SIGNAL(finished()))); } +class SpyForLoadSignalsOrder : public QStateMachine { + Q_OBJECT +public: + SpyForLoadSignalsOrder(QWebPage* page, QObject* parent = 0) + : QStateMachine(parent) + { + connect(page, SIGNAL(loadProgress(int)), SLOT(onLoadProgress(int))); + + QState* waitingForLoadStarted = new QState(this); + QState* waitingForLastLoadProgress = new QState(this); + QState* waitingForLoadFinished = new QState(this); + QFinalState* final = new QFinalState(this); + + waitingForLoadStarted->addTransition(page, SIGNAL(loadStarted()), waitingForLastLoadProgress); + waitingForLastLoadProgress->addTransition(this, SIGNAL(lastLoadProgress()), waitingForLoadFinished); + waitingForLoadFinished->addTransition(page, SIGNAL(loadFinished(bool)), final); + + setInitialState(waitingForLoadStarted); + start(); + } + bool isFinished() const + { + return !isRunning(); + } +public Q_SLOTS: + void onLoadProgress(int progress) + { + if (progress == 100) + emit lastLoadProgress(); + } +signals: + void lastLoadProgress(); +}; + +void tst_QWebPage::loadSignalsOrder_data() +{ + QTest::addColumn<QUrl>("url"); + QTest::newRow("inline data") << QUrl("data:text/html,This is first page"); + QTest::newRow("simple page") << QUrl("qrc:///resources/content.html"); + QTest::newRow("frameset page") << QUrl("qrc:///resources/index.html"); +} + +void tst_QWebPage::loadSignalsOrder() +{ + QFETCH(QUrl, url); + QWebPage page; + SpyForLoadSignalsOrder loadSpy(&page); + waitForSignal(&loadSpy, SIGNAL(started())); + page.mainFrame()->load(url); + QTRY_VERIFY(loadSpy.isFinished()); +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 413f504..6a40345 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - dda59e50379214c098f365a39c4d64b39ced427e + 64cce100215c71575f19ca0b090c65fa97d4ba10 diff --git a/src/corelib/arch/generic/qatomic_generic_windows.cpp b/src/corelib/arch/generic/qatomic_generic_windows.cpp index 7ce0eea..123b823 100644 --- a/src/corelib/arch/generic/qatomic_generic_windows.cpp +++ b/src/corelib/arch/generic/qatomic_generic_windows.cpp @@ -43,6 +43,7 @@ #include <QtCore/qatomic.h> +QT_BEGIN_NAMESPACE class QCriticalSection { @@ -129,3 +130,5 @@ void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff qAtomicCriticalSection.unlock(); return returnValue; } + +QT_END_NAMESPACE diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index f59f404..aaebec3 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -90,8 +90,8 @@ QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len, QTextCodec::Conve while (ch < end) { uint u = ch->unicode(); if (surrogate_high >= 0) { - if (u >= 0xdc00 && u < 0xe000) { - u = (surrogate_high - 0xd800)*0x400 + (u - 0xdc00) + 0x10000; + if (ch->isLowSurrogate()) { + u = QChar::surrogateToUcs4(surrogate_high, u); surrogate_high = -1; } else { // high surrogate without low @@ -101,13 +101,13 @@ QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len, QTextCodec::Conve surrogate_high = -1; continue; } - } else if (u >= 0xdc00 && u < 0xe000) { + } else if (ch->isLowSurrogate()) { // low surrogate without high *cursor = replacement; ++ch; ++invalid; continue; - } else if (u >= 0xd800 && u < 0xdc00) { + } else if (ch->isHighSurrogate()) { surrogate_high = u; ++ch; continue; diff --git a/src/corelib/concurrent/qtconcurrentfilter.h b/src/corelib/concurrent/qtconcurrentfilter.h index 4b9c4ae..d8c5f43 100644 --- a/src/corelib/concurrent/qtconcurrentfilter.h +++ b/src/corelib/concurrent/qtconcurrentfilter.h @@ -102,10 +102,9 @@ namespace QtConcurrent { namespace QtConcurrent { -template <typename Sequence, typename KeepFunctor, typename T, typename C, typename U> -ThreadEngineStarter<void> filterInternal(Sequence &sequence, KeepFunctor keep, T (C::*reduce)(U)) +template <typename Sequence, typename KeepFunctor, typename ReduceFunctor> +ThreadEngineStarter<void> filterInternal(Sequence &sequence, KeepFunctor keep, ReduceFunctor reduce) { - typedef MemberFunctionWrapper1<T, C, U> ReduceFunctor; typedef typename Sequence::const_iterator Iterator; typedef FilterKernel<Sequence, KeepFunctor, ReduceFunctor> KernelType; return startThreadEngine(new KernelType(sequence, keep, reduce)); @@ -115,7 +114,7 @@ ThreadEngineStarter<void> filterInternal(Sequence &sequence, KeepFunctor keep, T template <typename Sequence, typename KeepFunctor> QFuture<void> filter(Sequence &sequence, KeepFunctor keep) { - return filterInternal(sequence, QtPrivate::createFunctionWrapper(keep), &Sequence::push_back); + return filterInternal(sequence, QtPrivate::createFunctionWrapper(keep), QtPrivate::PushBackWrapper()); } // filteredReduced() on sequences @@ -184,7 +183,7 @@ QFuture<typename qValueType<Iterator>::value_type> filtered(Iterator begin, Iter template <typename Sequence, typename KeepFunctor> void blockingFilter(Sequence &sequence, KeepFunctor keep) { - filterInternal(sequence, QtPrivate::createFunctionWrapper(keep), &Sequence::push_back).startBlocking(); + filterInternal(sequence, QtPrivate::createFunctionWrapper(keep), QtPrivate::PushBackWrapper()).startBlocking(); } // blocking filteredReduced() on sequences @@ -246,18 +245,17 @@ typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFiltered template <typename Sequence, typename KeepFunctor> Sequence blockingFiltered(const Sequence &sequence, KeepFunctor keep) { - return blockingFilteredReduced(sequence, QtPrivate::createFunctionWrapper(keep), &Sequence::push_back, OrderedReduce); + return startFilteredReduced<Sequence>(sequence, QtPrivate::createFunctionWrapper(keep), QtPrivate::PushBackWrapper(), OrderedReduce).startBlocking(); } // blocking filtered() on iterators template <typename OutputSequence, typename Iterator, typename KeepFunctor> OutputSequence blockingFiltered(Iterator begin, Iterator end, KeepFunctor keep) { - return blockingFilteredReduced(begin, - end, - QtPrivate::createFunctionWrapper(keep), - &OutputSequence::push_back, - OrderedReduce); + return startFilteredReduced<OutputSequence>(begin, end, + QtPrivate::createFunctionWrapper(keep), + QtPrivate::PushBackWrapper(), + OrderedReduce).startBlocking(); } } // namespace QtConcurrent diff --git a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h index 4bf2736..1e09221 100644 --- a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h +++ b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h @@ -195,6 +195,25 @@ QtConcurrent::ConstMemberFunctionWrapper<T, C> createFunctionWrapper(T (C::*func return QtConcurrent::ConstMemberFunctionWrapper<T, C>(func); } +struct PushBackWrapper +{ + typedef void result_type; + + template <class C, class U> + inline void operator()(C &c, const U &u) const + { + return c.push_back(u); + } + +#ifdef Q_COMPILER_RVALUE_REFS + template <class C, class U> + inline void operator()(C &c, U &&u) const + { + return c.push_back(u); + } +#endif +}; + template <typename Functor, bool foo = HasResultType<Functor>::Value> struct LazyResultType { typedef typename Functor::result_type Type; }; template <typename Functor> diff --git a/src/corelib/concurrent/qtconcurrentmap.h b/src/corelib/concurrent/qtconcurrentmap.h index 37a4143..166d5c8 100644 --- a/src/corelib/concurrent/qtconcurrentmap.h +++ b/src/corelib/concurrent/qtconcurrentmap.h @@ -271,7 +271,7 @@ OutputSequence blockingMapped(const InputSequence &sequence, MapFunctor map) return blockingMappedReduced<OutputSequence> (sequence, QtPrivate::createFunctionWrapper(map), - &OutputSequence::push_back, + QtPrivate::PushBackWrapper(), QtConcurrent::OrderedReduce); } @@ -282,7 +282,7 @@ typename QtPrivate::MapResultType<InputSequence, MapFunctor>::ResultType blockin return blockingMappedReduced<OutputSequence> (sequence, QtPrivate::createFunctionWrapper(map), - &OutputSequence::push_back, + QtPrivate::PushBackWrapper(), QtConcurrent::OrderedReduce); } @@ -293,7 +293,7 @@ Sequence blockingMapped(Iterator begin, Iterator end, MapFunctor map) return blockingMappedReduced<Sequence> (begin, end, QtPrivate::createFunctionWrapper(map), - &Sequence::push_back, + QtPrivate::PushBackWrapper(), QtConcurrent::OrderedReduce); } @@ -304,7 +304,7 @@ typename QtPrivate::MapResultType<Iterator, MapFunctor>::ResultType blockingMapp return blockingMappedReduced<OutputSequence> (begin, end, QtPrivate::createFunctionWrapper(map), - &OutputSequence::push_back, + QtPrivate::PushBackWrapper(), QtConcurrent::OrderedReduce); } diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 4974aef..03e0d1f 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2560,7 +2560,7 @@ will imply to use the layout direction set on the parent widget or QApplication. This has the same effect as QWidget::unsetLayoutDirection(). - When LayoutDirectoinAuto is used in conjunction with text layouting, it will imply that the text + When LayoutDirectionAuto is used in conjunction with text layouting, it will imply that the text directionality is determined from the content of the string to be layouted. \sa QApplication::setLayoutDirection(), QWidget::setLayoutDirection(), QTextOption::setTextDirection(), QString::isRightToLeft() diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index d9086c1..4ba8e06 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -198,7 +198,7 @@ inline void QDirPrivate::resolveAbsoluteEntry() const QString absoluteName; if (fileEngine.isNull()) { - if (!dirEntry.isRelative()) { + if (!dirEntry.isRelative() && dirEntry.isClean()) { absoluteDirEntry = dirEntry; return; } @@ -1638,8 +1638,19 @@ bool QDir::operator==(const QDir &dir) const if (d->dirEntry.filePath() == other->dirEntry.filePath()) return true; - // Fallback to expensive canonical path computation - return canonicalPath().compare(dir.canonicalPath(), sensitive) == 0; + if (exists()) { + if (!dir.exists()) + return false; //can't be equal if only one exists + // Both exist, fallback to expensive canonical path computation + return canonicalPath().compare(dir.canonicalPath(), sensitive) == 0; + } else { + if (dir.exists()) + return false; //can't be equal if only one exists + // Neither exists, compare absolute paths rather than canonical (which would be empty strings) + d->resolveAbsoluteEntry(); + other->resolveAbsoluteEntry(); + return d->absoluteDirEntry.filePath().compare(other->absoluteDirEntry.filePath(), sensitive) == 0; + } } return false; } diff --git a/src/corelib/io/qfilesystemengine_symbian.cpp b/src/corelib/io/qfilesystemengine_symbian.cpp index 18c52cb..c8c1dfd 100644 --- a/src/corelib/io/qfilesystemengine_symbian.cpp +++ b/src/corelib/io/qfilesystemengine_symbian.cpp @@ -114,9 +114,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) { QString orig = entry.filePath(); const bool isAbsolute = entry.isAbsolute(); - const bool isDirty = (orig.contains(QLatin1String("/../")) || orig.contains(QLatin1String("/./")) || - orig.contains(QLatin1String("//")) || - orig.endsWith(QLatin1String("/..")) || orig.endsWith(QLatin1String("/."))); + const bool isDirty = !entry.isClean(); if (isAbsolute && !isDirty) return entry; diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index b0ebfbd..cfb17de 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -223,7 +223,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, //static QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) { - if (entry.isAbsolute()) + if (entry.isAbsolute() && entry.isClean()) return entry; QByteArray orig = entry.nativeFilePath(); diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 764ee6d..031d64b 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -508,11 +508,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) if (!entry.isRelative()) { #if !defined(Q_OS_WINCE) - if (entry.isAbsolute() - && !entry.filePath().contains(QLatin1String("/../")) - && !entry.filePath().contains(QLatin1String("/./")) - && !entry.filePath().endsWith(QLatin1String("/..")) - && !entry.filePath().endsWith(QLatin1String("/."))) { + if (entry.isAbsolute() && entry.isClean()) { ret = entry.filePath(); } else { ret = QDir::fromNativeSeparators(nativeAbsoluteFilePath(entry.filePath())); diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp index bb7cb4e..2f37542 100644 --- a/src/corelib/io/qfilesystementry.cpp +++ b/src/corelib/io/qfilesystementry.cpp @@ -380,4 +380,35 @@ void QFileSystemEntry::findFileNameSeparators() const } } +bool QFileSystemEntry::isClean() const +{ + resolveFilePath(); + int dots = 0; + bool dotok = true; // checking for ".." or "." starts to relative paths + bool slashok = true; + for (QString::const_iterator iter = m_filePath.constBegin(); iter != m_filePath.constEnd(); iter++) { + if (*iter == QLatin1Char('/')) { + if (dots == 1 || dots == 2) + return false; // path contains "./" or "../" + if (!slashok) + return false; // path contains "//" + dots = 0; + dotok = true; + slashok = false; + } else if (dotok) { + slashok = true; + if (*iter == QLatin1Char('.')) { + dots++; + if (dots > 2) + dotok = false; + } else { + //path element contains a character other than '.', it's clean + dots = 0; + dotok = false; + } + } + } + return (dots != 1 && dots != 2); // clean if path doesn't end in . or .. +} + QT_END_NAMESPACE diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h index 34b083a..8d524c0 100644 --- a/src/corelib/io/qfilesystementry_p.h +++ b/src/corelib/io/qfilesystementry_p.h @@ -91,6 +91,7 @@ public: QString completeSuffix() const; bool isAbsolute() const; bool isRelative() const; + bool isClean() const; #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) bool isDriveRoot() const; diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 79b2728..547bbeb 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -66,13 +66,12 @@ #ifndef QT_NO_QOBJECT #include "qcoreapplication.h" +#endif #ifdef Q_OS_WIN // for homedirpath reading from registry #include "qt_windows.h" #include <private/qsystemlibrary_p.h> - -#endif // Q_OS_WIN -#endif // QT_NO_QOBJECT +#endif #ifdef Q_OS_VXWORKS # include <ioLib.h> @@ -1024,9 +1023,6 @@ static QString windowsConfigPath(int type) { QString result; -#ifndef QT_NO_QOBJECT - // We can't use QLibrary if there is QT_NO_QOBJECT is defined - // This only happens when bootstrapping qmake. #ifndef Q_OS_WINCE QSystemLibrary library(QLatin1String("shell32")); #else @@ -1040,8 +1036,6 @@ static QString windowsConfigPath(int type) result = QString::fromWCharArray(path); } -#endif // QT_NO_QOBJECT - if (result.isEmpty()) { switch (type) { #ifndef Q_OS_WINCE @@ -1114,11 +1108,11 @@ static void initDefaultPaths(QMutexLocker *locker) userPath += QLatin1String(".config"); #endif } else if (*env == '/') { - userPath = QLatin1String(env); + userPath = QFile::decodeName(env); } else { userPath = homePath; userPath += QLatin1Char('/'); - userPath += QLatin1String(env); + userPath += QFile::decodeName(env); } userPath += QLatin1Char('/'); diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 0e9d645..76b57b9 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -133,6 +133,6 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) return true; } -#endif // QT_NO_SYSTEMSEMAPHORE - QT_END_NAMESPACE + +#endif // QT_NO_SYSTEMSEMAPHORE diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index 16861c9..2408cd3 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -205,8 +205,7 @@ void QCache<Key,T>::trim(int m) while (n && total > m) { Node *u = n; n = n->p; - if (qIsDetached(*u->t)) - unlink(*u); + unlink(*u); } } diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index af3b7d5..0f67652 100644 --- a/src/corelib/tools/qline.cpp +++ b/src/corelib/tools/qline.cpp @@ -564,8 +564,9 @@ qreal QLineF::length() const Returns the angle of the line in degrees. - Positive values for the angles mean counter-clockwise while negative values - mean the clockwise direction. Zero degrees is at the 3 o'clock position. + The return value will be in the range of values from 0.0 up to but not + including 360.0. The angles are measured counter-clockwise from a point + on the x-axis to the right of the origin (x > 0). \sa setAngle() */ diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index 8787a5e..b1ebec8 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -114,7 +114,7 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty bool AnimatedImage::cache - \since Quick 1.1 + \since QtQuick 1.1 Specifies whether the image should be cached. The default value is true. Setting \a cache to false is useful when dealing with large images, @@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty bool AnimatedImage::mirror - \since Quick 1.1 + \since QtQuick 1.1 This property holds whether the image should be horizontally inverted (effectively displaying a mirrored image). diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 9c274e9..d3bab7a 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -215,7 +215,7 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() /*! \qmlproperty bool BorderImage::cache - \since Quick 1.1 + \since QtQuick 1.1 Specifies whether the image should be cached. The default value is true. Setting \a cache to false is useful when dealing with large images, @@ -224,7 +224,7 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() /*! \qmlproperty bool BorderImage::mirror - \since Quick 1.1 + \since QtQuick 1.1 This property holds whether the image should be horizontally inverted (effectively displaying a mirrored image). @@ -289,6 +289,12 @@ void QDeclarativeBorderImage::setSource(const QUrl &url) load(); } +void QDeclarativeBorderImage::setSourceSize(const QSize& size) +{ + Q_UNUSED(size); + qmlInfo(this) << "Setting sourceSize for borderImage not supported"; +} + void QDeclarativeBorderImage::load() { Q_D(QDeclarativeBorderImage); diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h index 6a50c3c..6b05608 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h @@ -63,9 +63,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeBorderImage : public QDeclarativeImageBase Q_PROPERTY(TileMode horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode NOTIFY horizontalTileModeChanged) Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged) - // read-only for BorderImage - Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged) - public: QDeclarativeBorderImage(QDeclarativeItem *parent=0); ~QDeclarativeBorderImage(); @@ -83,10 +80,11 @@ public: void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); void setSource(const QUrl &url); + void setSourceSize(const QSize&); + Q_SIGNALS: void horizontalTileModeChanged(); void verticalTileModeChanged(); - void sourceSizeChanged(); protected: virtual void load(); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index d5c58df..ca6c496 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -1399,7 +1399,7 @@ void QDeclarativeFlickable::setContentHeight(qreal h) /*! \qmlmethod Flickable::resizeContent(real width, real height, QPointF center) \preliminary - \since Quick 1.1 + \since QtQuick 1.1 Resizes the content to \a width x \a height about \a center. @@ -1439,7 +1439,7 @@ void QDeclarativeFlickable::resizeContent(qreal w, qreal h, QPointF center) /*! \qmlmethod Flickable::returnToBounds() \preliminary - \since Quick 1.1 + \since QtQuick 1.1 Ensures the content is within legal bounds. @@ -1532,7 +1532,7 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) d->handleMouseMoveEvent(&mouseEvent); break; case QEvent::GraphicsSceneMousePress: - if (d->pressed) // we are already pressed - this is a delayed replay + if (d->pressed && !event->spontaneous()) // we are already pressed - this is a delayed replay return false; d->handleMousePressEvent(&mouseEvent); diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 23433d6..023737d 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1066,6 +1066,8 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m highlightEnd = highlightRangeEnd; } + bool strictHighlightRange = haveHighlightRange && highlightRange == QDeclarativeGridView::StrictlyEnforceRange; + if (snapMode != QDeclarativeGridView::NoSnap) { qreal tempPosition = isRightToLeftTopToBottom() ? -position()-size() : position(); if (snapMode == QDeclarativeGridView::SnapOneRow && moveReason == Mouse) { @@ -1083,7 +1085,7 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m FxGridItem *topItem = snapItemAt(tempPosition+highlightStart); FxGridItem *bottomItem = snapItemAt(tempPosition+highlightEnd); qreal pos; - if (topItem && bottomItem && haveHighlightRange && highlightRange == QDeclarativeGridView::StrictlyEnforceRange) { + if (topItem && bottomItem && strictHighlightRange) { qreal topPos = qMin(topItem->rowPos() - highlightStart, -maxExtent); qreal bottomPos = qMax(bottomItem->rowPos() - highlightEnd, -minExtent); pos = qAbs(data.move + topPos) < qAbs(data.move + bottomPos) ? topPos : bottomPos; @@ -1091,7 +1093,7 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m qreal headerPos = 0; if (header) headerPos = isRightToLeftTopToBottom() ? header->rowPos() + cellWidth - headerSize() : header->rowPos(); - if (topItem->index == 0 && header && tempPosition+highlightStart < headerPos+headerSize()/2) { + if (topItem->index == 0 && header && tempPosition+highlightStart < headerPos+headerSize()/2 && !strictHighlightRange) { pos = isRightToLeftTopToBottom() ? - headerPos + highlightStart - size() : headerPos - highlightStart; } else { if (isRightToLeftTopToBottom()) @@ -2618,7 +2620,7 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) /*! \qmlmethod GridView::positionViewAtBeginning() \qmlmethod GridView::positionViewAtEnd() - \since Quick 1.1 + \since QtQuick 1.1 Positions the view at the beginning or end, taking into account any header or footer. diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index e6bb798..9b9d680 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -473,7 +473,7 @@ QRectF QDeclarativeImage::boundingRect() const /*! \qmlproperty bool Image::cache - \since Quick 1.1 + \since QtQuick 1.1 Specifies whether the image should be cached. The default value is true. Setting \a cache to false is useful when dealing with large images, @@ -482,7 +482,7 @@ QRectF QDeclarativeImage::boundingRect() const /*! \qmlproperty bool Image::mirror - \since Quick 1.1 + \since QtQuick 1.1 This property holds whether the image should be horizontally inverted (effectively displaying a mirrored image). diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 7127173..b9d231e 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -3480,7 +3480,7 @@ qreal QDeclarativeItem::implicitHeight() const /*! \qmlproperty real Item::implicitWidth \qmlproperty real Item::implicitHeight - \since Quick 1.1 + \since QtQuick 1.1 Defines the natural width or height of the Item if no \l width or \l height is specified. diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index f29f778..6a91e5f 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1295,6 +1295,7 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m correctFlick = false; fixupMode = moveReason == Mouse ? fixupMode : Immediate; + bool strictHighlightRange = haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange; qreal highlightStart; qreal highlightEnd; @@ -1327,9 +1328,9 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m FxListItem *topItem = snapItemAt(tempPosition+highlightStart); FxListItem *bottomItem = snapItemAt(tempPosition+highlightEnd); qreal pos; - bool isInBounds = -position() > maxExtent && -position() < minExtent; + bool isInBounds = -position() > maxExtent && -position() <= minExtent; if (topItem && isInBounds) { - if (topItem->index == 0 && header && tempPosition+highlightStart < header->position()+header->size()/2) { + if (topItem->index == 0 && header && tempPosition+highlightStart < header->position()+header->size()/2 && !strictHighlightRange) { pos = isRightToLeft() ? - header->position() + highlightStart - size() : header->position() - highlightStart; } else { if (isRightToLeft()) @@ -1358,7 +1359,7 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m } vTime = timeline.time(); } - } else if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange + } else if (currentItem && strictHighlightRange && moveReason != QDeclarativeListViewPrivate::SetIndex) { updateHighlight(); qreal pos = currentItem->itemPosition(); @@ -3028,7 +3029,7 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode) /*! \qmlmethod ListView::positionViewAtBeginning() \qmlmethod ListView::positionViewAtEnd() - \since Quick 1.1 + \since QtQuick 1.1 Positions the view at the beginning or end, taking into account any header or footer. diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 18f008a..0e06a4c 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -419,7 +419,7 @@ void QDeclarativeMouseArea::setEnabled(bool a) /*! \qmlproperty bool MouseArea::preventStealing - \since Quick 1.1 + \since QtQuick 1.1 This property holds whether the mouse events may be stolen from this MouseArea. diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index f3d1a68..483cad4 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -584,7 +584,7 @@ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) /*! \qmlproperty enumeration Row::layoutDirection - \since Quick 1.1 + \since QtQuick 1.1 This property holds the layoutDirection of the row. @@ -878,7 +878,7 @@ void QDeclarativeGrid::setFlow(Flow flow) /*! \qmlproperty enumeration Grid::layoutDirection - \since Quick 1.1 + \since QtQuick 1.1 This property holds the layout direction of the layout. @@ -1236,7 +1236,7 @@ void QDeclarativeFlow::setFlow(Flow flow) /*! \qmlproperty enumeration Flow::layoutDirection - \since Quick 1.1 + \since QtQuick 1.1 This property holds the layout direction of the layout. diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 813c255..e881b96 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -128,7 +128,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() /*! \qmlsignal Repeater::onItemAdded(int index, Item item) - \since Quick 1.1 + \since QtQuick 1.1 This handler is called when an item is added to the repeater. The \a index parameter holds the index at which the item has been inserted within the @@ -137,7 +137,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() /*! \qmlsignal Repeater::onItemRemoved(int index, Item item) - \since Quick 1.1 + \since QtQuick 1.1 This handler is called when an item is removed from the repeater. The \a index parameter holds the index at which the item was removed from the repeater, @@ -306,7 +306,7 @@ int QDeclarativeRepeater::count() const /*! \qmlmethod Item Repeater::itemAt(index) - \since Quick 1.1 + \since QtQuick 1.1 Returns the \l Item that has been created at the given \a index, or \c null if no item exists at \a index. diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 54ff406..20e4eef 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1190,7 +1190,7 @@ void QDeclarativeText::setWrapMode(WrapMode mode) /*! \qmlproperty int Text::lineCount - \since Quick 1.1 + \since QtQuick 1.1 Returns the number of lines visible in the text item. @@ -1206,7 +1206,7 @@ int QDeclarativeText::lineCount() const /*! \qmlproperty bool Text::truncated - \since Quick 1.1 + \since QtQuick 1.1 Returns true if the text has been truncated due to \l maximumLineCount or \l elide. @@ -1223,7 +1223,7 @@ bool QDeclarativeText::truncated() const /*! \qmlproperty int Text::maximumLineCount - \since Quick 1.1 + \since QtQuick 1.1 Set this property to limit the number of lines that the text item will show. If elide is set to Text.ElideRight, the text will be elided appropriately. @@ -1457,7 +1457,7 @@ qreal QDeclarativeText::paintedHeight() const /*! \qmlproperty real Text::lineHeight - \since Quick 1.1 + \since QtQuick 1.1 Sets the line height for the text. The value can be in pixels or a multiplier depending on lineHeightMode. diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 0ea7ff3..1e30e78 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -107,7 +107,7 @@ TextEdit { /*! \qmlsignal TextEdit::onLinkActivated(string link) - \since Quick 1.1 + \since QtQuick 1.1 This handler is called when the user clicks on a link embedded in the text. The link must be in rich text or HTML format and the @@ -623,7 +623,7 @@ void QDeclarativeTextEdit::setWrapMode(WrapMode mode) /*! \qmlproperty int TextEdit::lineCount - \since Quick 1.1 + \since QtQuick 1.1 Returns the total number of lines in the textEdit item. */ @@ -717,7 +717,7 @@ void QDeclarativeTextEdit::moveCursorSelection(int pos) /*! \qmlmethod void TextEdit::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters) - \since Quick 1.1 + \since QtQuick 1.1 Moves the cursor to \a position and updates the selection according to the optional \a mode parameter. (To only move the cursor, set the \l cursorPosition property.) @@ -1082,7 +1082,7 @@ void QDeclarativeTextEdit::setSelectByMouse(bool on) /*! \qmlproperty enum TextEdit::mouseSelectionMode - \since Quick 1.1 + \since QtQuick 1.1 Specifies how text should be selected using a mouse. @@ -1228,7 +1228,7 @@ void QDeclarativeTextEditPrivate::focusChanged(bool hasFocus) /*! \qmlmethod void TextEdit::deselect() - \since Quick 1.1 + \since QtQuick 1.1 Removes active text selection. */ @@ -1712,7 +1712,9 @@ void QDeclarativeTextEdit::updateSize() setImplicitWidth(newWidth); else if (d->requireImplicitWidth) setImplicitWidth(naturalWidth); - qreal newHeight = d->document->isEmpty() ? fm.height() : (int)d->document->size().height(); + qreal newHeight = d->document->size().height(); + if (newHeight == 0) + newHeight = fm.height(); setImplicitHeight(newHeight); d->paintedSize = QSize(newWidth, newHeight); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h index 731d956..412d33c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h @@ -77,7 +77,7 @@ public: yoff(0) { #ifdef Q_OS_SYMBIAN - if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) { + if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_1) { showInputPanelOnFocus = false; } #endif diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index cc3f0b9..5928d31 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1015,7 +1015,7 @@ int QDeclarativeTextInput::positionAt(int x) const /*! \qmlmethod int TextInput::positionAt(int x, CursorPosition position = CursorBetweenCharacters) - \since Quick 1.1 + \since QtQuick 1.1 This function returns the character position at x pixels from the left of the textInput. Position 0 is before the @@ -1403,7 +1403,7 @@ QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property) /*! \qmlmethod void TextInput::deselect() - \since Quick 1.1 + \since QtQuick 1.1 Removes active text selection. */ @@ -1575,7 +1575,7 @@ void QDeclarativeTextInput::setSelectByMouse(bool on) /*! \qmlproperty enum TextInput::mouseSelectionMode - \since Quick 1.1 + \since QtQuick 1.1 Specifies how text should be selected using a mouse. @@ -1623,7 +1623,7 @@ void QDeclarativeTextInput::moveCursorSelection(int position) /*! \qmlmethod void TextInput::moveCursorSelection(int position, SelectionMode mode = TextInput.SelectCharacters) - \since Quick 1.1 + \since QtQuick 1.1 Moves the cursor to \a position and updates the selection according to the optional \a mode parameter. (To only move the cursor, set the \l cursorPosition property.) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index 4712c65..0325016 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -80,7 +80,7 @@ public: selectPressed(false) { #ifdef Q_OS_SYMBIAN - if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) { + if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_1) { showInputPanelOnFocus = false; } #endif diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 689cd00..9359196 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -254,6 +254,8 @@ QDeclarativeBinding::createBinding(Identifier id, QObject *obj, QDeclarativeCont cdata = typeData->compiledData(); } QDeclarativeBinding *rv = cdata ? new QDeclarativeBinding((void*)cdata->datas.at(id).constData(), cdata, obj, ctxtdata, url, lineNumber, parent) : 0; + if (cdata) + cdata->release(); if (typeData) typeData->release(); return rv; diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 51ffc10..72a3e53 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -235,6 +235,7 @@ public: void run(Binding *, QDeclarativePropertyPrivate::WriteFlags flags); const char *programData; + QDeclarativeRefCount *dataRef; Binding *m_bindings; quint32 *m_signalTable; @@ -267,7 +268,7 @@ public: }; QDeclarativeCompiledBindingsPrivate::QDeclarativeCompiledBindingsPrivate() -: subscriptions(0), identifiers(0) +: subscriptions(0), identifiers(0), programData(0), dataRef(0), m_bindings(0), m_signalTable(0) { } @@ -275,11 +276,16 @@ QDeclarativeCompiledBindingsPrivate::~QDeclarativeCompiledBindingsPrivate() { delete [] subscriptions; subscriptions = 0; delete [] identifiers; identifiers = 0; + if (dataRef) { + dataRef->release(); + dataRef = 0; + } } int QDeclarativeCompiledBindingsPrivate::methodCount = -1; -QDeclarativeCompiledBindings::QDeclarativeCompiledBindings(const char *program, QDeclarativeContextData *context) +QDeclarativeCompiledBindings::QDeclarativeCompiledBindings(const char *program, QDeclarativeContextData *context, + QDeclarativeRefCount *dataRef) : QObject(*(new QDeclarativeCompiledBindingsPrivate)) { Q_D(QDeclarativeCompiledBindings); @@ -288,6 +294,8 @@ QDeclarativeCompiledBindings::QDeclarativeCompiledBindings(const char *program, d->methodCount = QDeclarativeCompiledBindings::staticMetaObject.methodCount(); d->programData = program; + d->dataRef = dataRef; + if (d->dataRef) d->dataRef->addref(); d->init(); diff --git a/src/declarative/qml/qdeclarativecompiledbindings_p.h b/src/declarative/qml/qdeclarativecompiledbindings_p.h index e7b6937..8ec0ac3 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings_p.h +++ b/src/declarative/qml/qdeclarativecompiledbindings_p.h @@ -95,7 +95,7 @@ class QDeclarativeCompiledBindingsPrivate; class QDeclarativeCompiledBindings : public QObject, public QDeclarativeAbstractExpression, public QDeclarativeRefCount { public: - QDeclarativeCompiledBindings(const char *program, QDeclarativeContextData *context); + QDeclarativeCompiledBindings(const char *program, QDeclarativeContextData *context, QDeclarativeRefCount *); virtual ~QDeclarativeCompiledBindings(); QDeclarativeAbstractBinding *configBinding(int index, QObject *target, QObject *scope, int property); diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index a23f89d..8cf97d2 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -209,7 +209,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEObjectStack &stack, if (instr.init.contextCache != -1) ctxt->setIdPropertyData(comp->contextCaches.at(instr.init.contextCache)); if (instr.init.compiledBinding != -1) - ctxt->optimizedBindings = new QDeclarativeCompiledBindings(datas.at(instr.init.compiledBinding).constData(), ctxt); + ctxt->optimizedBindings = new QDeclarativeCompiledBindings(datas.at(instr.init.compiledBinding).constData(), ctxt, comp); } break; diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 9f56ccb..ee3d06b 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -173,6 +173,18 @@ QDeclarativeState::~QDeclarativeState() Q_D(QDeclarativeState); if (d->group) d->group->removeState(this); + + /* + destroying an active state does not return us to the + base state, so we need to clean up our revert list to + prevent leaks. In the future we may want to redconsider + this overall architecture. + */ + for (int i = 0; i < d->revertList.count(); ++i) { + if (d->revertList.at(i).binding()) { + d->revertList.at(i).binding()->destroy(); + } + } } /*! diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 0c218fc..9092593 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5378,11 +5378,9 @@ void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively() { QGraphicsItemPrivate *itemPrivate = this; do { - if (itemPrivate->graphicsEffect) { + if (itemPrivate->graphicsEffect && !itemPrivate->updateDueToGraphicsEffect) { itemPrivate->notifyInvalidated = 1; - - if (!itemPrivate->updateDueToGraphicsEffect) - static_cast<QGraphicsItemEffectSourcePrivate *>(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache(); + static_cast<QGraphicsItemEffectSourcePrivate *>(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache(); } } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0)); } @@ -5690,21 +5688,27 @@ void QGraphicsItem::update(const QRectF &rect) d_ptr->invalidateParentGraphicsEffectsRecursively(); #endif //QT_NO_GRAPHICSEFFECT - if (CacheMode(d_ptr->cacheMode) != NoCache) { - // Invalidate cache. - QGraphicsItemCache *cache = d_ptr->extraItemCache(); - if (!cache->allExposed) { - if (rect.isNull()) { - cache->allExposed = true; - cache->exposed.clear(); - } else { - cache->exposed.append(rect); +#ifndef QT_NO_GRAPHICSEFFECT + if (!d_ptr->updateDueToGraphicsEffect) { +#endif + if (CacheMode(d_ptr->cacheMode) != NoCache) { + // Invalidate cache. + QGraphicsItemCache *cache = d_ptr->extraItemCache(); + if (!cache->allExposed) { + if (rect.isNull()) { + cache->allExposed = true; + cache->exposed.clear(); + } else { + cache->exposed.append(rect); + } } + // Only invalidate cache; item is already dirty. + if (d_ptr->fullUpdatePending) + return; } - // Only invalidate cache; item is already dirty. - if (d_ptr->fullUpdatePending) - return; +#ifndef QT_NO_GRAPHICSEFFECT } +#endif if (d_ptr->scene) d_ptr->scene->d_func()->markDirty(this, rect); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 1551944..867880c 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -3504,7 +3504,9 @@ bool QGraphicsScene::event(QEvent *event) } break; case QEvent::WindowDeactivate: - if (!--d->activationRefCount) { + if (d->activationRefCount > 0) + --d->activationRefCount; + if (!d->activationRefCount) { if (d->activePanel) { // Deactivate the active panel (but keep it so we can // reactivate it later). diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 965b1b34..d3562fc 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -1173,6 +1173,12 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant & QApplication::sendEvent(this, &event); break; } + case ItemChildAddedChange: { + QGraphicsItem *child = qVariantValue<QGraphicsItem *>(value); + if (child->isWidget()) + static_cast<QGraphicsWidget *>(child)->d_func()->resolveLayoutDirection(); + break; + } default: break; } diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 9857015..8c30838 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -154,6 +154,7 @@ private: TUint m_textCapabilities; bool m_inDestruction; bool m_pendingInputCapabilitiesChanged; + bool m_pendingTransactionCancel; int m_cursorVisibility; int m_inlinePosition; MFepInlineTextFormatRetriever *m_formatRetriever; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 5ddd53f..56338b2 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -64,6 +64,8 @@ #define QT_EAknCursorPositionChanged MAknEdStateObserver::EAknEdwinStateEvent(6) // MAknEdStateObserver::EAknActivatePenInputRequest #define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7) +// MAknEdStateObserver::EAknClosePenInputRequest +#define QT_EAknClosePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(10) // EAknEditorFlagSelectionVisible is only valid from 3.2 onwards. // Sym^3 AVKON FEP manager expects that this flag is used for FEP-aware editors @@ -107,6 +109,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_textCapabilities(TCoeInputCapabilities::EAllText), m_inDestruction(false), m_pendingInputCapabilitiesChanged(false), + m_pendingTransactionCancel(false), m_cursorVisibility(1), m_inlinePosition(0), m_formatRetriever(0), @@ -252,9 +255,6 @@ bool QCoeFepInputContext::needsInputPanel() bool QCoeFepInputContext::filterEvent(const QEvent *event) { - // The CloseSoftwareInputPanel event is not handled here, because the VK will automatically - // close when it discovers that the underlying widget does not have input capabilities. - if (!focusWidget()) return false; @@ -318,6 +318,12 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) if (!needsInputPanel()) return false; + if ((event->type() == QEvent::CloseSoftwareInputPanel) + && (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)) { + m_fepState->ReportAknEdStateEventL(QT_EAknClosePenInputRequest); + return false; + } + if (event->type() == QEvent::RequestSoftwareInputPanel) { // Only request virtual keyboard if it is not yet active or if this is the first time // panel is requested for this application. @@ -354,10 +360,6 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) if (sControl) { sControl->setIgnoreFocusChanged(false); } - //If m_pointerHandler has already been set, it means that fep inline editing is in progress. - //When this is happening, do not filter out pointer events. - if (!m_pointerHandler) - return true; } } @@ -473,7 +475,7 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) windowToMove->setUpdatesEnabled(false); if (!alwaysResize) { - if (gv->scene()) { + if (gv->scene() && S60->partial_keyboardAutoTranslation) { if (gv->scene()->focusItem()) { // Check if the widget contains cursorPositionChanged signal and disconnect from it. QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())); @@ -580,7 +582,7 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) if (!moveWithinVisibleArea) { // Check if the widget contains cursorPositionChanged signal and connect to it. QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())); - if (gv->scene() && gv->scene()->focusItem()) { + if (gv->scene() && gv->scene()->focusItem() && S60->partial_keyboardAutoTranslation) { int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1)); if (index != -1) connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); @@ -1062,15 +1064,24 @@ void QCoeFepInputContext::CancelFepInlineEdit() // We are not supposed to ever have a tempPreeditString and a real preedit string // from S60 at the same time, so it should be safe to rely on this test to determine // whether we should honor S60's request to clear the text or not. - if (m_hasTempPreeditString) + if (m_hasTempPreeditString || m_pendingTransactionCancel) return; + m_pendingTransactionCancel = true; + QList<QInputMethodEvent::Attribute> attributes; QInputMethodEvent event(QLatin1String(""), attributes); event.setCommitString(QLatin1String(""), 0, 0); m_preeditString.clear(); m_inlinePosition = 0; sendEvent(event); + + // Sync with native side editor state. Native side can then do various operations + // based on editor state, such as removing 'exact word bubble'. + if (!m_pendingInputCapabilitiesChanged) + ReportAknEdStateEvent(MAknEdStateObserver::EAknSyncEdwinState); + + m_pendingTransactionCancel = false; } TInt QCoeFepInputContext::DocumentLengthForFep() const @@ -1080,7 +1091,18 @@ TInt QCoeFepInputContext::DocumentLengthForFep() const return 0; QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText); - return variant.value<QString>().size() + m_preeditString.size(); + + int size = variant.value<QString>().size() + m_preeditString.size(); + + // To fix an issue with backspaces not being generated if document size is zero, + // fake document length to be at least one always, except when dealing with + // hidden text widgets, where this faking would generate extra asterisk. Since the + // primary use of hidden text widgets is password fields, they are unlikely to + // support multiple lines anyway. + if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText)) + size = 1; + + return size; } TInt QCoeFepInputContext::DocumentMaximumLengthForFep() const @@ -1163,6 +1185,12 @@ void QCoeFepInputContext::GetEditorContentForFep(TDes& aEditorContent, TInt aDoc // FEP expects the preedit string to be part of the editor content, so let's mix it in. int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); text.insert(cursor, m_preeditString); + + // Add additional space to empty non-password text to compensate + // for the fake length we specified in DocumentLengthForFep(). + if (text.size() == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText)) + text += QChar(0x20); + aEditorContent.Copy(qt_QString2TPtrC(text.mid(aDocumentPosition, aLengthToRetrieve))); } diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 361af8b..80bcdf0 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -2767,6 +2767,9 @@ QS60ThreadLocalData::QS60ThreadLocalData() QS60ThreadLocalData::~QS60ThreadLocalData() { + for (int i = 0; i < releaseFuncs.count(); ++i) + releaseFuncs[i](); + releaseFuncs.clear(); if (!usingCONEinstances) { delete screenDevice; wsSession.Close(); diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp index 200696d..3f2e8b2 100644 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_qpa.cpp @@ -284,7 +284,7 @@ int QEventDispatcherQPA::select(int nfds, fd_set *readfds, fd_set *writefds, fd_ Q_D(QEventDispatcherQPA); int retVal = 0; if (d->hasIntegration()) { - qint64 timeoutmsec = 0; + qint64 timeoutmsec = 1000; // wait a second if we don't have timers if (timeout) timeoutmsec = timeout->tv_sec * 1000 + (timeout->tv_usec/1000); d->selectReturnMutex->lock(); diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 117b72f..469973f 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -933,7 +933,7 @@ QKeySequence::QKeySequence(const QString &key) } /*! - \since 4.x + \since 4.7 Creates a key sequence from the \a key string based on \a format. */ QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format) @@ -1130,7 +1130,7 @@ int QKeySequence::assign(const QString &ks) /*! \fn int QKeySequence::assign(const QString &keys, QKeySequence::SequenceFormat format) - \since 4.x + \since 4.7 Adds the given \a keys to the key sequence (based on \a format). \a keys may contain up to four key codes, provided they are @@ -1381,11 +1381,11 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat QString p; if (key && key < Qt::Key_Escape && key != Qt::Key_Space) { - if (key < 0x10000) { - p = QChar(key & 0xffff).toUpper(); + if (!QChar::requiresSurrogates(key)) { + p = QChar(ushort(key)).toUpper(); } else { - p = QChar((key-0x10000)/0x400+0xd800); - p += QChar((key-0x10000)%400+0xdc00); + p += QChar(QChar::highSurrogate(key)); + p += QChar(QChar::lowSurrogate(key)); } } else if (key >= Qt::Key_F1 && key <= Qt::Key_F35) { p = nativeText ? QShortcut::tr("F%1").arg(key - Qt::Key_F1 + 1) @@ -1418,11 +1418,11 @@ NonSymbol: // Or else characters like Qt::Key_aring may not get displayed // (Really depends on you locale) if (!keyname[i].name) { - if (key < 0x10000) { - p = QChar(key & 0xffff).toUpper(); + if (!QChar::requiresSurrogates(key)) { + p = QChar(ushort(key)).toUpper(); } else { - p = QChar((key-0x10000)/0x400+0xd800); - p += QChar((key-0x10000)%400+0xdc00); + p += QChar(QChar::highSurrogate(key)); + p += QChar(QChar::lowSurrogate(key)); } } } diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 510705f..9caa37e 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -123,8 +123,10 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act default: break; }; - if (key != 0) + if (key != 0) { QSoftKeyManager::instance()->d_func()->softKeyCommandActions.insert(action, key); + connect(action, SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*))); + } #endif QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; switch (standardKey) { @@ -157,7 +159,13 @@ QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key QScopedPointer<QAction> action(createAction(standardKey, actionWidget)); connect(action.data(), SIGNAL(triggered()), QSoftKeyManager::instance(), SLOT(sendKeyEvent())); + +#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2) + // Don't connect destroyed slot if is was already connected in createAction + if (!(QSoftKeyManager::instance()->d_func()->softKeyCommandActions.contains(action.data()))) +#endif connect(action.data(), SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*))); + QSoftKeyManager::instance()->d_func()->keyedActions.insert(action.data(), key); return action.take(); #endif //QT_NO_ACTION @@ -166,7 +174,9 @@ QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key void QSoftKeyManager::cleanupHash(QObject *obj) { Q_D(QSoftKeyManager); - QAction *action = qobject_cast<QAction*>(obj); + // Can't use qobject_cast in destroyed() signal handler as that'll return NULL, + // so use static_cast instead. Since the pointer is only used as a hash key, it is safe. + QAction *action = static_cast<QAction *>(obj); d->keyedActions.remove(action); #if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2) d->softKeyCommandActions.remove(action); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 01d5f22..96b8141 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -98,6 +98,10 @@ static const int qt_symbian_max_screens = 4; //this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 #define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13) +class QSymbianTypeFaceExtras; +typedef QHash<QString, const QSymbianTypeFaceExtras *> QSymbianTypeFaceExtrasHash; +typedef void (*QThreadLocalReleaseFunc)(); + class Q_AUTOTEST_EXPORT QS60ThreadLocalData { public: @@ -106,6 +110,8 @@ public: bool usingCONEinstances; RWsSession wsSession; CWsScreenDevice *screenDevice; + QSymbianTypeFaceExtrasHash fontData; + QVector<QThreadLocalReleaseFunc> releaseFuncs; }; class QS60Data @@ -179,6 +185,8 @@ public: inline CWsScreenDevice* screenDevice(const QWidget *widget); inline CWsScreenDevice* screenDevice(int screenNumber); static inline int screenNumberForWidget(const QWidget *widget); + inline QSymbianTypeFaceExtrasHash& fontData(); + inline void addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func); static inline CCoeAppUi* appUi(); static inline CEikMenuBar* menuBar(); #ifdef Q_WS_S60 @@ -505,6 +513,24 @@ inline int QS60Data::screenNumberForWidget(const QWidget *widget) return qt_widget_private(const_cast<QWidget *>(w))->symbianScreenNumber; } +inline QSymbianTypeFaceExtrasHash& QS60Data::fontData() +{ + if (!tls.hasLocalData()) { + tls.setLocalData(new QS60ThreadLocalData); + } + return tls.localData()->fontData; +} + +inline void QS60Data::addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func) +{ + if (!tls.hasLocalData()) { + tls.setLocalData(new QS60ThreadLocalData); + } + QS60ThreadLocalData *data = tls.localData(); + if (!data->releaseFuncs.contains(func)) + data->releaseFuncs.append(func); +} + inline CCoeAppUi* QS60Data::appUi() { return CCoeEnv::Static()-> AppUi(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index ad8fbb7..0aa1dfa 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -345,6 +345,10 @@ QWidgetPrivate::QWidgetPrivate(int version) QWidgetPrivate::~QWidgetPrivate() { +#ifdef Q_OS_SYMBIAN + _q_cleanupWinIds(); +#endif + if (widgetItem) widgetItem->wid = 0; @@ -12668,9 +12672,11 @@ void QWidget::clearMask() */ #ifdef Q_OS_SYMBIAN -void QWidgetPrivate::_q_delayedDestroy(WId winId) +void QWidgetPrivate::_q_cleanupWinIds() { - delete winId; + foreach (WId wid, widCleanupList) + delete wid; + widCleanupList.clear(); } #endif diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 1a9987d..8306ed4 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -806,7 +806,7 @@ private: Q_DISABLE_COPY(QWidget) Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden()) #ifdef Q_OS_SYMBIAN - Q_PRIVATE_SLOT(d_func(), void _q_delayedDestroy(WId winId)) + Q_PRIVATE_SLOT(d_func(), void void _q_cleanupWinIds()) #endif QWidgetData *data; diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index a51e295..632df78 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -5031,7 +5031,7 @@ void QWidgetPrivate::registerTouchWindow(bool enable) if (enable == touchEventsEnabled) return; - QCocoaView *view = static_cast<QCocoaView *>(qt_mac_effectiveview_for(q)); + QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_effectiveview_for(q)); if (!view) return; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index ad65274..aefffb6 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -419,7 +419,7 @@ public: #ifdef Q_OS_SYMBIAN void setSoftKeys_sys(const QList<QAction*> &softkeys); void activateSymbianWindow(WId wid = 0); - void _q_delayedDestroy(WId winId); + void _q_cleanupWinIds(); #endif void raise_sys(); @@ -914,6 +914,7 @@ public: void s60UpdateIsOpaque(); void reparentChildren(); void registerTouchWindow(); + QList<WId> widCleanupList; #endif }; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 256e34b..2b51aaa 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -58,9 +58,7 @@ #endif // This is necessary in order to be able to perform delayed invocation on slots -// which take arguments of type WId. One example is -// QWidgetPrivate::_q_delayedDestroy, which is used to delay destruction of -// CCoeControl objects until after the CONE event handler has finished running. +// which take arguments of type WId. Q_DECLARE_METATYPE(WId) // Workaround for the fact that S60 SDKs 3.x do not contain the akntoolbar.h @@ -235,11 +233,22 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) QSize oldSize(q->size()); QRect oldGeom(data.crect); + bool checkExtra = true; + if (q->isWindow() && (data.window_state & (Qt::WindowFullScreen | Qt::WindowMaximized))) { + // Do not allow fullscreen/maximized windows to expand beyond client rect + TRect r = S60->clientRect(); + w = qMin(w, r.Width()); + h = qMin(h, r.Height()); + + if (w == r.Width() && h == r.Height()) + checkExtra = false; + } + // Lose maximized status if deliberate resize if (w != oldSize.width() || h != oldSize.height()) data.window_state &= ~Qt::WindowMaximized; - if (extra) { // any size restrictions? + if (checkExtra && extra) { // any size restrictions? w = qMin(w,extra->maxw); h = qMin(h,extra->maxh); w = qMax(w,extra->minw); @@ -480,8 +489,8 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de // Delay deletion of the control in case this function is called in the // context of a CONE event handler such as // CCoeControl::ProcessPointerEventL - QMetaObject::invokeMethod(q, "_q_delayedDestroy", - Qt::QueuedConnection, Q_ARG(WId, destroyw)); + widCleanupList << destroyw; + QMetaObject::invokeMethod(q, "_q_cleanupWinIds", Qt::QueuedConnection); } if (q->testAttribute(Qt::WA_AcceptTouchEvents)) diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index c46513a..38ba6f9 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -756,14 +756,15 @@ void QPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) path.setFillRule(Qt::WindingFill); #endif if (ti.glyphs.numGlyphs) - ti.fontEngine->addOutlineToPath(p.x(), p.y(), ti.glyphs, &path, ti.flags); + ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags); if (!path.isEmpty()) { - bool oldAA = painter()->renderHints() & QPainter::Antialiasing; + painter()->save(); painter()->setRenderHint(QPainter::Antialiasing, bool((painter()->renderHints() & QPainter::TextAntialiasing) && !(painter()->font().styleStrategy() & QFont::NoAntialias))); + painter()->translate(p.x(), p.y()); painter()->fillPath(path, state->pen().brush()); - painter()->setRenderHint(QPainter::Antialiasing, oldAA); + painter()->restore(); } } diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 36786c4..bcc5f9d 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3764,6 +3764,11 @@ extern "C" { int q_gray_rendered_spans(QT_FT_Raster raster); } +static inline uchar *alignAddress(uchar *address, quintptr alignmentMask) +{ + return (uchar *)(((quintptr)address + alignmentMask) & ~alignmentMask); +} + void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, ProcessSpans callback, void *userData, QRasterBuffer *) @@ -3791,19 +3796,10 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, // minimize memory reallocations. However if initial size for // raster pool is changed for lower value, reallocations will // occur normally. - const int rasterPoolInitialSize = MINIMUM_POOL_SIZE; - int rasterPoolSize = rasterPoolInitialSize; - unsigned char *rasterPoolBase; -#if defined(Q_WS_WIN64) - rasterPoolBase = - // We make use of setjmp and longjmp in qgrayraster.c which requires - // 16-byte alignment, hence we hardcode this requirement here.. - (unsigned char *) _aligned_malloc(rasterPoolSize, sizeof(void*) * 2); -#else - unsigned char rasterPoolOnStack[rasterPoolInitialSize]; - rasterPoolBase = rasterPoolOnStack; -#endif - Q_CHECK_PTR(rasterPoolBase); + int rasterPoolSize = MINIMUM_POOL_SIZE; + uchar rasterPoolOnStack[MINIMUM_POOL_SIZE + 0xf]; + uchar *rasterPoolBase = alignAddress(rasterPoolOnStack, 0xf); + uchar *rasterPoolOnHeap = 0; qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); @@ -3839,31 +3835,20 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, // Out of memory, reallocate some more and try again... if (error == -6) { // ErrRaster_OutOfMemory from qgrayraster.c - int new_size = rasterPoolSize * 2; - if (new_size > 1024 * 1024) { + rasterPoolSize *= 2; + if (rasterPoolSize > 1024 * 1024) { qWarning("QPainter: Rasterization of primitive failed"); break; } rendered_spans += q_gray_rendered_spans(*grayRaster.data()); -#if defined(Q_WS_WIN64) - _aligned_free(rasterPoolBase); -#else - if (rasterPoolBase != rasterPoolOnStack) // initially on the stack - free(rasterPoolBase); -#endif + free(rasterPoolOnHeap); + rasterPoolOnHeap = (uchar *)malloc(rasterPoolSize + 0xf); - rasterPoolSize = new_size; - rasterPoolBase = -#if defined(Q_WS_WIN64) - // We make use of setjmp and longjmp in qgrayraster.c which requires - // 16-byte alignment, hence we hardcode this requirement here.. - (unsigned char *) _aligned_malloc(rasterPoolSize, sizeof(void*) * 2); -#else - (unsigned char *) malloc(rasterPoolSize); -#endif - Q_CHECK_PTR(rasterPoolBase); // note: we just freed the old rasterPoolBase. I hope it's not fatal. + Q_CHECK_PTR(rasterPoolOnHeap); // note: we just freed the old rasterPoolBase. I hope it's not fatal. + + rasterPoolBase = alignAddress(rasterPoolOnHeap, 0xf); qt_ft_grays_raster.raster_done(*grayRaster.data()); qt_ft_grays_raster.raster_new(grayRaster.data()); @@ -3873,12 +3858,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, } } -#if defined(Q_WS_WIN64) - _aligned_free(rasterPoolBase); -#else - if (rasterPoolBase != rasterPoolOnStack) // initially on the stack - free(rasterPoolBase); -#endif + free(rasterPoolOnHeap); } void QRasterPaintEnginePrivate::recalculateFastImages() diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index ad0e151..327bedf 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -837,14 +837,12 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, int role) const { - Q_Q(const QCommonStyle); - const QWidget *widget = option->widget; switch (role) { case Qt::CheckStateRole: if (option->features & QStyleOptionViewItemV2::HasCheckIndicator) - return QSize(q->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), - q->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); + return QSize(proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), + proxyStyle->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); break; case Qt::DisplayRole: if (option->features & QStyleOptionViewItemV2::HasDisplay) { @@ -855,7 +853,7 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, in textLayout.setFont(option->font); textLayout.setText(option->text); const bool wrapText = option->features & QStyleOptionViewItemV2::WrapText; - const int textMargin = q->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1; + const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1; QRect bounds = option->rect; switch (option->decorationPosition) { case QStyleOptionViewItem::Left: @@ -919,9 +917,8 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItemV4 *option, const QRect &rect) const { - Q_Q(const QCommonStyle); const QWidget *widget = option->widget; - const int textMargin = q->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1; + const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1; QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding const bool wrapText = option->features & QStyleOptionViewItemV2::WrapText; @@ -999,7 +996,6 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRect *checkRect, QRect *pixmapRect, QRect *textRect, bool sizehint) const { - Q_Q(const QCommonStyle); Q_ASSERT(checkRect && pixmapRect && textRect); *pixmapRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DecorationRole)); *textRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DisplayRole)); @@ -1009,9 +1005,9 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRe const bool hasCheck = checkRect->isValid(); const bool hasPixmap = pixmapRect->isValid(); const bool hasText = textRect->isValid(); - const int textMargin = hasText ? q->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; - const int pixmapMargin = hasPixmap ? q->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; - const int checkMargin = hasCheck ? q->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; + const int textMargin = hasText ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; + const int pixmapMargin = hasPixmap ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; + const int checkMargin = hasCheck ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; int x = opt->rect.left(); int y = opt->rect.top(); int w, h; diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 8400feb..ffa4e59 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -166,7 +166,6 @@ public: COpenFontRasterizer *m_rasterizer; mutable QList<const QSymbianTypeFaceExtras *> m_extras; - mutable QHash<QString, const QSymbianTypeFaceExtras *> m_extrasHash; mutable QSet<QString> m_applicationFontFamilies; }; @@ -269,8 +268,9 @@ void QSymbianFontDatabaseExtrasImplementation::clear() static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras); if (!dbExtras) return; // initializeDb() has never been called + QSymbianTypeFaceExtrasHash &extrasHash = S60->fontData(); if (QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) { - qDeleteAll(dbExtras->m_extrasHash); + qDeleteAll(extrasHash); } else { typedef QList<const QSymbianTypeFaceExtras *>::iterator iterator; for (iterator p = dbExtras->m_extras.begin(); p != dbExtras->m_extras.end(); ++p) { @@ -279,11 +279,16 @@ void QSymbianFontDatabaseExtrasImplementation::clear() } dbExtras->m_extras.clear(); } - dbExtras->m_extrasHash.clear(); + extrasHash.clear(); } void qt_cleanup_symbianFontDatabase() { + static bool cleanupDone = false; + if (cleanupDone) + return; + cleanupDone = true; + QFontDatabasePrivate *db = privateDb(); if (!db) return; @@ -334,9 +339,12 @@ COpenFont* OpenFontFromBitmapFont(const CBitmapFont* aBitmapFont) const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &aTypeface, bool bold, bool italic) const { + QSymbianTypeFaceExtrasHash &extrasHash = S60->fontData(); + if (extrasHash.isEmpty() && QThread::currentThread() != QApplication::instance()->thread()) + S60->addThreadLocalReleaseFunc(clear); const QString typeface = qt_symbian_fontNameWithAppFontMarker(aTypeface); const QString searchKey = typeface + QString::number(int(bold)) + QString::number(int(italic)); - if (!m_extrasHash.contains(searchKey)) { + if (!extrasHash.contains(searchKey)) { TFontSpec searchSpec(qt_QString2TPtrC(typeface), 1); if (bold) searchSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); @@ -350,7 +358,7 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c QScopedPointer<CFont, CFontFromScreenDeviceReleaser> sFont(font); QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font); sFont.take(); - m_extrasHash.insert(searchKey, extras); + extrasHash.insert(searchKey, extras); } else { const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, searchSpec); Q_ASSERT(err == KErrNone && font); @@ -364,20 +372,20 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c const TOpenFontFaceAttrib* const attrib = openFont->FaceAttrib(); const QString foundKey = QString((const QChar*)attrib->FullName().Ptr(), attrib->FullName().Length()); - if (!m_extrasHash.contains(foundKey)) { + if (!extrasHash.contains(foundKey)) { QScopedPointer<CFont, CFontFromFontStoreReleaser> sFont(font); QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font, openFont); sFont.take(); m_extras.append(extras); - m_extrasHash.insert(searchKey, extras); - m_extrasHash.insert(foundKey, extras); + extrasHash.insert(searchKey, extras); + extrasHash.insert(foundKey, extras); } else { m_store->ReleaseFont(font); - m_extrasHash.insert(searchKey, m_extrasHash.value(foundKey)); + extrasHash.insert(searchKey, extrasHash.value(foundKey)); } } } - return m_extrasHash.value(searchKey); + return extrasHash.value(searchKey); } void QSymbianFontDatabaseExtrasImplementation::removeAppFontData( @@ -973,7 +981,7 @@ bool QFontDatabase::removeAllApplicationFonts() bool QFontDatabase::supportsThreadedFontRendering() { - return false; + return QSymbianTypeFaceExtras::symbianFontTableApiAvailable(); } static diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index dec0982..c9b672b 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -280,6 +280,8 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform int i = glyphs.numGlyphs; int totalKashidas = 0; while(i--) { + if (glyphs.attributes[i].dontPrint) + continue; xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); ypos += glyphs.advances_y[i]; totalKashidas += glyphs.justifications[i].nKashidas; @@ -1335,8 +1337,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, int glyph_pos = 0; for (int i = 0; i < len; ++i) { - bool surrogate = (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 && i < len-1 - && str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000); + bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()); if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) { QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos); diff --git a/src/gui/text/qfontengine_coretext_p.h b/src/gui/text/qfontengine_coretext_p.h index 0a2ae1f..4bd80be 100644 --- a/src/gui/text/qfontengine_coretext_p.h +++ b/src/gui/text/qfontengine_coretext_p.h @@ -52,6 +52,10 @@ #if !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + class QRawFontPrivate; class QCoreTextFontEngineMulti; class QCoreTextFontEngine : public QFontEngine @@ -146,6 +150,10 @@ private: CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef); +QT_END_NAMESPACE + +QT_END_HEADER + #endif// !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) #endif // QFONTENGINE_CORETEXT_P_H diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 9a5d9d6..e20aa25 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -78,6 +78,10 @@ #include FT_ERRORS_H #endif +#if !defined(QT_MAX_CACHED_GLYPH_SIZE) +# define QT_MAX_CACHED_GLYPH_SIZE 64 +#endif + QT_BEGIN_NAMESPACE /* @@ -373,7 +377,7 @@ void QFreetypeFace::computeSize(const QFontDef &fontDef, int *xsize, int *ysize, *xsize = *ysize = 0; } } else { - *outline_drawing = (*xsize > (64<<6) || *ysize > (64<<6)); + *outline_drawing = (*xsize > (QT_MAX_CACHED_GLYPH_SIZE<<6) || *ysize > (QT_MAX_CACHED_GLYPH_SIZE<<6)); } } @@ -1317,7 +1321,7 @@ QFontEngineFT::QGlyphSet *QFontEngineFT::loadTransformedGlyphSet(const QTransfor if (!gs) { // don't try to load huge fonts - bool draw_as_outline = fontDef.pixelSize * qSqrt(qAbs(matrix.det())) >= 64; + bool draw_as_outline = fontDef.pixelSize * qSqrt(qAbs(matrix.det())) >= QT_MAX_CACHED_GLYPH_SIZE; if (draw_as_outline) return 0; @@ -1418,15 +1422,12 @@ void QFontEngineFT::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_me static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } bool QFontEngineFT::canRender(const QChar *string, int len) diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index 9d9eaed..6186b2f 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -257,10 +257,8 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS #if !defined(QT_NO_DEBUG) int surrogates = 0; const QChar *str = item->string; - for (int i = item->from; i < item->from + item->length - 1; ++i) { - surrogates += (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 - && str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000); - } + for (int i = item->from; i < item->from + item->length - 1; ++i) + surrogates += (str[i].isHighSurrogate() && str[i+1].isLowSurrogate()); #endif for (nextCharStop = item->from; nextCharStop < item->from + item->length; ++nextCharStop) if (item->charAttributes[nextCharStop].charStop) @@ -328,10 +326,8 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS if (charOffset < item->length - 1) { QChar current = item->string[item->from + charOffset]; QChar next = item->string[item->from + charOffset + 1]; - if (current.unicode() >= 0xd800 && current.unicode() < 0xdc00 - && next.unicode() >= 0xdc00 && next.unicode() < 0xe000) { + if (current.isHighSurrogate() && next.isLowSurrogate()) item->log_clusters[charOffset + 1] = currentClusterGlyph; - } } } } @@ -738,15 +734,12 @@ QFontEngineMac::~QFontEngineMac() static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } // Not used directly for shaping, only used to calculate m_averageCharWidth diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index cb1e7d6..c829c2f 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -226,15 +226,12 @@ QVariant QFontEngineQPA::extractHeaderField(const uchar *data, HeaderTag request static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data) diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 30a1623..3db5ce1 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -278,15 +278,12 @@ QList<QByteArray> QFontEngineQPF::cleanUpAfterClientCrash(const QList<int> &cras static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } #ifdef QT_FONTS_ARE_RESOURCES QFontEngineQPF::QFontEngineQPF(const QFontDef &def, const uchar *bytes, int size) diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index 237842b..ade283f 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -83,15 +83,12 @@ QT_BEGIN_NAMESPACE static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } #define FM_SMOOTH 1 diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index b0824cb..203b6e1 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -233,15 +233,12 @@ bool QSymbianTypeFaceExtras::symbianFontTableApiAvailable() // duplicated from qfontengine_xyz.cpp static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } extern QString qt_symbian_fontNameWithAppFontMarker(const QString &fontName); // qfontdatabase_s60.cpp diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index aef2145..fc11387 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -224,15 +224,12 @@ void QFontEngineWin::getCMap() inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } int QFontEngineWin::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout *glyphs, bool mirrored) const diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp index 490866c..6e87f4c 100644 --- a/src/gui/text/qfontengine_x11.cpp +++ b/src/gui/text/qfontengine_x11.cpp @@ -358,9 +358,7 @@ bool QFontEngineXLFD::stringToCMap(const QChar *s, int len, QGlyphLayout *glyphs QVarLengthArray<ushort> _s(len); QChar *str = (QChar *)_s.data(); for (int i = 0; i < len; ++i) { - if (i < len - 1 - && s[i].unicode() >= 0xd800 && s[i].unicode() < 0xdc00 - && s[i+1].unicode() >= 0xdc00 && s[i].unicode() < 0xe000) { + if (s[i].isHighSurrogate() && i < len-1 && s[i+1].isLowSurrogate()) { *str = QChar(); ++i; } else { diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp index d693273..5bac117 100644 --- a/src/gui/text/qfontenginedirectwrite.cpp +++ b/src/gui/text/qfontenginedirectwrite.cpp @@ -269,15 +269,12 @@ QFixed QFontEngineDirectWrite::emSquareSize() const inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4( ucs4, str[i].unicode()); } - return uc; + return ucs4; } bool QFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 442f7cc..7f43378 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -140,14 +140,18 @@ bool QGlyphRun::operator==(const QGlyphRun &other) const return false; } - for (int i=0; i<qMax(d->glyphIndexDataSize, d->glyphPositionDataSize); ++i) { - if (i < d->glyphIndexDataSize && d->glyphIndexData[i] != other.d->glyphIndexData[i]) - return false; - - if (i < d->glyphPositionDataSize && d->glyphPositionData[i] != other.d->glyphPositionData[i]) - return false; + if (d->glyphIndexData != other.d->glyphIndexData) { + for (int i = 0; i < d->glyphIndexDataSize; ++i) { + if (d->glyphIndexData[i] != other.d->glyphIndexData[i]) + return false; + } + } + if (d->glyphPositionData != other.d->glyphPositionData) { + for (int i = 0; i < d->glyphPositionDataSize; ++i) { + if (d->glyphPositionData[i] != other.d->glyphPositionData[i]) + return false; + } } - return (d->overline == other.d->overline && d->underline == other.d->underline @@ -156,13 +160,11 @@ bool QGlyphRun::operator==(const QGlyphRun &other) const } /*! + \fn bool QGlyphRun::operator!=(const QGlyphRun &other) const + Compares \a other to this QGlyphRun object. Returns true if any of the list of glyph indexes, the list of positions or the font are different, otherwise returns false. */ -bool QGlyphRun::operator!=(const QGlyphRun &other) const -{ - return !(*this == other); -} /*! Returns the font selected for this QGlyphRun object. @@ -294,6 +296,9 @@ bool QGlyphRun::overline() const */ void QGlyphRun::setOverline(bool overline) { + if (d->overline == overline) + return; + detach(); d->overline = overline; } @@ -316,6 +321,9 @@ bool QGlyphRun::underline() const */ void QGlyphRun::setUnderline(bool underline) { + if (d->underline == underline) + return; + detach(); d->underline = underline; } @@ -338,6 +346,9 @@ bool QGlyphRun::strikeOut() const */ void QGlyphRun::setStrikeOut(bool strikeOut) { + if (d->strikeOut == strikeOut) + return; + detach(); d->strikeOut = strikeOut; } diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h index cf407a8..bc7f4ff 100644 --- a/src/gui/text/qglyphrun.h +++ b/src/gui/text/qglyphrun.h @@ -79,8 +79,10 @@ public: void clear(); QGlyphRun &operator=(const QGlyphRun &other); + bool operator==(const QGlyphRun &other) const; - bool operator!=(const QGlyphRun &other) const; + inline bool operator!=(const QGlyphRun &other) const + { return !operator==(other); } void setOverline(bool overline); bool overline() const; diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 60a6cb3..7c7d4eb 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -46,7 +46,6 @@ #include "qrawfont.h" #include "qrawfont_p.h" -#include <QtCore/qthread.h> #include <QtCore/qendian.h> QT_BEGIN_NAMESPACE @@ -77,7 +76,7 @@ QT_BEGIN_NAMESPACE A QRawFont object represents a single, physical instance of a given font in a given pixel size. I.e. in the typical case it represents a set of TrueType or OpenType font tables and uses a - user specified pixel size to convert metrics into logical pixel units. In can be used in + user specified pixel size to convert metrics into logical pixel units. It can be used in combination with the QGlyphRun class to draw specific glyph indexes at specific positions, and also have accessors to some relevant data in the physical font. @@ -190,8 +189,7 @@ QRawFont &QRawFont::operator=(const QRawFont &other) */ bool QRawFont::isValid() const { - Q_ASSERT(d->thread == 0 || d->thread == QThread::currentThread()); - return d->fontEngine != 0; + return d->isValid(); } /*! @@ -225,7 +223,7 @@ void QRawFont::loadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { - detach(); + d.detach(); d->cleanUp(); d->hintingPreference = hintingPreference; d->thread = QThread::currentThread(); @@ -240,20 +238,21 @@ void QRawFont::loadFromData(const QByteArray &fontData, If \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image will be in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities of the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of - QImage::Format_A8 and each pixel will contain the opacity of the pixel in the rasterization. + QImage::Format_Indexed8 and each pixel will contain the opacity of the pixel in the + rasterization. \sa pathForGlyph(), QPainter::drawGlyphRun() */ QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialiasingType, const QTransform &transform) const { - if (!isValid()) + if (!d->isValid()) return QImage(); if (antialiasingType == SubPixelAntialiasing) return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), 0, transform); - else - return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform); + + return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform); } /*! @@ -266,7 +265,7 @@ QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialias */ QPainterPath QRawFont::pathForGlyph(quint32 glyphIndex) const { - if (!isValid()) + if (!d->isValid()) return QPainterPath(); QFixedPoint position; @@ -284,16 +283,19 @@ bool QRawFont::operator==(const QRawFont &other) const } /*! + \fn bool QRawFont::operator!=(const QRawFont &other) const + + Returns true if this QRawFont is not equal to \a other. Otherwise, returns false. +*/ + +/*! Returns the ascent of this QRawFont in pixel units. \sa QFontMetricsF::ascent() */ qreal QRawFont::ascent() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->ascent().toReal(); + return d->isValid() ? d->fontEngine->ascent().toReal() : 0.0; } /*! @@ -303,10 +305,7 @@ qreal QRawFont::ascent() const */ qreal QRawFont::descent() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->descent().toReal(); + return d->isValid() ? d->fontEngine->descent().toReal() : 0.0; } /*! @@ -316,10 +315,7 @@ qreal QRawFont::descent() const */ qreal QRawFont::xHeight() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->xHeight().toReal(); + return d->isValid() ? d->fontEngine->xHeight().toReal() : 0.0; } /*! @@ -329,10 +325,7 @@ qreal QRawFont::xHeight() const */ qreal QRawFont::leading() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->leading().toReal(); + return d->isValid() ? d->fontEngine->leading().toReal() : 0.0; } /*! @@ -342,10 +335,7 @@ qreal QRawFont::leading() const */ qreal QRawFont::averageCharWidth() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->averageCharWidth().toReal(); + return d->isValid() ? d->fontEngine->averageCharWidth().toReal() : 0.0; } /*! @@ -355,10 +345,7 @@ qreal QRawFont::averageCharWidth() const */ qreal QRawFont::maxCharWidth() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->maxCharWidth(); + return d->isValid() ? d->fontEngine->maxCharWidth() : 0.0; } /*! @@ -370,10 +357,7 @@ qreal QRawFont::maxCharWidth() const */ qreal QRawFont::pixelSize() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->fontDef.pixelSize; + return d->isValid() ? d->fontEngine->fontDef.pixelSize : 0.0; } /*! @@ -386,10 +370,7 @@ qreal QRawFont::pixelSize() const */ qreal QRawFont::unitsPerEm() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->emSquareSize().toReal(); + return d->isValid() ? d->fontEngine->emSquareSize().toReal() : 0.0; } /*! @@ -397,10 +378,7 @@ qreal QRawFont::unitsPerEm() const */ QString QRawFont::familyName() const { - if (!isValid()) - return QString(); - - return d->fontEngine->fontDef.family; + return d->isValid() ? d->fontEngine->fontDef.family : QString(); } /*! @@ -410,10 +388,7 @@ QString QRawFont::familyName() const */ QString QRawFont::styleName() const { - if (!isValid()) - return QString(); - - return d->fontEngine->fontDef.styleName; + return d->isValid() ? d->fontEngine->fontDef.styleName : QString(); } /*! @@ -423,10 +398,7 @@ QString QRawFont::styleName() const */ QFont::Style QRawFont::style() const { - if (!isValid()) - return QFont::StyleNormal; - - return QFont::Style(d->fontEngine->fontDef.style); + return d->isValid() ? QFont::Style(d->fontEngine->fontDef.style) : QFont::StyleNormal; } /*! @@ -436,10 +408,7 @@ QFont::Style QRawFont::style() const */ int QRawFont::weight() const { - if (!isValid()) - return -1; - - return int(d->fontEngine->fontDef.weight); + return d->isValid() ? int(d->fontEngine->fontDef.weight) : -1; } /*! @@ -457,7 +426,7 @@ int QRawFont::weight() const */ QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const { - if (!isValid()) + if (!d->isValid()) return QVector<quint32>(); int nglyphs = text.size(); @@ -490,7 +459,7 @@ QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const */ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const { - if (!isValid()) + if (!d->isValid()) return false; QGlyphLayout glyphs; @@ -507,7 +476,7 @@ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *g */ QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const { - if (!isValid()) + if (!d->isValid()) return QVector<QPointF>(); int numGlyphs = glyphIndexes.size(); @@ -534,7 +503,7 @@ QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyph */ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const { - if (!isValid()) + if (!d->isValid()) return false; QGlyphLayout glyphs; @@ -560,10 +529,7 @@ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *adv */ QFont::HintingPreference QRawFont::hintingPreference() const { - if (!isValid()) - return QFont::PreferDefaultHinting; - - return d->hintingPreference; + return d->isValid() ? d->hintingPreference : QFont::PreferDefaultHinting; } /*! @@ -574,7 +540,7 @@ QFont::HintingPreference QRawFont::hintingPreference() const */ QByteArray QRawFont::fontTable(const char *tagName) const { - if (!isValid()) + if (!d->isValid()) return QByteArray(); const quint32 *tagId = reinterpret_cast<const quint32 *>(tagName); @@ -597,9 +563,9 @@ extern QList<QFontDatabase::WritingSystem> qt_determine_writing_systems_from_tru */ QList<QFontDatabase::WritingSystem> QRawFont::supportedWritingSystems() const { - if (isValid()) { + if (d->isValid()) { QByteArray os2Table = fontTable("OS/2"); - if (!os2Table.isEmpty() && os2Table.size() > 86) { + if (os2Table.size() > 86) { char *data = os2Table.data(); quint32 *bigEndianUnicodeRanges = reinterpret_cast<quint32 *>(data + 42); quint32 *bigEndianCodepageRanges = reinterpret_cast<quint32 *>(data + 78); @@ -627,10 +593,7 @@ QList<QFontDatabase::WritingSystem> QRawFont::supportedWritingSystems() const */ bool QRawFont::supportsCharacter(QChar character) const { - if (!isValid()) - return false; - - return d->fontEngine->canRender(&character, 1); + return d->isValid() && d->fontEngine->canRender(&character, 1); } /*! @@ -641,9 +604,6 @@ bool QRawFont::supportsCharacter(QChar character) const */ bool QRawFont::supportsCharacter(quint32 ucs4) const { - if (!isValid()) - return false; - QChar str[2]; int len; if (!QChar::requiresSurrogates(ucs4)) { @@ -655,7 +615,7 @@ bool QRawFont::supportsCharacter(quint32 ucs4) const len = 2; } - return d->fontEngine->canRender(str, len); + return d->isValid() && d->fontEngine->canRender(str, len); } // qfontdatabase.cpp @@ -667,6 +627,7 @@ extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSyst */ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writingSystem) { + QRawFont rawFont; #if defined(Q_WS_MAC) QTextLayout layout(QFontDatabase::writingSystemSample(writingSystem), font); layout.beginLayout(); @@ -677,14 +638,12 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ // Pick the one matches the family name we originally requested, // if none of them match, just pick the first one for (int i = 0; i < list.size(); i++) { - QGlyphRun glyphs = list.at(i); - QRawFont rawfont = glyphs.rawFont(); - if (rawfont.familyName() == font.family()) - return rawfont; + rawFont = list.at(i).rawFont(); + if (rawFont.familyName() == font.family()) + return rawFont; } return list.at(0).rawFont(); } - return QRawFont(); #else QFontPrivate *font_d = QFontPrivate::get(font); int script = qt_script_for_writing_system(writingSystem); @@ -700,15 +659,12 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ } if (fe != 0) { - QRawFont rawFont; rawFont.d.data()->fontEngine = fe; rawFont.d.data()->fontEngine->ref.ref(); rawFont.d.data()->hintingPreference = font.hintingPreference(); - return rawFont; - } else { - return QRawFont(); } #endif + return rawFont; } /*! @@ -719,7 +675,7 @@ void QRawFont::setPixelSize(qreal pixelSize) if (d->fontEngine == 0) return; - detach(); + d.detach(); QFontEngine *oldFontEngine = d->fontEngine; d->fontEngine = d->fontEngine->cloneWithSize(pixelSize); @@ -734,15 +690,6 @@ void QRawFont::setPixelSize(qreal pixelSize) /*! \internal */ -void QRawFont::detach() -{ - if (d->ref != 1) - d.detach(); -} - -/*! - \internal -*/ void QRawFontPrivate::cleanUp() { platformCleanUp(); diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index d5b5680..cf77996 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -81,7 +81,10 @@ public: bool isValid() const; QRawFont &operator=(const QRawFont &other); + bool operator==(const QRawFont &other) const; + inline bool operator!=(const QRawFont &other) const + { return !operator==(other); } QString familyName() const; QString styleName() const; @@ -132,9 +135,6 @@ public: private: friend class QRawFontPrivate; - - void detach(); - QExplicitlySharedDataPointer<QRawFontPrivate> d; }; diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h index fdf7cad..3557751 100644 --- a/src/gui/text/qrawfont_p.h +++ b/src/gui/text/qrawfont_p.h @@ -54,7 +54,9 @@ // #include "qrawfont.h" + #include "qfontengine_p.h" +#include <QtCore/qthread.h> #include <QtCore/qthreadstorage.h> #if !defined(QT_NO_RAWFONT) @@ -71,21 +73,17 @@ public: , thread(0) #if defined(Q_WS_WIN) , fontHandle(NULL) - , ptrAddFontMemResourceEx(NULL) - , ptrRemoveFontMemResourceEx(NULL) #endif {} QRawFontPrivate(const QRawFontPrivate &other) - : hintingPreference(other.hintingPreference) + : fontEngine(other.fontEngine) + , hintingPreference(other.hintingPreference) , thread(other.thread) #if defined(Q_WS_WIN) , fontHandle(NULL) - , ptrAddFontMemResourceEx(other.ptrAddFontMemResourceEx) - , ptrRemoveFontMemResourceEx(other.ptrRemoveFontMemResourceEx) #endif { - fontEngine = other.fontEngine; if (fontEngine != 0) fontEngine->ref.ref(); } @@ -96,6 +94,12 @@ public: cleanUp(); } + inline bool isValid() const + { + Q_ASSERT(thread == 0 || thread == QThread::currentThread()); + return fontEngine != 0; + } + void cleanUp(); void platformCleanUp(); void platformLoadFromData(const QByteArray &fontData, @@ -111,14 +115,7 @@ public: #if defined(Q_WS_WIN) HANDLE fontHandle; - - typedef HANDLE (WINAPI *PtrAddFontMemResourceEx)(PVOID, DWORD, PVOID, DWORD *); - typedef BOOL (WINAPI *PtrRemoveFontMemResourceEx)(HANDLE); - - PtrAddFontMemResourceEx ptrAddFontMemResourceEx; - PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx; - -#endif // Q_WS_WIN +#endif }; QT_END_NAMESPACE diff --git a/src/gui/text/qrawfont_win.cpp b/src/gui/text/qrawfont_win.cpp index 779652f..a729e31 100644 --- a/src/gui/text/qrawfont_win.cpp +++ b/src/gui/text/qrawfont_win.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qrawfont_p.h" + +#if !defined(QT_NO_RAWFONT) + #include <private/qsystemlibrary_p.h> #if !defined(QT_NO_DIRECTWRITE) @@ -47,8 +50,6 @@ # include <dwrite.h> #endif -#if !defined(QT_NO_RAWFONT) - QT_BEGIN_NAMESPACE namespace { @@ -61,18 +62,16 @@ namespace { operator T() const { T littleEndian = 0; - for (int i=0; i<sizeof(T); ++i) { + for (int i = 0; i < int(sizeof(T)); ++i) littleEndian |= data[i] << ((sizeof(T) - i - 1) * 8); - } return littleEndian; } BigEndian<T> &operator=(const T &t) { - for (int i=0; i<sizeof(T); ++i) { + for (int i = 0; i < int(sizeof(T)); ++i) data[i] = ((t >> (sizeof(T) - i - 1) * 8) & 0xff); - } return *this; } @@ -157,7 +156,7 @@ namespace { class EmbeddedFont { public: - EmbeddedFont(const QByteArray &fontData); + EmbeddedFont(const QByteArray &fontData) : m_fontData(fontData) {} QString changeFamilyName(const QString &newFamilyName); QByteArray data() const { return m_fontData; } @@ -168,10 +167,6 @@ namespace { QByteArray m_fontData; }; - EmbeddedFont::EmbeddedFont(const QByteArray &fontData) : m_fontData(fontData) - { - } - TableDirectory *EmbeddedFont::tableDirectoryEntry(const QByteArray &tagName) { Q_ASSERT(tagName.size() == 4); @@ -214,9 +209,9 @@ namespace { + nameRecord->offset; const BigEndian<quint16> *s = reinterpret_cast<const BigEndian<quint16> *>(ptr); - for (int j=0; j<nameRecord->length / sizeof(quint16); ++j) - name += QChar(s[j]); - + const BigEndian<quint16> *e = s + nameRecord->length / sizeof(quint16); + while (s != e) + name += QChar(*s++); break; } } @@ -525,41 +520,49 @@ extern QFontEngine *qt_load_font_engine_win(const QFontDef &request); // From qfontdatabase.cpp extern QFont::Weight weightFromInteger(int weight); -void QRawFontPrivate::platformCleanUp() +typedef HANDLE (WINAPI *PtrAddFontMemResourceEx)(PVOID, DWORD, PVOID, DWORD *); +static PtrAddFontMemResourceEx ptrAddFontMemResourceEx = 0; +typedef BOOL (WINAPI *PtrRemoveFontMemResourceEx)(HANDLE); +static PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx = 0; + +static void resolveGdi32() { - if (fontHandle != NULL) { - if (ptrRemoveFontMemResourceEx == NULL) { - void *func = QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); - ptrRemoveFontMemResourceEx = - reinterpret_cast<QRawFontPrivate::PtrRemoveFontMemResourceEx>(func); + static bool triedResolve = false; + if (!triedResolve) { + QSystemLibrary gdi32(QLatin1String("gdi32")); + if (gdi32.load()) { + ptrAddFontMemResourceEx = (PtrAddFontMemResourceEx)gdi32.resolve("AddFontMemResourceEx"); + ptrRemoveFontMemResourceEx = (PtrRemoveFontMemResourceEx)gdi32.resolve("RemoveFontMemResourceEx"); } - if (ptrRemoveFontMemResourceEx == NULL) { - qWarning("QRawFont::platformCleanUp: Can't find RemoveFontMemResourceEx in gdi32"); - fontHandle = NULL; - } else { + triedResolve = true; + } +} + +void QRawFontPrivate::platformCleanUp() +{ + if (fontHandle != NULL) { + if (ptrRemoveFontMemResourceEx) ptrRemoveFontMemResourceEx(fontHandle); - fontHandle = NULL; - } + fontHandle = NULL; } } -void QRawFontPrivate::platformLoadFromData(const QByteArray &_fontData, +void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { - QByteArray fontData(_fontData); EmbeddedFont font(fontData); #if !defined(QT_NO_DIRECTWRITE) if (hintingPreference == QFont::PreferDefaultHinting - || hintingPreference == QFont::PreferFullHinting) + || hintingPreference == QFont::PreferFullHinting) #endif { GUID guid; CoCreateGuid(&guid); - QString uniqueFamilyName = QString::fromLatin1("f") + QString uniqueFamilyName = QLatin1Char('f') + QString::number(guid.Data1, 36) + QLatin1Char('-') + QString::number(guid.Data2, 36) + QLatin1Char('-') + QString::number(guid.Data3, 36) + QLatin1Char('-') @@ -571,22 +574,13 @@ void QRawFontPrivate::platformLoadFromData(const QByteArray &_fontData, return; } - if (ptrAddFontMemResourceEx == NULL || ptrRemoveFontMemResourceEx == NULL) { - void *func = QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); - ptrRemoveFontMemResourceEx = - reinterpret_cast<QRawFontPrivate::PtrRemoveFontMemResourceEx>(func); - - func = QSystemLibrary::resolve(QLatin1String("gdi32"), "AddFontMemResourceEx"); - ptrAddFontMemResourceEx = - reinterpret_cast<QRawFontPrivate::PtrAddFontMemResourceEx>(func); - } - Q_ASSERT(fontHandle == NULL); - if (ptrAddFontMemResourceEx != NULL && ptrRemoveFontMemResourceEx != NULL) { + resolveGdi32(); + if (ptrAddFontMemResourceEx && ptrRemoveFontMemResourceEx) { DWORD count = 0; - fontData = font.data(); - fontHandle = ptrAddFontMemResourceEx(fontData.data(), fontData.size(), 0, &count); - + QByteArray newFontData = font.data(); + fontHandle = ptrAddFontMemResourceEx((void *)newFontData.constData(), newFontData.size(), + 0, &count); if (count == 0 && fontHandle != NULL) { ptrRemoveFontMemResourceEx(fontHandle); fontHandle = NULL; diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index bde2c34..aeeef85 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1638,16 +1638,13 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons return; } - if (!mousePressed) - return; - const qreal mouseX = qreal(mousePos.x()); int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit); if (newCursorPos == -1) return; - if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) { + if (mousePressed && wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) { selectedWordOnDoubleClick = cursor; selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor); } @@ -1656,7 +1653,7 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons extendBlockwiseSelection(newCursorPos); else if (selectedWordOnDoubleClick.hasSelection()) extendWordwiseSelection(newCursorPos, mouseX); - else + else if (mousePressed) setCursorPosition(newCursorPos, QTextCursor::KeepAnchor); if (interactionFlags & Qt::TextEditable) { diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 7e7ca6c..acef9fa 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -1511,11 +1511,11 @@ void QTextCursor::deletePreviousChar() const QTextFragmentData * const frag = fragIt.value(); int fpos = fragIt.position(); QChar uc = d->priv->buffer().at(d->anchor - fpos + frag->stringPosition); - if (d->anchor > fpos && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { + if (d->anchor > fpos && uc.isLowSurrogate()) { // second half of a surrogate, check if we have the first half as well, // if yes delete both at once uc = d->priv->buffer().at(d->anchor - 1 - fpos + frag->stringPosition); - if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) + if (uc.isHighSurrogate()) --d->anchor; } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index aa4a20d..2fc1dbd 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -968,7 +968,7 @@ void QTextEngine::shapeText(int item) const } for (int i = 0; i < si.num_glyphs; ++i) - si.width += glyphs.advances_x[i]; + si.width += glyphs.advances_x[i] * !glyphs.attributes[i].dontPrint; } static inline bool hasCaseChange(const QScriptItem &si) @@ -993,8 +993,7 @@ static void heuristicSetGlyphAttributes(const QChar *uc, int length, QGlyphLayou int glyph_pos = 0; for (int i = 0; i < length; i++) { - if (uc[i].unicode() >= 0xd800 && uc[i].unicode() < 0xdc00 && i < length-1 - && uc[i+1].unicode() >= 0xdc00 && uc[i+1].unicode() < 0xe000) { + if (uc[i].isHighSurrogate() && i < length-1 && uc[i+1].isLowSurrogate()) { logClusters[i] = glyph_pos; logClusters[++i] = glyph_pos; } else { @@ -1387,6 +1386,7 @@ QTextEngine::~QTextEngine() if (!stackEngine) delete layoutData; delete specialData; + resetFontEngineCache(); } const HB_CharAttributes *QTextEngine::attributes() const @@ -1447,6 +1447,13 @@ static inline void releaseCachedFontEngine(QFontEngine *fontEngine) } } +void QTextEngine::resetFontEngineCache() +{ + releaseCachedFontEngine(feCache.prevFontEngine); + releaseCachedFontEngine(feCache.prevScaledFontEngine); + feCache.reset(); +} + void QTextEngine::invalidate() { freeMemory(); @@ -1455,9 +1462,7 @@ void QTextEngine::invalidate() if (specialData) specialData->resolvedFormatIndices.clear(); - releaseCachedFontEngine(feCache.prevFontEngine); - releaseCachedFontEngine(feCache.prevScaledFontEngine); - feCache.reset(); + resetFontEngineCache(); } void QTextEngine::clearLineData() @@ -2658,7 +2663,7 @@ void QTextEngine::splitItem(int item, int pos) const QFixed w = 0; const QGlyphLayout g = shapedGlyphs(&oldItem); for(int j = 0; j < breakGlyph; ++j) - w += g.advances_x[j]; + w += g.advances_x[j] * !g.attributes[j].dontPrint; newItem.width = oldItem.width - w; oldItem.width = w; @@ -2951,7 +2956,7 @@ int QTextEngine::lineNumberForTextPosition(int pos) return lines.size() - 1; for (int i = 0; i < lines.size(); ++i) { const QScriptLine& line = lines[i]; - if (line.from + line.length > pos) + if (line.from + line.length + line.trailingSpaces > pos) return i; } return -1; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index b1bd0c3..9362022 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -376,7 +376,7 @@ struct Q_AUTOTEST_EXPORT QScriptLine { // created and filled in QTextLine::layout_helper QScriptLine() - : from(0), length(0), + : from(0), trailingSpaces(0), length(0), justified(0), gridfitted(0), hasTrailingSpaces(0), leadingIncluded(0) {} QFixed descent; @@ -388,6 +388,7 @@ struct Q_AUTOTEST_EXPORT QScriptLine QFixed textWidth; QFixed textAdvance; int from; + unsigned short trailingSpaces; signed int length : 28; mutable uint justified : 1; mutable uint gridfitted : 1; @@ -628,6 +629,7 @@ public: int lineNumberForTextPosition(int pos); int positionAfterVisualMovement(int oldPos, QTextCursor::MoveOperation op); void insertionPointsForLine(int lineNum, QVector<int> &insertionPoints); + void resetFontEngineCache(); private: void setBoundary(int strPos) const; diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 5b60dfa..d130c61 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -820,15 +820,11 @@ QString QTextHtmlParser::parseEntity() if (uc >= 0x80 && uc < 0x80 + (sizeof(windowsLatin1ExtendedCharacters)/sizeof(windowsLatin1ExtendedCharacters[0]))) uc = windowsLatin1ExtendedCharacters[uc - 0x80]; QString str; - if (uc > 0xffff) { - // surrogate pair - uc -= 0x10000; - ushort high = uc/0x400 + 0xd800; - ushort low = uc%0x400 + 0xdc00; - str.append(QChar(high)); - str.append(QChar(low)); + if (QChar::requiresSurrogates(uc)) { + str += QChar(QChar::highSurrogate(uc)); + str += QChar(QChar::lowSurrogate(uc)); } else { - str.append(QChar(uc)); + str = QChar(uc); } return str; } diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 4fd6ddf..d0c1a0e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -375,7 +375,7 @@ QTextLayout::~QTextLayout() void QTextLayout::setFont(const QFont &font) { d->fnt = font; - d->feCache.reset(); + d->resetFontEngineCache(); } /*! @@ -515,7 +515,7 @@ void QTextLayout::setAdditionalFormats(const QList<FormatRange> &formatList) } if (d->block.docHandle()) d->block.docHandle()->documentChange(d->block.position(), d->block.length()); - d->feCache.reset(); + d->resetFontEngineCache(); } /*! @@ -814,7 +814,7 @@ QTextLine QTextLayout::createLine() if (l && d->lines.at(l-1).length < 0) { QTextLine(l-1, d).setNumColumns(INT_MAX); } - int from = l > 0 ? d->lines.at(l-1).from + d->lines.at(l-1).length : 0; + int from = l > 0 ? d->lines.at(l-1).from + d->lines.at(l-1).length + d->lines.at(l-1).trailingSpaces : 0; int strlen = d->layoutData->string.length(); if (l && from >= strlen) { if (!d->lines.at(l-1).length || d->layoutData->string.at(strlen - 1) != QChar::LineSeparator) @@ -1708,6 +1708,7 @@ void QTextLine::layout_helper(int maxGlyphs) { QScriptLine &line = eng->lines[i]; line.length = 0; + line.trailingSpaces = 0; line.textWidth = 0; line.hasTrailingSpaces = false; @@ -1931,7 +1932,7 @@ found: if (eng->option.flags() & QTextOption::IncludeTrailingSpaces) line.textWidth += lbh.spaceData.textWidth; if (lbh.spaceData.length) { - line.length += lbh.spaceData.length; + line.trailingSpaces = lbh.spaceData.length; line.hasTrailingSpaces = true; } @@ -1995,7 +1996,7 @@ int QTextLine::textLength() const && eng->block.isValid() && i == eng->lines.count()-1) { return eng->lines[i].length - 1; } - return eng->lines[i].length; + return eng->lines[i].length + eng->lines[i].trailingSpaces; } static void drawMenuText(QPainter *p, QFixed x, QFixed y, const QScriptItem &si, QTextItemInt &gf, QTextEngine *eng, @@ -2506,6 +2507,9 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const int pos = *cursorPos; int itm; + const HB_CharAttributes *attributes = eng->attributes(); + while (pos < line.from + line.length && !attributes[pos].charStop) + pos++; if (pos == line.from + (int)line.length) { // end of line ensure we have the last item on the line itm = eng->findItem(pos-1); diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 8c243ed..7a53224 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -313,12 +313,12 @@ static void handleUrlL(const TDesC& aUrl) CleanupStack::PopAndDestroy(); } -static bool handleUrl(const QUrl &url) +static bool handleUrl(const QUrl &url, bool useEncodedUrl) { if (!url.isValid()) return false; - QString urlString(url.toEncoded()); + QString urlString(useEncodedUrl ? url.toEncoded() : url.toString()); TPtrC urlPtr(qt_QString2TPtrC(urlString)); TRAPD( err, handleUrlL(urlPtr)); return err ? false : true; @@ -326,12 +326,12 @@ static bool handleUrl(const QUrl &url) static bool launchWebBrowser(const QUrl &url) { - return handleUrl(url); + return handleUrl(url, true); } static bool openDocument(const QUrl &file) { - return handleUrl(file); + return handleUrl(file, false); } #endif //USE_SCHEMEHANDLER diff --git a/src/gui/widgets/qabstractplatformmenubar_p.h b/src/gui/widgets/qabstractplatformmenubar_p.h new file mode 100644 index 0000000..10e6fdc --- /dev/null +++ b/src/gui/widgets/qabstractplatformmenubar_p.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTPLATFORMMENUBAR_P_H +#define QABSTRACTPLATFORMMENUBAR_P_H + +#include <qfactoryinterface.h> +#include <qglobal.h> +#include <qplugin.h> + +#ifndef QT_NO_MENUBAR + +QT_BEGIN_NAMESPACE + +class QAction; +class QActionEvent; +class QEvent; +class QMenuBar; +class QObject; +class QWidget; + +class QAbstractPlatformMenuBar; + +struct QPlatformMenuBarFactoryInterface : public QFactoryInterface +{ + virtual QAbstractPlatformMenuBar *create() = 0; +}; + +#define QPlatformMenuBarFactoryInterface_iid "com.nokia.qt.QPlatformMenuBarFactoryInterface" +Q_DECLARE_INTERFACE(QPlatformMenuBarFactoryInterface, QPlatformMenuBarFactoryInterface_iid) + +/*! + The platform-specific implementation of a menubar +*/ +class QAbstractPlatformMenuBar +{ +public: + virtual ~QAbstractPlatformMenuBar() {} + + virtual void init(QMenuBar *) = 0; + + virtual void setVisible(bool visible) = 0; + + virtual void actionEvent(QActionEvent *) = 0; + + virtual void handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow) = 0; + + virtual bool allowCornerWidgets() const = 0; + + virtual void popupAction(QAction *) = 0; + + virtual void setNativeMenuBar(bool) = 0; + + virtual bool isNativeMenuBar() const = 0; + + /*! + Return true if the native menubar is capable of listening to the + shortcut keys. If false is returned, QMenuBar will trigger actions on + shortcut itself. + */ + virtual bool shortcutsHandledByNativeMenuBar() const = 0; + + virtual bool menuBarEventFilter(QObject *, QEvent *event) = 0; +}; + +QT_END_NAMESPACE + +#endif // QT_NO_MENUBAR + +#endif // QABSTRACTPLATFORMMENUBAR_P_H diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index b6e2f90..d58da37 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE #ifdef QT_GUI_PASSWORD_ECHO_DELAY -static int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY; +static const int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY; #endif /*! @@ -93,8 +93,8 @@ void QLineControl::updateDisplayText(bool forceUpdate) if (m_echoMode == QLineEdit::Password) { str.fill(m_passwordCharacter); #ifdef QT_GUI_PASSWORD_ECHO_DELAY - if (m_passwordEchoTimer != 0 && !str.isEmpty()) { - int cursor = m_text.length() - 1; + if (m_passwordEchoTimer != 0 && m_cursor > 0 && m_cursor <= m_text.length()) { + int cursor = m_cursor - 1; QChar uc = m_text.at(cursor); str[cursor] = uc; if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { @@ -198,12 +198,10 @@ void QLineControl::backspace() --m_cursor; if (m_maskData) m_cursor = prevMaskBlank(m_cursor); - QChar uc = m_text.at(m_cursor); - if (m_cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { + if (m_cursor > 0 && m_text.at(m_cursor).isLowSurrogate()) { // second half of a surrogate, check if we have the first half as well, // if yes delete both at once - uc = m_text.at(m_cursor - 1); - if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) { + if (m_text.at(m_cursor - 1).isHighSurrogate()) { internalDelete(true); --m_cursor; } diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 9db068c..56658b3 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -1639,7 +1639,7 @@ QMenuBarPrivate::QMacMenuBarPrivate::~QMacMenuBarPrivate() } void -QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QMacMenuAction *before) +QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QAction *before) { if (a->isSeparator() || !menu) return; @@ -1649,7 +1649,7 @@ QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QMacMenuAction *befor #ifndef QT_MAC_USE_COCOA action->command = qt_mac_menu_static_cmd_id++; #endif - addAction(action, before); + addAction(action, findAction(before)); } void diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 0e63799..82bd932 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -154,6 +154,9 @@ public: #endif scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0), hasCheckableItems(0), sloppyAction(0), doChildEffects(false) +#ifdef QT3_SUPPORT + ,emitHighlighted(false) +#endif #ifdef Q_WS_MAC ,mac_menu(0) #endif @@ -163,9 +166,6 @@ public: #ifdef Q_WS_S60 ,symbian_menu(0) #endif -#ifdef QT3_SUPPORT - ,emitHighlighted(false) -#endif { } ~QMenuPrivate() { diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index c9dbff5..99a1d78 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -398,12 +398,12 @@ void QMenuPrivate::QSymbianMenuPrivate::rebuild(bool) { } -void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QSymbianMenuAction *before) +void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QAction *before) { QSymbianMenuAction *action = new QSymbianMenuAction; action->action = a; action->command = qt_symbian_menu_static_cmd_id++; - addAction(action, before); + addAction(action, findAction(before)); } void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QSymbianMenuAction *action, QSymbianMenuAction *before) diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp index 1157fff..b0c6c1b 100644 --- a/src/gui/widgets/qmenu_wince.cpp +++ b/src/gui/widgets/qmenu_wince.cpp @@ -504,12 +504,12 @@ void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action) rebuild(); } -void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QWceMenuAction *before) +void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before) { QWceMenuAction *action = new QWceMenuAction; action->action = a; action->command = qt_wce_menu_static_cmd_id++; - addAction(action, before); + addAction(action, findAction(before)); } void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 3ff98a4..3e5365c 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -55,6 +55,9 @@ #include <qtoolbar.h> #include <qtoolbutton.h> #include <qwhatsthis.h> +#ifdef Q_WS_X11 +#include <qpluginloader.h> +#endif #ifndef QT_NO_MENUBAR @@ -66,6 +69,9 @@ #include "qmenu_p.h" #include "qmenubar_p.h" #include "qdebug.h" +#ifdef Q_WS_X11 +#include "qmenubar_x11_p.h" +#endif #ifdef Q_WS_WINCE extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp @@ -173,7 +179,11 @@ void QMenuBarPrivate::updateGeometries() return; int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q)*2); int q_start = -1; - if(leftWidget || rightWidget) { + if( +#ifdef Q_WS_X11 + platformMenuBar->allowCornerWidgets() && +#endif + (leftWidget || rightWidget)) { int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q) + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q); int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, q) @@ -204,7 +214,11 @@ void QMenuBarPrivate::updateGeometries() calcActionRects(q_width, q_start); currentAction = 0; #ifndef QT_NO_SHORTCUT - if(itemsDirty) { + if( +#ifdef Q_WS_X11 + !platformMenuBar->shortcutsHandledByNativeMenuBar() && +#endif + itemsDirty) { for(int j = 0; j < shortcutIndexMap.size(); ++j) q->releaseShortcut(shortcutIndexMap.value(j)); shortcutIndexMap.resize(0); // faster than clear @@ -212,6 +226,12 @@ void QMenuBarPrivate::updateGeometries() shortcutIndexMap.append(q->grabShortcut(QKeySequence::mnemonic(actions.at(i)->text()))); } #endif +#ifdef Q_WS_X11 + if(q->isNativeMenuBar()) {//nothing to see here folks, move along.. + itemsDirty = false; + return; + } +#endif itemsDirty = false; hiddenActions.clear(); @@ -743,6 +763,11 @@ void QMenuBarPrivate::init() QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); } #endif +#ifdef Q_WS_X11 + platformMenuBar = qt_guiPlatformMenuBarFactory()->create(); + platformMenuBar->init(q); +#endif + q->setBackgroundRole(QPalette::Button); oldWindow = oldParent = 0; #ifdef QT3_SUPPORT @@ -751,6 +776,10 @@ void QMenuBarPrivate::init() #ifdef QT_SOFTKEYS_ENABLED menuBarAction = 0; #endif +#ifdef Q_WS_X11 + cornerWidgetToolBar = 0; + cornerWidgetContainer = 0; +#endif handleReparent(); q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); @@ -821,6 +850,10 @@ QMenuBar::~QMenuBar() Q_D(QMenuBar); d->symbianDestroyMenuBar(); #endif +#ifdef Q_WS_X11 + Q_D(QMenuBar); + delete d->cornerWidgetToolBar; +#endif } /*! @@ -1072,6 +1105,10 @@ void QMenuBar::paintEvent(QPaintEvent *e) */ void QMenuBar::setVisible(bool visible) { +#ifdef Q_WS_X11 + Q_D(QMenuBar); + d->platformMenuBar->setVisible(visible); +#else #if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) if (isNativeMenuBar()) { if (!visible) @@ -1080,6 +1117,7 @@ void QMenuBar::setVisible(bool visible) } #endif QWidget::setVisible(visible); +#endif // Q_WS_X11 } /*! @@ -1275,6 +1313,9 @@ void QMenuBar::actionEvent(QActionEvent *e) { Q_D(QMenuBar); d->itemsDirty = true; +#ifdef Q_WS_X11 + d->platformMenuBar->actionEvent(e); +#endif #if defined (Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) if (isNativeMenuBar()) { #ifdef Q_WS_MAC @@ -1287,7 +1328,7 @@ void QMenuBar::actionEvent(QActionEvent *e) if (!nativeMenuBar) return; if(e->type() == QEvent::ActionAdded) - nativeMenuBar->addAction(e->action(), nativeMenuBar->findAction(e->before())); + nativeMenuBar->addAction(e->action(), e->before()); else if(e->type() == QEvent::ActionRemoved) nativeMenuBar->removeAction(e->action()); else if(e->type() == QEvent::ActionChanged) @@ -1369,6 +1410,10 @@ void QMenuBarPrivate::handleReparent() newWindow->installEventFilter(q); } +#ifdef Q_WS_X11 + platformMenuBar->handleReparent(oldParent, newParent, oldWindow, newWindow); +#endif + oldParent = newParent; oldWindow = newWindow; @@ -1566,6 +1611,11 @@ bool QMenuBar::event(QEvent *e) bool QMenuBar::eventFilter(QObject *object, QEvent *event) { Q_D(QMenuBar); +#ifdef Q_WS_X11 + if (d->platformMenuBar->menuBarEventFilter(object, event)) { + return true; + } +#endif if (object == parent() && object) { #ifdef QT3_SUPPORT if (d->doAutoResize && event->type() == QEvent::Resize) { @@ -1659,7 +1709,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const QSize QMenuBar::minimumSizeHint() const { Q_D(const QMenuBar); -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) +#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1682,6 +1732,9 @@ QSize QMenuBar::minimumSizeHint() const ret += QSize(2*fw + hmargin, 2*fw + vmargin); } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; +#ifdef Q_WS_X11 + if (d->platformMenuBar->allowCornerWidgets()) { +#endif if(d->leftWidget) { QSize sz = d->leftWidget->minimumSizeHint(); ret.setWidth(ret.width() + sz.width()); @@ -1694,6 +1747,9 @@ QSize QMenuBar::minimumSizeHint() const if(sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } +#ifdef Q_WS_X11 + } +#endif if(as_gui_menubar) { QStyleOptionMenuItem opt; opt.rect = rect(); @@ -1715,7 +1771,7 @@ QSize QMenuBar::minimumSizeHint() const QSize QMenuBar::sizeHint() const { Q_D(const QMenuBar); -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) +#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1741,6 +1797,9 @@ QSize QMenuBar::sizeHint() const ret += QSize(fw + hmargin, fw + vmargin); } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; +#ifdef Q_WS_X11 + if(d->platformMenuBar->allowCornerWidgets()) { +#endif if(d->leftWidget) { QSize sz = d->leftWidget->sizeHint(); ret.setWidth(ret.width() + sz.width()); @@ -1753,6 +1812,9 @@ QSize QMenuBar::sizeHint() const if(sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } +#ifdef Q_WS_X11 + } +#endif if(as_gui_menubar) { QStyleOptionMenuItem opt; opt.rect = rect(); @@ -1774,7 +1836,7 @@ QSize QMenuBar::sizeHint() const int QMenuBar::heightForWidth(int) const { Q_D(const QMenuBar); -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) +#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1794,10 +1856,16 @@ int QMenuBar::heightForWidth(int) const height += 2*vmargin; } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; +#ifdef Q_WS_X11 + if(d->platformMenuBar->allowCornerWidgets()) { +#endif if(d->leftWidget) height = qMax(d->leftWidget->sizeHint().height() + margin, height); if(d->rightWidget) height = qMax(d->rightWidget->sizeHint().height() + margin, height); +#ifdef Q_WS_X11 + } +#endif if(as_gui_menubar) { QStyleOptionMenuItem opt; opt.init(this); @@ -1817,7 +1885,15 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id) { Q_Q(QMenuBar); QAction *act = actions.at(id); - setCurrentAction(act, true, true); +#ifdef Q_WS_X11 + if (q->isNativeMenuBar()) { + platformMenuBar->popupAction(act); + } else { +#endif + setCurrentAction(act, true, true); +#ifdef Q_WS_X11 + } +#endif if (act && !act->menu()) { activateAction(act, QAction::Trigger); //100 is the same as the default value in QPushButton::animateClick @@ -1838,6 +1914,39 @@ void QMenuBarPrivate::_q_updateLayout() } } +#ifdef Q_WS_X11 +void QMenuBarPrivate::updateCornerWidgetToolBar() +{ + Q_Q(QMenuBar); + if (!cornerWidgetToolBar) { + QMainWindow *window = qobject_cast<QMainWindow *>(q->window()); + if (!window) { + qWarning() << "Menubar parent is not a QMainWindow, not showing corner widgets"; + return; + } + cornerWidgetToolBar = window->addToolBar(QApplication::translate("QMenuBar", "Corner Toolbar")); + cornerWidgetToolBar->setObjectName(QLatin1String("CornerToolBar")); + cornerWidgetContainer = new QWidget; + cornerWidgetToolBar->addWidget(cornerWidgetContainer); + new QHBoxLayout(cornerWidgetContainer); + } else { + QLayout *layout = cornerWidgetContainer->layout(); + while (layout->count() > 0) { + layout->takeAt(0); + } + } + if (leftWidget) { + leftWidget->setParent(cornerWidgetContainer); + cornerWidgetContainer->layout()->addWidget(leftWidget); + } + if (rightWidget) { + rightWidget->setParent(cornerWidgetContainer); + cornerWidgetContainer->layout()->addWidget(rightWidget); + } +} +#endif + + /*! \fn void QMenuBar::setCornerWidget(QWidget *widget, Qt::Corner corner) @@ -1870,10 +1979,18 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) return; } +#ifdef Q_WS_X11 + if(!d->platformMenuBar->allowCornerWidgets()) { + d->updateCornerWidgetToolBar(); + } else { +#endif if (w) { w->setParent(this); w->installEventFilter(this); } +#ifdef Q_WS_X11 + } +#endif d->_q_updateLayout(); } @@ -1923,6 +2040,9 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const void QMenuBar::setNativeMenuBar(bool nativeMenuBar) { Q_D(QMenuBar); +#ifdef Q_WS_X11 + d->platformMenuBar->setNativeMenuBar(nativeMenuBar); +#else if (d->nativeMenuBar == -1 || (nativeMenuBar != bool(d->nativeMenuBar))) { d->nativeMenuBar = nativeMenuBar; #ifdef Q_WS_MAC @@ -1947,15 +2067,20 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar) setVisible(true); #endif } +#endif // Q_WS_X11 } bool QMenuBar::isNativeMenuBar() const { Q_D(const QMenuBar); +#ifdef Q_WS_X11 + return d->platformMenuBar->isNativeMenuBar(); +#else if (d->nativeMenuBar == -1) { return !QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar); } return d->nativeMenuBar; +#endif } /*! diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index 1ac694e..9a1f758 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -47,7 +47,7 @@ // ------------- // // This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to +// platformMenuBarementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. @@ -61,6 +61,10 @@ #include "qguifunctions_wince.h" #endif +#ifdef Q_WS_X11 +#include "qabstractplatformmenubar_p.h" +#endif + #ifndef QT_NO_MENUBAR #ifdef Q_WS_S60 class CCoeControl; @@ -71,21 +75,27 @@ class CEikMenuBar; QT_BEGIN_NAMESPACE #ifndef QT_NO_MENUBAR +class QToolBar; class QMenuBarExtension; class QMenuBarPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QMenuBar) public: QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0), - closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0), - nativeMenuBar(-1), doChildEffects(false) + closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0) +#ifndef Q_WS_X11 + , nativeMenuBar(-1) +#endif + , doChildEffects(false) #ifdef QT3_SUPPORT , doAutoResize(false) #endif #ifdef Q_WS_MAC , mac_menubar(0) #endif - +#ifdef Q_WS_X11 + , platformMenuBar(0) +#endif #ifdef Q_WS_WINCE , wce_menubar(0), wceClassicMenu(false) #endif @@ -96,6 +106,9 @@ public: { } ~QMenuBarPrivate() { +#ifdef Q_WS_X11 + delete platformMenuBar; +#endif #ifdef Q_WS_MAC delete mac_menubar; #endif @@ -136,8 +149,9 @@ public: uint keyboardState : 1, altPressed : 1; QPointer<QWidget> keyboardFocusWidget; - +#ifndef Q_WS_X11 int nativeMenuBar : 3; // Only has values -1, 0, and 1 +#endif //firing of events void activateAction(QAction *, QAction::ActionEvent); @@ -173,6 +187,9 @@ public: #ifdef QT3_SUPPORT bool doAutoResize; #endif +#ifdef Q_WS_X11 + QAbstractPlatformMenuBar *platformMenuBar; +#endif #ifdef Q_WS_MAC //mac menubar binding struct QMacMenuBarPrivate { @@ -181,7 +198,7 @@ public: QMacMenuBarPrivate(); ~QMacMenuBarPrivate(); - void addAction(QAction *, QMacMenuAction* =0); + void addAction(QAction *, QAction* =0); void addAction(QMacMenuAction *, QMacMenuAction* =0); void syncAction(QMacMenuAction *); inline void syncAction(QAction *a) { syncAction(findAction(a)); } @@ -220,7 +237,7 @@ public: QWceMenuBarPrivate(QMenuBarPrivate *menubar); ~QWceMenuBarPrivate(); - void addAction(QAction *, QWceMenuAction* =0); + void addAction(QAction *, QAction* =0); void addAction(QWceMenuAction *, QWceMenuAction* =0); void syncAction(QWceMenuAction *); inline void syncAction(QAction *a) { syncAction(findAction(a)); } @@ -250,7 +267,7 @@ public: QMenuBarPrivate *d; QSymbianMenuBarPrivate(QMenuBarPrivate *menubar); ~QSymbianMenuBarPrivate(); - void addAction(QAction *, QSymbianMenuAction* =0); + void addAction(QAction *, QAction* =0); void addAction(QSymbianMenuAction *, QSymbianMenuAction* =0); void syncAction(QSymbianMenuAction *); inline void syncAction(QAction *a) { syncAction(findAction(a)); } @@ -273,6 +290,12 @@ public: #ifdef QT_SOFTKEYS_ENABLED QAction *menuBarAction; #endif + +#ifdef Q_WS_X11 + void updateCornerWidgetToolBar(); + QToolBar *cornerWidgetToolBar; + QWidget *cornerWidgetContainer; +#endif }; #endif diff --git a/src/gui/widgets/qmenubar_x11.cpp b/src/gui/widgets/qmenubar_x11.cpp new file mode 100644 index 0000000..25336d4 --- /dev/null +++ b/src/gui/widgets/qmenubar_x11.cpp @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmenubar_x11_p.h" + +#ifndef QT_NO_MENUBAR + +#include "qapplication.h" +#include "qdebug.h" +#include "qevent.h" +#include "qmenu.h" +#include "qmenubar.h" + +#include <private/qfactoryloader_p.h> + +QT_BEGIN_NAMESPACE + +QX11MenuBar::~QX11MenuBar() +{ +} + +void QX11MenuBar::init(QMenuBar *_menuBar) +{ + nativeMenuBar = -1; + menuBar = _menuBar; +} + +void QX11MenuBar::setVisible(bool visible) +{ + menuBar->QWidget::setVisible(visible); +} + +void QX11MenuBar::actionEvent(QActionEvent *e) +{ + Q_UNUSED(e); +} + +void QX11MenuBar::handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow) +{ + Q_UNUSED(oldParent) + Q_UNUSED(newParent) + Q_UNUSED(oldWindow) + Q_UNUSED(newWindow) +} + +bool QX11MenuBar::allowCornerWidgets() const +{ + return true; +} + +void QX11MenuBar::popupAction(QAction *) +{ +} + +void QX11MenuBar::setNativeMenuBar(bool value) +{ + if (nativeMenuBar == -1 || (value != bool(nativeMenuBar))) { + nativeMenuBar = value; + } +} + +bool QX11MenuBar::isNativeMenuBar() const +{ + return false; +} + +bool QX11MenuBar::shortcutsHandledByNativeMenuBar() const +{ + return false; +} + +bool QX11MenuBar::menuBarEventFilter(QObject *, QEvent *) +{ + return false; +} + +struct QX11MenuBarFactory : public QPlatformMenuBarFactoryInterface +{ + QAbstractPlatformMenuBar *create() { return new QX11MenuBar; } + virtual QStringList keys() const { return QStringList(); } +}; + +QPlatformMenuBarFactoryInterface *qt_guiPlatformMenuBarFactory() +{ + static QPlatformMenuBarFactoryInterface *factory = 0; + if (!factory) { +#ifndef QT_NO_LIBRARY + QFactoryLoader loader(QPlatformMenuBarFactoryInterface_iid, QLatin1String("/menubar")); + factory = qobject_cast<QPlatformMenuBarFactoryInterface *>(loader.instance(QLatin1String("default"))); +#endif // QT_NO_LIBRARY + if(!factory) { + static QX11MenuBarFactory def; + factory = &def; + } + } + return factory; +} + +QT_END_NAMESPACE + +#endif // QT_NO_MENUBAR diff --git a/src/gui/widgets/qmenubar_x11_p.h b/src/gui/widgets/qmenubar_x11_p.h new file mode 100644 index 0000000..41debd0 --- /dev/null +++ b/src/gui/widgets/qmenubar_x11_p.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QX11MENUBAR_P_H +#define QX11MENUBAR_P_H + +#ifndef QT_NO_MENUBAR + +#include "qabstractplatformmenubar_p.h" + +QT_BEGIN_NAMESPACE + +class QMenuBar; + +class QX11MenuBar : public QAbstractPlatformMenuBar +{ +public: + ~QX11MenuBar(); + + virtual void init(QMenuBar *); + + virtual void setVisible(bool visible); + + virtual void actionEvent(QActionEvent *e); + + virtual void handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow); + + virtual bool allowCornerWidgets() const; + + virtual void popupAction(QAction*); + + virtual void setNativeMenuBar(bool); + virtual bool isNativeMenuBar() const; + + virtual bool shortcutsHandledByNativeMenuBar() const; + virtual bool menuBarEventFilter(QObject *, QEvent *event); + +private: + QMenuBar *menuBar; + int nativeMenuBar : 3; // Only has values -1, 0, and 1 +}; + +QPlatformMenuBarFactoryInterface *qt_guiPlatformMenuBarFactory(); + +QT_END_NAMESPACE + +#endif // QT_NO_MENUBAR + +#endif /* QX11MENUBAR_P_H */ diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 2670089..61d4fed 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -2472,6 +2472,8 @@ bool QTextEdit::find(const QString &exp, QTextDocument::FindFlags options) and the text edit will try to guess the right format. Use setHtml() or setPlainText() directly to avoid text edit's guessing. + + \sa toPlainText(), toHtml() */ void QTextEdit::setText(const QString &text) { diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri index 669b838..6b3d6a9 100644 --- a/src/gui/widgets/widgets.pri +++ b/src/gui/widgets/widgets.pri @@ -144,6 +144,14 @@ SOURCES += \ widgets/qplaintextedit.cpp \ widgets/qprintpreviewwidget.cpp +x11: { + HEADERS += \ + widgets/qabstractplatformmenubar_p.h + + SOURCES += \ + widgets/qmenubar_x11.cpp +} + !embedded:!qpa:mac { HEADERS += widgets/qmacnativewidget_mac.h \ widgets/qmaccocoaviewcontainer_mac.h diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 6101eea..4f2145e 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -48,6 +48,7 @@ #include <private/qauthenticator_p.h> #include <qnetworkproxy.h> #include <qauthenticator.h> +#include <qcoreapplication.h> #include <qbuffer.h> #include <qpair.h> @@ -665,32 +666,31 @@ QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError e QString errorString; switch (errorCode) { case QNetworkReply::HostNotFoundError: - errorString = QString::fromLatin1(QT_TRANSLATE_NOOP("QHttp", "Host %1 not found")) - .arg(socket->peerName()); + errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName()); break; case QNetworkReply::ConnectionRefusedError: - errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Connection refused")); + errorString = QCoreApplication::translate("QHttp", "Connection refused"); break; case QNetworkReply::RemoteHostClosedError: - errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Connection closed")); + errorString = QCoreApplication::translate("QHttp", "Connection closed"); break; case QNetworkReply::TimeoutError: - errorString = QLatin1String(QT_TRANSLATE_NOOP("QAbstractSocket", "Socket operation timed out")); + errorString = QCoreApplication::translate("QAbstractSocket", "Socket operation timed out"); break; case QNetworkReply::ProxyAuthenticationRequiredError: - errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Proxy requires authentication")); + errorString = QCoreApplication::translate("QHttp", "Proxy requires authentication"); break; case QNetworkReply::AuthenticationRequiredError: - errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Host requires authentication")); + errorString = QCoreApplication::translate("QHttp", "Host requires authentication"); break; case QNetworkReply::ProtocolFailure: - errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Data corrupted")); + errorString = QCoreApplication::translate("QHttp", "Data corrupted"); break; case QNetworkReply::ProtocolUnknownError: - errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Unknown protocol specified")); + errorString = QCoreApplication::translate("QHttp", "Unknown protocol specified"); break; case QNetworkReply::SslHandshakeFailedError: - errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "SSL handshake failed")); + errorString = QCoreApplication::translate("QHttp", "SSL handshake failed"); break; default: // all other errors are treated as QNetworkReply::UnknownNetworkError diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 58eb0d8..0b568d4 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -275,6 +275,11 @@ void QNetworkReplyImplPrivate::_q_networkSessionConnected() if (session->state() != QNetworkSession::Connected) return; + #ifndef QT_NO_NETWORKPROXY + // Re-set proxies here as new session might have changed them + proxyList = manager->d_func()->queryProxy(QNetworkProxyQuery(request.url())); + #endif + switch (state) { case QNetworkReplyImplPrivate::Buffering: case QNetworkReplyImplPrivate::Working: diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index ab09932..2a2ad55 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -792,15 +792,38 @@ static const char *certificate_blacklist[] = { "92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43", "addons.mozilla.org", // Comodo "b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0", "login.live.com", // Comodo "d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0", "global trustee", // Comodo - "05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56", "*.google.com", // DigiNotar + + "05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56", "*.google.com", // leaf certificate issued by DigiNotar + "0c:76:da:9c:91:0c:4e:2c:9e:fe:15:d0:58:93:3c:4c", "DigiNotar Root CA", // DigiNotar root + "f1:4a:13:f4:87:2b:56:dc:39:df:84:ca:7a:a1:06:49", "DigiNotar Services CA", // DigiNotar intermediate signed by DigiNotar Root + "36:16:71:55:43:42:1b:9d:e6:cb:a3:64:41:df:24:38", "DigiNotar Services 1024 CA", // DigiNotar intermediate signed by DigiNotar Root + "0a:82:bd:1e:14:4e:88:14:d7:5b:1a:55:27:be:bf:3e", "DigiNotar Root CA G2", // other DigiNotar Root CA + "a4:b6:ce:e3:2e:d3:35:46:26:3c:b3:55:3a:a8:92:21", "CertiID Enterprise Certificate Authority", // DigiNotar intermediate signed by "DigiNotar Root CA G2" + "5b:d5:60:9c:64:17:68:cf:21:0e:35:fd:fb:05:ad:41", "DigiNotar Qualified CA", // DigiNotar intermediate signed by DigiNotar Root + + "1184640176", "DigiNotar Services 1024 CA", // DigiNotar intermediate cross-signed by Entrust + "120000525", "DigiNotar Cyber CA", // DigiNotar intermediate cross-signed by CyberTrust + "120000505", "DigiNotar Cyber CA", // DigiNotar intermediate cross-signed by CyberTrust + "120000515", "DigiNotar Cyber CA", // DigiNotar intermediate cross-signed by CyberTrust + "20015536", "DigiNotar PKIoverheid CA Overheid en Bedrijven", // DigiNotar intermediate cross-signed by the Dutch government + "20001983", "DigiNotar PKIoverheid CA Organisatie - G2", // DigiNotar intermediate cross-signed by the Dutch government + "d6:d0:29:77:f1:49:fd:1a:83:f2:b9:ea:94:8c:5c:b4", "DigiNotar Extended Validation CA", // DigiNotar intermediate signed by DigiNotar EV Root + "1e:7d:7a:53:3d:45:30:41:96:40:0f:71:48:1f:45:04", "DigiNotar Public CA 2025", // DigiNotar intermediate +// "(has not been seen in the wild so far)", "DigiNotar Public CA - G2", // DigiNotar intermediate +// "(has not been seen in the wild so far)", "Koninklijke Notariele Beroepsorganisatie CA", // compromised during DigiNotar breach +// "(has not been seen in the wild so far)", "Stichting TTP Infos CA," // compromised during DigiNotar breach + "1184640175", "DigiNotar Root CA", // DigiNotar intermediate cross-signed by Entrust + "1184644297", "DigiNotar Root CA", // DigiNotar intermediate cross-signed by Entrust 0 }; bool QSslCertificatePrivate::isBlacklisted(const QSslCertificate &certificate) { for (int a = 0; certificate_blacklist[a] != 0; a++) { + QString blacklistedCommonName = QString::fromUtf8(certificate_blacklist[(a+1)]); if (certificate.serialNumber() == certificate_blacklist[a++] && - certificate.subjectInfo(QSslCertificate::CommonName) == QString::fromUtf8(certificate_blacklist[a])) + (certificate.subjectInfo(QSslCertificate::CommonName) == blacklistedCommonName || + certificate.issuerInfo(QSslCertificate::CommonName) == blacklistedCommonName)) return true; } return false; diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 5a606af..8e53974 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1246,12 +1246,15 @@ bool QSslSocketBackendPrivate::startHandshake() // Start translating errors. QList<QSslError> errors; - if (QSslCertificatePrivate::isBlacklisted(configuration.peerCertificate)) { - QSslError error(QSslError::CertificateBlacklisted, configuration.peerCertificate); - errors << error; - emit q->peerVerifyError(error); - if (q->state() != QAbstractSocket::ConnectedState) - return false; + // check the whole chain for blacklisting (including root, as we check for subjectInfo and issuer) + foreach (const QSslCertificate &cert, configuration.peerCertificateChain) { + if (QSslCertificatePrivate::isBlacklisted(cert)) { + QSslError error(QSslError::CertificateBlacklisted, cert); + errors << error; + emit q->peerVerifyError(error); + if (q->state() != QAbstractSocket::ConnectedState) + return false; + } } bool doVerifyPeer = configuration.peerVerifyMode == QSslSocket::VerifyPeer diff --git a/src/opengl/opengl.pro.user.2.1pre1 b/src/opengl/opengl.pro.user.2.1pre1 deleted file mode 100644 index 0c38724..0000000 --- a/src/opengl/opengl.pro.user.2.1pre1 +++ /dev/null @@ -1,83 +0,0 @@ -<!DOCTYPE QtCreatorProject> -<qtcreator> - <data> - <variable>ProjectExplorer.Project.ActiveTarget</variable> - <value type="int">0</value> - </data> - <data> - <variable>ProjectExplorer.Project.EditorSettings</variable> - <valuemap type="QVariantMap"> - <value key="EditorConfiguration.Codec" type="QByteArray">UTF-8</value> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.Target.0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value> - <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value> - <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value> - <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value> - <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap"> - <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap"> - <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value> - <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value> - <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"> - <value type="QString">QMAKE_ABSOLUTE_SOURCE_PATH=/home/jlind/dev/qt/lighthouse-master/src/opengl</value> - </valuelist> - </valuemap> - <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap"> - <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value> - <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value> - <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value> - <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"> - <value type="QString">-j9</value> - </valuelist> - <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value> - </valuemap> - <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value> - <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap"> - <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value> - <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value> - <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value> - <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"> - <value type="QString">clean</value> - </valuelist> - <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value> - </valuemap> - <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value> - <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value> - <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/> - <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value> - <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value> - <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/jlind/builds/master-lighthouse/src/opengl</value> - <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">23</value> - <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value> - <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value> - </valuemap> - <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">1</value> - <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap"> - <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">headers</value> - <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value> - <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value> - <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/> - <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">../../../../../builds/master-lighthouse/include/QtOpenGL/headers.pri</value> - <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value> - <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value> - <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/> - <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value> - <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value> - <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value> - </valuemap> - <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.TargetCount</variable> - <value type="int">1</value> - </data> - <data> - <variable>ProjectExplorer.Project.Updater.FileVersion</variable> - <value type="int">4</value> - </data> -</qtcreator> diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index 90078e9..590a85b 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -5,9 +5,8 @@ QT = core network LIBS += -framework Foundation -framework SystemConfiguration contains(QT_CONFIG, corewlan) { - isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10.6.sdk") { + isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10\.[67]\.sdk") { LIBS += -framework CoreWLAN -framework Security - DEFINES += MAC_SDK_10_6 } } diff --git a/src/plugins/codecs/cn/qgb18030codec.cpp b/src/plugins/codecs/cn/qgb18030codec.cpp index 0a45eeb..d12f5d9 100644 --- a/src/plugins/codecs/cn/qgb18030codec.cpp +++ b/src/plugins/codecs/cn/qgb18030codec.cpp @@ -108,10 +108,10 @@ QByteArray QGb18030Codec::convertFromUnicode(const QChar *uc, int len, Converter int len; uchar buf[4]; if (high >= 0) { - if (ch >= 0xdc00 && ch < 0xe000) { + if (uc[i].isLowSurrogate()) { // valid surrogate pair ++i; - uint u = (high-0xd800)*0x400+(ch-0xdc00)+0x10000; + uint u = QChar::surrogateToUcs4(high, uc[i].unicode()); len = qt_UnicodeToGb18030(u, buf); if (len >= 2) { for (int j=0; j<len; j++) @@ -129,10 +129,10 @@ QByteArray QGb18030Codec::convertFromUnicode(const QChar *uc, int len, Converter } } - if (ch < 0x80) { + if (IsLatin(ch)) { // ASCII *cursor++ = ch; - } else if ((ch >= 0xd800 && ch < 0xdc00)) { + } else if (uc[i].isHighSurrogate()) { // surrogates area. check for correct encoding // we need at least one more character, first the high surrogate, then the low one high = ch; @@ -181,7 +181,7 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta uchar ch = chars[i]; switch (nbuf) { case 0: - if (ch < 0x80) { + if (IsLatin(ch)) { // ASCII resultData[unicodeLen] = ch; ++unicodeLen; @@ -339,7 +339,7 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState * uchar ch = chars[i]; switch (nbuf) { case 0: - if (ch < 0x80) { + if (IsLatin(ch)) { // ASCII resultData[unicodeLen] = ch; ++unicodeLen; @@ -487,7 +487,7 @@ QString QGb2312Codec::convertToUnicode(const char* chars, int len, ConverterStat uchar ch = chars[i]; switch (nbuf) { case 0: - if (ch < 0x80) { + if (IsLatin(ch)) { // ASCII resultData[unicodeLen] = ch; ++unicodeLen; diff --git a/src/qt3support/network/q3socketdevice_win.cpp b/src/qt3support/network/q3socketdevice_win.cpp index df115d7..bde63a0 100644 --- a/src/qt3support/network/q3socketdevice_win.cpp +++ b/src/qt3support/network/q3socketdevice_win.cpp @@ -83,8 +83,13 @@ typedef struct { struct qt_in6_addr sin6_addr; /* IPv6 address */ u_long sin6_scope_id; /* set of interfaces for a scope */ } qt_sockaddr_in6; + +QT_END_NAMESPACE + #endif +QT_BEGIN_NAMESPACE + #ifndef AF_INET6 #define AF_INET6 23 /* Internetwork Version 6 */ #endif diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index e05f0b8..40886ef 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -1901,7 +1901,7 @@ EXPORTS ?ResourceFileName@QS60MainApplication@@UBE?AV?$TBuf@$0BAA@@@XZ @ 1900 NONAME ; class TBuf<256> QS60MainApplication::ResourceFileName(void) const ?RestoreMenuL@QS60MainAppUi@@UAEXPAVCCoeControl@@HW4TMenuType@MEikMenuObserver@@@Z @ 1901 NONAME ; void QS60MainAppUi::RestoreMenuL(class CCoeControl *, int, enum MEikMenuObserver::TMenuType) ?_q_clipboardChanged@QLineControl@@AAEXXZ @ 1902 NONAME ; void QLineControl::_q_clipboardChanged(void) - ?_q_delayedDestroy@QWidgetPrivate@@QAEXPAVCCoeControl@@@Z @ 1903 NONAME ; void QWidgetPrivate::_q_delayedDestroy(class CCoeControl *) + ?_q_delayedDestroy@QWidgetPrivate@@QAEXPAVCCoeControl@@@Z @ 1903 NONAME ABSENT ; void QWidgetPrivate::_q_delayedDestroy(class CCoeControl *) ?_q_deleteSelected@QLineControl@@AAEXXZ @ 1904 NONAME ; void QLineControl::_q_deleteSelected(void) ?_q_showIfNotHidden@QWidgetPrivate@@QAEXXZ @ 1905 NONAME ; void QWidgetPrivate::_q_showIfNotHidden(void) ?about@QMessageBox@@SAXPAVQWidget@@ABVQString@@1@Z @ 1906 NONAME ; void QMessageBox::about(class QWidget *, class QString const &, class QString const &) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 38c67b9..b450806 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -11593,7 +11593,7 @@ EXPORTS _ZN13QSymbianEventD2Ev @ 11592 NONAME _ZN14QFileOpenEventC1ERK4QUrl @ 11593 NONAME _ZN14QFileOpenEventC2ERK4QUrl @ 11594 NONAME - _ZN14QWidgetPrivate17_q_delayedDestroyEP11CCoeControl @ 11595 NONAME + _ZN14QWidgetPrivate17_q_delayedDestroyEP11CCoeControl @ 11595 NONAME ABSENT _ZN14QWidgetPrivate21activateSymbianWindowEP11CCoeControl @ 11596 NONAME _ZN14QWidgetPrivate26nearestGraphicsProxyWidgetEPK7QWidget @ 11597 NONAME _ZN14QWidgetPrivate36invalidateGraphicsEffectsRecursivelyEv @ 11598 NONAME diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h index 46318a9..d4a9079 100644 --- a/src/testlib/qtestxmlstreamer.h +++ b/src/testlib/qtestxmlstreamer.h @@ -40,7 +40,7 @@ ****************************************************************************/ #ifndef QTESTXMLSTREAMER_H -#define QTESXMLSTREAMER_H +#define QTESTXMLSTREAMER_H #include <QtTest/qtestbasicstreamer.h> diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp index 00cdec3..e13e1d9 100644 --- a/tests/auto/collections/tst_collections.cpp +++ b/tests/auto/collections/tst_collections.cpp @@ -2442,6 +2442,7 @@ void tst_Collections::cache() QVERIFY(!cache.contains(2)); delete cache.take(10); } +#if 0 { QCache<int, QString> cache(120); int i; @@ -2455,6 +2456,7 @@ void tst_Collections::cache() QVERIFY(!cache.contains(3)); QVERIFY(cache.contains(2)); } +#endif { QCache<int, int> cache(100); cache.insert(2, new int(2)); @@ -3505,7 +3507,7 @@ void testVectorAlignment() for (int i = 0; i < 200; ++i) container.append(Aligned()); - + for (int i = 0; i < container.size(); ++i) QVERIFY(container.at(i).checkAligned()); } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index fde0588..33f74a9 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -147,6 +147,8 @@ private slots: void pastingRichText_QTBUG_14003(); void implicitSize_data(); void implicitSize(); + void implicitSizePreedit_data(); + void implicitSizePreedit(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); @@ -2368,6 +2370,48 @@ void tst_qdeclarativetextedit::implicitSize() QVERIFY(textObject->height() == textObject->implicitHeight()); } +void tst_qdeclarativetextedit::implicitSizePreedit_data() +{ + QTest::addColumn<QString>("text"); + QTest::addColumn<QString>("wrap"); + QTest::addColumn<bool>("wrapped"); + QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.NoWrap" << false; + QTest::newRow("plain_wrap") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.Wrap" << true; + +} + +void tst_qdeclarativetextedit::implicitSizePreedit() +{ + QFETCH(QString, text); + QFETCH(QString, wrap); + QFETCH(bool, wrapped); + + QString componentStr = "import QtQuick 1.1\nTextEdit { focus: true; width: 50; wrapMode: " + wrap + " }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeTextEdit *textObject = qobject_cast<QDeclarativeTextEdit*>(textComponent.create()); + + QGraphicsScene scene; + QGraphicsView view(&scene); + scene.addItem(textObject); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); + + QInputMethodEvent event(text, QList<QInputMethodEvent::Attribute>()); + QCoreApplication::sendEvent(&view, &event); + + QVERIFY(textObject->width() < textObject->implicitWidth()); + QVERIFY(textObject->height() == textObject->implicitHeight()); + qreal wrappedHeight = textObject->height(); + + textObject->resetWidth(); + QVERIFY(textObject->width() == textObject->implicitWidth()); + QVERIFY(textObject->height() == textObject->implicitHeight()); + QCOMPARE(textObject->height() < wrappedHeight, wrapped); +} + void tst_qdeclarativetextedit::testQtQuick11Attributes() { QFETCH(QString, code); diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index 419eaae..9693480 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -1133,6 +1133,11 @@ void tst_QDir::absolutePath_data() QTest::newRow("4") << "c:/machine/share/dir1" << "c:/machine/share/dir1"; QTest::newRow("5") << "c:\\machine\\share\\dir1" << "c:/machine/share/dir1"; #endif + //test dirty paths are cleaned (QTBUG-19995) + QTest::newRow("/home/qt/.") << QDir::rootPath() + "home/qt/." << QDir::rootPath() + "home/qt"; + QTest::newRow("/system/data/../config") << QDir::rootPath() + "system/data/../config" << QDir::rootPath() + "system/config"; + QTest::newRow("//home//qt/") << QDir::rootPath() + "/home//qt/" << QDir::rootPath() + "home/qt"; + QTest::newRow("foo/../bar") << "foo/../bar" << QDir::currentPath() + "/bar"; QTest::newRow("resource") << ":/prefix/foo.bar" << ":/prefix/foo.bar"; } @@ -1942,6 +1947,34 @@ void tst_QDir::equalityOperator_data() << "./entrylist" << "*.cpp" << int(QDir::Name) << int(QDir::Files) << true; + QTest::newRow("QTBUG-20495") << QDir::currentPath() + "/entrylist/.." << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << "." << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << true; + + //need a path in the root directory that is unlikely to be a symbolic link. +#if defined (Q_OS_WIN) + QString pathinroot("c:/windows/.."); +#elif defined (Q_OS_SYMBIAN) + QString pathinroot("c:/data/.."); +#else + QString pathinroot("/sbin/.."); +#endif + QTest::newRow("QTBUG-20495-root") << pathinroot << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << QDir::rootPath() << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << true; + + QTest::newRow("slashdot") << QDir::rootPath() + "." << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << QDir::rootPath() << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << true; + + QTest::newRow("slashdotslash") << QDir::rootPath() + "./" << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << QDir::rootPath() << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << true; + + QTest::newRow("nonexistantpaths") << "dir-that-dont-exist" << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << "another-dir-that-dont-exist" << "*.cpp" << int(QDir::Name) << int(QDir::Files) + << false; + QTest::newRow("diff-filters") << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Files) << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Dirs) << false; diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index c7d9979..d7d57f6 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -482,6 +482,11 @@ void tst_QFileInfo::absolutePath_data() QTest::newRow("c:\\autoexec.bat") << "c:\\autoexec.bat" << "C:/" << "autoexec.bat"; #endif + QTest::newRow("QTBUG-19995.1") << drivePrefix + "/System/Library/StartupItems/../Frameworks" + << drivePrefix + "/System/Library" + << "Frameworks"; + QTest::newRow("QTBUG-19995.2") << drivePrefix + "/System/Library/StartupItems/../Frameworks/" + << drivePrefix + "/System/Library/Frameworks" << ""; } void tst_QFileInfo::absolutePath() @@ -503,6 +508,7 @@ void tst_QFileInfo::absFilePath_data() QTest::newRow("relativeFile") << "tmp.txt" << QDir::currentPath() + "/tmp.txt"; QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << QDir::currentPath() + "/" + "temp/tmp.txt"; + QString drivePrefix; #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) QString curr = QDir::currentPath(); @@ -511,7 +517,7 @@ void tst_QFileInfo::absFilePath_data() QTest::newRow("absFilePath") << "c:\\home\\andy\\tmp.txt" << "C:/home/andy/tmp.txt"; // Make sure drive-relative paths return correct absolute paths (task 255326) - QString drivePrefix = QDir::currentPath().left(2); + drivePrefix = QDir::currentPath().left(2); QString nonCurrentDrivePrefix = drivePrefix.left(1).compare("X", Qt::CaseInsensitive) == 0 ? QString("Y:") : QString("X:"); @@ -521,6 +527,8 @@ void tst_QFileInfo::absFilePath_data() #else QTest::newRow("absFilePath") << "/home/andy/tmp.txt" << "/home/andy/tmp.txt"; #endif + QTest::newRow("QTBUG-19995") << drivePrefix + "/System/Library/StartupItems/../Frameworks" + << drivePrefix + "/System/Library/Frameworks"; } void tst_QFileInfo::absFilePath() @@ -1395,7 +1403,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() wchar_t errstr[0x100]; DWORD count = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, errstr, 0x100, 0); - QString error(QString::fromUtf16(errstr, count)); + QString error(QString::fromWCharArray (errstr, count)); qWarning() << error; //we need at least one data set for the test not to assert fail when skipping _data function QDir target("target"); diff --git a/tests/auto/qfilesystementry/tst_qfilesystementry.cpp b/tests/auto/qfilesystementry/tst_qfilesystementry.cpp index 016bcbf..2daabee 100644 --- a/tests/auto/qfilesystementry/tst_qfilesystementry.cpp +++ b/tests/auto/qfilesystementry/tst_qfilesystementry.cpp @@ -68,6 +68,8 @@ private slots: void absoluteOrRelative_data(); void absoluteOrRelative(); #endif + void isClean_data(); + void isClean(); }; #if defined(WIN_STUFF) @@ -383,5 +385,35 @@ void tst_QFileSystemEntry::absoluteOrRelative() } #endif +void tst_QFileSystemEntry::isClean_data() +{ + QTest::addColumn<QString>("path"); + QTest::addColumn<bool>("isClean"); + + QTest::newRow("simple") << "foo" << true; + QTest::newRow("complex") << "/foo/bar/bz" << true; + QTest::newRow(".file") << "/foo/.file" << true; + QTest::newRow("..file") << "/foo/..file" << true; + QTest::newRow("...") << "/foo/.../bar" << true; + QTest::newRow("./") << "./" << false; + QTest::newRow("../") << "../" << false; + QTest::newRow(".") << "." << false; + QTest::newRow("..") << ".." << false; + QTest::newRow("/.") << "/." << false; + QTest::newRow("/..") << "/.." << false; + QTest::newRow("/../") << "foo/../bar" << false; + QTest::newRow("/./") << "foo/./bar" << false; + QTest::newRow("//") << "foo//bar" << false; +} + +void tst_QFileSystemEntry::isClean() +{ + QFETCH(QString, path); + QFETCH(bool, isClean); + + QFileSystemEntry fi(path); + QCOMPARE(fi.isClean(), isClean); +} + QTEST_MAIN(tst_QFileSystemEntry) #include <tst_qfilesystementry.moc> diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index 1f5563c..9c189cb 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -78,6 +78,8 @@ private slots: void dropShadowClipping(); void childrenVisibilityShouldInvalidateCache(); void prepareGeometryChangeInvalidateCache(); + void graphicsEffectUpdateShouldNotInvalidateGraphicsItemCache(); + void graphicsEffectUpdateShouldInvalidateParentGraphicsEffect(); void itemHasNoContents(); }; @@ -732,6 +734,99 @@ void tst_QGraphicsEffect::prepareGeometryChangeInvalidateCache() QCOMPARE(item->nbPaint, 0); } +class MyGraphicsEffect : public QGraphicsEffect +{ + public: + MyGraphicsEffect(QObject *parent = 0) : + QGraphicsEffect(parent), nbSourceInvalidations(0) + {} + int nbSourceInvalidations; + protected: + void draw(QPainter *painter) + { + drawSource(painter); + } + + void sourceChanged(ChangeFlags flags) + { + if (flags == SourceInvalidated) + nbSourceInvalidations++; + } +}; + +void tst_QGraphicsEffect::graphicsEffectUpdateShouldNotInvalidateGraphicsItemCache() +{ + QGraphicsScene scene; + MyGraphicsItem parent; + parent.resize(200, 200); + parent.setCacheMode(QGraphicsItem::ItemCoordinateCache); + scene.addItem(&parent); + + QGraphicsView view(&scene); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(parent.nbPaint, 1); + + //we set an effect on the parent + MyGraphicsEffect* opacityEffect = new MyGraphicsEffect(&parent); + opacityEffect->update(); + parent.setGraphicsEffect(opacityEffect); + //flush the events + QApplication::processEvents(); + //new effect applied->repaint + QCOMPARE(parent.nbPaint, 1); + + opacityEffect->update(); + //flush the events + QApplication::processEvents(); + //A change to the effect shouldn't invalidate the graphicsitem's cache + // => it shouldn't trigger a paint + QCOMPARE(parent.nbPaint, 1); +} + +void tst_QGraphicsEffect::graphicsEffectUpdateShouldInvalidateParentGraphicsEffect() +{ + QGraphicsScene scene; + // Add the parent + MyGraphicsItem parent; + parent.resize(200, 200); + scene.addItem(&parent); + // Add a child to the parent + MyGraphicsItem child(&parent); + child.resize(100, 100); + + QGraphicsView view(&scene); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + //flush the events + QApplication::processEvents(); + QTRY_COMPARE(parent.nbPaint, 1); + QTRY_COMPARE(child.nbPaint, 1); + + //we set an effect on the parent and the child + MyGraphicsEffect* effectForParent = new MyGraphicsEffect(&parent); + parent.setGraphicsEffect(effectForParent); + + MyGraphicsEffect* effectForChild = new MyGraphicsEffect(&child); + child.setGraphicsEffect(effectForChild); + //flush the events + QApplication::processEvents(); + // Both effects should start with no source invalidations + QCOMPARE(effectForParent->nbSourceInvalidations, 0); + QCOMPARE(effectForChild->nbSourceInvalidations, 0); + + // Trigger an update of the child graphics effect + effectForChild->update(); + //flush the events + QApplication::processEvents(); + // An update of the effect on the child shouldn't tell that effect that its source has been invalidated + QCOMPARE(effectForChild->nbSourceInvalidations, 0); + // The effect on the parent should however be notified of an invalidated source + QCOMPARE(effectForParent->nbSourceInvalidations, 1); +} + void tst_QGraphicsEffect::itemHasNoContents() { QGraphicsRectItem *parent = new QGraphicsRectItem; diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index b8741fe..8a26323 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -290,6 +290,7 @@ private slots: void taskQT_3674_doNotCrash(); void taskQTBUG_15977_renderWithDeviceCoordinateCache(); void taskQTBUG_16401_focusItem(); + void taskQTBUG_19680_tabWidgetFocus(); }; void tst_QGraphicsScene::initTestCase() @@ -4711,5 +4712,72 @@ void tst_QGraphicsScene::taskQTBUG_16401_focusItem() QVERIFY(!scene.focusItem()); } +void tst_QGraphicsScene::taskQTBUG_19680_tabWidgetFocus() +{ + QTabWidget tabWidget; + QGraphicsScene scene1; + QGraphicsScene scene2; + QGraphicsView view1(&scene1); + QGraphicsView view2(&scene2); + + tabWidget.show(); + + tabWidget.addTab(&view1, "view1"); + tabWidget.setCurrentWidget(&view1); + + QGraphicsTextItem *textItem1 = scene1.addText("Text1"); + textItem1->setFlags(QGraphicsItem::ItemIsFocusable); + textItem1->setTextInteractionFlags(Qt::TextEditorInteraction); + textItem1->setEnabled(true); + textItem1->setFocus(); + + tabWidget.addTab(&view2, "view2"); + tabWidget.setCurrentWidget(&view2); + + QGraphicsTextItem *textItem2 = scene2.addText("Text2"); + textItem2->setFlags(QGraphicsItem::ItemIsFocusable); + textItem2->setTextInteractionFlags(Qt::TextEditorInteraction); + textItem2->setEnabled(true); + textItem2->setFocus(); + + scene2.clearFocus(); + + view2.clearFocus(); + view2.setEnabled(false); + view2.setInteractive(false); + view2.setVisible(false); + view2.setShown(false); + view2.hide(); + + tabWidget.clearFocus(); + tabWidget.setEnabled(false); + tabWidget.setShown(false); + tabWidget.setVisible(false); + tabWidget.hide(); + + tabWidget.setFocus(); + tabWidget.setEnabled(true); + tabWidget.activateWindow(); + tabWidget.setShown(true); + tabWidget.setVisible(true); + tabWidget.show(); + + view2.setFocus(); + view2.setEnabled(true); + view2.activateWindow(); + view2.setInteractive(true); + view2.setVisible(true); + view2.setShown(true); + view2.show(); + + QTest::qWaitForWindowShown(&view2); + QApplication::setActiveWindow(&tabWidget); + + textItem2->setFocus(); + + QVERIFY(scene2.isActive()); + QVERIFY(textItem2->hasFocus()); +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 1df9d38..7b273d2 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -124,6 +124,8 @@ private slots: void layout(); void layoutDirection_data(); void layoutDirection(); + void recursiveLayoutDirection_data(); + void recursiveLayoutDirection(); void paint_data(); void paint(); void palettePropagation(); @@ -1213,14 +1215,20 @@ void tst_QGraphicsWidget::layout() void tst_QGraphicsWidget::layoutDirection_data() { QTest::addColumn<Qt::LayoutDirection>("layoutDirection"); - QTest::newRow("rtl") << Qt::RightToLeft; - QTest::newRow("ltr") << Qt::LeftToRight; + QTest::addColumn<bool>("setDirectionBeforeAddingWidget"); + + QTest::newRow("rtl, setting direction before adding widget") << Qt::RightToLeft << true; + QTest::newRow("ltr, setting direction before adding widget") << Qt::LeftToRight << true; + QTest::newRow("rtl, setting direction after adding widget") << Qt::RightToLeft << false; + QTest::newRow("ltr, setting direction after adding widget") << Qt::LeftToRight << false; + } // Qt::LayoutDirection layoutDirection() const public void tst_QGraphicsWidget::layoutDirection() { QFETCH(Qt::LayoutDirection, layoutDirection); + QFETCH(bool, setDirectionBeforeAddingWidget); QGraphicsScene scene; QGraphicsView *view = new QGraphicsView(&scene); SubQGraphicsWidget widget; @@ -1228,13 +1236,16 @@ void tst_QGraphicsWidget::layoutDirection() QCOMPARE(widget.layoutDirection(), Qt::LeftToRight); QCOMPARE(widget.testAttribute(Qt::WA_SetLayoutDirection), false); + if (setDirectionBeforeAddingWidget) + widget.setLayoutDirection(layoutDirection); QList<SubQGraphicsWidget*> children; for (int i = 0; i < 10; ++i) { SubQGraphicsWidget *item = new SubQGraphicsWidget(&widget); children.append(item); QCOMPARE(item->testAttribute(Qt::WA_SetLayoutDirection), false); } - widget.setLayoutDirection(layoutDirection); + if (!setDirectionBeforeAddingWidget) + widget.setLayoutDirection(layoutDirection); QCOMPARE(widget.testAttribute(Qt::WA_SetLayoutDirection), true); view->show(); QTest::qWaitForWindowShown(view); @@ -1247,6 +1258,42 @@ void tst_QGraphicsWidget::layoutDirection() delete view; } +void tst_QGraphicsWidget::recursiveLayoutDirection_data() +{ + QTest::addColumn<Qt::LayoutDirection>("layoutDirection"); + QTest::addColumn<bool>("setDirectionBeforeAddingWidget"); + + QTest::newRow("rtl, setting direction before adding widget") << Qt::RightToLeft << true; + QTest::newRow("ltr, setting direction before adding widget") << Qt::LeftToRight << true; + QTest::newRow("rtl, setting direction after adding widget") << Qt::RightToLeft << false; + QTest::newRow("ltr, setting direction after adding widget") << Qt::LeftToRight << false; +} + +void tst_QGraphicsWidget::recursiveLayoutDirection() +{ + QFETCH(Qt::LayoutDirection, layoutDirection); + QFETCH(bool, setDirectionBeforeAddingWidget); + QGraphicsWidget *widget = new QGraphicsWidget; + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(widget); + QGraphicsWidget *widget2 = new QGraphicsWidget; + QGraphicsLinearLayout *layout2 = new QGraphicsLinearLayout(widget2); + QGraphicsWidget *widget3 = new QGraphicsWidget; + QGraphicsLinearLayout *layout3 = new QGraphicsLinearLayout(widget3); + + if (setDirectionBeforeAddingWidget) + widget->setLayoutDirection(layoutDirection); + layout->addItem(widget2); + layout2->addItem(widget3); + if (!setDirectionBeforeAddingWidget) + widget->setLayoutDirection(layoutDirection); + + QCOMPARE(widget->layoutDirection(), layoutDirection); + QCOMPARE(widget2->layoutDirection(), layoutDirection); + QCOMPARE(widget3->layoutDirection(), layoutDirection); + + delete widget; +} + void tst_QGraphicsWidget::paint_data() { // currently QGraphicsWidget doesn't paint or do anything ... diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 6abbdcd..2c88561 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -1770,6 +1770,13 @@ void tst_QLineEdit::passwordEchoDelay() QApplication::sendEvent(testWidget, &ev); QCOMPARE(testWidget->displayText(), QString(7, fillChar) + QLatin1Char('7')); + testWidget->setCursorPosition(3); + QCOMPARE(testWidget->displayText(), QString(7, fillChar) + QLatin1Char('7')); + QTest::keyPress(testWidget, 'a'); + QCOMPARE(testWidget->displayText(), QString(3, fillChar) + QLatin1Char('a') + QString(5, fillChar)); + QTest::keyPress(testWidget, Qt::Key_Backspace); + QCOMPARE(testWidget->displayText(), QString(8, fillChar)); + // restore clean state testWidget->setEchoMode(QLineEdit::Normal); } diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp index 9f7192d..b36cf98 100644 --- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp @@ -72,6 +72,7 @@ private slots: void clear(); void pixmapKey(); void noLeak(); + void strictCacheLimit(); }; static QPixmapCache::KeyData* getPrivate(QPixmapCache::Key &key) @@ -517,5 +518,29 @@ void tst_QPixmapCache::noLeak() QCOMPARE(oldSize, newSize); } + +void tst_QPixmapCache::strictCacheLimit() +{ + const int limit = 1024; // 1024 KB + + QPixmapCache::clear(); + QPixmapCache::setCacheLimit(limit); + + // insert 200 64x64 pixmaps + // 3200 KB for 32-bit depths + // 1600 KB for 16-bit depths + // not counting the duplicate entries + for (int i = 0; i < 200; ++i) { + QPixmap pixmap(64, 64); + pixmap.fill(Qt::transparent); + + QString id = QString::number(i); + QPixmapCache::insert(id + "-a", pixmap); + QPixmapCache::insert(id + "-b", pixmap); + } + + QVERIFY(QPixmapCache::totalUsed() <= limit); +} + QTEST_MAIN(tst_QPixmapCache) #include "tst_qpixmapcache.moc" diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp index f4249ab..336dc71 100644 --- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -2320,10 +2320,6 @@ void tst_QtConcurrentMap::stlContainers() { #ifdef QT_NO_STL QSKIP("Qt compiled without STL support", SkipAll); -#elif defined(Q_COMPILER_RVALUE_REFS) - //mapped uses &Container::push_back, but in c++0x, std::vector has two overload of it - // meaning it is not possible to take the address of that function anymore. - QSKIP("mapped do not work with c++0x stl vector", SkipAll); #else std::vector<int> vector; vector.push_back(1); diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp index 42ea3b1..73d09f4 100644 --- a/tests/auto/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/qtextedit/tst_qtextedit.cpp @@ -138,6 +138,8 @@ private slots: void textSemantics(); #endif void cursorPositionChanged(); + void mouseSelection(); + void mouseSelectionDClick(); void setTextCursor(); #ifndef QT_NO_CLIPBOARD void undoAvailableAfterPaste(); @@ -785,6 +787,45 @@ void tst_QTextEdit::cursorPositionChanged() QCOMPARE(ed->textCursor().position(), 0); } +void tst_QTextEdit::mouseSelection() +{ + ed->show(); + ed->setPlainText(("Hello World")); + QTextCursor cursor = ed->textCursor(); + cursor.setPosition(1); + QPoint p1 = ed->cursorRect(cursor).center(); + cursor.setPosition(10); + QPoint p2 = ed->cursorRect(cursor).center(); + QTest::mousePress(ed->viewport(), Qt::LeftButton, 0, p1); + { QMouseEvent ev(QEvent::MouseMove, p2, Qt::LeftButton, Qt::LeftButton, 0); + QCoreApplication::sendEvent(ed->viewport(), &ev); } + QTest::mouseRelease(ed->viewport(), Qt::LeftButton, 0, p2); + QVERIFY(ed->textCursor().hasSelection()); + QCOMPARE(ed->textCursor().selectedText(), QString("ello Worl")); + +} + +void tst_QTextEdit::mouseSelectionDClick() +{ + ed->show(); + ed->setPlainText(("Hello World")); + QTextCursor cursor = ed->textCursor(); + cursor.setPosition(1); + QPoint p1 = ed->cursorRect(cursor).center(); + cursor.setPosition(10); + QPoint p2 = ed->cursorRect(cursor).center(); + QTest::mousePress(ed->viewport(), Qt::LeftButton, 0, p1); + QTest::mouseRelease(ed->viewport(), Qt::LeftButton, 0, p1); + QTest::mouseDClick(ed->viewport(), Qt::LeftButton, 0, p1); + QVERIFY(ed->textCursor().hasSelection()); + QCOMPARE(ed->textCursor().selectedText(), QString("Hello")); + { QMouseEvent ev(QEvent::MouseMove, p2, Qt::LeftButton, Qt::LeftButton, 0); + QCoreApplication::sendEvent(ed->viewport(), &ev); } + QTest::mouseRelease(ed->viewport(), Qt::LeftButton, 0, p2); + QVERIFY(ed->textCursor().hasSelection()); + QCOMPARE(ed->textCursor().selectedText(), QString("Hello World")); +} + void tst_QTextEdit::setTextCursor() { QSignalSpy spy(ed, SIGNAL(cursorPositionChanged())); diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 2414ab3..67d8269 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -129,6 +129,7 @@ private slots: void textWidthWithLineSeparator(); void cursorInLigatureWithMultipleLines(); void xToCursorForLigatures(); + void cursorInNonStopChars(); private: QFont testFont; @@ -1465,7 +1466,7 @@ void tst_QTextLayout::textWidthWithLineSeparator() void tst_QTextLayout::cursorInLigatureWithMultipleLines() { #if !defined(Q_WS_MAC) - QSKIP("This test can not be run on Mac", SkipAll); + QSKIP("This test can only be run on Mac", SkipAll); #endif QTextLayout layout("first line finish", QFont("Times", 20)); layout.beginLayout(); @@ -1481,7 +1482,7 @@ void tst_QTextLayout::cursorInLigatureWithMultipleLines() void tst_QTextLayout::xToCursorForLigatures() { #if !defined(Q_WS_MAC) - QSKIP("This test can not be run on Mac", SkipAll); + QSKIP("This test can only be run on Mac", SkipAll); #endif QTextLayout layout("fi", QFont("Times", 20)); layout.beginLayout(); @@ -1502,5 +1503,19 @@ void tst_QTextLayout::xToCursorForLigatures() line.xToCursor(width) == line.xToCursor(width / 2)); } +void tst_QTextLayout::cursorInNonStopChars() +{ +#if defined(Q_WS_MAC) + QSKIP("This test can not be run on Mac", SkipAll); +#endif + QTextLayout layout(QString::fromUtf8("\xE0\xA4\xA4\xE0\xA5\x8D\xE0\xA4\xA8")); + layout.beginLayout(); + QTextLine line = layout.createLine(); + layout.endLayout(); + + QVERIFY(line.cursorToX(1) == line.cursorToX(3)); + QVERIFY(line.cursorToX(2) == line.cursorToX(3)); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" diff --git a/tools/assistant/lib/lib.pro b/tools/assistant/lib/lib.pro index 03821b2..d6c3fce 100644 --- a/tools/assistant/lib/lib.pro +++ b/tools/assistant/lib/lib.pro @@ -1,5 +1,4 @@ QT += sql \ - xml \ network TEMPLATE = lib TARGET = QtHelp diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 31c359e..e6d8526 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3599,17 +3599,21 @@ void Configure::displayConfig() #if !defined(EVAL) void Configure::generateHeaders() { - if (dictionary["SYNCQT"] == "yes" - && findFile("perl.exe")) { - cout << "Running syncqt..." << endl; - QStringList args; - args += buildPath + "/bin/syncqt.bat"; - QStringList env; - env += QString("QTDIR=" + sourcePath); - env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH")); - int retc = Environment::execute(args, env, QStringList()); - if (retc) { - cout << "syncqt failed, return code " << retc << endl << endl; + if (dictionary["SYNCQT"] == "yes") { + if (findFile("perl.exe")) { + cout << "Running syncqt..." << endl; + QStringList args; + args += buildPath + "/bin/syncqt.bat"; + QStringList env; + env += QString("QTDIR=" + sourcePath); + env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH")); + int retc = Environment::execute(args, env, QStringList()); + if (retc) { + cout << "syncqt failed, return code " << retc << endl << endl; + dictionary["DONE"] = "error"; + } + } else { + cout << "Perl not found in environment - cannot run syncqt." << endl; dictionary["DONE"] = "error"; } } diff --git a/tools/qdbus/qdbus/qdbus.cpp b/tools/qdbus/qdbus/qdbus.cpp index 14b4b9e..757267f 100644 --- a/tools/qdbus/qdbus/qdbus.cpp +++ b/tools/qdbus/qdbus/qdbus.cpp @@ -59,7 +59,7 @@ static bool printArgumentsLiterally = false; static void showUsage() { - printf("Usage: qdbus [--system] [--literal] [servicename] [path] [method] [args]\n" + printf("Usage: qdbus [--system | --address ADDRESS] [--literal] [servicename] [path] [method] [args]\n" "\n" " servicename the service to connect to (e.g., org.freedesktop.DBus)\n" " path the path to the object (e.g., /)\n" @@ -71,6 +71,7 @@ static void showUsage() "\n" "Options:\n" " --system connect to the system bus\n" + " --address ADDRESS connect to the given bus\n" " --literal print replies literally\n"); } @@ -454,6 +455,11 @@ int main(int argc, char **argv) if (arg == QLatin1String("--system")) { connection = QDBusConnection::systemBus(); connectionOpened = true; + } else if (arg == QLatin1String("--address")) { + if (!args.isEmpty()) { + connection = QDBusConnection::connectToBus(args.takeFirst(), "bus"); + connectionOpened = true; + } } else if (arg == QLatin1String("--literal")) { printArgumentsLiterally = true; } else if (arg == QLatin1String("--help")) { diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 37c2c3a..743688f 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -919,7 +919,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, int i = 0; int start = 0; int finish = 0; - char ch; + QChar ch; QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)"); QRegExp functionRegExp("q([A-Z][a-z]+)+"); @@ -929,13 +929,13 @@ QString CppCodeMarker::addMarkUp(const QString &in, QString tag; bool target = false; - if (isalpha(ch) || ch == '_') { + if (ch.isLetter() || ch == '_') { QString ident; do { - ident += ch; - finish = i; - readChar(); - } while (ch >= 0 && isalnum(ch) || ch == '_'); + ident += ch; + finish = i; + readChar(); + } while (ch.isLetterOrNumber() || ch == '_'); if (classRegExp.exactMatch(ident)) { tag = QLatin1String("type"); @@ -952,14 +952,14 @@ QString CppCodeMarker::addMarkUp(const QString &in, tag = QLatin1String("func"); target = true; } - } else if (isdigit(ch)) { + } else if (ch.isDigit()) { do { finish = i; readChar(); - } while (isalnum(ch) || ch == '.'); + } while (ch.isLetterOrNumber() || ch == '.'); tag = QLatin1String("number"); } else { - switch (ch) { + switch (ch.unicode()) { case '+': case '-': case '!': diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 0d5b4d3..e3e32a0 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1180,7 +1180,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, Just output the href as if the image is in the images directory... */ - fileName = QLatin1String("images/") + protectEnc(atom->string()); + if (atom->string()[0] == '/') + fileName = QLatin1String("images") + atom->string(); + else + fileName = QLatin1String("images/") + atom->string(); } if (currentTag() != DT_xref) diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index c20d2b4..355c9b2 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -814,10 +814,13 @@ QString Generator::imageFileName(const Node *relative, const QString& fileBase) if (filePath.isEmpty()) return QString(); - return QLatin1String("images/") - + Config::copyFile(relative->doc().location(), - filePath, userFriendlyFilePath, - outputDir() + QLatin1String("/images")); + QString path = Config::copyFile(relative->doc().location(), + filePath, + userFriendlyFilePath, + outputDir() + QLatin1String("/images")); + if (path[0] != '/') + return QLatin1String("images/") + path; + return QLatin1String("images") + path; } void Generator::setImageFileExtensions(const QStringList& extensions) diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index 29ce202..ca8f4f4 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -8,6 +8,9 @@ DESTDIR = ../../bin target.path=$$[QT_INSTALL_BINS] INSTALLS += target +DEPENDPATH += ../../include +INCLUDEPATH += ../../src/gui/embedded + FORMS = config.ui HEADERS = qvfb.h \ qvfbview.h \ @@ -16,7 +19,10 @@ HEADERS = qvfb.h \ gammaview.h \ qvfbprotocol.h \ qvfbshmem.h \ - qvfbmmap.h + qvfbmmap.h \ + ../../src/gui/embedded/qlock_p.h \ + ../../src/gui/embedded/qwslock_p.h \ + ../../src/gui/embedded/qwssignalhandler_p.h SOURCES = qvfb.cpp \ qvfbview.cpp \ @@ -25,7 +31,16 @@ SOURCES = qvfb.cpp \ qanimationwriter.cpp \ qvfbprotocol.cpp \ qvfbshmem.cpp \ - qvfbmmap.cpp + qvfbmmap.cpp \ + ../../src/gui/embedded/qlock.cpp \ + ../../src/gui/embedded/qwslock.cpp \ + ../../src/gui/embedded/qwssignalhandler.cpp + +!embedded { + DEFINES += QT_NO_QWS_SIGNALHANDLER + HEADERS += ../../src/gui/embedded/qlock_p.h + SOURCES += ../../src/gui/embedded/qlock.cpp +} include(../shared/deviceskin/deviceskin.pri) diff --git a/tools/qvfb/qvfbshmem.cpp b/tools/qvfb/qvfbshmem.cpp index c17a680..c9a4293 100644 --- a/tools/qvfb/qvfbshmem.cpp +++ b/tools/qvfb/qvfbshmem.cpp @@ -39,9 +39,11 @@ ** ****************************************************************************/ +#include <qplatformdefs.h> + #include "qvfbshmem.h" -#include <qvfbhdr.h> -#include <private/qlock_p.h> +#include "qvfbhdr.h" +#include "qlock_p.h" #include <QFile> #include <QTimer> diff --git a/tools/runonphone/codasignalhandler.cpp b/tools/runonphone/codasignalhandler.cpp index 0d086b5..3d524dd 100644 --- a/tools/runonphone/codasignalhandler.cpp +++ b/tools/runonphone/codasignalhandler.cpp @@ -168,7 +168,7 @@ int CodaSignalHandler::run() QString deviceError = "No such port"; if (d->codaDevice) deviceError = d->codaDevice->device()->errorString(); - reportError(tr("Could not open serial device: ").arg(deviceError)); + reportError(tr("Could not open serial device: %1").arg(deviceError)); SymbianUtils::SymbianDeviceManager::instance()->releaseCodaDevice(d->codaDevice); return 1; } diff --git a/tools/runonphone/trksignalhandler.cpp b/tools/runonphone/trksignalhandler.cpp index 59ff22c..52de3c8 100644 --- a/tools/runonphone/trksignalhandler.cpp +++ b/tools/runonphone/trksignalhandler.cpp @@ -106,7 +106,7 @@ void TrkSignalHandler::canNotCloseFile(const QString &filename, const QString &e void TrkSignalHandler::installingStarted(const QString &packageName) { if (d->loglevel > 0) - d->out << "Installing" << packageName << "..." << endl; + d->out << "Installing " << packageName << "..." << endl; } void TrkSignalHandler::canNotInstall(const QString &packageFilename, const QString &errorMessage) |