[Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5)
authorvestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2012 14:00:53 +0000 (14:00 +0000)
committervestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2012 14:00:53 +0000 (14:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=87955

Reviewed by Simon Hausmann.

Source/WebCore:

* bridge/qt/qt_class.cpp:
* bridge/qt/qt_instance.cpp:
* bridge/qt/qt_runtime.h:
* page/qt/EventHandlerQt.cpp:
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/OpenGLShims.cpp:
* platform/graphics/OpenGLShims.h:
* platform/graphics/gstreamer/PlatformVideoWindowPrivate.h:
* platform/graphics/gstreamer/PlatformVideoWindowQt.cpp:
* platform/graphics/qt/GraphicsContext3DQt.cpp:
* platform/graphics/qt/SimpleFontDataQt.cpp:
* platform/graphics/texmap/TextureMapper.h:
* platform/graphics/texmap/TextureMapperGL.cpp:
* platform/qt/DeviceMotionProviderQt.h:
* platform/qt/DeviceOrientationProviderQt.h:
* platform/qt/KURLQt.cpp:
* platform/qt/PlatformScreenQt.cpp:
* platform/qt/QWebPageClient.h:
* plugins/qt/PluginPackageQt.cpp:
* plugins/qt/PluginViewQt.cpp:

Source/WebKit/qt:

* Api/qgraphicswebview.cpp:
* Api/qgraphicswebview.h:
* Api/qwebframe.cpp:
* Api/qwebframe_p.h:
* Api/qwebpage.cpp:
* Api/qwebpage.h:
* Api/qwebsettings.cpp:
* Api/qwebview.cpp:
* Api/qwebview.h:
* WebCoreSupport/FrameLoaderClientQt.cpp:
* WebCoreSupport/GeolocationClientQt.cpp:
* WebCoreSupport/GeolocationClientQt.h:
* WebCoreSupport/PageClientQt.cpp:
* WebCoreSupport/WebEventConversion.cpp:
* declarative/plugin.cpp:
* tests/qwebframe/tst_qwebframe.cpp:
* tests/util.h:

Source/WebKit2:

* UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:

Source/WTF:

* wtf/qt/UtilsQt.h:

Tools:

* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
* DumpRenderTree/qt/EventSenderQt.cpp:
* DumpRenderTree/qt/QtInitializeTestFonts.cpp:
* DumpRenderTree/qt/main.cpp:
* QtTestBrowser/cookiejar.cpp:
* QtTestBrowser/launcherwindow.cpp:
* WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp:
* qmake/mkspecs/features/default_post.prf:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119098 268f45cc-cd09-0410-ab3c-d52691b4dbfc

53 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/qt/UtilsQt.h
Source/WebCore/ChangeLog
Source/WebCore/bridge/qt/qt_class.cpp
Source/WebCore/bridge/qt/qt_instance.cpp
Source/WebCore/bridge/qt/qt_runtime.h
Source/WebCore/page/qt/EventHandlerQt.cpp
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/OpenGLShims.cpp
Source/WebCore/platform/graphics/OpenGLShims.h
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowPrivate.h
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp
Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
Source/WebCore/platform/graphics/texmap/TextureMapper.h
Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Source/WebCore/platform/qt/DeviceMotionProviderQt.h
Source/WebCore/platform/qt/DeviceOrientationProviderQt.h
Source/WebCore/platform/qt/KURLQt.cpp
Source/WebCore/platform/qt/PlatformScreenQt.cpp
Source/WebCore/platform/qt/QWebPageClient.h
Source/WebCore/plugins/qt/PluginPackageQt.cpp
Source/WebCore/plugins/qt/PluginViewQt.cpp
Source/WebKit/qt/Api/qgraphicswebview.cpp
Source/WebKit/qt/Api/qgraphicswebview.h
Source/WebKit/qt/Api/qwebframe.cpp
Source/WebKit/qt/Api/qwebframe_p.h
Source/WebKit/qt/Api/qwebpage.cpp
Source/WebKit/qt/Api/qwebpage.h
Source/WebKit/qt/Api/qwebsettings.cpp
Source/WebKit/qt/Api/qwebview.cpp
Source/WebKit/qt/Api/qwebview.h
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h
Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
Source/WebKit/qt/declarative/plugin.cpp
Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
Source/WebKit/qt/tests/util.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
Source/WebKit2/UIProcess/API/qt/tests/tests.pri
Tools/ChangeLog
Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
Tools/DumpRenderTree/qt/EventSenderQt.cpp
Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp
Tools/DumpRenderTree/qt/main.cpp
Tools/QtTestBrowser/cookiejar.cpp
Tools/QtTestBrowser/launcherwindow.cpp
Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp
Tools/qmake/mkspecs/features/default_post.prf

index bcdf6a2..85f3b9b 100644 (file)
@@ -1,3 +1,12 @@
+2012-05-31  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5)
+        https://bugs.webkit.org/show_bug.cgi?id=87955
+
+        Reviewed by Simon Hausmann.
+
+        * wtf/qt/UtilsQt.h:
+
 2012-05-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
 
         HashTable.h has using directives for std::pair and std::make_pair
index 74067a8..61c9e32 100644 (file)
 #define WTF_UtilsQt_h
 
 #include <QString>
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
 #include <QTextDocument>
 #endif
 
 inline QString escapeHtml(const QString& string)
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     return string.toHtmlEscaped();
 #else
     return Qt::escape(string);
index f021ca7..99e4901 100644 (file)
@@ -1,3 +1,31 @@
+2012-05-31  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5)
+        https://bugs.webkit.org/show_bug.cgi?id=87955
+
+        Reviewed by Simon Hausmann.
+
+        * bridge/qt/qt_class.cpp:
+        * bridge/qt/qt_instance.cpp:
+        * bridge/qt/qt_runtime.h:
+        * page/qt/EventHandlerQt.cpp:
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/OpenGLShims.cpp:
+        * platform/graphics/OpenGLShims.h:
+        * platform/graphics/gstreamer/PlatformVideoWindowPrivate.h:
+        * platform/graphics/gstreamer/PlatformVideoWindowQt.cpp:
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        * platform/graphics/qt/SimpleFontDataQt.cpp:
+        * platform/graphics/texmap/TextureMapper.h:
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        * platform/qt/DeviceMotionProviderQt.h:
+        * platform/qt/DeviceOrientationProviderQt.h:
+        * platform/qt/KURLQt.cpp:
+        * platform/qt/PlatformScreenQt.cpp:
+        * platform/qt/QWebPageClient.h:
+        * plugins/qt/PluginPackageQt.cpp:
+        * plugins/qt/PluginViewQt.cpp:
+
 2012-05-30  Andreas Kling  <kling@webkit.org>
 
         Have StylePropertySet constructor take array/length instead of vector.
index 105898e..3803d47 100644 (file)
@@ -99,7 +99,7 @@ JSValue QtClass::fallbackObject(ExecState* exec, Instance* inst, PropertyName id
         if (m.access() == QMetaMethod::Private)
             continue;
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
         int iter = 0;
         const char* signature = m.signature();
         while (signature[iter] && signature[iter] != '(')
index d498921..c79096d 100644 (file)
@@ -237,7 +237,7 @@ void QtInstance::getPropertyNames(ExecState* exec, PropertyNameArray& array)
         for (i = 0; i < methodCount; i++) {
             QMetaMethod method = meta->method(i);
             if (method.access() != QMetaMethod::Private) {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
                 QString sig = QString::fromLatin1(method.methodSignature());
                 array.add(Identifier(exec, UString(sig.utf16(), sig.length())));
 #else
@@ -289,7 +289,7 @@ JSValue QtInstance::stringValue(ExecState* exec) const
             // Check to see how much we can call it
             if (m.access() != QMetaMethod::Private
                 && m.methodType() != QMetaMethod::Signal
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
                 && m.parameterCount() == 0
                 && m.returnType() != QMetaType::Void) {
                 QVariant ret(m.returnType(), (void*)0);
@@ -403,7 +403,7 @@ void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValue
     if (obj) {
         QMetaType::Type argtype = QMetaType::Void;
         if (m_type == MetaProperty)
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
             argtype = (QMetaType::Type) m_property.userType();
 #else
             argtype = (QMetaType::Type) QMetaType::type(m_property.typeName());
index 737247a..4d9afa4 100644 (file)
@@ -238,14 +238,14 @@ private:
 // with the appropriate signal of 'sender'. When execute() is called, it will call JS 'receiverFunction'.
 class QtConnectionObject : public QObject
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     Q_OBJECT_FAKE
 #endif
 public:
     QtConnectionObject(JSContextRef, PassRefPtr<QtInstance> senderInstance, int signalIndex, JSObjectRef receiver, JSObjectRef receiverFunction);
     ~QtConnectionObject();
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
     // Explicitly define these because want a custom qt_metacall(), so we can't use Q_OBJECT macro.
     static const QMetaObject staticMetaObject;
     virtual const QMetaObject *metaObject() const;
index 8aebb9c..d522229 100644 (file)
@@ -50,7 +50,7 @@
 #include "RenderWidget.h"
 #include "Scrollbar.h"
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
 QT_BEGIN_NAMESPACE
 Q_GUI_EXPORT extern bool qt_tab_all_widgets; // from qapplication.cpp
 QT_END_NAMESPACE
@@ -66,7 +66,7 @@ const double EventHandler::TextDragDelay = 0.0;
 
 bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     return !isKeyboardOptionTab(event);
 #else
     return (isKeyboardOptionTab(event) ? !qt_tab_all_widgets : qt_tab_all_widgets);
index 692da56..b0bc5c0 100644 (file)
@@ -68,7 +68,7 @@ typedef unsigned int GLuint;
 #if PLATFORM(MAC)
 typedef CGLContextObj PlatformGraphicsContext3D;
 #elif PLATFORM(QT)
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
 typedef QOpenGLContext* PlatformGraphicsContext3D;
 typedef QSurface* PlatformGraphicsSurface3D;
 #else
index f59f26c..a23dc68 100644 (file)
@@ -42,7 +42,7 @@ OpenGLFunctionTable* openGLFunctionTable()
 #if PLATFORM(QT)
 static void* getProcAddress(const char* procName)
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     return reinterpret_cast<void*>(QOpenGLContext::currentContext()->getProcAddress(procName));
 #else
     return reinterpret_cast<void*>(QGLContext::currentContext()->getProcAddress(QString::fromLatin1(procName)));
index 1d5f37d..706f17d 100644 (file)
@@ -22,7 +22,7 @@
 
 #if PLATFORM(QT)
 #include <qglobal.h>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
 #include <qopenglfunctions.h>
 #include <QOpenGLContext>
 #include <QSurface>
index 33600f6..b929e90 100644 (file)
@@ -23,7 +23,7 @@
 #include <QEvent>
 #include <QTimer>
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if defined(HAVE_QT5) && HAVE_QT5
 #include <QWindow>
 #else
 #include <QWidget>
@@ -33,7 +33,7 @@ namespace WebCore {
 
 class HTMLVideoElement;
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if defined(HAVE_QT5) && HAVE_QT5
 typedef QWindow Base;
 #else
 typedef QWidget Base;
index 506a59d..3e431f2 100644 (file)
@@ -38,7 +38,7 @@ static const int gHideMouseCursorDelay = 3000;
 FullScreenVideoWindow::FullScreenVideoWindow()
     : m_mediaElement(0)
 {
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
     setAttribute(Qt::WA_NativeWindow);
     setAttribute(Qt::WA_NoSystemBackground, true);
     setAttribute(Qt::WA_PaintOnScreen, true);
@@ -83,7 +83,7 @@ bool FullScreenVideoWindow::event(QEvent* ev)
 #ifndef QT_NO_CURSOR
         m_cursorTimer.stop();
 #endif
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
         setMouseTracking(false);
         releaseMouse();
 #endif
@@ -100,11 +100,11 @@ bool FullScreenVideoWindow::event(QEvent* ev)
 void FullScreenVideoWindow::showFullScreen()
 {
     Base::showFullScreen();
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
     setMouseTracking(true);
 #endif
     raise();
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
     setFocus();
 #endif
     hideCursor();
@@ -132,7 +132,7 @@ PlatformVideoWindow::PlatformVideoWindow()
     m_window = win;
     win->setWindowFlags(win->windowFlags() | Qt::FramelessWindowHint);
     // FIXME: Port to Qt 5.
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
     QPalette p;
     p.setColor(QPalette::Base, Qt::black);
     p.setColor(QPalette::Window, Qt::black);
index c089eb9..f3a7ea8 100644 (file)
@@ -194,7 +194,7 @@ void GraphicsContext3DPrivate::blitMultisampleFramebufferAndRestoreContext() con
     if (!m_context->m_attrs.antialias)
         return;
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     const QOpenGLContext* currentContext = QOpenGLContext::currentContext();
     QSurface* currentSurface = 0;
     if (currentContext != m_platformContext) {
@@ -220,7 +220,7 @@ void GraphicsContext3DPrivate::blitMultisampleFramebufferAndRestoreContext() con
 
 bool GraphicsContext3DPrivate::makeCurrentIfNeeded() const
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     const QOpenGLContext* currentContext = QOpenGLContext::currentContext();
     if (currentContext == m_platformContext)
         return true;
index 1bcd6c0..4c01f1d 100644 (file)
@@ -148,7 +148,7 @@ void SimpleFontData::platformInit()
     float spaceWidth = fm.width(QLatin1Char(' '));
 #endif
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
     // Qt subtracts 1 from the descent to account for the baseline,
     // we add it back here to get correct metrics for WebKit.
     descent += 1;
index 2907d1a..12498ec 100644 (file)
@@ -25,7 +25,7 @@
 #if PLATFORM(QT)
 #include <qglobal.h>
 
-#if defined(QT_OPENGL_LIB) || (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
+#if defined(QT_OPENGL_LIB) || HAVE(QT5)
     #if defined(QT_OPENGL_ES_2) && !defined(TEXMAP_OPENGL_ES_2)
         #define TEXMAP_OPENGL_ES_2
     #endif
index 0f7652c..660334a 100644 (file)
@@ -505,7 +505,7 @@ void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, co
 
 #if PLATFORM(QT)
     QImage qtImage;
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     // With QPA, we can avoid a deep copy.
     qtImage = *frameImage->handle()->buffer();
 #else
index cf3d589..18437c6 100644 (file)
@@ -25,7 +25,7 @@
 #include <QAccelerometerFilter>
 #include <wtf/RefPtr.h>
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
 using QTM_NAMESPACE::QAccelerometer;
 using QTM_NAMESPACE::QAccelerometerFilter;
 using QTM_NAMESPACE::QAccelerometerReading;
index 6d3e199..c7f6d23 100644 (file)
@@ -25,7 +25,7 @@
 #include <QRotationFilter>
 #include <wtf/RefPtr.h>
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
 using QTM_NAMESPACE::QRotationFilter;
 using QTM_NAMESPACE::QRotationReading;
 using QTM_NAMESPACE::QRotationSensor;
index 2e75774..86e4ab7 100644 (file)
@@ -34,7 +34,7 @@ KURL::KURL(const QUrl& url)
 
 KURL::operator QUrl() const
 {
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
     QString str = QString::fromRawData(reinterpret_cast<const QChar*>(m_string.characters()), m_string.length());
     QByteArray ba = str.toUtf8();
 
index 62dcf50..8bfbf26 100644 (file)
@@ -38,7 +38,7 @@
 #include "NotImplemented.h"
 #include "Widget.h"
 #include "QWebPageClient.h"
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
 #include <QGuiApplication>
 #include <QScreen>
 #else
@@ -71,7 +71,7 @@ static int screenNumber(Widget* w)
 
 int screenDepth(Widget* w)
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     return QGuiApplication::screens().value(screenNumber(w))->depth();
 #else
     return QApplication::desktop()->screen(screenNumber(w))->depth();
@@ -80,7 +80,7 @@ int screenDepth(Widget* w)
 
 int screenDepthPerComponent(Widget* w)
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     int depth = QGuiApplication::primaryScreen()->depth();
     // FIXME: Use widget's screen
     Q_UNUSED(w);
@@ -114,7 +114,7 @@ int screenDepthPerComponent(Widget* w)
 
 bool screenIsMonochrome(Widget* w)
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     Q_UNUSED(w);
     // FIXME: In Qt 5 colorCount() isn't even implemented beyond returning 256 :)
     return false;
@@ -125,7 +125,7 @@ bool screenIsMonochrome(Widget* w)
 
 FloatRect screenRect(Widget* widget)
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     QRect r = QGuiApplication::screens().value(screenNumber(widget))->geometry();
 #else
     QRect r = QApplication::desktop()->screenGeometry(screenNumber(widget));
@@ -135,7 +135,7 @@ FloatRect screenRect(Widget* widget)
 
 FloatRect screenAvailableRect(Widget* widget)
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     QRect r = QGuiApplication::screens().value(screenNumber(widget))->availableGeometry();
 #else
     QRect r = QApplication::desktop()->availableGeometry(screenNumber(widget));
index 9541c64..6c9a1ae 100644 (file)
@@ -110,7 +110,7 @@ public:
     virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*,
                                                  PlatformGraphicsSurface3D*) = 0;
 #endif
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     virtual QWindow* ownerWindow() const;
 #endif
 
index b9824fa..fbac529 100644 (file)
@@ -132,7 +132,7 @@ static void initializeGtk(QLibrary* module = 0)
 
 bool PluginPackage::isPluginBlacklisted()
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     // TODO: enumerate all plugins that are incompatible with Qt5.
     const QLatin1String pluginBlacklist[] = {
         QLatin1String("skypebuttons")
index 323c551..eda0504 100644 (file)
@@ -79,8 +79,6 @@
 #include <runtime/JSLock.h>
 #include <runtime/JSValue.h>
 
-#define HAVE_QT5 (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
-
 #if HAVE(QT5)
 #include "QtX11ImageConversion.h"
 #include <QGuiApplication>
index 3f6fe14..d194f9f 100644 (file)
@@ -313,7 +313,7 @@ bool QGraphicsWebView::sceneEvent(QEvent* event)
     if (d->page && (event->type() == QEvent::TouchBegin
                 || event->type() == QEvent::TouchEnd
                 || event->type() == QEvent::TouchUpdate
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
                 || event->type() == QEvent::TouchCancel
 #endif
        )) {
index 15fe087..c7ca44a 100644 (file)
@@ -23,7 +23,7 @@
 #include "qwebkitglobal.h"
 #include "qwebpage.h"
 #include <QtCore/qurl.h>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if defined(HAVE_QT5) && HAVE_QT5
 #include <QtWidgets/qgraphicswidget.h>
 #else
 #include <QtGui/qgraphicswidget.h>
index f09a8a8..aba58db 100644 (file)
 #include <qregion.h>
 #include <qnetworkrequest.h>
 
-#if ENABLE(ORIENTATION_EVENTS) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if ENABLE(ORIENTATION_EVENTS) && !HAVE(QT5)
 QTM_USE_NAMESPACE
 #endif
 
index 4ab7b97..82fd920 100644 (file)
@@ -30,9 +30,9 @@
 #include "PlatformString.h"
 #if ENABLE(ORIENTATION_EVENTS)
 #include "qorientationsensor.h"
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !(defined(HAVE_QT5) && HAVE_QT5)
 using QTM_NAMESPACE::QOrientationSensor;
-#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0).
+#endif
 #endif // ENABLE(ORIENTATION_EVENTS).
 #include "qwebelement.h"
 #include "wtf/RefPtr.h"
index d9b0077..8fb319d 100644 (file)
@@ -3151,7 +3151,7 @@ bool QWebPage::event(QEvent *ev)
     case QEvent::TouchBegin:
     case QEvent::TouchUpdate:
     case QEvent::TouchEnd:
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     case QEvent::TouchCancel:
 #endif
         // Return whether the default action was cancelled in the JS event handler
index 0bf35e2..fce68a8 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <QtCore/qobject.h>
 #include <QtCore/qurl.h>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if defined(HAVE_QT5) && HAVE_QT5
 #include <QtWidgets/qwidget.h>
 #else
 #include <QtGui/qwidget.h>
index 4e01836..5425a92 100644 (file)
@@ -46,7 +46,7 @@
 #include "FileSystem.h"
 
 #include <QApplication>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
 #include <QStandardPaths>
 #else
 #include <QDesktopServices>
@@ -1151,7 +1151,7 @@ void QWebSettings::enablePersistentStorage(const QString& path)
 
     if (path.isEmpty()) {
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
         storagePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
 #else
         storagePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
@@ -1174,7 +1174,7 @@ void QWebSettings::enablePersistentStorage(const QString& path)
 #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     // All applications can share the common QtWebkit cache file(s).
     // Path is not configurable and uses QDesktopServices::CacheLocation by default.
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     QString cachePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
 #else
     QString cachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
index 937d3bd..76bf392 100644 (file)
@@ -704,7 +704,7 @@ bool QWebView::event(QEvent *e)
         } else if (e->type() == QEvent::TouchBegin 
                    || e->type() == QEvent::TouchEnd 
                    || e->type() == QEvent::TouchUpdate
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
                    || e->type() == QEvent::TouchCancel
 #endif
                   ) {
index 90d0a8e..c31aa35 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "qwebkitglobal.h"
 #include "qwebpage.h"
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if defined(HAVE_QT5) && HAVE_QT5
 #include <QtWidgets/qwidget.h>
 #else
 #include <QtGui/qwidget.h>
index e82740f..70c1ff0 100644 (file)
@@ -1,3 +1,28 @@
+2012-05-31  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5)
+        https://bugs.webkit.org/show_bug.cgi?id=87955
+
+        Reviewed by Simon Hausmann.
+
+        * Api/qgraphicswebview.cpp:
+        * Api/qgraphicswebview.h:
+        * Api/qwebframe.cpp:
+        * Api/qwebframe_p.h:
+        * Api/qwebpage.cpp:
+        * Api/qwebpage.h:
+        * Api/qwebsettings.cpp:
+        * Api/qwebview.cpp:
+        * Api/qwebview.h:
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        * WebCoreSupport/GeolocationClientQt.cpp:
+        * WebCoreSupport/GeolocationClientQt.h:
+        * WebCoreSupport/PageClientQt.cpp:
+        * WebCoreSupport/WebEventConversion.cpp:
+        * declarative/plugin.cpp:
+        * tests/qwebframe/tst_qwebframe.cpp:
+        * tests/util.h:
+
 2012-05-29  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
 
         [Qt] Sync up favicon-implementation with WebView url changes in r118158
index e816b9f..097d7d8 100644 (file)
@@ -1603,7 +1603,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
         Vector<String> params = paramNames;
         Vector<String> values = paramValues;
         if (mimeType == "application/x-shockwave-flash") {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
             const bool shouldInjectWmode = true;
 #else
             // Inject wmode=opaque when there is no client or the client is not a QWebView.
index 8551cf9..ec4d1bb 100644 (file)
@@ -37,9 +37,9 @@
 #include "qwebpage.h"
 #include "qwebpage_p.h"
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
 #include <QGeoPositionInfoSource>
-#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#elif HAVE(QT5)
 #include <QtLocation/QGeoPositionInfoSource>
 #endif
 
index 9d07a91..94b0f65 100644 (file)
 #include <QObject>
 #include <wtf/RefPtr.h>
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !HAVE(QT5)
 #include <QGeoPositionInfo>
 namespace QtMobility {
 class QGeoPositionInfoSource;
 };
 using namespace QtMobility;
-#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#elif HAVE(QT5)
 #include <QtLocation/QGeoPositionInfo>
 class QGeoPositionInfoSource;
 #endif
index ed61d1f..93be5a5 100644 (file)
@@ -30,7 +30,7 @@
 #if ENABLE(WEBGL)
 #include <QGLWidget>
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
 #include <QWindow>
 #endif
 
@@ -50,7 +50,7 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG
     if (glWidget->isValid()) {
         // Geometry can be set to zero because m_glWidget is used only for its QGLContext.
         glWidget->setGeometry(0, 0, 0, 0);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
         *surface = glWidget->windowHandle();
         *context = glWidget->context()->contextHandle();
 #else
@@ -69,7 +69,7 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG
 #include "texmap/TextureMapperLayer.h"
 #endif
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
 QWindow* QWebPageClient::ownerWindow() const
 {
     QWidget* widget = ownerWidget();
index d45f8ce..0b732a4 100644 (file)
@@ -243,7 +243,7 @@ WebKitPlatformTouchEvent::WebKitPlatformTouchEvent(QTouchEvent* event)
     case QEvent::TouchEnd:
         m_type = PlatformEvent::TouchEnd;
         break;
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     case QEvent::TouchCancel:
         m_type = PlatformEvent::TouchCancel;
         break;
index b18a7bb..988b36e 100644 (file)
@@ -25,7 +25,7 @@
 #include "qdeclarativewebview_p.h"
 #endif
 
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
+#if (HAVE(QT5))
 #include <QtQml/qqml.h>
 #include <QtQml/qqmlextensionplugin.h>
 #else
index 2c28aef..3d8a2b3 100644 (file)
@@ -2033,7 +2033,7 @@ void tst_QWebFrame::enumerate_data()
         << "dp1" << "dp2" << "dp3"
         // inherited signals and slots
         << "destroyed(QObject*)" << "destroyed()"
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if defined(HAVE_QT5) && HAVE_QT5
         << "objectNameChanged(QString)"
 #endif
         << "deleteLater()"
index 22192ba..2fb59e0 100644 (file)
@@ -49,7 +49,7 @@ static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
     return timeoutSpy.isEmpty();
 }
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !(defined(HAVE_QT5) && HAVE_QT5)
 // Will try to wait for the condition while allowing event processing
 #define QTRY_VERIFY(__expr) \
     do { \
index 8229277..193d9f6 100644 (file)
@@ -1,3 +1,12 @@
+2012-05-31  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5)
+        https://bugs.webkit.org/show_bug.cgi?id=87955
+
+        Reviewed by Simon Hausmann.
+
+        * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:
+
 2012-05-31  Zalan Bujtas  <zbujtas@gmail.com>
 
         [Qt][WK2] Add missing ViewportUpdateDeferrer guarding to setPageItemRectVisible() calls.
index 6c0cb4b..0e3b33c 100644 (file)
@@ -17,6 +17,8 @@
     Boston, MA 02110-1301, USA.
 */
 
+#include "config.h"
+
 #include <QMetaEnum>
 #include <QMetaMethod>
 #include <QMetaObject>
@@ -142,7 +144,7 @@ static void gatherAPI(const QString& prefix, const QMetaMethod& method, QStringL
 {
     if (method.access() != QMetaMethod::Private) {
         const char* methodTypeName = !!strlen(method.typeName()) ? method.typeName() : "void";
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
         *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(QString::fromLatin1(method.methodSignature())).arg(QString::fromLatin1(methodTypeName));
 #else
         *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(method.signature()).arg(methodTypeName);
index 358a232..2704efe 100644 (file)
@@ -11,6 +11,7 @@ SOURCES += ../util.cpp \
 INCLUDEPATH += $$PWD
 
 QT += testlib qml quick quick-private webkit
+WEBKIT += wtf # For platform macros
 
 DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\" \
            QWP_PATH=\\\"$${ROOT_BUILD_DIR}/bin\\\"
index 2b71b7c..1c7d4ef 100644 (file)
@@ -1,3 +1,19 @@
+2012-05-31  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5)
+        https://bugs.webkit.org/show_bug.cgi?id=87955
+
+        Reviewed by Simon Hausmann.
+
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        * DumpRenderTree/qt/EventSenderQt.cpp:
+        * DumpRenderTree/qt/QtInitializeTestFonts.cpp:
+        * DumpRenderTree/qt/main.cpp:
+        * QtTestBrowser/cookiejar.cpp:
+        * QtTestBrowser/launcherwindow.cpp:
+        * WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp:
+        * qmake/mkspecs/features/default_post.prf:
+
 2012-05-31  Zoltan Horvath  <zoltan@webkit.org>
 
         [Qt] Don't enforce the version of libpng for the config test when passing the option to the linker
index a9f27bf..df70e08 100644 (file)
@@ -620,9 +620,7 @@ void DumpRenderTree::open(const QUrl& url)
     m_page->event(&ev);
 
     QWebSettings::clearMemoryCaches();
-#if !(QT_VERSION <= QT_VERSION_CHECK(4, 6, 2))
     QFontDatabase::removeAllApplicationFonts();
-#endif
     WebKit::initializeTestFonts();
 
     DumpRenderTreeSupportQt::dumpFrameLoader(url.toString().contains("loading/"));
index 4a3b245..c0506ef 100644 (file)
@@ -511,7 +511,7 @@ void EventSender::cancelTouchPoint(int index)
 
 void EventSender::sendTouchEvent(QEvent::Type type)
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     static QTouchDevice* device = 0;
     if (!device) {
         device = new QTouchDevice;
index ca6b66c..7ae5e22 100644 (file)
@@ -67,7 +67,7 @@ void initializeTestFonts()
     // The resolving of default font families was altered in Qt5 with 2cc5442 (qtbase),
     // we use this hack to keep resolving to the same font Qt4 did for serif while
     // supporting both versions.
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     configFile = fontDir + "/fonts-qt5-wk1.conf";
     if (!FcConfigParseAndLoad(config, reinterpret_cast<const FcChar8*>(configFile.constData()), FcTrue))
         qFatal("Couldn't load font configuration file");
index 1763367..3125d61 100644 (file)
@@ -152,7 +152,9 @@ int main(int argc, char* argv[])
     QApplication app(argc, argv);
     app.setQuitOnLastWindowClosed(false);
 
-#if QT_VERSION <= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
+    QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true);
+#else
 #ifdef Q_WS_X11
     QX11Info::setAppDpiY(0, 96);
     QX11Info::setAppDpiX(0, 96);
@@ -170,8 +172,6 @@ int main(int argc, char* argv[])
     * default font, but with the correct paint-device DPI.
    */
     QApplication::setFont(QWidget().font());
-#else
-    QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true);
 #endif
 
 #if HAVE(SIGNAL_H)
index 22a8d17..b8ed7d0 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "config.h"
+
 #include "cookiejar.h"
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
 #include <QStandardPaths>
 #else
 #include <QDesktopServices>
@@ -46,7 +48,7 @@ TestBrowserCookieJar::TestBrowserCookieJar(QObject* parent)
     connect(&m_timer, SIGNAL(timeout()), this, SLOT(saveToDisk()));
 
 #ifndef QT_NO_DESKTOPSERVICES
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
     QString path = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
 #else
     QString path = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
index 623a7ef..e4ae456 100644 (file)
@@ -32,6 +32,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "config.h"
+
 #include "launcherwindow.h"
 #include "cookiejar.h"
 #include "urlloader.h"
@@ -64,7 +66,7 @@
 #endif
 
 #if !defined(QT_NO_NETWORKDISKCACHE) && !defined(QT_NO_DESKTOPSERVICES)
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
 #include <QStandardPaths>
 #else
 #include <QDesktopServices>
@@ -806,7 +808,7 @@ void LauncherWindow::setDiskCache(bool enable)
     QNetworkDiskCache* cache = 0;
     if (enable) {
         cache = new QNetworkDiskCache();
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if HAVE(QT5)
         QString cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
 #else
         QString cacheLocation = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
index 72d0487..5de8ae7 100644 (file)
@@ -64,9 +64,7 @@ void LayoutTestController::platformInitialize()
     // which makes the use of QFontDatabase unnecessary.
     // See https://bugs.webkit.org/show_bug.cgi?id=53427
     QWebSettings::clearMemoryCaches();
-#if !(QT_VERSION <= QT_VERSION_CHECK(4, 6, 2))
     QFontDatabase::removeAllApplicationFonts();
-#endif
     activateFonts();
     QObject::connect(&m_waitToDumpWatchdogTimer, SIGNAL(timeout()), WatchdogTimerHelper::instance(), SLOT(timerFired()));
 }
index c37d71b..78c93d7 100644 (file)
@@ -21,6 +21,8 @@ isEmpty(OBJECTS_DIR): OBJECTS_DIR = obj/$$activeBuildConfig()
 DEFINES += \
     BUILDING_QT__=1
 
+haveQt(5): DEFINES += HAVE_QT5=1
+
 CONFIG(release, debug|release): DEFINES *= NDEBUG
 
 CONFIG += depend_includepath