[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:38:57 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit dc1a615991527619804bf0a9f56ddbb66e9a8477
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 5 14:03:12 2009 +0000

    WebCore: [Qt] Added pure virtual QWebPageClient::pluginParent()
    
    Patch by J-P Nurmi <jpnurmi at gmail.com> on 2009-10-05
    Reviewed by Simon Hausmann.
    
    https://bugs.webkit.org/show_bug.cgi?id=29710
    
    * platform/qt/QWebPageClient.h:
    
    WebKit/qt: Added QGraphicsWidget-plugins support to FrameLoaderClientQt.
    
    Patch by J-P Nurmi <jpnurmi at gmail.com> on 2009-10-05
    Reviewed by Simon Hausmann.
    
    https://bugs.webkit.org/show_bug.cgi?id=29710
    
    * Api/qgraphicswebview.cpp:
    (QGraphicsWebViewPrivate::pluginParent):
    * Api/qwebview.cpp:
    (QWebViewPrivate::pluginParent):
    * WebCoreSupport/FrameLoaderClientQt.cpp:
    (WebCore::):
    (WebCore::FrameLoaderClientQt::createPlugin):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49092 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8b07193..ba2b3d4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-05  J-P Nurmi  <jpnurmi at gmail.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] Added pure virtual QWebPageClient::pluginParent()
+
+        https://bugs.webkit.org/show_bug.cgi?id=29710
+
+        * platform/qt/QWebPageClient.h:
+
 2009-10-05  Jakub Wieczorek  <faw217 at gmail.com>
 
         Reviewed by Tor Arne Vestbø.
diff --git a/WebCore/platform/qt/QWebPageClient.h b/WebCore/platform/qt/QWebPageClient.h
index b62985e..09f7886 100644
--- a/WebCore/platform/qt/QWebPageClient.h
+++ b/WebCore/platform/qt/QWebPageClient.h
@@ -55,6 +55,8 @@ public:
     virtual int screenNumber() const = 0;
     virtual WId winId() const = 0;
 
+    virtual QObject* pluginParent() const = 0;
+
 protected:
 #ifndef QT_NO_CURSOR
     virtual QCursor cursor() const = 0;
diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
index d7580c9..29490a7 100644
--- a/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -53,6 +53,8 @@ public:
     virtual int screenNumber() const;
     virtual WId winId() const;
 
+    virtual QObject* pluginParent() const;
+
     void _q_doLoadProgress(int progress);
     void _q_doLoadFinished(bool success);
     void _q_setStatusBarMessage(const QString& message);
@@ -131,6 +133,11 @@ WId QGraphicsWebViewPrivate::winId() const
     return 0;
 }
 
+QObject* QGraphicsWebViewPrivate::pluginParent() const
+{
+    return q;
+}
+
 void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s)
 {
     statusBarMessage = s;
diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp
index f90fc2a..fcf9cd4 100644
--- a/WebKit/qt/Api/qwebview.cpp
+++ b/WebKit/qt/Api/qwebview.cpp
@@ -56,6 +56,8 @@ public:
     virtual int screenNumber() const;
     virtual WId winId() const;
 
+    virtual QObject* pluginParent() const;
+
     void _q_pageDestroyed();
 
     QWebView *view;
@@ -104,6 +106,11 @@ WId QWebViewPrivate::winId() const
     return 0;
 }
 
+QObject* QWebViewPrivate::pluginParent() const
+{
+    return view;
+}
+
 void QWebViewPrivate::_q_pageDestroyed()
 {
     page = 0;
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 29bbc4f..179275a 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-05  J-P Nurmi  <jpnurmi at gmail.com>
+
+        Reviewed by Simon Hausmann.
+
+        Added QGraphicsWidget-plugins support to FrameLoaderClientQt.
+
+        https://bugs.webkit.org/show_bug.cgi?id=29710
+
+        * Api/qgraphicswebview.cpp:
+        (QGraphicsWebViewPrivate::pluginParent):
+        * Api/qwebview.cpp:
+        (QWebViewPrivate::pluginParent):
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::):
+        (WebCore::FrameLoaderClientQt::createPlugin):
+
 2009-10-03  Adam Barth  <abarth at webkit.org>
 
         Unreview build fix.  I wish I had a try server...
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index f3dd75d..16afd0e 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -55,8 +55,10 @@
 #include "ResourceHandle.h"
 #include "Settings.h"
 #include "ScriptString.h"
+#include "QWebPageClient.h"
 
 #include "qwebpage.h"
+#include "qwebpage_p.h"
 #include "qwebframe.h"
 #include "qwebframe_p.h"
 #include "qwebhistoryinterface.h"
@@ -67,6 +69,8 @@
 #include <QCoreApplication>
 #include <QDebug>
 #if QT_VERSION >= 0x040400
+#include <QGraphicsScene>
+#include <QGraphicsWidget>
 #include <QNetworkRequest>
 #include <QNetworkReply>
 #else
@@ -1117,6 +1121,53 @@ public:
     }
 };
 
+#if QT_VERSION >= 0x040600
+class QtPluginGraphicsWidget: public Widget
+{
+public:
+    static RefPtr<QtPluginGraphicsWidget> create(QGraphicsWidget* w = 0)
+    {
+        return adoptRef(new QtPluginGraphicsWidget(w));
+    }
+
+    ~QtPluginGraphicsWidget()
+    {
+        if (graphicsWidget)
+            graphicsWidget->deleteLater();
+    }
+    virtual void invalidateRect(const IntRect& r)
+    {
+        QGraphicsScene* scene = graphicsWidget ? graphicsWidget->scene() : 0;
+        if (scene)
+            scene->update(QRect(r));
+    }
+    virtual void frameRectsChanged()
+    {
+        if (!graphicsWidget)
+            return;
+
+        IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height()));
+        graphicsWidget->setGeometry(QRect(windowRect));
+
+        // FIXME: clipping of graphics widgets
+    }
+    virtual void show()
+    {
+        if (graphicsWidget)
+            graphicsWidget->show();
+    }
+    virtual void hide()
+    {
+        if (graphicsWidget)
+            graphicsWidget->hide();
+    }
+private:
+    QtPluginGraphicsWidget(QGraphicsWidget* w = 0): Widget(0), graphicsWidget(w) {}
+
+    QGraphicsWidget* graphicsWidget;
+};
+#endif
+
 PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames,
                                           const Vector<String>& paramValues, const String& mimeType, bool loadManually)
 {
@@ -1178,15 +1229,26 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
         if (object) {
             QWidget* widget = qobject_cast<QWidget*>(object);
             if (widget) {
-                QWidget* view = m_webFrame->page()->view();
-                if (view)
-                    widget->setParent(view);
+                QWidget* parentWidget = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent());
+                if (parentWidget)
+                    widget->setParent(parentWidget);
                 RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget());
                 w->setPlatformWidget(widget);
                 // Make sure it's invisible until properly placed into the layout
                 w->setFrameRect(IntRect(0, 0, 0, 0));
                 return w;
             }
+#if QT_VERSION >= 0x040600
+            QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(object);
+            if (graphicsWidget) {
+                graphicsWidget->hide();
+                graphicsWidget->setParentItem(qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent()));
+                RefPtr<QtPluginGraphicsWidget> w = QtPluginGraphicsWidget::create(graphicsWidget);
+                // Make sure it's invisible until properly placed into the layout
+                w->setFrameRect(IntRect(0, 0, 0, 0));
+                return w;
+            }
+#endif
             // FIXME: make things work for widgetless plugins as well
             delete object;
     } else { // NPAPI Plugins

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list