[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

hausmann at webkit.org hausmann at webkit.org
Thu Oct 29 20:39:52 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit fba6730fdab0c4692872bf531319120797344f48
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 6 07:35:37 2009 +0000

    [Qt] Windowless plugins: Use X Pixmap instead of QPixmap.
    
    Patch by Girish Ramakrishnan <girish at forwardbias.in> on 2009-10-06
    Reviewed by Simon Hausmann.
    
    This has the following advantages:
    1. Allows more sharing of code between gtk and Qt ports in the future
    2. QPixmap creates 24-bit by default. We have to later 'upgrade' it to 32-bit.
    3. QPixmap may sometime change depth behind our back! This will require us to
    update the plugin about the new visual and colormap.
    4. We cannot ensure that QPixmap is backed by a X Drawable. For example, with
    -graphicssystem raster, QPixmap uses the raster (image) backend.
    
    https://bugs.webkit.org/show_bug.cgi?id=20081
    
    * plugins/PluginView.cpp:
    (WebCore::PluginView::PluginView):
    * plugins/PluginView.h:
    * plugins/qt/PluginViewQt.cpp:
    (WebCore::PluginView::updatePluginWidget):
    (WebCore::PluginView::paint):
    (WebCore::PluginView::platformDestroy):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49159 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 80e702e..58d8287 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,30 @@
 
         Reviewed by Simon Hausmann.
 
+        [Qt] Windowless plugins: Use X Pixmap instead of QPixmap.
+
+        This has the following advantages:
+        1. Allows more sharing of code between gtk and Qt ports in the future
+        2. QPixmap creates 24-bit by default. We have to later 'upgrade' it to 32-bit.
+        3. QPixmap may sometime change depth behind our back! This will require us to
+        update the plugin about the new visual and colormap.
+        4. We cannot ensure that QPixmap is backed by a X Drawable. For example, with
+        -graphicssystem raster, QPixmap uses the raster (image) backend.
+
+        https://bugs.webkit.org/show_bug.cgi?id=20081
+
+        * plugins/PluginView.cpp:
+        (WebCore::PluginView::PluginView):
+        * plugins/PluginView.h:
+        * plugins/qt/PluginViewQt.cpp:
+        (WebCore::PluginView::updatePluginWidget):
+        (WebCore::PluginView::paint):
+        (WebCore::PluginView::platformDestroy):
+
+2009-10-06  Girish Ramakrishnan  <girish at forwardbias.in>
+
+        Reviewed by Simon Hausmann.
+
         [Qt] Add support for windowless NPAPI plugins
 
         https://bugs.webkit.org/show_bug.cgi?id=20081
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index 75e9768..5770886 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -820,6 +820,7 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p
 #endif
 #if defined(Q_WS_X11)
     , m_hasPendingGeometryChange(false)
+    , m_drawable(0)
     , m_pluginDisplay(0)
 #endif
     , m_loadManually(loadManually)
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index 630b196..e7b2293 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -52,10 +52,6 @@ typedef HWND PlatformPluginWidget;
 typedef PlatformWidget PlatformPluginWidget;
 #endif
 
-#if defined(Q_WS_X11)
-#include <QPixmap>
-#endif
-
 namespace JSC {
     namespace Bindings {
         class Instance;
@@ -330,7 +326,7 @@ private:
 
 #if defined(Q_WS_X11)
         bool m_hasPendingGeometryChange;
-        QPixmap m_drawable;
+        Pixmap m_drawable;
         Display* m_pluginDisplay;
 
         void initXEvent(XEvent* event);
diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp
index ef40d0d..c5b2b26 100644
--- a/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/WebCore/plugins/qt/PluginViewQt.cpp
@@ -101,7 +101,11 @@ void PluginView::updatePluginWidget()
     if (m_windowRect == oldWindowRect && m_clipRect == oldClipRect)
         return;
 
-    m_drawable = QPixmap(m_windowRect.width(), m_windowRect.height());
+    if (m_drawable)
+        XFreePixmap(QX11Info::display(), m_drawable);
+
+    if (!m_isWindowed)
+        m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), QX11Info::appDepth());
 
     // do not call setNPWindowIfNeeded immediately, will be called on paint()
     m_hasPendingGeometryChange = true;
@@ -166,9 +170,11 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
 
     QPainter* painter = context->platformContext();
     const bool isPaintingOnWidget = painter->device()->devType() == QInternal::Widget;
-    if (!isPaintingOnWidget || m_drawable.handle() == 0)
+    if (!isPaintingOnWidget || !m_drawable)
         return;
 
+    QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared);
+
     if (m_isTransparent) {
         // Attempt content propagation by copying over from the backing store
         QPoint offset;
@@ -177,13 +183,13 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
         offset = -offset; // negating the offset gives us the offset of the view within the backing store pixmap
 
         if (hasValidBackingStore) {
-            QPixmap* backingStorePixmap = static_cast<QPixmap *>(backingStoreDevice);
+            QPixmap* backingStorePixmap = static_cast<QPixmap*>(backingStoreDevice);
             GC gc = XDefaultGC(QX11Info::display(), QX11Info::appScreen());
-            XCopyArea(QX11Info::display(), backingStorePixmap->handle(), m_drawable.handle(), gc,
+            XCopyArea(QX11Info::display(), backingStorePixmap->handle(), m_drawable, gc,
                 offset.x() + m_windowRect.x() + m_clipRect.x(), offset.y() + m_windowRect.y() + m_clipRect.y(),
                 m_clipRect.width(), m_clipRect.height(), m_clipRect.x(), m_clipRect.y());
         } else { // no backing store, clean the pixmap
-            QPainter painter(&m_drawable);
+            QPainter painter(&qtDrawable);
             painter.fillRect(m_clipRect, Qt::white);
         }
     }
@@ -200,7 +206,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
     XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose;
     exposeEvent.type = GraphicsExpose;
     exposeEvent.display = QX11Info::display();
-    exposeEvent.drawable = m_drawable.handle();
+    exposeEvent.drawable = m_drawable;
     exposeEvent.x = m_clipRect.x();
     exposeEvent.y = m_clipRect.y();
     exposeEvent.width = m_clipRect.x() + m_clipRect.width(); // flash bug? it thinks width is the right
@@ -211,7 +217,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
     if (syncX)
         XSync(m_pluginDisplay, False); // sync changes by plugin
 
-    painter->drawPixmap(frameRect().x() + m_clipRect.x(), frameRect().y() + m_clipRect.y(), m_drawable,
+    painter->drawPixmap(frameRect().x() + m_clipRect.x(), frameRect().y() + m_clipRect.y(), qtDrawable,
         m_clipRect.x(), m_clipRect.y(), m_clipRect.width(), m_clipRect.height());
 }
 
@@ -706,9 +712,9 @@ bool PluginView::platformStart()
 
     show();
 
-    NPSetWindowCallbackStruct *wsi = new NPSetWindowCallbackStruct();
+    NPSetWindowCallbackStruct* wsi = new NPSetWindowCallbackStruct();
     wsi->type = 0;
-    
+
     const QX11Info* x11Info = 0;
     if (m_isWindowed) {
         x11Info = &platformPluginWidget()->x11Info();
@@ -746,6 +752,9 @@ void PluginView::platformDestroy()
 {
     if (platformPluginWidget())
         delete platformPluginWidget();
+
+    if (m_drawable)
+        XFreePixmap(QX11Info::display(), m_drawable);
 }
 
 void PluginView::halt()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list