summaryrefslogtreecommitdiffstats
path: root/WebCore/plugins/win
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-02 14:57:50 +0000
committerSteve Block <steveblock@google.com>2010-02-04 15:06:55 +0000
commitd0825bca7fe65beaee391d30da42e937db621564 (patch)
tree7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebCore/plugins/win
parent3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff)
downloadexternal_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebCore/plugins/win')
-rw-r--r--WebCore/plugins/win/PluginDatabaseWin.cpp6
-rw-r--r--WebCore/plugins/win/PluginPackageWin.cpp4
-rw-r--r--WebCore/plugins/win/PluginViewWin.cpp65
3 files changed, 45 insertions, 30 deletions
diff --git a/WebCore/plugins/win/PluginDatabaseWin.cpp b/WebCore/plugins/win/PluginDatabaseWin.cpp
index 634b2a1..71bcdb5 100644
--- a/WebCore/plugins/win/PluginDatabaseWin.cpp
+++ b/WebCore/plugins/win/PluginDatabaseWin.cpp
@@ -38,7 +38,7 @@
#define _countof(x) (sizeof(x)/sizeof(x[0]))
#endif
-#if PLATFORM(WINCE)
+#if OS(WINCE)
// WINCE doesn't support Registry Key Access Rights. The parameter should always be 0
#define KEY_ENUMERATE_SUB_KEYS 0
@@ -252,7 +252,7 @@ static inline void addMozillaPluginDirectories(Vector<String>& directories)
static inline void addWindowsMediaPlayerPluginDirectory(Vector<String>& directories)
{
-#if !PLATFORM(WINCE)
+#if !OS(WINCE)
// The new WMP Firefox plugin is installed in \PFiles\Plugins if it can't find any Firefox installs
WCHAR pluginDirectoryStr[_MAX_PATH + 1];
DWORD pluginDirectorySize = ::ExpandEnvironmentStringsW(TEXT("%SYSTEMDRIVE%\\PFiles\\Plugins"), pluginDirectoryStr, _countof(pluginDirectoryStr));
@@ -355,7 +355,7 @@ exit:
static inline void addMacromediaPluginDirectories(Vector<String>& directories)
{
-#if !PLATFORM(WINCE)
+#if !OS(WINCE)
WCHAR systemDirectoryStr[MAX_PATH];
if (GetSystemDirectory(systemDirectoryStr, _countof(systemDirectoryStr)) == 0)
diff --git a/WebCore/plugins/win/PluginPackageWin.cpp b/WebCore/plugins/win/PluginPackageWin.cpp
index dc9ec17..233b10c 100644
--- a/WebCore/plugins/win/PluginPackageWin.cpp
+++ b/WebCore/plugins/win/PluginPackageWin.cpp
@@ -234,7 +234,7 @@ bool PluginPackage::load()
m_loadCount++;
return true;
} else {
-#if PLATFORM(WINCE)
+#if OS(WINCE)
m_module = ::LoadLibraryW(m_path.charactersWithNullTermination());
#else
WCHAR currentPath[MAX_PATH];
@@ -267,7 +267,7 @@ bool PluginPackage::load()
NP_InitializeFuncPtr NP_Initialize = 0;
NPError npErr;
-#if PLATFORM(WINCE)
+#if OS(WINCE)
NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, L"NP_Initialize");
NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, L"NP_GetEntryPoints");
m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, L"NP_Shutdown");
diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp
index 37f1fc8..2ade663 100644
--- a/WebCore/plugins/win/PluginViewWin.cpp
+++ b/WebCore/plugins/win/PluginViewWin.cpp
@@ -44,6 +44,7 @@
#include "Frame.h"
#include "FrameView.h"
#include "GraphicsContext.h"
+#include "HostWindow.h"
#include "Image.h"
#include "HTMLNames.h"
#include "HTMLPlugInElement.h"
@@ -71,13 +72,17 @@
#include <runtime/JSValue.h>
#include <wtf/ASCIICType.h>
-#if PLATFORM(WINCE)
+#if OS(WINCE)
#undef LOG_NPERROR
#define LOG_NPERROR(x)
#undef LOG_PLUGIN_NET_ERROR
#define LOG_PLUGIN_NET_ERROR()
#endif
+#if PLATFORM(CAIRO)
+#include <cairo-win32.h>
+#endif
+
#if PLATFORM(QT)
#include "QWebPageClient.h"
#include <QWidget>
@@ -93,7 +98,9 @@ static inline HWND windowHandleForPageClient(PlatformPageClient client)
#if PLATFORM(QT)
if (!client)
return 0;
- return client->ownerWidget()->winId();
+ if (QWidget* pluginParent = qobject_cast<QWidget*>(client->pluginParent()))
+ return pluginParent->winId();
+ return 0;
#elif PLATFORM(WX)
if (!client)
return 0;
@@ -119,7 +126,7 @@ using namespace HTMLNames;
const LPCWSTR kWebPluginViewdowClassName = L"WebPluginView";
const LPCWSTR kWebPluginViewProperty = L"WebPluginViewProperty";
-#if !PLATFORM(WINCE)
+#if !OS(WINCE)
// The code used to hook BeginPaint/EndPaint originally came from
// <http://www.fengyuan.com/article/wmprint.html>.
// Copyright (C) 2000 by Feng Yuan (www.fengyuan.com).
@@ -133,7 +140,7 @@ static BYTE* endPaint;
typedef HDC (WINAPI *PtrBeginPaint)(HWND, PAINTSTRUCT*);
typedef BOOL (WINAPI *PtrEndPaint)(HWND, const PAINTSTRUCT*);
-#if PLATFORM(WIN_OS) && PLATFORM(X86_64) && COMPILER(MSVC)
+#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC)
extern "C" HDC __stdcall _HBeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint);
extern "C" BOOL __stdcall _HEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint);
#endif
@@ -287,7 +294,7 @@ static bool registerPluginView()
ASSERT(Page::instanceHandle());
-#if PLATFORM(WINCE)
+#if OS(WINCE)
WNDCLASS wcex = { 0 };
#else
WNDCLASSEX wcex;
@@ -296,7 +303,7 @@ static bool registerPluginView()
#endif
wcex.style = CS_DBLCLKS;
-#if PLATFORM(WINCE)
+#if OS(WINCE)
wcex.style |= CS_PARENTDC;
#endif
wcex.lpfnWndProc = DefWindowProc;
@@ -309,7 +316,7 @@ static bool registerPluginView()
wcex.lpszMenuName = 0;
wcex.lpszClassName = kWebPluginViewdowClassName;
-#if PLATFORM(WINCE)
+#if OS(WINCE)
return !!RegisterClass(&wcex);
#else
return !!RegisterClassEx(&wcex);
@@ -385,7 +392,7 @@ PluginView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
m_popPopupsStateTimer.startOneShot(0);
}
-#if !PLATFORM(WINCE)
+#if !OS(WINCE)
if (message == WM_PRINTCLIENT) {
// Most (all?) windowed plugins don't respond to WM_PRINTCLIENT, so we
// change the message to WM_PAINT and rely on our hooked versions of
@@ -416,7 +423,7 @@ void PluginView::updatePluginWidget()
IntRect oldWindowRect = m_windowRect;
IntRect oldClipRect = m_clipRect;
-#if PLATFORM(WINCE)
+#if OS(WINCE)
m_windowRect = frameView->contentsToWindow(frameRect());
#else
m_windowRect = IntRect(frameView->contentsToWindow(frameRect().location()), frameRect().size());
@@ -519,7 +526,7 @@ void PluginView::paintIntoTransformedContext(HDC hdc)
WINDOWPOS windowpos = { 0 };
-#if PLATFORM(WINCE)
+#if OS(WINCE)
IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(frameRect());
windowpos.x = r.x();
@@ -556,7 +563,7 @@ void PluginView::paintIntoTransformedContext(HDC hdc)
void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const IntRect& rect)
{
-#if !PLATFORM(WINCE)
+#if !OS(WINCE)
ASSERT(m_isWindowed);
ASSERT(context->shouldIncludeChildWindows());
@@ -565,14 +572,22 @@ void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const
HDC hdc = context->getWindowsContext(frameRect(), false);
+#if PLATFORM(CAIRO)
+ // Must flush drawings up to this point to the backing metafile, otherwise the
+ // plugin region will be overwritten with any clear regions specified in the
+ // cairo-controlled portions of the rendering.
+ PlatformGraphicsContext* ctx = context->platformContext();
+ cairo_show_page(ctx);
+#endif
+
XFORM originalTransform;
GetWorldTransform(hdc, &originalTransform);
// The plugin expects the DC to be in client coordinates, so we translate
// the DC to make that so.
- XFORM transform = originalTransform;
- transform.eDx = locationInWindow.x();
- transform.eDy = locationInWindow.y();
+ TransformationMatrix ctm = context->getCTM();
+ ctm.translate(locationInWindow.x(), locationInWindow.y());
+ XFORM transform = static_cast<XFORM>(ctm);
SetWorldTransform(hdc, &transform);
@@ -596,7 +611,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
return;
if (m_isWindowed) {
-#if !PLATFORM(WINCE)
+#if !OS(WINCE)
if (context->shouldIncludeChildWindows())
paintWindowedPluginIntoContext(context, rect);
#endif
@@ -611,7 +626,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
// of the window and the plugin expects that the passed in DC has window coordinates.
// In the Qt port we always draw in an offscreen buffer and therefore need to preserve
// the translation set in getWindowsContext.
-#if !PLATFORM(QT) && !PLATFORM(WINCE)
+#if !PLATFORM(QT) && !OS(WINCE)
if (!context->inTransparencyLayer()) {
XFORM transform;
GetWorldTransform(hdc, &transform);
@@ -645,7 +660,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event)
event->setDefaultHandled();
}
-#if !PLATFORM(WINCE)
+#if !OS(WINCE)
extern HCURSOR lastSetCursor;
extern bool ignoreNextSetCursor;
#endif
@@ -713,7 +728,7 @@ void PluginView::handleMouseEvent(MouseEvent* event)
if (!dispatchNPEvent(npEvent))
event->setDefaultHandled();
-#if !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(WINCE)
+#if !PLATFORM(QT) && !PLATFORM(WX) && !OS(WINCE)
// Currently, Widget::setCursor is always called after this function in EventHandler.cpp
// and since we don't want that we set ignoreNextSetCursor to true here to prevent that.
ignoreNextSetCursor = true;
@@ -725,7 +740,7 @@ void PluginView::setParent(ScrollView* parent)
{
Widget::setParent(parent);
-#if PLATFORM(WINCE)
+#if OS(WINCE)
if (parent) {
init();
if (parent->isVisible())
@@ -770,7 +785,7 @@ void PluginView::setNPWindowRect(const IntRect& rect)
if (!m_isStarted)
return;
-#if PLATFORM(WINCE)
+#if OS(WINCE)
IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(rect);
m_npWindow.x = r.x();
m_npWindow.y = r.y();
@@ -805,7 +820,7 @@ void PluginView::setNPWindowRect(const IntRect& rect)
ASSERT(platformPluginWidget());
-#if PLATFORM(WINCE)
+#if OS(WINCE)
if (!m_pluginWndProc) {
WNDPROC currentWndProc = (WNDPROC)GetWindowLong(platformPluginWidget(), GWL_WNDPROC);
if (currentWndProc != PluginViewWndProc)
@@ -986,7 +1001,7 @@ bool PluginView::platformStart()
if (m_isWindowed) {
registerPluginView();
-#if !PLATFORM(WINCE)
+#if !OS(WINCE)
setUpOffscreenPaintingHooks(hookedBeginPaint, hookedEndPaint);
#endif
@@ -998,7 +1013,7 @@ bool PluginView::platformStart()
HWND window = ::CreateWindowEx(0, kWebPluginViewdowClassName, 0, flags,
0, 0, 0, 0, parentWindowHandle, 0, Page::instanceHandle(), 0);
-#if PLATFORM(WIN_OS) && (PLATFORM(QT) || PLATFORM(WX))
+#if OS(WINDOWS) && (PLATFORM(QT) || PLATFORM(WX))
m_window = window;
#else
setPlatformWidget(window);
@@ -1006,9 +1021,9 @@ bool PluginView::platformStart()
// Calling SetWindowLongPtrA here makes the window proc ASCII, which is required by at least
// the Shockwave Director plug-in.
-#if PLATFORM(WIN_OS) && PLATFORM(X86_64) && COMPILER(MSVC)
+#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC)
::SetWindowLongPtrA(platformPluginWidget(), GWLP_WNDPROC, (LONG_PTR)DefWindowProcA);
-#elif PLATFORM(WINCE)
+#elif OS(WINCE)
::SetWindowLong(platformPluginWidget(), GWL_WNDPROC, (LONG)DefWindowProc);
#else
::SetWindowLongPtrA(platformPluginWidget(), GWL_WNDPROC, (LONG)DefWindowProcA);