Title: [99872] trunk
Revision
99872
Author
[email protected]
Date
2011-11-10 09:32:31 -0800 (Thu, 10 Nov 2011)

Log Message

[Qt] X11 plugins need to be reworked for Qt5
https://bugs.webkit.org/show_bug.cgi?id=70023

Reviewed by Simon Hausmann.

.:

Rework our basic plugin support in a way that does
not need a bridge between Qt and X. The solution is
based on getting the content drawed by the plugin
from the server as an image and creating a QImage
from it.

* Source/api.pri: Link to xlib if necessary.

Source/WebCore:

Rework our basic plugin support in a way that does
not need a bridge between Qt and X. The solution is
based on getting the content drawed by the plugin
from the server as an image and creating a QImage
from it.

No new tests. Existing plugin test are sufficient.

* Target.pri:
* bridge/npruntime_internal.h: Added yet another undef
to fix build with Qt5 + X11 headers.
* plugins/qt/QtX11ImageConversion.cpp: Added.
(WebCore::qimageFromXImage):
* plugins/qt/QtX11ImageConversion.h: Added.
Added a helper function to create a QImage from an XImage.
Put it in a new file into WebCore to avoid copyright issues - as
the code has been taken directly from Qt - and to be able to resuse
it for the WK1 plugin support in the future.

Source/WebKit2:

* Target.pri:
* UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
(WebKit::PluginInfoStore::pluginsDirectories):
Kill the last dependency from the WebKit1 plugin system.
This is necessary because currently we don't build the WebKit1
plugin code. The function is equivalent with the XP_UNIX part of
PluginDatabase::defaultPluginDirectories.

* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_GetValue):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
(WebKit::getPluginDisplay):
(WebKit::x11Screen):
(WebKit::displayDepth):
(WebKit::rootWindowID):
(WebKit::NetscapePlugin::x11HostDisplay):
(WebKit::NetscapePlugin::platformPostInitialize):
(WebKit::NetscapePlugin::platformDestroy):
(WebKit::NetscapePlugin::platformGeometryDidChange):
(WebKit::NetscapePlugin::platformPaint):
(WebKit::initializeXEvent):
Rework plugin initialization and drawing model.

Tools:

Rework our basic plugin support in a way that does
not need a bridge between Qt and X. The solution is
based on getting the content drawed by the plugin
from the server as an image and creating a QImage
from it.

* qmake/mkspecs/features/features.prf: Enable X11
plugins if Qt is built with the xcb-xlib backend.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (99871 => 99872)


--- trunk/ChangeLog	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/ChangeLog	2011-11-10 17:32:31 UTC (rev 99872)
@@ -1,3 +1,18 @@
+2011-11-10  Balazs Kelemen  <[email protected]>
+
+        [Qt] X11 plugins need to be reworked for Qt5
+        https://bugs.webkit.org/show_bug.cgi?id=70023
+
+        Reviewed by Simon Hausmann.
+
+        Rework our basic plugin support in a way that does
+        not need a bridge between Qt and X. The solution is
+        based on getting the content drawed by the plugin
+        from the server as an image and creating a QImage
+        from it.
+
+        * Source/api.pri: Link to xlib if necessary.
+
 2011-11-10  Simon Hausmann  <[email protected]>
 
         [Qt] Clean up build system

Modified: trunk/Source/WebCore/ChangeLog (99871 => 99872)


--- trunk/Source/WebCore/ChangeLog	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/WebCore/ChangeLog	2011-11-10 17:32:31 UTC (rev 99872)
@@ -1,3 +1,29 @@
+2011-11-10  Balazs Kelemen  <[email protected]>
+
+        [Qt] X11 plugins need to be reworked for Qt5
+        https://bugs.webkit.org/show_bug.cgi?id=70023
+
+        Reviewed by Simon Hausmann.
+
+        Rework our basic plugin support in a way that does
+        not need a bridge between Qt and X. The solution is
+        based on getting the content drawed by the plugin
+        from the server as an image and creating a QImage
+        from it.
+
+        No new tests. Existing plugin test are sufficient.
+
+        * Target.pri:
+        * bridge/npruntime_internal.h: Added yet another undef
+        to fix build with Qt5 + X11 headers.
+        * plugins/qt/QtX11ImageConversion.cpp: Added.
+        (WebCore::qimageFromXImage):
+        * plugins/qt/QtX11ImageConversion.h: Added.
+        Added a helper function to create a QImage from an XImage.
+        Put it in a new file into WebCore to avoid copyright issues - as
+        the code has been taken directly from Qt - and to be able to resuse
+        it for the WK1 plugin support in the future.
+
 2011-11-10  Andreas Kling  <[email protected]>
 
         Cache and reuse HTMLCollections exposed by Document.

Modified: trunk/Source/WebCore/Target.pri (99871 => 99872)


--- trunk/Source/WebCore/Target.pri	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/WebCore/Target.pri	2011-11-10 17:32:31 UTC (rev 99872)
@@ -2864,6 +2864,11 @@
         plugins/PluginViewNone.cpp
 }
 
+plugin_backend_xlib {
+    SOURCES += plugins/qt/QtX11ImageConversion.cpp
+    HEADERS += plugins/qt/QtX11ImageConversion.h
+}
+
 contains(DEFINES, ENABLE_SQL_DATABASE=1) {
     SOURCES += \
         storage/ChangeVersionWrapper.cpp \

Modified: trunk/Source/WebCore/bridge/npruntime_internal.h (99871 => 99872)


--- trunk/Source/WebCore/bridge/npruntime_internal.h	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/WebCore/bridge/npruntime_internal.h	2011-11-10 17:32:31 UTC (rev 99872)
@@ -51,4 +51,5 @@
     #undef True
     #undef False
     #undef Success
+    #undef Expose
 #endif

Added: trunk/Source/WebCore/plugins/qt/QtX11ImageConversion.cpp (0 => 99872)


--- trunk/Source/WebCore/plugins/qt/QtX11ImageConversion.cpp	                        (rev 0)
+++ trunk/Source/WebCore/plugins/qt/QtX11ImageConversion.cpp	2011-11-10 17:32:31 UTC (rev 99872)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "QtX11ImageConversion.h"
+
+namespace WebCore {
+
+QImage qimageFromXImage(XImage* xi)
+{
+    QImage::Format format = QImage::Format_ARGB32_Premultiplied;
+    if (xi->depth == 24)
+        format = QImage::Format_RGB32;
+    else if (xi->depth == 16)
+        format = QImage::Format_RGB16;
+
+    QImage image = QImage(reinterpret_cast<uchar*>(xi->data), xi->width, xi->height, xi->bytes_per_line, format).copy();
+
+    // we may have to swap the byte order
+    if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst)
+        || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) {
+
+        for (int i = 0; i < image.height(); i++) {
+            if (xi->depth == 16) {
+                ushort* p = reinterpret_cast<ushort*>(image.scanLine(i));
+                ushort* end = p + image.width();
+                while (p < end) {
+                    *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff);
+                    p++;
+                }
+            } else {
+                uint* p = reinterpret_cast<uint*>(image.scanLine(i));
+                uint* end = p + image.width();
+                while (p < end) {
+                    *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000)
+                         | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff);
+                    p++;
+                }
+            }
+        }
+    }
+
+    // fix-up alpha channel
+    if (format == QImage::Format_RGB32) {
+        QRgb* p = reinterpret_cast<QRgb*>(image.bits());
+        for (int y = 0; y < xi->height; ++y) {
+            for (int x = 0; x < xi->width; ++x)
+                p[x] |= 0xff000000;
+            p += xi->bytes_per_line / 4;
+        }
+    }
+
+    return image;
+}
+
+} // namespace WebKit

Added: trunk/Source/WebCore/plugins/qt/QtX11ImageConversion.h (0 => 99872)


--- trunk/Source/WebCore/plugins/qt/QtX11ImageConversion.h	                        (rev 0)
+++ trunk/Source/WebCore/plugins/qt/QtX11ImageConversion.h	2011-11-10 17:32:31 UTC (rev 99872)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef QtX11ImageConversion_h
+#define QtX11ImageConversion_h
+
+#include <QImage>
+#include <X11/Xlib.h>
+
+namespace WebCore {
+
+QImage qimageFromXImage(XImage*);
+
+}
+
+#endif

Modified: trunk/Source/WebKit2/ChangeLog (99871 => 99872)


--- trunk/Source/WebKit2/ChangeLog	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-10 17:32:31 UTC (rev 99872)
@@ -1,3 +1,34 @@
+2011-11-10  Balazs Kelemen  <[email protected]>
+
+        [Qt] X11 plugins need to be reworked for Qt5
+        https://bugs.webkit.org/show_bug.cgi?id=70023
+
+        Reviewed by Simon Hausmann.
+
+        * Target.pri:
+        * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
+        (WebKit::PluginInfoStore::pluginsDirectories):
+        Kill the last dependency from the WebKit1 plugin system.
+        This is necessary because currently we don't build the WebKit1
+        plugin code. The function is equivalent with the XP_UNIX part of
+        PluginDatabase::defaultPluginDirectories.
+
+        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+        (WebKit::NPN_GetValue):
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
+        (WebKit::getPluginDisplay):
+        (WebKit::x11Screen):
+        (WebKit::displayDepth):
+        (WebKit::rootWindowID):
+        (WebKit::NetscapePlugin::x11HostDisplay):
+        (WebKit::NetscapePlugin::platformPostInitialize):
+        (WebKit::NetscapePlugin::platformDestroy):
+        (WebKit::NetscapePlugin::platformGeometryDidChange):
+        (WebKit::NetscapePlugin::platformPaint):
+        (WebKit::initializeXEvent):
+        Rework plugin initialization and drawing model.
+
 2011-11-10  Martin Robinson  <[email protected]>
 
         [GTK] [WebKit2] Fix remaining gtkdoc errors

Modified: trunk/Source/WebKit2/Target.pri (99871 => 99872)


--- trunk/Source/WebKit2/Target.pri	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/WebKit2/Target.pri	2011-11-10 17:32:31 UTC (rev 99872)
@@ -744,10 +744,6 @@
     WebProcess/qt/WebProcessQt.cpp \
     $$WEBKIT2_GENERATED_SOURCES
 
-contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=0) {
-    DEFINES += PLUGIN_ARCHITECTURE_UNSUPPORTED
-}
-
 contains(DEFINES, ENABLE_TOUCH_EVENTS=1) {
     HEADERS += \
         Shared/NativeWebTouchEvent.h
@@ -756,3 +752,7 @@
 }
 
 contains(DEFINES, ENABLE_GEOLOCATION=1): QT += location
+
+plugin_backend_xlib {
+    DEFINES += XP_UNIX
+}

Modified: trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp (99871 => 99872)


--- trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp	2011-11-10 17:32:31 UTC (rev 99872)
@@ -30,6 +30,7 @@
 
 #include "NetscapePluginModule.h"
 #include "PluginDatabase.h"
+#include <WebCore/FileSystem.h>
 
 using namespace WebCore;
 
@@ -37,7 +38,41 @@
 
 Vector<String> PluginInfoStore::pluginsDirectories()
 {
-    return PluginDatabase::defaultPluginDirectories();
+    Vector<String> result;
+
+    result.append(homeDirectoryPath() + "/.mozilla/plugins");
+    result.append(homeDirectoryPath() + "/.netscape/plugins");
+    result.append("/usr/lib/browser/plugins");
+    result.append("/usr/local/lib/mozilla/plugins");
+    result.append("/usr/lib/firefox/plugins");
+    result.append("/usr/lib64/browser-plugins");
+    result.append("/usr/lib/browser-plugins");
+    result.append("/usr/lib/mozilla/plugins");
+    result.append("/usr/local/netscape/plugins");
+    result.append("/opt/mozilla/plugins");
+    result.append("/opt/mozilla/lib/plugins");
+    result.append("/opt/netscape/plugins");
+    result.append("/opt/netscape/communicator/plugins");
+    result.append("/usr/lib/netscape/plugins");
+    result.append("/usr/lib/netscape/plugins-libc5");
+    result.append("/usr/lib/netscape/plugins-libc6");
+    result.append("/usr/lib64/netscape/plugins");
+    result.append("/usr/lib64/mozilla/plugins");
+    result.append("/usr/lib/nsbrowser/plugins");
+    result.append("/usr/lib64/nsbrowser/plugins");
+
+    String mozillaHome(getenv("MOZILLA_HOME"));
+    if (!mozillaHome.isEmpty())
+        result.append(mozillaHome + "/plugins");
+
+    String mozillaPaths(getenv("MOZ_PLUGIN_PATH"));
+    if (!mozillaPaths.isEmpty()) {
+        Vector<String> paths;
+        mozillaPaths.split(UChar(':'), /* allowEmptyEntries */ false, paths);
+        result.append(paths);
+    }
+
+    return result;
 }
 
 Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory)

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp (99871 => 99872)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp	2011-11-10 17:32:31 UTC (rev 99872)
@@ -36,14 +36,6 @@
 #include <WebCore/SharedBuffer.h>
 #include <utility>
 
-#if PLUGIN_ARCHITECTURE(X11)
-#if PLATFORM(QT)
-#include <QX11Info>
-#elif PLATFORM(GTK)
-#include <gdk/gdkx.h>
-#endif
-#endif
-
 using namespace WebCore;
 using namespace std;
 
@@ -527,15 +519,8 @@
        case NPNVxDisplay: {
            if (!npp)
                return NPERR_GENERIC_ERROR;
-#if PLATFORM(QT)
-           *reinterpret_cast<Display**>(value) = QX11Info::display();
+           *reinterpret_cast<Display**>(value) = NetscapePlugin::x11HostDisplay();
            break;
-#elif PLATFORM(GTK)
-           *reinterpret_cast<Display**>(value) = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
-           break;
-#else
-           goto default;
-#endif
        }
        case NPNVSupportsXEmbedBool:
            *static_cast<NPBool*>(value) = true;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (99871 => 99872)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-11-10 17:32:31 UTC (rev 99872)
@@ -341,6 +341,9 @@
 #elif PLUGIN_ARCHITECTURE(X11)
     Pixmap m_drawable;
     Display* m_pluginDisplay;
+
+public: // Need to call it in the NPN_GetValue browser callback.
+    static Display* x11HostDisplay();
 #endif
 };
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp (99871 => 99872)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2011-11-10 17:32:31 UTC (rev 99872)
@@ -34,10 +34,7 @@
 #include <WebCore/NotImplemented.h>
 
 #if PLATFORM(QT)
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QPixmap>
-#include <QX11Info>
+#include <WebCore/QtX11ImageConversion.h>
 #elif PLATFORM(GTK)
 #include "PlatformContextCairo.h"
 #include "RefPtrCairo.h"
@@ -50,7 +47,7 @@
 
 namespace WebKit {
 
-static Display *getPluginDisplay()
+static Display* getPluginDisplay()
 {
 #if PLATFORM(QT)
     // At the moment, we only support gdk based plugins (like Flash) that use a different X connection.
@@ -87,12 +84,12 @@
 #endif
 }
 
-static inline Display* x11Display()
+static inline int x11Screen()
 {
 #if PLATFORM(QT)
-    return QX11Info::display();
+    return XDefaultScreen(NetscapePlugin::x11HostDisplay());
 #elif PLATFORM(GTK)
-    return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+    return gdk_screen_get_number(gdk_screen_get_default());
 #else
     return 0;
 #endif
@@ -101,7 +98,7 @@
 static inline int displayDepth()
 {
 #if PLATFORM(QT)
-    return QApplication::desktop()->x11Info().depth();
+    return XDefaultDepth(NetscapePlugin::x11HostDisplay(), x11Screen());
 #elif PLATFORM(GTK)
     return gdk_visual_get_depth(gdk_screen_get_system_visual(gdk_screen_get_default()));
 #else
@@ -112,7 +109,7 @@
 static inline unsigned long rootWindowID()
 {
 #if PLATFORM(QT)
-    return QX11Info::appRootWindow();
+    return XDefaultRootWindow(NetscapePlugin::x11HostDisplay());
 #elif PLATFORM(GTK)
     return GDK_ROOT_WINDOW();
 #else
@@ -120,17 +117,6 @@
 #endif
 }
 
-static inline int x11Screen()
-{
-#if PLATFORM(QT)
-    return QX11Info::appScreen();
-#elif PLATFORM(GTK)
-    return gdk_screen_get_number(gdk_screen_get_default());
-#else
-    return 0;
-#endif
-}
-
 #if PLATFORM(GTK)
 static bool moduleMixesGtkSymbols(Module* module)
 {
@@ -142,6 +128,22 @@
 }
 #endif
 
+Display* NetscapePlugin::x11HostDisplay()
+{
+#if PLATFORM(QT)
+    static Display* dedicatedDisplay = 0;
+    if (!dedicatedDisplay)
+        dedicatedDisplay = XOpenDisplay(0);
+
+    ASSERT(dedicatedDisplay);
+    return dedicatedDisplay;
+#elif PLATFORM(GTK)
+    return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+#else
+    return 0;
+#endif
+}
+
 bool NetscapePlugin::platformPostInitialize()
 {
 #if PLATFORM(GTK)
@@ -157,8 +159,11 @@
 
     NPSetWindowCallbackStruct* callbackStruct = new NPSetWindowCallbackStruct;
     callbackStruct->type = 0;
-    Display* display = x11Display();
+    Display* display = x11HostDisplay();
     int depth = displayDepth();
+#if PLATFORM(QT)
+    ASSERT(depth == 16 || depth == 24 || depth == 32);
+#endif
     callbackStruct->display = display;
     callbackStruct->depth = depth;
 
@@ -191,7 +196,7 @@
     delete static_cast<NPSetWindowCallbackStruct*>(m_npWindow.ws_info);
 
     if (m_drawable) {
-        XFreePixmap(x11Display(), m_drawable);
+        XFreePixmap(x11HostDisplay(), m_drawable);
         m_drawable = 0;
     }
 }
@@ -209,7 +214,7 @@
         return;
     }
 
-    Display* display = x11Display();
+    Display* display = x11HostDisplay();
     if (m_drawable)
         XFreePixmap(display, m_drawable);
 
@@ -243,17 +248,11 @@
     if (context->paintingDisabled() || !m_drawable)
         return;
 
-#if PLATFORM(QT)
-#elif !PLATFORM(GTK)
-    notImplemented();
-    return;
-#endif
-
     XEvent xevent;
     memset(&xevent, 0, sizeof(XEvent));
     XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose;
     exposeEvent.type = GraphicsExpose;
-    exposeEvent.display = x11Display();
+    exposeEvent.display = x11HostDisplay();
     exposeEvent.drawable = m_drawable;
 
     IntRect exposedRect(dirtyRect);
@@ -267,14 +266,16 @@
 
     NPP_HandleEvent(&xevent);
 
-    if (m_pluginDisplay != x11Display())
+    if (m_pluginDisplay != x11HostDisplay())
         XSync(m_pluginDisplay, false);
 
 #if PLATFORM(QT)
-    QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared);
-    ASSERT(qtDrawable.depth() == static_cast<NPSetWindowCallbackStruct*>(m_npWindow.ws_info)->depth);
+    XImage* xImage = XGetImage(NetscapePlugin::x11HostDisplay(), m_drawable, exposedRect.x(), exposedRect.y(),
+                               exposedRect.width(), exposedRect.height(), ULONG_MAX, ZPixmap);
     QPainter* painter = context->platformContext();
-    painter->drawPixmap(QPoint(exposedRect.x(), exposedRect.y()), qtDrawable, exposedRect);
+    painter->drawImage(QPoint(exposedRect.x(), exposedRect.y()), qimageFromXImage(xImage), exposedRect);
+
+    XDestroyImage(xImage);
 #elif PLATFORM(GTK)
     RefPtr<cairo_surface_t> drawableSurface = adoptRef(cairo_xlib_surface_create(m_pluginDisplay,
                                                                                  m_drawable,
@@ -292,6 +293,8 @@
     cairo_paint(cr);
 
     cairo_restore(cr);
+#else
+    notImplemented();
 #endif
 }
 
@@ -300,7 +303,7 @@
     memset(&event, 0, sizeof(XEvent));
     event.xany.serial = 0;
     event.xany.send_event = false;
-    event.xany.display = x11Display();
+    event.xany.display = NetscapePlugin::x11HostDisplay();
     event.xany.window = 0;
 }
 

Modified: trunk/Source/api.pri (99871 => 99872)


--- trunk/Source/api.pri	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Source/api.pri	2011-11-10 17:32:31 UTC (rev 99872)
@@ -222,3 +222,7 @@
     QMAKE_LFLAGS_SONAME = "$${QMAKE_LFLAGS_SONAME}$${DESTDIR}$${QMAKE_DIR_SEP}"
 }
 
+plugin_backend_xlib {
+    CONFIG *= link_pkgconfig
+    PKGCONFIG += x11
+}

Modified: trunk/Tools/ChangeLog (99871 => 99872)


--- trunk/Tools/ChangeLog	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Tools/ChangeLog	2011-11-10 17:32:31 UTC (rev 99872)
@@ -1,3 +1,19 @@
+2011-11-10  Balazs Kelemen  <[email protected]>
+
+        [Qt] X11 plugins need to be reworked for Qt5
+        https://bugs.webkit.org/show_bug.cgi?id=70023
+
+        Reviewed by Simon Hausmann.
+
+        Rework our basic plugin support in a way that does
+        not need a bridge between Qt and X. The solution is
+        based on getting the content drawed by the plugin
+        from the server as an image and creating a QImage
+        from it.
+
+        * qmake/mkspecs/features/features.prf: Enable X11
+        plugins if Qt is built with the xcb-xlib backend.
+
 2011-11-10  Simon Hausmann  <[email protected]>
 
         [Qt] Fix keyboard related layout tests after API refactoring

Modified: trunk/Tools/qmake/mkspecs/features/features.prf (99871 => 99872)


--- trunk/Tools/qmake/mkspecs/features/features.prf	2011-11-10 17:25:58 UTC (rev 99871)
+++ trunk/Tools/qmake/mkspecs/features/features.prf	2011-11-10 17:32:31 UTC (rev 99872)
@@ -96,6 +96,17 @@
     }
 }
 
+# Netscape plugins support for WebKit2
+!no_webkit2:!contains(DEFINES, PLUGIN_ARCHITECTURE_UNSUPPORTED): {
+    contains(QT_CONFIG, xcb-xlib) {
+        CONFIG += plugin_backend_xlib
+        DEFINES += PLUGIN_ARCHITECTURE_X11=1 \
+                   PLUGIN_ARCHITECTURE_UNSUPPORTED=0
+    } else {
+        DEFINES += PLUGIN_ARCHITECTURE_UNSUPPORTED=1
+    }
+}
+
 # WebGL support
 contains(QT_CONFIG, opengl):!win32-* {
     !contains(DEFINES, ENABLE_WEBGL=.): DEFINES += ENABLE_WEBGL=1
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to