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

aroben at apple.com aroben at apple.com
Wed Dec 22 13:45:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8d4e51a05a92ccb6534d3f037996eb5db5c89ae0
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 24 22:12:33 2010 +0000

    Give windowed Netscape plugins their own window
    
    The plugin window is a child of the WebView's window. The WebView's
    window is in the UI process, and the plugin's window is in the web
    process (though someday it will be in the plugin process), but Windows
    mostly handles this just fine. Right now we move the plugin's window
    in the web process, but we need to do it at paint time in the UI
    process instead so that the plugin windows will stay in sync with the
    web page's contents. There are also a whole bunch of plugin quirks
    that WebKit1 supports that we don't support yet, but that's a task for
    another day.
    
    Fixes <http://webkit.org/b/44428> Get basic in-process windowed
    plugins working in WebKit2 on Windows
    
    Reviewed by Anders Carlsson.
    
    * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
    (WebKit::NetscapePlugin::destroy):
    (WebKit::NetscapePlugin::geometryDidChange):
    Call the new platform-specific functions.
    
    * WebProcess/Plugins/Netscape/NetscapePlugin.h: Added
    platformDestroy/platformGeometryDidChange, and an m_window member on
    Windows to hold our window.
    
    * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
    (WebKit::NetscapePlugin::platformDestroy):
    (WebKit::NetscapePlugin::platformGeometryDidChange):
    * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp:
    (WebKit::NetscapePlugin::platformDestroy):
    (WebKit::NetscapePlugin::platformGeometryDidChange):
    Stubbed these out.
    
    * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp:
    (WebKit::registerPluginView): Added. The code came from
    WebCore's PluginViewWin.cpp, though I changed it to add one to
    COLOR_WINDOW, since that's what MSDN says we should do.
    (WebKit::NetscapePlugin::platformPostInitialize): If we're windowed,
    create a window for the plugin and make it a child of the WebView's
    window. If we're not windowed, just set m_window to 0.
    (WebKit::NetscapePlugin::platformDestroy): Destroy our window if we
    have one and it hasn't been destroyed already.
    (WebKit::NetscapePlugin::platformGeometryDidChange): Update our
    window's size and position.
    
    * WebProcess/Plugins/PluginController.h:
    * WebProcess/Plugins/PluginView.cpp:
    (WebKit::PluginView::nativeParentWindow):
    * WebProcess/Plugins/PluginView.h:
    Added nativeParentWindow on Windows to return the WebView's window.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68299 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index a30ba3a..ef6c3cd 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,59 @@
 2010-09-24  Adam Roben  <aroben at apple.com>
 
+        Give windowed Netscape plugins their own window
+
+        The plugin window is a child of the WebView's window. The WebView's
+        window is in the UI process, and the plugin's window is in the web
+        process (though someday it will be in the plugin process), but Windows
+        mostly handles this just fine. Right now we move the plugin's window
+        in the web process, but we need to do it at paint time in the UI
+        process instead so that the plugin windows will stay in sync with the
+        web page's contents. There are also a whole bunch of plugin quirks
+        that WebKit1 supports that we don't support yet, but that's a task for
+        another day.
+
+        Fixes <http://webkit.org/b/44428> Get basic in-process windowed
+        plugins working in WebKit2 on Windows
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::destroy):
+        (WebKit::NetscapePlugin::geometryDidChange):
+        Call the new platform-specific functions.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h: Added
+        platformDestroy/platformGeometryDidChange, and an m_window member on
+        Windows to hold our window.
+
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::NetscapePlugin::platformDestroy):
+        (WebKit::NetscapePlugin::platformGeometryDidChange):
+        * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp:
+        (WebKit::NetscapePlugin::platformDestroy):
+        (WebKit::NetscapePlugin::platformGeometryDidChange):
+        Stubbed these out.
+
+        * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp:
+        (WebKit::registerPluginView): Added. The code came from
+        WebCore's PluginViewWin.cpp, though I changed it to add one to
+        COLOR_WINDOW, since that's what MSDN says we should do.
+        (WebKit::NetscapePlugin::platformPostInitialize): If we're windowed,
+        create a window for the plugin and make it a child of the WebView's
+        window. If we're not windowed, just set m_window to 0.
+        (WebKit::NetscapePlugin::platformDestroy): Destroy our window if we
+        have one and it hasn't been destroyed already.
+        (WebKit::NetscapePlugin::platformGeometryDidChange): Update our
+        window's size and position.
+
+        * WebProcess/Plugins/PluginController.h:
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::nativeParentWindow):
+        * WebProcess/Plugins/PluginView.h:
+        Added nativeParentWindow on Windows to return the WebView's window.
+
+2010-09-24  Adam Roben  <aroben at apple.com>
+
         Pass the WebView's HWND over to the web process
 
         The HWND is packaged up in the WebPageCreationParameters and stored in
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index 610e8e6..eb2ac7a 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -374,6 +374,8 @@ void NetscapePlugin::destroy()
 
     m_isStarted = false;
     m_pluginController = 0;
+
+    platformDestroy();
 }
     
 void NetscapePlugin::paint(GraphicsContext* context, const IntRect& dirtyRect)
@@ -396,6 +398,7 @@ void NetscapePlugin::geometryDidChange(const IntRect& frameRect, const IntRect&
     m_clipRect = clipRect;
 
     callSetWindow();
+    platformGeometryDidChange();
 }
 
 void NetscapePlugin::frameDidFinishLoading(uint64_t requestID)
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index bc00cfe..e08dff6 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -99,6 +99,8 @@ private:
     bool allowPopups() const;
 
     bool platformPostInitialize();
+    void platformDestroy();
+    void platformGeometryDidChange();
     void platformPaint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect);
 
     bool platformHandleMouseEvent(const WebMouseEvent&);
@@ -173,6 +175,8 @@ private:
     NPDrawingModel m_drawingModel;
     NPEventModel m_eventModel;
     RetainPtr<PlatformLayer> m_pluginLayer;
+#elif PLATFORM(WIN)
+    HWND m_window;
 #endif
 };
 
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index bb160e6..f2d8fe7 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -125,6 +125,14 @@ bool NetscapePlugin::platformPostInitialize()
     return true;
 }
 
+void NetscapePlugin::platformDestroy()
+{
+}
+
+void NetscapePlugin::platformGeometryDidChange()
+{
+}
+
 static inline NPCocoaEvent initializeEvent(NPCocoaEventType type)
 {
     NPCocoaEvent event;
diff --git a/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp b/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
index 3f2ae4f..67ac7ea 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
@@ -40,6 +40,16 @@ bool NetscapePlugin::platformPostInitialize()
     return true;
 }
 
+void NetscapePlugin::platformDestroy()
+{
+    notImplemented();
+}
+
+void NetscapePlugin::platformGeometryDidChange()
+{
+    notImplemented();
+}
+
 void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect)
 {
     notImplemented();
diff --git a/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp b/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
index 6b7cc7c..ef06a8e 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
@@ -26,6 +26,7 @@
 #include "NetscapePlugin.h"
 
 #include "NotImplemented.h"
+#include "PluginController.h"
 #include "WebEvent.h"
 #include <WebCore/GraphicsContext.h>
 #include <WebCore/LocalWindowsContext.h>
@@ -34,12 +35,71 @@ using namespace WebCore;
 
 namespace WebKit {
 
+static LPCWSTR windowClassName = L"org.webkit.NetscapePluginWindow";
+
+static void registerPluginView()
+{
+    static bool didRegister;
+    if (didRegister)
+        return;
+    didRegister = true;
+
+    WNDCLASSW windowClass = {0};
+    windowClass.style = CS_DBLCLKS | CS_PARENTDC;
+    windowClass.lpfnWndProc = ::DefWindowProcW;
+    windowClass.hCursor = ::LoadCursorW(0, IDC_ARROW);
+    windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);
+    windowClass.lpszClassName = windowClassName;
+
+    ::RegisterClassW(&windowClass);
+}
+
 bool NetscapePlugin::platformPostInitialize()
 {
-    notImplemented();
+    if (!m_isWindowed) {
+        m_window = 0;
+        return true;
+    }
+
+    registerPluginView();
+
+    m_window = ::CreateWindowExW(0, windowClassName, 0, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, m_pluginController->nativeParentWindow(), 0, 0, 0);
+    if (!m_window)
+        return false;
+
+    // FIXME: Do we need to pass our window to setPlatformWidget?
+    // FIXME: WebCore::PluginView sets the window proc to DefWindowProcA here for Shockwave Director.
+
+    m_npWindow.type = NPWindowTypeWindow;
+    m_npWindow.window = m_window;
+
     return true;
 }
 
+void NetscapePlugin::platformDestroy()
+{
+    if (!m_isWindowed) {
+        ASSERT(!m_window);
+        return;
+    }
+
+    if (!::IsWindow(m_window))
+        return;
+    ::DestroyWindow(m_window);
+}
+
+void NetscapePlugin::platformGeometryDidChange()
+{
+    if (!m_isWindowed)
+        return;
+
+    // FIXME: We should only update the size here and let the UI process update our position so
+    // that we can keep our position in sync when scrolling, etc.
+    // FIXME: We should also set a window region based on m_clipRect. Perhaps that should happen in
+    // the UI process, too.
+    ::MoveWindow(m_window, m_frameRect.x(), m_frameRect.y(), m_frameRect.width(), m_frameRect.height(), TRUE);
+}
+
 void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect)
 {
     // FIXME: Call SetWindow here if we haven't called it yet (see r59904).
diff --git a/WebKit2/WebProcess/Plugins/PluginController.h b/WebKit2/WebProcess/Plugins/PluginController.h
index 0448ede..b4e6e76 100644
--- a/WebKit2/WebProcess/Plugins/PluginController.h
+++ b/WebKit2/WebProcess/Plugins/PluginController.h
@@ -83,6 +83,11 @@ public:
     // Tells the controller that the plug-in process has crashed.
     virtual void pluginProcessCrashed() = 0;
     
+#if PLATFORM(WIN)
+    // The window to use as the parent of the plugin's window.
+    virtual HWND nativeParentWindow() = 0;
+#endif
+
 protected:
     virtual ~PluginController() { }
 };
diff --git a/WebKit2/WebProcess/Plugins/PluginView.cpp b/WebKit2/WebProcess/Plugins/PluginView.cpp
index 26e39b0..c79cb1a 100644
--- a/WebKit2/WebProcess/Plugins/PluginView.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginView.cpp
@@ -817,6 +817,13 @@ void PluginView::pluginProcessCrashed()
     invalidateRect(frameRect());
 }
 
+#if PLATFORM(WIN)
+HWND PluginView::nativeParentWindow()
+{
+    return m_webPage->nativeWindow();
+}
+#endif
+
 void PluginView::didFinishLoad(WebFrame* webFrame)
 {
     RefPtr<URLRequest> request = m_pendingFrameLoads.take(webFrame);
diff --git a/WebKit2/WebProcess/Plugins/PluginView.h b/WebKit2/WebProcess/Plugins/PluginView.h
index 88b4318..025ddbf 100644
--- a/WebKit2/WebProcess/Plugins/PluginView.h
+++ b/WebKit2/WebProcess/Plugins/PluginView.h
@@ -124,6 +124,9 @@ private:
     virtual void setStatusbarText(const String&);
     virtual bool isAcceleratedCompositingEnabled();
     virtual void pluginProcessCrashed();
+#if PLATFORM(WIN)
+    virtual HWND nativeParentWindow();
+#endif
 
     // WebFrame::LoadListener
     virtual void didFinishLoad(WebFrame*);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list