[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

girish at forwardbias.in girish at forwardbias.in
Wed Dec 22 12:17:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 510bb35bd8ce1487e8f2c58b0381e736990674f5
Author: girish at forwardbias.in <girish at forwardbias.in@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 18 16:52:32 2010 +0000

    [Qt] Implement Maemo5 local rendering NPAPI extension. See
    https://wiki.mozilla.org/Plugins:NokiaMaemoImageSurface for details.
    
    With the local rendering extension, Flash will paint into a 16-bit surface.
    For wmode=transparent, Flash expects the surface to contain the contents
    beneath it. As it is tricky to implement the content propagation across all
    graphics systems, transparent Flash is not supported. We just fill the surface
    with white and wmode=transparent behaves the same as wmode=opaque with a white
    background.
    
    Reviewed by Kenneth Rohde Christiansen.
    
    https://bugs.webkit.org/show_bug.cgi?id=44043
    
    * WebCore.pro:
    * plugins/PluginView.cpp:
    (WebCore::PluginView::setValue):
    (WebCore::PluginView::PluginView):
    * plugins/PluginView.h:
    * plugins/qt/PluginViewQt.cpp:
    (WebCore::PluginView::updatePluginWidget):
    (WebCore::PluginView::paintUsingImageSurfaceExtension):
    (WebCore::PluginView::paint):
    (WebCore::PluginView::platformGetValueStatic):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65612 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f9d9474..1dacf00 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-08-18  Girish Ramakrishnan  <girish at forwardbias.in>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Implement Maemo5 local rendering NPAPI extension. See 
+        https://wiki.mozilla.org/Plugins:NokiaMaemoImageSurface for details.
+
+        With the local rendering extension, Flash will paint into a 16-bit surface.
+        For wmode=transparent, Flash expects the surface to contain the contents
+        beneath it. As it is tricky to implement the content propagation across all
+        graphics systems, transparent Flash is not supported. We just fill the surface 
+        with white and wmode=transparent behaves the same as wmode=opaque with a white 
+        background.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44043
+
+        * WebCore.pro:
+        * plugins/PluginView.cpp:
+        (WebCore::PluginView::setValue):
+        (WebCore::PluginView::PluginView):
+        * plugins/PluginView.h:
+        * plugins/qt/PluginViewQt.cpp:
+        (WebCore::PluginView::updatePluginWidget):
+        (WebCore::PluginView::paintUsingImageSurfaceExtension):
+        (WebCore::PluginView::paint):
+        (WebCore::PluginView::platformGetValueStatic):
+
 2010-08-18  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r65603.
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 7118e4c..2f5769c 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2362,6 +2362,9 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) {
                     CONFIG += x11
                     LIBS += -lXrender
                 }
+                maemo5 {
+                    DEFINES += MOZ_PLATFORM_MAEMO=5
+                }
                 SOURCES += \
                     plugins/qt/PluginContainerQt.cpp \
                     plugins/qt/PluginPackageQt.cpp \
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index 50eca7e..ca222d5 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Collabora Ltd. All rights reserved.
+ * Copyright (C) 2010 Girish Ramakrishnan <girish at forwardbias.in>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -673,6 +674,12 @@ NPError PluginView::setValue(NPPVariable variable, void* value)
     }
 #endif // defined(XP_MACOSX)
 
+#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
+    case NPPVpluginWindowlessLocalBool:
+        m_renderToImage = true;
+        return NPERR_NO_ERROR;
+#endif
+
     default:
         notImplemented();
         return NPERR_GENERIC_ERROR;
@@ -849,6 +856,9 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p
     , m_colormap(0)
     , m_pluginDisplay(0)
 #endif
+#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
+    , m_renderToImage(false)
+#endif
     , m_loadManually(loadManually)
     , m_manualStream(0)
     , m_isJavaScriptPaused(false)
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index 431ce0e..9b44197 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -54,6 +54,10 @@ typedef PlatformWidget PlatformPluginWidget;
 #include <QPixmap>
 #endif
 #endif
+#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
+#include <QImage>
+class QPainter;
+#endif
 
 #if USE(JSC)
 namespace JSC {
@@ -374,6 +378,12 @@ private:
         void initXEvent(XEvent* event);
 #endif
 
+#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
+        QImage m_image;
+        bool m_renderToImage;
+        void paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect);
+#endif
+
         IntRect m_clipRect; // The clip rect to apply to a windowed plug-in
         IntRect m_windowRect; // Our window rect.
 
diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp
index de90693..3b41072 100644
--- a/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/WebCore/plugins/qt/PluginViewQt.cpp
@@ -111,12 +111,20 @@ void PluginView::updatePluginWidget()
         return;
 
     if (!m_isWindowed && m_windowRect.size() != oldWindowRect.size()) {
-        if (m_drawable)
-            XFreePixmap(QX11Info::display(), m_drawable);
+#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
+        // On Maemo5, Flash always renders to 16-bit buffer
+        if (m_renderToImage)
+            m_image = QImage(m_windowRect.width(), m_windowRect.height(), QImage::Format_RGB16);
+        else
+#endif
+        {
+            if (m_drawable)
+                XFreePixmap(QX11Info::display(), m_drawable);
 
-        m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), 
-                                   ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth);
-        QApplication::syncX(); // make sure that the server knows about the Drawable
+            m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), 
+                                       ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth);
+            QApplication::syncX(); // make sure that the server knows about the Drawable
+        }
     }
 
     // do not call setNPWindowIfNeeded immediately, will be called on paint()
@@ -160,6 +168,48 @@ void PluginView::hide()
     Widget::hide();
 }
 
+#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
+void PluginView::paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect)
+{
+    if (m_isTransparent) {
+        // On Maemo5, Flash expects the buffer to contain the contents that are below it.
+        // We don't support transparency, so clean the image before giving to Flash.
+        QPainter imagePainter(&m_image);
+        imagePainter.fillRect(exposedRect, Qt::white);
+    }
+
+    NPImageExpose imageExpose;
+    imageExpose.data = reinterpret_cast<char*>(m_image.bits());
+    imageExpose.stride = m_image.bytesPerLine();
+    imageExpose.depth = m_image.depth();
+    imageExpose.x = exposedRect.x();
+    imageExpose.y = exposedRect.y();
+    imageExpose.width = exposedRect.width();
+    imageExpose.height = exposedRect.height();
+    imageExpose.dataSize.width = m_image.width();
+    imageExpose.dataSize.height = m_image.height();
+    imageExpose.translateX = 0;
+    imageExpose.translateY = 0;
+    imageExpose.scaleX = 1;
+    imageExpose.scaleY = 1;
+
+    XEvent xevent;
+    memset(&xevent, 0, sizeof(XEvent));
+    XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose;
+    exposeEvent.type = GraphicsExpose;
+    exposeEvent.display = 0;
+    exposeEvent.drawable = reinterpret_cast<XID>(&imageExpose);
+    exposeEvent.x = exposedRect.x();
+    exposeEvent.y = exposedRect.y();
+    exposeEvent.width = exposedRect.width();
+    exposeEvent.height = exposedRect.height();
+
+    dispatchNPEvent(xevent);
+
+    painter->drawImage(QPoint(frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y()), m_image, exposedRect);
+}
+#endif
+
 void PluginView::paint(GraphicsContext* context, const IntRect& rect)
 {
     if (!m_isStarted) {
@@ -172,19 +222,32 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
 
     setNPWindowIfNeeded();
 
-    if (m_isWindowed || !m_drawable)
+    if (m_isWindowed)
         return;
 
-    const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display();
+    if (!m_drawable
+#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
+        && m_image.isNull()
+#endif
+       )
+        return;
 
     QPainter* painter = context->platformContext();
     IntRect exposedRect(rect);
     exposedRect.intersect(frameRect());
     exposedRect.move(-frameRect().x(), -frameRect().y());
 
+#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
+    if (!m_image.isNull()) {
+        paintUsingImageSurfaceExtension(painter, exposedRect);
+        return;
+    }
+#endif
+
     QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared);
     const int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth;
     ASSERT(drawableDepth == qtDrawable.depth());
+    const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display();
 
     // When printing, Qt uses a QPicture to capture the output in preview mode. The
     // QPicture holds a reference to the X Pixmap. As a result, the print preview would
@@ -587,6 +650,13 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr
         *result = NPERR_NO_ERROR;
         return true;
 
+#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
+    case NPNVSupportsWindowlessLocal:
+        *static_cast<NPBool*>(value) = true;
+        *result = NPERR_NO_ERROR;
+        return true;
+#endif
+
     default:
         return false;
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list