Bug 1023156 - Cannot build Qt with errors in gfxQtPlatforms (with Qt 5.3)
authorTatiana Meshkova <tanya.meshkova@gmail.com>
Wed, 19 Nov 2014 22:02:51 -0800
changeset 216585 88315012b6cc251a867c36941d5296a29b77ca83
parent 216584 9986a68aa635ee7845a23cb4adb14d48d0edb013
child 216586 19b303e7e7f262f0a8ee925770981499b3632e5f
push idunknown
push userunknown
push dateunknown
bugs1023156
milestone36.0a1
Bug 1023156 - Cannot build Qt with errors in gfxQtPlatforms (with Qt 5.3)
dom/plugins/ipc/PluginHelperQt.cpp
dom/plugins/ipc/PluginHelperQt.h
dom/plugins/ipc/PluginModuleParent.cpp
dom/plugins/ipc/moz.build
gfx/2d/moz.build
gfx/thebes/gfxQtPlatform.cpp
ipc/chromium/src/base/message_pump_qt.cc
uriloader/exthandler/moz.build
uriloader/exthandler/unix/nsMIMEInfoQt.cpp
uriloader/exthandler/unix/nsMIMEInfoQt.h
uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
widget/qt/moz.build
widget/qt/nsPrintSettingsQt.cpp
new file mode 100644
--- /dev/null
+++ b/dom/plugins/ipc/PluginHelperQt.cpp
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "PluginHelperQt.h"
+#include <QtCore/QCoreApplication>
+#include <QtCore/QEventLoop>
+
+static const int kMaxtimeToProcessEvents = 30;
+
+bool
+PluginHelperQt::AnswerProcessSomeEvents()
+{
+    QCoreApplication::processEvents(QEventLoop::AllEvents, kMaxtimeToProcessEvents);
+    return true;
+}
new file mode 100644
--- /dev/null
+++ b/dom/plugins/ipc/PluginHelperQt.h
@@ -0,0 +1,16 @@
+/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef PluginHelperQt_h_
+#define PluginHelperQt_h_
+
+class PluginHelperQt
+{
+public:
+  static bool AnswerProcessSomeEvents();
+};
+
+#endif // PluginHelperQt_h_
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -1,19 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: sw=4 ts=4 et :
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifdef MOZ_WIDGET_QT
-// Must be included first to avoid conflicts.
-#include <QtCore/QCoreApplication>
-#include <QtCore/QEventLoop>
-#include "NestedLoopTimer.h"
+#include "PluginHelperQt.h"
 #endif
 
 #include "mozilla/plugins/PluginModuleParent.h"
 
 #include "base/process_util.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/ContentChild.h"
@@ -1641,23 +1638,21 @@ PluginModuleParent::ContentsScaleFactorC
     if (!i)
         return NS_ERROR_FAILURE;
 
     return i->ContentsScaleFactorChanged(aContentsScaleFactor);
 }
 #endif // #if defined(XP_MACOSX)
 
 #if defined(MOZ_WIDGET_QT)
-static const int kMaxtimeToProcessEvents = 30;
 bool
 PluginModuleParent::AnswerProcessSomeEvents()
 {
     PLUGIN_LOG_DEBUG(("Spinning mini nested loop ..."));
-    QCoreApplication::processEvents(QEventLoop::AllEvents, kMaxtimeToProcessEvents);
-
+    PluginHelperQt::AnswerProcessSomeEvents();
     PLUGIN_LOG_DEBUG(("... quitting mini nested loop"));
 
     return true;
 }
 
 #elif defined(XP_MACOSX)
 bool
 PluginModuleParent::AnswerProcessSomeEvents()
--- a/dom/plugins/ipc/moz.build
+++ b/dom/plugins/ipc/moz.build
@@ -65,18 +65,19 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
     EXPORTS.mozilla.plugins += [
         'PluginInterposeOSX.h',
     ]
 
 if CONFIG['MOZ_ENABLE_QT']:
     GENERATED_SOURCES += [
         'moc_NestedLoopTimer.cpp',
     ]
-    UNIFIED_SOURCES += [
+    SOURCES += [
         'NestedLoopTimer.cpp',
+        'PluginHelperQt.cpp',
     ]
 
 UNIFIED_SOURCES += [
     'BrowserStreamChild.cpp',
     'BrowserStreamParent.cpp',
     'ChildAsyncCall.cpp',
     'ChildTimer.cpp',
     'PluginBackgroundDestroyer.cpp',
--- a/gfx/2d/moz.build
+++ b/gfx/2d/moz.build
@@ -84,27 +84,31 @@ if CONFIG['MOZ_ENABLE_SKIA']:
     ]
 
 # Are we targeting x86 or x64?  If so, build SSE2 files.
 if CONFIG['INTEL_ARCHITECTURE']:
     # VC2005 doesn't support _mm_castsi128_ps, so SSE2 is turned off
     if CONFIG['_MSC_VER'] != '1400':
         SOURCES += [
             'BlurSSE2.cpp',
-            'convolverSSE2.cpp',
             'FilterProcessingSSE2.cpp',
             'ImageScalingSSE2.cpp',
         ]
+        if CONFIG['MOZ_ENABLE_SKIA']:
+            SOURCES += [
+                'convolverSSE2.cpp',
+            ]
         DEFINES['USE_SSE2'] = True
         # The file uses SSE2 intrinsics, so it needs special compile flags on some
         # compilers.
         SOURCES['BlurSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
         SOURCES['FilterProcessingSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
         SOURCES['ImageScalingSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
-        SOURCES['convolverSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
+        if CONFIG['MOZ_ENABLE_SKIA']:
+            SOURCES['convolverSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
 
 UNIFIED_SOURCES += [
     'Blur.cpp',
     'DataSourceSurface.cpp',
     'DataSurfaceHelpers.cpp',
     'DrawEventRecorder.cpp',
     'DrawTarget.cpp',
     'DrawTargetCairo.cpp',
--- a/gfx/thebes/gfxQtPlatform.cpp
+++ b/gfx/thebes/gfxQtPlatform.cpp
@@ -2,17 +2,16 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <QPixmap>
 #include <QWindow>
 #ifdef MOZ_X11
 #include <qpa/qplatformnativeinterface.h>
-#include <qpa/qplatformintegration.h>
 #endif
 #include <QGuiApplication>
 #include <QScreen>
 
 #include "gfxQtPlatform.h"
 
 #include "gfxFontconfigUtils.h"
 
--- a/ipc/chromium/src/base/message_pump_qt.cc
+++ b/ipc/chromium/src/base/message_pump_qt.cc
@@ -10,17 +10,16 @@
 
 #include "base/message_pump_qt.h"
 
 #include <fcntl.h>
 #include <limits>
 #include <math.h>
 
 #include "base/eintr_wrapper.h"
-#include "base/lazy_instance.h"
 #include "base/logging.h"
 #include "base/platform_thread.h"
 
 namespace {
 // Cached QEvent user type, registered for our event system
 static int sPokeEvent;
 }  // namespace
 
--- a/uriloader/exthandler/moz.build
+++ b/uriloader/exthandler/moz.build
@@ -79,16 +79,19 @@ if CONFIG['MOZ_ENABLE_GTK']:
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     UNIFIED_SOURCES += [
         'android/nsAndroidHandlerApp.cpp',
         'android/nsExternalSharingAppService.cpp',
         'android/nsExternalURLHandlerService.cpp',
         'android/nsMIMEInfoAndroid.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
+    SOURCES += [
+        'unix/nsMIMEInfoQt.cpp',
+    ]
     UNIFIED_SOURCES += [
         'unix/nsGNOMERegistry.cpp',
         'unix/nsMIMEInfoUnix.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     UNIFIED_SOURCES += [
         'win/nsMIMEInfoWin.cpp',
     ]
new file mode 100644
--- /dev/null
+++ b/uriloader/exthandler/unix/nsMIMEInfoQt.cpp
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifdef MOZ_WIDGET_QT
+#include <QDesktopServices>
+#include <QUrl>
+#include <QString>
+#include <QStringList>
+#endif
+
+#include "nsMIMEInfoQt.h"
+#include "nsIURI.h"
+#include "nsStringGlue.h"
+
+nsresult
+nsMIMEInfoQt::LoadUriInternal(nsIURI * aURI)
+{
+#ifdef MOZ_WIDGET_QT
+  nsAutoCString spec;
+  aURI->GetAsciiSpec(spec);
+  if (QDesktopServices::openUrl(QUrl(spec.get()))) {
+    return NS_OK;
+  }
+#endif
+
+  return NS_ERROR_FAILURE;
+}
new file mode 100644
--- /dev/null
+++ b/uriloader/exthandler/unix/nsMIMEInfoQt.h
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsMIMEInfoQt_h_
+#define nsMIMEInfoQt_h_
+
+#include "nsCOMPtr.h"
+
+class nsIURI;
+
+class nsMIMEInfoQt
+{
+public:
+  static nsresult LoadUriInternal(nsIURI * aURI);
+};
+
+#endif // nsMIMEInfoQt_h_
--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
+++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
@@ -1,47 +1,43 @@
 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifdef MOZ_WIDGET_QT
-#include <QDesktopServices>
-#include <QUrl>
-#include <QString>
 #if (MOZ_ENABLE_CONTENTACTION)
 #include <contentaction/contentaction.h>
 #include "nsContentHandlerApp.h"
 #endif
 #endif
 
 #include "nsMIMEInfoUnix.h"
 #include "nsGNOMERegistry.h"
 #include "nsIGIOService.h"
 #include "nsNetCID.h"
 #include "nsIIOService.h"
 #include "nsIGnomeVFSService.h"
 #include "nsAutoPtr.h"
 #ifdef MOZ_ENABLE_DBUS
 #include "nsDBusHandlerApp.h"
 #endif
+#ifdef MOZ_WIDGET_QT
+#include "nsMIMEInfoQt.h"
+#endif
 
 nsresult
 nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
 {
   nsresult rv = nsGNOMERegistry::LoadURL(aURI);
 
 #ifdef MOZ_WIDGET_QT
   if (NS_FAILED(rv)) {
-    nsAutoCString spec;
-    aURI->GetAsciiSpec(spec);
-    if (QDesktopServices::openUrl(QUrl(spec.get()))) {
-      rv = NS_OK;
-    }
+    rv = nsMIMEInfoQt::LoadUriInternal(aURI);
   }
 #endif
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval)
--- a/widget/qt/moz.build
+++ b/widget/qt/moz.build
@@ -37,17 +37,17 @@ include('/ipc/chromium/chromium-config.m
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/widget',
 ]
 
 if CONFIG['MOZ_X11']:
     LOCAL_INCLUDES += [
-        '../shared/x11',
+        '../x11',
     ]
 
 #DEFINES['DEBUG_WIDGETS'] = True
 
 if CONFIG['OS_ARCH'] == 'Linux':
     DEFINES['_BSD_SOURCE'] = True
 
 if CONFIG['OS_ARCH'] == 'SunOS' and not CONFIG['GNU_CC']:
--- a/widget/qt/nsPrintSettingsQt.cpp
+++ b/widget/qt/nsPrintSettingsQt.cpp
@@ -286,33 +286,27 @@ static const QPrinter::PageSize indexToQ
     QPrinter::B4, QPrinter::B6, QPrinter::B7, QPrinter::B8, QPrinter::B9,
     QPrinter::C5E, QPrinter::Comm10E, QPrinter::DLE, QPrinter::Folio,
     QPrinter::Ledger, QPrinter::Tabloid
 };
 
 NS_IMETHODIMP
 nsPrintSettingsQt::GetPaperName(char16_t** aPaperName)
 {
-    PR_STATIC_ASSERT(sizeof(indexToPaperName)/
-        sizeof(char*) == QPrinter::NPageSize);
-    PR_STATIC_ASSERT(sizeof(indexToQtPaperEnum)/
-        sizeof(QPrinter::PageSize) == QPrinter::NPageSize);
-
     QPrinter::PaperSize size = mQPrinter->paperSize();
     QString name(indexToPaperName[size]);
-    *aPaperName = ToNewUnicode(nsDependentString
-        ((const char16_t*)name.constData()));
+    *aPaperName = ToNewUnicode(nsDependentString((const char16_t*)name.constData()));
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrintSettingsQt::SetPaperName(const char16_t* aPaperName)
 {
     QString ref((QChar*)aPaperName, NS_strlen(aPaperName));
-    for (uint32_t i = 0; i < QPrinter::NPageSize; i++)
+    for (uint32_t i = 0; i < sizeof(indexToPaperName)/sizeof(char*); i++)
     {
         if (ref == QString(indexToPaperName[i])) {
             mQPrinter->setPageSize(indexToQtPaperEnum[i]);
             return NS_OK;
         }
     }
     return NS_ERROR_FAILURE;
 }